:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #1a2538;
  --line: #27354d;
  --text: #e6edf7;
  --muted: #93a1b8;
  --accent: #f0b429;
  --accent-2: #3fb98a;
  --danger: #e5534b;
  --felt: #1d6b45;
  --felt-dark: #114a2e;
  --card-w: 110px;
  --card-h: 160px;
  --radius: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
button, input, select {
  font: inherit;
  color: inherit;
}
button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
button:hover:not(:disabled) { background: #22304a; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #1a1200; border-color: transparent; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #f7c452; }
button.good { background: var(--accent-2); color: #04150d; border-color: transparent; font-weight: 600; }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.small { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
input[type="text"], input[type="password"], input[type="number"], select {
  background: #0d1526;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  width: 100%;
}
input:focus, select:focus { outline: 2px solid rgba(240, 180, 41, 0.35); border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; }
.hidden { display: none !important; }

/* ---- pages: lobby / admin ---------------------------------------------- */
.page { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: 0.2px; }
.brand .logo { width: 38px; height: 38px; display: grid; place-items: center; }
.brand .logo img { width: 38px; height: 38px; display: block; }
/* Suggestion box in the lobby */
.suggest textarea { width: 100%; min-height: 64px; resize: vertical; box-sizing: border-box; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; }
.suggest textarea:focus { outline: 2px solid rgba(240, 180, 41, 0.35); border-color: var(--accent); }
.suggest-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.suggest-list li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel-2); font-size: 14px; }
.suggest-list li.done { opacity: 0.55; }
.suggest-list li.done .text { text-decoration: line-through; }
.suggest-list .meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.suggest-list .meta .tools { display: flex; gap: 6px; }
.suggest-list .meta .tools button { padding: 1px 7px; font-size: 12px; }
.suggest-list .text { white-space: pre-wrap; word-break: break-word; }
.card-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
/* Lobby: the tables/standings column may hold wide tables; minmax(0, 1fr) stops
   them from squeezing the New table form into a sliver (a plain 1fr grows to fit
   its content). The form gets a fixed, comfortable width. */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.grid-2 > .card-panel { min-width: 0; }
.grid-2 > .card-panel > table.data, .grid-2 .table-wrap { display: block; overflow-x: auto; max-width: 100%; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.login-box { max-width: 380px; margin: 60px auto; }
.login-box h1 { margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 8px 0; }
.check input { width: 16px; height: 16px; }
h2 { font-size: 16px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.table-list { display: flex; flex-direction: column; gap: 10px; }
.table-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.table-item > .row { flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 0 0 auto; max-width: 210px; }
.table-item .name { font-weight: 600; }
.table-item .meta { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #22304a; color: var(--muted); margin-right: 4px; }
.pill.open { background: rgba(63, 185, 138, 0.18); color: var(--accent-2); }
.pill.playing { background: rgba(240, 180, 41, 0.18); color: var(--accent); }
.pill.finished { background: rgba(147, 161, 184, 0.15); }
.pill.paused { background: rgba(229, 83, 75, 0.18); color: var(--danger); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- cards --------------------------------------------------------------- */
.card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 7px;
  background: #fff;
  color: #111;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  user-select: none;
  flex: 0 0 auto;
  font-family: "Georgia", "Times New Roman", serif;
}
.card.red { color: #c81e1e; }
.card .idx { position: absolute; font-size: 24px; line-height: 1; font-weight: 700; text-align: center; }
.card .idx.tl { top: 6px; left: 6px; }
.card .idx.br { bottom: 6px; right: 6px; transform: rotate(180deg); }
.card .idx small { display: block; font-size: 26px; }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--card-h) * 0.6); line-height: 1; }
/* Simple deck: a clean sans-serif card. One bold index top-left (rank over suit),
   one suit pip low in the middle so it stays hidden under the next card in a fan,
   no upside-down index. Face cards get a rank badge instead of a pip. */
.card.simple { background: #fff; color: #1a1a1a; font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; box-shadow: 0 0 0 1px rgba(0,0,0,0.22), 0 2px 6px rgba(0,0,0,0.4); font-variant-emoji: text; }
.card.simple.red { color: #d32f2f; }
.card.simple .idx { font-size: 34px; font-weight: 800; top: 3px; left: 6px; letter-spacing: -0.03em; }
.card.simple .idx small { font-size: 22px; margin-top: 1px; }
.card.simple .idx.br { display: none; }

.card .art { display: block; width: 100%; height: 100%; border-radius: inherit; position: absolute; inset: 0; background: transparent; }
.card:has(> .art) { overflow: hidden; background: #fff; }

.card.back {
  border: 4px solid #fff;
  background-color: #1d3f86;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.18) 0 18%, transparent 19%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.10) 0 4px, transparent 4px 10px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.10) 0 4px, transparent 4px 10px),
    linear-gradient(160deg, #27529f, #16306a);
  box-shadow: inset 0 0 0 2px #c9a44a, inset 0 0 0 4px #1d3f86, 0 2px 6px rgba(0,0,0,0.45);
}
.card.mini { --card-w: 34px; --card-h: 48px; border-radius: 4px; }
.card.mini .idx { font-size: 10px; }
.card.mini .idx small { font-size: 9px; }
.card.mini .pip { font-size: 16px; }

/* ---- table page ---------------------------------------------------------- */
/* The table takes the full width; scores and chat sit in a strip below it. */
.table-page { display: flex; flex-direction: column; min-height: 100vh; }
.play-area { display: flex; flex-direction: column; min-width: 0; }
.table-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); gap: 10px; flex-wrap: wrap; }
.table-head .title { font-weight: 700; font-size: 17px; }
.table-head .rules { font-size: 12px; color: var(--muted); }
.felt-wrap { flex: none; padding: 12px; display: flex; }
.felt {
  flex: 1;
  position: relative;
  border-radius: 180px;
  background: radial-gradient(ellipse at center, #2a8457 0%, var(--felt) 55%, var(--felt-dark) 100%);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.45), 0 0 0 10px #3b2314, 0 0 0 12px #241209;
  height: calc(100vh - 176px);
  min-height: 560px;
  overflow: visible;
}

.seat { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 250px; }
.seat.south { bottom: 24px; left: 10px; width: 190px; z-index: 6; }   /* beside the fan, drawn above it so it is never covered */
.seat.north { top: 14px; left: 50%; transform: translateX(-50%); }
.seat.west { left: 14px; top: 46%; transform: translateY(-50%); }
.seat.east { right: 14px; top: 46%; transform: translateY(-50%); }
.seat .tile {
  width: 160px; height: 120px; border-radius: 10px; background: #0d1526; border: 2px solid var(--line);
  overflow: hidden; position: relative; display: grid; place-items: center; transition: border-color 0.2s, box-shadow 0.2s;
}
.seat.turn .tile { border-color: var(--accent); box-shadow: 0 0 18px rgba(240,180,41,0.55); }
.seat .tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
/* Phones hide your own seat behind the hand, so a small mirror of your camera
   sits in the top corner while it is on (desktop keeps the south tile). */
.self-view { display: none; position: absolute; top: 8px; right: 8px; width: 80px; height: 60px; border-radius: 8px; border: 2px solid var(--line); overflow: hidden; background: #000; z-index: 8; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.self-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
@media (max-width: 760px), (max-height: 520px) { body.seated .self-view:not(.hidden) { display: block; } }
@media (max-height: 520px) and (orientation: landscape) { .self-view { width: 64px; height: 48px; top: 6px; right: 6px; } }
.seat .tile .initials { font-size: 40px; font-weight: 700; color: #4b5d7a; }
.seat .tile .initials.emoji { font-size: 64px; color: inherit; line-height: 1; }
.seat .tile .count { position: absolute; bottom: 4px; right: 6px; font-size: 11px; background: rgba(0,0,0,0.55); padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.seat .tile .flag { position: absolute; top: 4px; left: 6px; font-size: 11px; background: rgba(0,0,0,0.55); padding: 1px 6px; border-radius: 999px; }
.seat .plate { background: rgba(0,0,0,0.55); border-radius: 999px; padding: 4px 14px; font-size: 14px; display: flex; gap: 8px; align-items: center; max-width: 190px; white-space: nowrap; }
.seat .plate .name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
.seat .plate .hand-pts { font-size: 20px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; margin-left: 2px; }
.seat .plate .score { color: var(--accent); font-variant-numeric: tabular-nums; }
.seat .plate .dot { width: 8px; height: 8px; border-radius: 50%; background: #5b6b85; }
.seat .plate .dot.on { background: var(--accent-2); }
.seat .actions { display: flex; gap: 6px; }

.key-cards { position: absolute; top: 14px; left: 18px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.key-cards .chip { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.5); border-radius: 10px; padding: 4px 10px 4px 4px; opacity: 0.55; }
.key-cards .chip.played { opacity: 1; background: rgba(0,0,0,0.65); box-shadow: 0 0 0 2px var(--accent); }
.key-cards .chip .card.mini { --card-w: 30px; --card-h: 42px; }
.key-cards .chip.dir { box-shadow: 0 0 0 2px var(--accent-2); }
.key-cards .chip.dir.hold { box-shadow: 0 0 0 2px var(--muted); }
.key-cards .chip .arrow { width: 30px; height: 42px; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: var(--accent-2); border-radius: 6px; background: rgba(255,255,255,0.08); }
.key-cards .chip.hold .arrow { color: var(--muted); }
.key-cards .label { font-size: 11px; line-height: 1.2; }
.key-cards .label b { display: block; font-size: 12px; }
.key-cards .label span { color: var(--muted); }
.key-cards .chip.played .label span { color: var(--text); }
/* Vertical bands of the felt: seats/top (0-18%), middle (trick + message, 18-56%),
   hand zone (56-100%): nothing but the hand and its action row lives there. */
.trick { position: absolute; left: 50%; top: var(--trick-top, 40%); width: 0; height: 0; perspective: 900px; --card-w: var(--trick-w); --card-h: var(--trick-h); }
.trick .slot { position: absolute; transition: transform 0.25s ease, opacity 0.25s; }
/* The four played cards overlap in a tight cluster (Trickster-style pile),
   later cards on top; it is sized by table.js from the room left between the
   north seat and the hand. */
.trick .slot.south { transform: translate(-50%, -20%); }
.trick .slot.north { transform: translate(-50%, -80%); }
.trick .slot.west { transform: translate(-115%, -50%); }
.trick .slot.east { transform: translate(15%, -50%); }
.trick .slot.winner .card { box-shadow: 0 0 0 3px var(--accent), 0 2px 6px rgba(0,0,0,0.45); }

.center-msg {
  position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%);
  background: #0f1b14; border: 1px solid rgba(240,180,41,0.35); border-radius: 12px; padding: 14px 20px; text-align: center; max-width: 360px;
  font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); z-index: 7;
}
.center-msg .scores th, .center-msg .scores td { padding: 4px 10px; font-size: 14px; }
.center-msg .scores td:first-child { font-weight: 600; color: var(--text); }
.center-msg.big { font-size: 20px; font-weight: 700; }
.center-msg .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.center-msg .phrase { font-size: 22px; font-style: italic; color: var(--accent); margin: 10px 0 4px; line-height: 1.3; }
.center-msg .phrase span { display: block; font-size: 12px; font-style: normal; color: var(--muted); margin-top: 2px; }
.soundboard { display: inline-flex; gap: 4px; }
.soundboard button.board { min-width: 38px; padding: 6px 10px; font-weight: 900; font-size: 15px; letter-spacing: 0.02em; background: var(--accent); color: #1b1b1b; border-color: #c8921a; }
.soundboard button.board:hover { background: #ffc94a; }
.soundboard button.board.empty { background: rgba(255,255,255,0.06); color: var(--muted); border-color: rgba(255,255,255,0.12); font-weight: 700; }
.soundboard button.board.pressed { transform: scale(0.9); box-shadow: 0 0 0 4px rgba(240,180,41,0.45); }
.center-msg .actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* seating: sit the panel below the north seat so its Sit here / Add bot buttons are never covered */
.center-msg.seating { top: 56%; }
@media (max-width: 760px) { .center-msg.seating { top: 56%; } }
@media (max-height: 520px) and (orientation: landscape) { .center-msg.seating { top: 58%; } }
/* game over: the win panel is the main event — big glowing title, bigger phrases and scores, pops in */
.center-msg.gameover { top: 46%; max-width: min(92vw, 600px); padding: 26px 40px 22px; border: 2px solid var(--accent); border-radius: 18px; z-index: 10;
  box-shadow: 0 0 0 6px rgba(240,180,41,0.14), 0 0 70px rgba(240,180,41,0.4), 0 20px 60px rgba(0,0,0,0.7); animation: winpop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.center-msg.gameover .big { font-size: 48px; font-weight: 900; line-height: 1.1; color: var(--accent); letter-spacing: 0.01em; text-shadow: 0 0 26px rgba(240,180,41,0.5), 0 2px 0 rgba(0,0,0,0.5); margin-bottom: 8px; }
.center-msg.gameover .phrase { font-size: 30px; margin: 12px 0 6px; }
.center-msg.gameover .phrase span { font-size: 14px; }
.center-msg.gameover .sub, .center-msg.gameover .oh-lines { font-size: 16px; }
.center-msg.gameover .scores th, .center-msg.gameover .scores td { font-size: 17px; padding: 6px 16px; }
.center-msg.gameover .actions { margin-top: 16px; }
.center-msg.gameover .actions button.primary { font-size: 17px; padding: 10px 20px; }
@keyframes winpop { from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@media (max-width: 760px) {
  .center-msg.gameover { max-width: 92vw; padding: 16px 18px 14px; }
  .center-msg.gameover .big { font-size: 32px; }
  .center-msg.gameover .phrase { font-size: 22px; }
  .center-msg.gameover .scores th, .center-msg.gameover .scores td { font-size: 14px; padding: 4px 10px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .center-msg.gameover { top: 50%; padding: 10px 16px; }
  .center-msg.gameover .big { display: block; font-size: 26px; }
  .center-msg.gameover .phrase { font-size: 18px; margin: 4px 0; }
}

.hand-wrap { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; pointer-events: none; }
.hand-wrap.passing { gap: 44px; }   /* selected cards rise 30px: keep the Pass button clear of them */
.hand { display: flex; justify-content: center; padding: 0 20px; pointer-events: auto; }
.hand .card { margin-left: calc(var(--card-w) * -0.45); transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s; cursor: default; }
.hand .card:first-child, .hand .hand-row .card:first-child { margin-left: 0; }
.hand.two-rows { flex-direction: column; align-items: center; gap: 5px; }
.hand-row { display: flex; justify-content: center; }
.hand .card.legal { cursor: pointer; }
.hand .card.legal.hover { transform: translateY(-12px); z-index: 2; }
.hand .card.illegal { opacity: 1; }
.hand .card.legal { box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.95), 0 2px 6px rgba(0,0,0,0.45); }
.hand.passing .card.legal:not(.selected) { box-shadow: 0 2px 6px rgba(0,0,0,0.45); }
.hand .card.selected, .hand .card.selected.hover { z-index: 3; transform: translateY(-22px); box-shadow: 0 0 0 5px var(--accent), 0 0 18px rgba(240,180,41,0.8), 0 6px 14px rgba(0,0,0,0.5); }
.hand .card.received { box-shadow: 0 0 0 5px #e5534b, 0 0 18px rgba(229,83,75,0.85), 0 2px 6px rgba(0,0,0,0.45); }   /* red ring = this card was passed to you */
.hand-actions { display: flex; gap: 8px; pointer-events: auto; align-items: center; flex-wrap: wrap; justify-content: center; }
.my-plate { display: none; /* phones only: on desktop your seat tile carries the score */ align-items: center; gap: 8px; background: rgba(0,0,0,0.6); border: 1px solid rgba(240,180,41,0.6); border-radius: 999px; padding: 3px 12px 3px 6px; font-size: 13px; white-space: nowrap; }
.my-plate .av { font-size: 18px; }
.my-plate .nm { font-weight: 700; }
.my-plate .pts { font-size: 18px; font-weight: 800; color: var(--accent); }
.my-plate .tot { color: var(--muted); }

.controls { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; align-items: center; }

/* ---- sidebar ------------------------------------------------------------- */
.sidebar { border-top: 1px solid var(--line); background: var(--panel); display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; }
@media (max-width: 760px) { .sidebar { grid-template-columns: 1fr; } }
.sidebar section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sidebar section.scores { border-right: 1px solid var(--line); }
@media (max-width: 760px) { .sidebar section.scores { border-right: 0; } }
.sidebar section h2 { margin-bottom: 8px; }
.scores table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.scores th, .scores td { padding: 3px 4px; text-align: right; }
.scores th:first-child, .scores td:first-child { text-align: left; color: var(--muted); }
.scores tr.total td { font-weight: 700; border-top: 1px solid var(--line); color: var(--accent); }
.scores td.moon { color: var(--accent-2); }
.chat { display: flex; flex-direction: column; min-height: 220px; max-height: 320px; }
.chat .log { flex: 1; overflow-y: auto; font-size: 14px; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.chat .log .m .who { color: var(--accent); font-weight: 600; margin-right: 6px; }
.chat .log .m.sys { color: var(--muted); font-style: italic; }
.chat .log .m.record { color: var(--accent); font-weight: 600; background: rgba(240,180,41,0.1); border-radius: 6px; padding: 3px 6px; }
.records-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.records-grid div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.records-grid .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.records-grid .v { font-size: 18px; font-weight: 700; }
.records-grid .v small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.chat form { display: flex; gap: 6px; margin-top: 8px; }
.online { font-size: 12px; color: var(--muted); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: 420px; width: calc(100% - 32px); text-align: center; }
.modal h3 { margin: 0 0 8px; font-size: 20px; }
.modal .actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--danger); color: white; padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* ---- animation helpers ---------------------------------------------------- */
.flipper { position: relative; width: var(--card-w); height: var(--card-h); transform-style: preserve-3d; will-change: transform; }
.flipper .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flipper .face.back-face { transform: rotateY(180deg); }
.flipper .card { position: absolute; inset: 0; }
.card .back-overlay { position: absolute; inset: 0; border-radius: inherit; z-index: 2; }
.deal-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 5; }
.deal-layer .card { will-change: transform; position: absolute; left: 50%; top: 50%; margin-left: calc(var(--card-w) / -2); margin-top: calc(var(--card-h) / -2); }
.hand.dealing { visibility: hidden; }

/* taken-trick pile next to the winner's seat */
.pile { display: none; position: relative; width: 48px; height: 58px; cursor: pointer; margin-top: 2px; }
.pile .card.mini { position: absolute; left: 0; top: 0; --card-w: 30px; --card-h: 42px; border-width: 2px; transform: rotate(-8deg); box-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.pile .card.mini:nth-child(2) { left: 7px; transform: rotate(2deg); }
.pile .card.mini:nth-child(3) { left: 14px; transform: rotate(10deg); }
.pile .label { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.pile:hover .label { color: var(--text); }
.last-trick { display: flex; gap: 14px; justify-content: center; margin: 14px 0 6px; flex-wrap: wrap; }
.last-trick .who { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: center; }
.last-trick .who.winner { color: var(--accent); font-weight: 600; }

/* ---- phones ---------------------------------------------------------------- */
body { overflow-x: hidden; }
@media (max-width: 760px) {
  :root { --card-w: 68px; --card-h: 99px; }
  .card.simple .idx { font-size: 27px; top: 2px; left: 4px; }
  .card.simple .idx small { font-size: 20px; margin-top: 0; }

  .table-page { display: flex; flex-direction: column; height: auto; min-height: 100vh; }
  .table-head { padding: 6px 10px; gap: 6px; }
  .table-head .title { font-size: 15px; }
  .table-head .rules { display: none; }
  .table-head #phaseLine { font-size: 12px; }
  .felt-wrap { padding: 6px; }
  .felt { min-height: 600px; height: calc(100vh - 128px); border-radius: 48px;
          box-shadow: inset 0 0 40px rgba(0,0,0,0.45), 0 0 0 6px #3b2314, 0 0 0 8px #241209; }
  .seat { width: 120px; gap: 3px; }
  .seat .tile { width: 100px; height: 75px; border-width: 2px; }
  .seat .tile .initials { font-size: 26px; }
  .seat .tile .initials.emoji { font-size: 42px; }
  .seat .tile .count, .seat .tile .flag { font-size: 9px; padding: 0 5px; }
  .seat .plate { font-size: 12px; padding: 2px 9px; max-width: 150px; gap: 5px; }
  .seat .plate .name { font-size: 13px; }
  .seat .plate .hand-pts { font-size: 16px; }
  .key-cards { top: 8px; left: 8px; gap: 4px; }
  .key-cards .chip { padding: 3px 7px 3px 3px; gap: 6px; }
  .key-cards .chip .card.mini { --card-w: 22px; --card-h: 31px; }
  .key-cards .chip .card.mini .pip { display: none; }
  .key-cards .chip .arrow { width: 22px; height: 31px; font-size: 18px; }
  .key-cards .label { font-size: 10px; }
  .key-cards .label b { font-size: 11px; }
  .seat.north { top: 6px; }
  .seat.west { left: 4px; top: 30%; }     /* between the key-card chips above and the trick below */
  .seat.east { right: 4px; top: 30%; }
  .seat.south { left: 6px; bottom: 6px; }
  .trick { top: var(--trick-top, 41%); }
  .trick .slot.west { transform: translate(-100%, -50%); }   /* a touch closer to the middle: clear of the side tiles */
  .trick .slot.east { transform: translate(0%, -50%); }
  .center-msg { top: 42%; max-width: 64vw; }
  body.seated .seat.south { display: none; }   /* your own seat is the hand itself */
  .seat .actions button { padding: 3px 8px; font-size: 12px; }
  .pile { width: 40px; height: 48px; }
  .pile .label { font-size: 10px; top: 36px; }
  .center-msg { max-width: 64vw; font-size: 13px; padding: 10px 14px; top: 42%; }
  .center-msg.big, .center-msg .big { font-size: 16px; }
  .hand-wrap { bottom: 8px; gap: 6px; }
  .hand { padding: 0 6px; }
  .hand .card.selected, .hand .card.selected.hover { transform: translateY(-14px); }
  .hand .card.legal.hover { transform: none; }
  .hand-actions button { padding: 9px 14px; font-size: 14px; }
  .hand .hand-row.fan .card.received { box-shadow: 0 0 0 5px #e5534b, 0 0 20px rgba(229,83,75,0.9); }
  .controls { padding: 5px 8px; gap: 5px; flex-wrap: wrap; overflow-x: hidden; }
  .my-plate { display: inline-flex; }
  .controls button { padding: 6px 9px; font-size: 12px; white-space: nowrap; flex: 0 0 auto; }
  .controls .muted { margin-left: auto; font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; text-align: right; flex: 0 0 auto; padding-left: 4px; }
  .sidebar section { padding: 10px 12px; }
  .chat { min-height: 200px; }
  .modal { padding: 16px; }
  .last-trick { gap: 8px; }
}

/* ---- phones held sideways --------------------------------------------------- */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --card-w: 58px; --card-h: 84px; }
  .table-page { display: flex; flex-direction: column; height: auto; }
  .table-head { padding: 4px 10px; } .table-head .rules { display: none; } .table-head .title { font-size: 14px; }
  .felt-wrap { padding: 4px; }
  .felt { min-height: 0; height: calc(100vh - 96px); border-radius: 40px; box-shadow: inset 0 0 30px rgba(0,0,0,0.45), 0 0 0 5px #3b2314, 0 0 0 7px #241209; }
  .seat { width: 96px; gap: 2px; }
  .seat .tile { width: 72px; height: 54px; border-width: 2px; }
  .seat .tile .initials { font-size: 18px; }
  .seat .tile .count, .seat .tile .flag { font-size: 8px; padding: 0 4px; }
  .seat .plate { font-size: 10px; padding: 1px 7px; }
  .seat .plate .name { font-size: 11px; }
  .seat .plate .hand-pts { font-size: 13px; }
  .seat.north { top: 4px; }
  .seat.west { left: 4px; top: 40%; }
  .seat.east { right: 4px; top: 40%; }
  body.seated .seat.south { display: none; }
  .seat.south { left: 6px; bottom: 6px; }
  .pile { display: none; }
  .key-cards { top: 6px; left: 6px; flex-direction: row; }
  .key-cards .chip .arrow { width: 22px; height: 31px; font-size: 18px; }
  .key-cards .chip .card.mini { --card-w: 22px; --card-h: 31px; }
  .key-cards .chip .card.mini .pip { display: none; }
  .key-cards .label { font-size: 10px; }
  .center-msg { max-width: 60vw; font-size: 12px; padding: 8px 12px; top: 38%; }
  .center-msg.big, .center-msg .big { font-size: 14px; }
  .hand-wrap { bottom: 4px; gap: 4px; }
  .hand .card.selected, .hand .card.selected.hover { transform: translateY(-10px); }
  .hand .card.legal.hover { transform: none; }
  .hand-actions button, .controls button { padding: 4px 10px; font-size: 12px; }
  .controls { padding: 4px 10px; }
  .my-plate { display: none; }   /* landscape: the footer shows the score; the band above the hand is for the trick */
  .seat.west { align-items: flex-start; } .seat.east { align-items: flex-end; }   /* plates overflow toward the middle, never off-screen */
}

/* passed cards waiting beside their recipient */
#passPiles { position: absolute; inset: 0; pointer-events: none; }
.pass-pile { position: absolute; display: flex; gap: 2px; align-items: flex-end; }
.pass-pile .card.mini { --card-w: 30px; --card-h: 42px; }
.pass-pile .label { position: absolute; left: 0; right: 0; top: 100%; text-align: center; font-size: 10px; color: var(--muted); white-space: nowrap; }
.pass-pile.north { top: 96px; left: calc(50% + 110px); }
.pass-pile.west { left: 250px; top: 46%; transform: translateY(-130%); }
.pass-pile.east { right: 250px; top: 46%; transform: translateY(-130%); }
.pass-pile.south { top: 0; left: calc(50% + 230px); pointer-events: auto; }   /* lives inside .hand-wrap: beside the Pass button, clear of the side fans */
@media (max-width: 760px) {
  .pass-pile .card.mini { --card-w: 22px; --card-h: 31px; }
  .pass-pile .card.mini .pip { display: none; }
  .pass-pile.north { top: 60px; left: calc(50% + 62px); }   /* beside the north tile, clear of the east seat */
  .pass-pile.west { left: 6px; top: 42%; transform: none; }
  .pass-pile.east { right: 6px; top: 42%; transform: none; }
  .pass-pile.south { display: none; }   /* would sit on the hand; the center text says the cards are waiting */
  .pile { display: none; }               /* the Last button in the bar replaces the pile on phones */
}

/* ---- fan hand (Trickster-style arc) --------------------------------------- */
.hand .hand-row.fan { position: relative; display: block; }
.hand .hand-row.fan .card { position: absolute; margin: 0 !important; transform-origin: 50% 85%; transform: rotate(var(--rot, 0deg)); transition: transform 0.18s ease, box-shadow 0.18s; }
.hand .hand-row.fan .card.legal.hover { transform: translateY(-18px) rotate(var(--rot, 0deg)) scale(1.06); z-index: 60 !important; }
/* Selected cards lift but keep their place in the stack, so a card between two
   selected ones is never covered. */
/* Lift straight up in screen space and cancel each card's arc drop, so every
   selected card sits on the same line no matter where it is in the fan. */
.hand .hand-row.fan .card.selected, .hand .hand-row.fan .card.selected.hover { transform: translateY(calc(-30px - var(--drop, 0px))) rotate(var(--rot, 0deg)); }
.hand.fan { overflow: visible; }
@media (max-width: 760px) {
  .felt-wrap { overflow: hidden; }             /* the felt edge acts as the screen edge: the fan is cut off there */
  .hand-wrap.fan { bottom: -14px; gap: 46px; } /* room above the fan for lifted (selected) cards */
  .hand .hand-row.fan .card.selected, .hand .hand-row.fan .card.selected.hover { transform: translateY(calc(-38px - var(--drop, 0px))) rotate(var(--rot, 0deg)); box-shadow: 0 0 0 5px var(--accent), 0 0 20px rgba(240,180,41,0.9), 0 8px 16px rgba(0,0,0,0.6); }
  .hand .hand-row.fan .card.legal.hover { transform: rotate(var(--rot, 0deg)); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .felt-wrap { overflow: hidden; }
  .hand-wrap.fan { bottom: -22px; }
  .pass-pile { display: none; }                /* no room: the center text reports passes instead */
}

/* opponents' hands as fanned backs, each turned to face the middle of the
   table from where that player sits: across = pointing down, left = pointing
   right, right = pointing left. */
.seat .backs { position: relative; height: 26px; width: 100%; margin-top: -6px; }
.seat.north .backs { order: 5; transform: rotate(180deg); margin-top: 2px; }
.seat.west .backs, .seat.east .backs { position: absolute; top: 50%; width: 150px; margin: 0; }
.seat.west .backs { left: calc(100% - 30px); transform: translateY(-50%) rotate(90deg); }
.seat.east .backs { right: calc(100% - 30px); transform: translateY(-50%) rotate(-90deg); }
.seat .backs .card.mini { position: absolute; left: 50%; bottom: 0; --card-w: 20px; --card-h: 28px; border-width: 2px; border-radius: 3px; transform-origin: 50% 100%; box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
@media (max-width: 760px) {
  .seat .backs { height: 20px; }
  .seat .backs .card.mini { --card-w: 14px; --card-h: 20px; }
  .seat.west .backs, .seat.east .backs { width: 64px; height: 16px; top: 34%; }   /* centred on the tile, clear of the name plate below it */
  .seat.west .backs .card.mini, .seat.east .backs .card.mini { --card-w: 11px; --card-h: 16px; border-width: 1px; }
  .seat.west .backs { left: calc(100% - 40px); }
  .seat.east .backs { right: calc(100% - 40px); }
}

/* tossed trick cards */
.trick .slot .flipper { --toss: 0deg; }

/* avatar picker */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 10px 0; }
.avatar-grid button { font-size: 28px; padding: 8px 0; line-height: 1; }
.avatar-grid button.on { outline: 3px solid var(--accent); }
/* photo avatars */
.avatar-img { width: 1.3em; height: 1.3em; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 4px; }
.avatar-img.big { width: 56px; height: 56px; }
.avatar-img.on { outline: 3px solid var(--accent); }
.av-list { font-size: 18px; margin-right: 4px; vertical-align: middle; }
.seat .tile .initials.photo { width: 100%; height: 100%; display: grid; place-items: center; }
.seat .tile .initials.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.my-plate .avatar-img { width: 26px; height: 26px; }
.btn-like { display: inline-block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: 13px; }

/* ---- UX touches ------------------------------------------------------------ */
.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--danger); color: #fff; text-align: center; padding: 6px; font-size: 13px; }
body.my-turn .seat[data-pos="south"] .tile, body.my-turn .my-plate { box-shadow: 0 0 0 2px var(--accent), 0 0 22px rgba(240,180,41,0.7); animation: turnpulse 1.4s ease-in-out infinite; }
@keyframes turnpulse { 0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(240,180,41,0.45); } 50% { box-shadow: 0 0 0 2px var(--accent), 0 0 28px rgba(240,180,41,0.9); } }
.pts-pop { position: absolute; z-index: 8; font-size: 26px; font-weight: 800; transform: translate(-50%, 0); animation: ptspop 1.4s ease-out forwards; pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
.pts-pop.bad { color: #ff6b6b; }
.pts-pop.good { color: #4ade80; }
@keyframes ptspop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9; }
.scores td.lead { color: var(--accent-2); }
.scores td.trail { color: var(--danger); }
.chat .log .m .av { margin-right: 4px; }
.hand .card.illegal { cursor: help; }

/* DJ listener controls */
.dj-listen { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.dj-listen input[type="range"] { width: 110px; accent-color: var(--accent); }
@media (max-width: 760px) { .dj-listen input[type="range"] { width: 80px; } }

/* last-trick chip (top-right of the felt) */
.last-trick-chip { position: absolute; top: 14px; right: 18px; z-index: 6; display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.25); border-radius: 10px; padding: 5px 10px 5px 6px; color: var(--text); }
.last-trick-chip .cards { display: flex; }
.last-trick-chip .mini-back { width: 14px; height: 20px; border-radius: 2px; background: #1d3f86; border: 1.5px solid #fff; margin-left: -6px; box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.last-trick-chip .mini-back:first-child { margin-left: 0; }
.last-trick-chip .txt { text-align: left; line-height: 1.1; }
.last-trick-chip .txt b { display: block; font-size: 12px; }
.last-trick-chip .txt small { color: var(--muted); font-size: 11px; }
.last-trick-chip:hover { background: rgba(0,0,0,0.75); }
.seat .tile .flag.waiting { background: rgba(240,180,41,0.85); color: #1a1200; font-weight: 700; }
.center-msg .waiting b { color: var(--accent); }

/* TRAM reveal: four rows of face-up cards, the claimant's row highlighted */
.center-msg .reveal { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 6px; text-align: left; }
.center-msg .reveal-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,0.04); }
.center-msg .reveal-row.claimant { background: rgba(240,180,41,0.14); box-shadow: inset 0 0 0 1px rgba(240,180,41,0.5); }
.center-msg .reveal-row .who { min-width: 90px; font-weight: 700; font-size: 14px; }
.center-msg .reveal-row .cards { display: flex; flex-wrap: wrap; gap: 3px; }
.center-msg .reveal-row .card.mini { --card-w: 38px; --card-h: 54px; }
.center-msg .reveal-row .card.mini .idx { font-size: 11px; }
/* the reveal is wide: centre it on the felt and let it use most of the width */
.center-msg:has(.reveal) { top: 50%; max-width: min(94vw, 720px); width: max-content; }
@media (max-width: 760px), (max-height: 520px) {
  .center-msg .reveal-row .who { min-width: 56px; font-size: 12px; }
  .center-msg .reveal-row .card.mini { --card-w: 24px; --card-h: 34px; }
  .center-msg .reveal-row .card.mini .pip { display: none; }
  .center-msg .reveal-row .card.mini .idx { font-size: 10px; }
  .center-msg:has(.reveal) { top: 50%; max-width: 94vw; width: max-content; padding: 8px 10px; }   /* max-content: left:50% would otherwise shrink it to half the felt */
  .center-msg .reveal { gap: 4px; }
  .center-msg .reveal-row { padding: 2px 6px; gap: 6px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .center-msg .reveal-row .card.mini { --card-w: 20px; --card-h: 28px; }
  .center-msg:has(.reveal) .sub { display: none; }
  .center-msg:has(.reveal) #revealCountdown { display: block; }
}
@media (max-width: 760px) {
  .last-trick-chip { top: 8px; right: 8px; padding: 4px 8px 4px 5px; }
  .last-trick-chip .mini-back { width: 11px; height: 16px; }
  .last-trick-chip .txt b { font-size: 11px; }
  .pile { display: none; }
}

/* phones: a raised (armed) card awaiting its second tap */
.hand .card.armed { z-index: 70 !important; }
.hand .hand-row.fan .card.armed { transform: translateY(calc(-34px - var(--drop, 0px))) rotate(var(--rot, 0deg)); box-shadow: 0 0 0 5px var(--accent), 0 0 22px rgba(240,180,41,0.9), 0 10px 18px rgba(0,0,0,0.6); }
.hand .hand-row:not(.fan) .card.armed { transform: translateY(-16px); box-shadow: 0 0 0 5px var(--accent), 0 0 22px rgba(240,180,41,0.9); }

/* Short desktop windows (laptops at 720-800px): smaller video tiles so the
   trick and the hand both fit between the north seat and the bottom edge. */
@media (min-width: 761px) and (max-height: 800px) and (min-height: 521px) {
  .seat .tile { width: 128px; height: 96px; }
  .seat.north .tile, .seat.west .tile, .seat.east .tile { width: 190px; height: 142px; }
  .seat .tile .initials.emoji { font-size: 56px; }
  .seat .tile .initials { font-size: 32px; }
}

/* Landscape phones (after the portrait rules so these win): short side fans
   that stay beside the tile instead of covering the name plate. */
@media (max-height: 520px) and (orientation: landscape) {
  .seat.west .backs, .seat.east .backs { width: 48px; height: 16px; top: 30%; }
  .seat.west .backs { left: calc(100% - 36px); }
  .seat.east .backs { right: calc(100% - 36px); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .seat.west .backs, .seat.east .backs { display: none; }   /* no room beside the tiles; the tile shows the card count */
  .hand-wrap.passing { gap: 44px; }                          /* raised cards stay under the Pass button */
  .center-msg { top: 31%; max-width: 88vw; padding: 5px 12px; }
  .center-msg .sub { display: none; }                        /* one line only: the hint has no room here */
  .center-msg .big, .center-msg .waiting { display: inline; }
  .center-msg .waiting::before { content: " · "; color: var(--muted); }
}

/* Spotify DJ: one embedded player for everyone, between the table and the sidebar */
.dj-spotify { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 14px 10px; }
.dj-spotify-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.dj-spotify-head #djSpotifyActions { margin-left: auto; display: flex; gap: 6px; }
.dj-spotify #djSpotifyEmbed iframe { width: 100%; border-radius: 12px; }
/* with the Spotify player open, keep it above the fold by trimming the felt */
body.dj-spotify .felt { height: calc(100vh - 176px - 118px); min-height: 480px; }
@media (max-width: 760px) { body.dj-spotify .felt { height: calc(100vh - 128px - 118px); min-height: 520px; } }
@media (max-height: 520px) { body.dj-spotify .felt { height: calc(100vh - 96px); } body.dj-spotify .dj-spotify { display: none; } } /* landscape phones: no room; rotate to use the player */
.dj-spotify #djSpotifyEmbed iframe { height: 80px; }

/* Oh Hell */
.bid-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.bid-row button { min-width: 40px; font-size: 16px; font-weight: 700; }
.seat .plate .dealer { font-size: 11px; font-weight: 800; background: var(--accent); color: #1b1b1b; border-radius: 999px; padding: 0 6px; margin-left: 4px; }
#scores td .lead { color: var(--accent-2); font-weight: 700; }

/* Oh Hell: the trump card flipped off the deck before bidding */
.trump-flip { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 8px 0 6px; --card-w: 84px; --card-h: 118px; }
.trump-flip .deckstack { position: relative; width: var(--card-w); height: var(--card-h); }
.trump-flip .deckstack .card { position: absolute; left: 0; top: 0; }
.trump-flip .deckstack .card:nth-child(2) { left: 3px; top: -3px; }
.trump-flip .deckstack .card:nth-child(3) { left: 6px; top: -6px; }
.trump-flip .flip3d { width: var(--card-w); height: var(--card-h); perspective: 700px; }
.trump-flip .flip3d .inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateY(0); }
.trump-flip .flip3d.animate .inner { animation: trumpflip 0.9s cubic-bezier(.2,.7,.2,1) both; }
@keyframes trumpflip { from { transform: translateX(-100px) rotateY(180deg); } 40% { transform: translateX(-40px) rotateY(180deg); } to { transform: translateX(0) rotateY(0); } }
.trump-flip .face { position: absolute; inset: 0; backface-visibility: hidden; }
.trump-flip .face.back { transform: rotateY(180deg); }
.trump-flip .card.notrump { display: grid; place-items: center; background: #1b2a1f; color: var(--muted); font-weight: 700; text-align: center; }
.center-msg .bid-row { margin: 8px 0 6px; }
@media (max-width: 760px) { .trump-flip { --card-w: 64px; --card-h: 90px; gap: 12px; } }

.trump-flip { --card-w: 110px; --card-h: 154px; gap: 22px; }
.trump-flip .flip3d { position: relative; }
.trump-flip.done .flip3d .face.front .card { box-shadow: 0 0 0 4px var(--accent), 0 0 28px rgba(240,180,41,0.85); animation: trumpglow 1.4s ease-in-out infinite alternate; }
@keyframes trumpglow { from { box-shadow: 0 0 0 4px var(--accent), 0 0 18px rgba(240,180,41,0.6); } to { box-shadow: 0 0 0 5px var(--accent), 0 0 40px rgba(240,180,41,1); } }
.trump-badge { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); background: var(--accent); color: #1b1b1b; font-weight: 900; font-size: 15px; letter-spacing: 0.06em; padding: 3px 10px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.trump-badge.red { color: #b3261e; }
.key-cards .chip.trump-chip { box-shadow: 0 0 0 2px var(--accent); background: rgba(240,180,41,0.12); }
.key-cards .chip .suit-big { font-size: 22px; line-height: 1; vertical-align: -3px; }
.key-cards .chip .suit-big.red { color: #e5534b; }
@media (max-width: 760px) { .trump-flip { --card-w: 72px; --card-h: 101px; gap: 14px; } .trump-badge { font-size: 12px; } }
.trump-flip { margin-bottom: 26px; } /* room for the TRUMP badge under the card */

/* Volume panel */
.vol-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.vol-row .vol-label { font-weight: 600; }
.vol-row input[type="range"] { width: 100%; }
.vol-row .vol-note { grid-column: 1 / -1; font-size: 12px; margin-top: -2px; }
@media (max-width: 760px) { .vol-row { grid-template-columns: 110px 1fr auto; } }

/* The other players' video tiles are bigger than your own (you can see yourself anyway). */
.seat.north .tile, .seat.west .tile, .seat.east .tile { width: 240px; height: 180px; }
.seat.north .tile .initials.emoji, .seat.west .tile .initials.emoji, .seat.east .tile .initials.emoji { font-size: 84px; }
@media (min-width: 761px) and (max-height: 800px) and (min-height: 521px) {
  .seat.north .tile, .seat.west .tile, .seat.east .tile { width: 190px; height: 142px; }
  .seat.north .tile .initials.emoji, .seat.west .tile .initials.emoji, .seat.east .tile .initials.emoji { font-size: 60px; }
}
@media (max-width: 760px) {
  .seat.north .tile, .seat.west .tile, .seat.east .tile { width: 120px; height: 90px; }
  .seat.north .tile .initials.emoji, .seat.west .tile .initials.emoji, .seat.east .tile .initials.emoji { font-size: 46px; }
  .seat.west, .seat.east { width: 128px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .seat.north .tile, .seat.west .tile, .seat.east .tile { width: 100px; height: 75px; }
  .seat.north .tile .initials.emoji, .seat.west .tile .initials.emoji, .seat.east .tile .initials.emoji { font-size: 36px; }
}
@media (max-width: 760px) and (min-height: 521px) {
  /* Portrait phones: the side tiles are wide enough that a fan beside them
     would land on the trick, so the side players' fans hang under their name
     plates, pointing at the middle like the north one. */
  .seat.west .backs, .seat.east .backs { position: relative; order: 5; top: auto; left: auto; right: auto; width: 100%; height: 20px; margin: 2px 0 0; transform: rotate(180deg); }
  .seat.west .backs .card.mini, .seat.east .backs .card.mini { --card-w: 14px; --card-h: 20px; border-width: 2px; }
}
/* In the fan an overlapped simple card shows only its index; the pip comes back when the card is raised or fully visible. */
.hand .hand-row.fan .card.simple:not(:last-child):not(.selected):not(.armed):not(.hover) .pip { visibility: hidden; }

/* Oh Hell, Trickster-style touches */
.seat .plate .trump-glyph { font-size: 16px; margin-left: 4px; }
.seat .plate .trump-glyph.red { color: #e5534b; }
/* Oh Hell lead marker: the turned trump card in front of whoever leads next */
.seat .lead-marker { position: absolute; display: flex; align-items: center; gap: 6px; z-index: 7; pointer-events: none; }
.seat .lead-marker .card.mini { --card-w: 34px; --card-h: 48px; box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(240,180,41,0.85); }
.seat .lead-marker .card.mini.notrump { display: grid; place-items: center; background: #f3ead8; color: #5a4a1a; font-size: 9px; line-height: 1.05; text-align: center; font-weight: 700; }
.seat .lead-marker .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); background: rgba(0,0,0,0.6); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.seat .lead-marker .lbl.red { color: #ff8a80; }
.seat .first-marker .lbl.big { font-size: 13px; padding: 5px 12px; background: var(--accent); color: #1b1b1b; box-shadow: 0 0 0 2px rgba(0,0,0,0.35), 0 0 18px rgba(240,180,41,0.9); animation: first-pulse 1.2s ease-in-out infinite; }
@keyframes first-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.seat.south .first-marker { bottom: calc(100% + 6px); }
.seat.north .first-marker { top: calc(100% + 6px); }
.seat.west .first-marker, .seat.east .first-marker { top: calc(50% + 40px); }
.seat.north .lead-marker { top: calc(100% + 6px); left: 50%; transform: translateX(-50%); flex-direction: column; }
.seat.south .lead-marker { bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); flex-direction: column-reverse; }
.seat.west .lead-marker { left: calc(100% + 70px); top: 50%; transform: translateY(-50%); }   /* past the fanned backs */
.seat.east .lead-marker { right: calc(100% + 70px); top: 50%; transform: translateY(-50%); flex-direction: row-reverse; }
@media (max-width: 760px) { .seat.west .lead-marker { left: calc(100% + 36px); } .seat.east .lead-marker { right: calc(100% + 36px); } }
@media (max-width: 760px) { .seat .lead-marker .card.mini { --card-w: 26px; --card-h: 36px; } .seat .lead-marker .lbl { font-size: 9px; padding: 1px 5px; } }
.seat .deck-stub { position: relative; height: 34px; width: 60px; margin-top: 2px; }
.seat .deck-stub .card.mini { position: absolute; left: 0; top: 0; --card-w: 24px; --card-h: 34px; }
.seat .deck-stub .card.mini:nth-child(2) { left: 2px; top: -2px; }
.seat .deck-stub .card.mini.turned-trump { left: 30px; top: 0; --card-w: 26px; --card-h: 36px; box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(240,180,41,0.8); }
.seat .won-tricks { position: relative; height: 30px; width: 70px; margin-top: 2px; }
.seat .won-tricks .card.mini { position: absolute; left: calc(var(--i) * 5px); top: 0; --card-w: 20px; --card-h: 28px; }
.seat .won-tricks .n { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 800; color: var(--accent); margin-left: 54px; }
.center-msg .bid-row button.bid { background: #fff; color: #111; border-color: #ddd; min-width: 44px; font-size: 18px; }
.center-msg .bid-row button.bid:hover { background: #ffe8a3; }
.center-msg .oh-lines { margin: 6px 0; font-size: 14px; line-height: 1.5; }
.center-msg .oh-lines .made { color: var(--accent-2); }
.center-msg .oh-lines .missed { color: var(--muted); }
@media (max-width: 760px) { .seat .deck-stub, .seat .won-tricks { transform: scale(0.8); transform-origin: top left; } }
/* the bidding panel is tall: pin it to the top of the felt so it never covers the hand */
.center-msg.bidding { top: 10px; transform: translateX(-50%); }
@media (max-width: 760px) { .center-msg.bidding { top: 6px; max-width: 94vw; } }
.center-msg.bidding { padding: 10px 18px; }
.center-msg.bidding .trump-flip { --card-w: 84px; --card-h: 118px; margin: 4px 0 20px; gap: 16px; }
.center-msg.bidding .sub { margin-top: 2px; }
.center-msg.bidding .bid-row { margin: 6px 0 4px; }
.center-msg.bidding .bid-row button.bid { min-width: 40px; padding: 4px 8px; font-size: 16px; }

/* Oh Hell bid verdicts */
.verdict-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 9; text-align: center; pointer-events: none; background: rgba(15,27,20,0.92); border: 2px solid var(--accent); border-radius: 16px; padding: 14px 28px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); animation: verdictin 2.8s ease both; }
.verdict-banner .icon { font-size: 64px; line-height: 1; }
.verdict-banner .word { font-size: 30px; font-weight: 900; color: var(--accent); letter-spacing: 0.04em; margin-top: 4px; }
.verdict-banner .note { font-size: 14px; color: var(--muted); margin-top: 2px; }
@keyframes verdictin { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 20% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(0.95); } }
.key-cards .chip .verdict-icon { font-size: 24px; }
.key-cards .chip.verdict { box-shadow: 0 0 0 2px var(--accent-2); }
/* stronger trump tint, in the hand and on the table */
@media (max-width: 760px) { .verdict-banner { top: 40%; padding: 10px 18px; } .verdict-banner .icon { font-size: 48px; } .verdict-banner .word { font-size: 24px; } }

.seat .tile.open-seat { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2), 0 0 16px rgba(63,185,138,0.6); }
/* trump cards: unmistakable — deep gold face and a gold edge, in the hand and on the table */
.card.trump.simple { background: #f3ead8 !important; box-shadow: 0 0 0 3px #c9a44a, 0 2px 6px rgba(0,0,0,0.45); }
.card.trump.simple .idx, .card.trump.simple .pip { color: #1a1a1a; }
.card.trump.simple.red .idx, .card.trump.simple.red .pip { color: #b3261e; }
/* classic deck: the picture is multiplied onto a gold card, so every white
   part turns gold while the red/black ink and the face art keep their colour */
.card.trump:has(> .art) { background: #f3ead8 !important; box-shadow: 0 0 0 3px #c9a44a, 0 2px 6px rgba(0,0,0,0.45); }
.card.trump .art { mix-blend-mode: multiply; filter: none; }
.hand .card.trump.legal { box-shadow: 0 0 0 3px var(--accent), 0 0 0 5px #b8860b, 0 0 14px rgba(240,180,41,0.7); }
/* simple deck: bigger suit icons */
.card.simple .idx small { font-size: 28px; }

@media (max-width: 760px) {
  .card.simple .idx small { font-size: 24px; }

}
/* bigger rank in the corner: shift the suit under it down a touch and keep the pip out of its way */
.card.simple .idx small { margin-top: 0; }


/* segmented toggles on the lobby stats */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 4px 12px; font-size: 13px; }
.seg button.on { background: var(--accent); color: #1b1b1b; font-weight: 700; }
#luck td.up { color: var(--accent-2); font-weight: 700; }
#luck td.down { color: #ff6b6b; font-weight: 700; }
#luck tr.avg td { color: var(--muted); border-top: 2px solid var(--line); }

/* Song clips panel */
.songclips .sc-row { display: grid; grid-template-columns: 1.2fr 1.4fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.songclips .sc-clip { display: flex; gap: 8px; align-items: center; }
.songclips .sc-clip img, .songclips .sc-result img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.songclips .sc-noart { width: 40px; height: 40px; border-radius: 6px; background: var(--panel-2); }
.songclips .sc-actions { display: flex; gap: 6px; }
.songclips .sc-result { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.songclips .sc-result .sc-meta { flex: 1; min-width: 0; }
.songclips .sc-result .sc-meta div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.songclips [data-preview].playing { background: var(--accent); color: #1b1b1b; }
.songclips .sc-scrub { margin-top: 8px; }
.songclips .sc-bar { position: relative; height: 26px; border-radius: 6px; background: repeating-linear-gradient(90deg, #2a3a55 0 2px, #1b2538 2px 6px); overflow: hidden; }
.songclips .sc-window { position: absolute; top: 0; bottom: 0; background: rgba(240,180,41,0.45); border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.songclips .sc-head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; display: none; }
.songclips input[type="range"] { width: 100%; margin-top: 4px; }
@media (max-width: 760px) { .songclips .sc-row { grid-template-columns: 1fr; gap: 4px; } }

/* Trickster-style simple deck: pip area below the index, faces from the classic art */
.card.simple { border-radius: 8px; box-shadow: 0 0 0 1px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.4); }
.card.simple .pip { position: absolute; inset: 0; display: block; }
.card.simple .pip.pips { left: 34%; right: 7%; top: 12%; bottom: 7%; }
.card.simple .pip.pips i { position: absolute; transform: translate(-50%, -50%); font-style: normal; font-size: calc(var(--card-h) * 0.16); line-height: 1; }
.card.simple .pip.pips i.f { transform: translate(-50%, -50%) rotate(180deg); }
.card.simple .pip.ace { display: grid; place-items: center; left: 20%; right: 4%; top: 22%; bottom: 4%; font-size: calc(var(--card-h) * 0.42); line-height: 1; }
.card.simple .pip.face { left: 32%; right: 6%; top: 8%; bottom: 7%; border-radius: 6px; background-size: 182% auto; background-position: 58% 50%; background-repeat: no-repeat; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.card.simple.trump .pip.face { mix-blend-mode: multiply; }
@media (max-width: 760px) {
  .card.simple .pip.pips { left: 36%; top: 14%; }
  .card.simple .pip.pips i { font-size: calc(var(--card-h) * 0.14); }
  .card.simple .pip.ace { font-size: calc(var(--card-h) * 0.38); }
}
.songclips select.small { font-size: 12px; padding: 3px 6px; max-width: 150px; }

/* turn timer */
.seat .plate .turn-clock { margin-left: 6px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
body.turn-slow .seat.turn .tile { animation: turnpulse 0.7s ease-in-out infinite; }
/* Oh Hell: Bid badge and bid history */
.seat .tile .flag.bid { background: var(--accent); color: #1b1b1b; font-weight: 800; }
.seat .tile .flag.bid.waiting { background: rgba(0,0,0,0.55); color: var(--muted); font-weight: 500; }
.seat .bid-hist { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-top: 3px; font-size: 10px; line-height: 1; max-width: 190px; }
.seat .bid-hist .lbl { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; align-self: center; margin-right: 1px; }
.seat .bid-hist .chip { padding: 2px 5px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(0,0,0,0.5); border: 1px solid transparent; }
.seat .bid-hist .chip.made { color: #1b1b1b; background: var(--accent-2); }
.seat .bid-hist .chip.over { color: #ffb08a; border-color: #ff8a5b; }
.seat .bid-hist .chip.under { color: #ff9a9a; border-color: #ff6b6b; }
.seat .plate { max-width: 240px; }
@media (max-width: 760px) { .seat .plate { max-width: 170px; } }
