@font-face { font-family: 'Fraunces'; src: url(/fonts/fraunces.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
.card .rank, .card .face-letter, .res-pts, .podium .pts, .scores tfoot td, .big-code { font-variant-numeric: lining-nums tabular-nums; }
@font-face { font-family: 'Nunito'; src: url(/fonts/nunito.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
  --bg1: #15223a;
  --bg2: #070d19;
  --panel: rgba(12, 22, 42, 0.82);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(242,140,40,0.28);
  --accent: #f28c28;
  --accent-2: #ffd3a1;
  --accent-3: #9c4a0a;
  --text: #f6f1e6;
  --muted: #aab3c5;
  --felt1: #1f7a46;
  --felt2: #0b3b22;
  --ink: #111a2c;
  --danger: #ff5d6c;
  /* Good vs. bad uses blue vs. orange (safe for red-green color blindness), never green vs. red */
  --good: #8fd8ff;
  --bad: #ffb070;
  --cw: 92px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { background: var(--bg2); }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #2a4a7a 0%, var(--bg1) 35%, var(--bg2) 100%) fixed;
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { min-height: 100%; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 0.85rem; }
.small-caps { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.warn { color: #ffb4a8; }
kbd { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: .8em; }

/* ---------- logo ---------- */
.logo { display: flex; flex-direction: column; align-items: center; user-select: none; }
.logo-mark { width: 110px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); border-radius: 22%; }
.logo-word { display: flex; flex-direction: column; align-items: center; line-height: .9; margin-top: 10px; }
.logo-top { font-family: 'Fraunces'; font-weight: 700; letter-spacing: .6em; margin-right: -.6em; font-size: 1.05rem; color: var(--accent-2); }
.logo-main {
  font-family: 'Fraunces'; font-weight: 900; font-size: 4rem; letter-spacing: .02em; color: var(--text);
  text-shadow: 0 3px 0 var(--accent-3), 0 10px 18px rgba(0,0,0,.5);
}
.logo-md .logo-mark { width: 72px; }
.logo-md .logo-main { font-size: 2.6rem; }
.logo-md .logo-top { font-size: .8rem; }
.logo-sm { flex-direction: row; gap: 7px; }
.logo-sm .logo-mark { width: 34px; filter: none; }
.logo-sm .logo-word { margin: 0; align-items: flex-start; }
.logo-sm .logo-top { font-size: .5rem; letter-spacing: .4em; margin-right: 0; }
.logo-sm .logo-main { font-size: 1.15rem; text-shadow: 0 1px 0 var(--accent-3); }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); border-radius: 12px;
  padding: 10px 18px; font-weight: 800; transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #ffb060, #f28c28 55%, #d9731a); color: var(--ink); border-color: #ffd3a1;
  box-shadow: 0 4px 0 #7a3908, 0 10px 24px rgba(242,140,40,.25); text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffc27f, #f79a3d 55%, #e07e22); }
.btn.primary:active:not(:disabled) { box-shadow: 0 2px 0 #7a3908; transform: translateY(2px); }
.btn.big { padding: 13px 26px; font-size: 1.08rem; }
.btn.small { padding: 6px 12px; font-size: .9rem; border-radius: 9px; }
.btn.danger { border-color: rgba(255,93,108,.5); color: #ffc2c8; }
.link { background: none; border: 0; color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; padding: 8px 10px; min-height: 36px; }
.icon-btn { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; font-size: 1.05rem; }
.icon-btn:hover { background: rgba(255,255,255,.15); }
/* Muted indicator: a red circle with a diagonal slash over the 🔊 icon. */
.aud-btn { position: relative; }
.aud-btn.muted::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; box-sizing: border-box;
  border: 2.5px solid #ff3b4a; border-radius: 50%; pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - 1.25px), #ff3b4a calc(50% - 1.25px), #ff3b4a calc(50% + 1.25px), transparent calc(50% + 1.25px));
}
.aud-pop {
  position: fixed; z-index: 60; width: min(260px, calc(100vw - 16px)); box-sizing: border-box; padding: 12px;
  background: var(--panel); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.aud-pop { background: rgba(28, 14, 62, 0.97); }
.aud-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; }
.aud-name { font-weight: 700; color: var(--accent-2); }
.aud-slider, .aud-slider:focus { padding: 0; border: 0; background: none; box-shadow: none; }
.aud-slider { grid-column: 1 / 2; width: 100%; min-width: 0; height: 36px; margin: 0; accent-color: var(--accent); touch-action: none; }
.aud-out { grid-column: 2; min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.aud-row.muted .aud-out { color: #ff7a85; }
.menu-list .aud-row { background: var(--panel-2); padding: 10px 12px; border-radius: 12px; }
.chip { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 4px 12px; font-size: .85rem; font-weight: 800; }
.chip.on { background: var(--accent); color: var(--ink); border-color: var(--accent-2); }
.tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--muted); font-weight: 800; }
.tag.accent { background: rgba(242,140,40,.18); color: var(--accent-2); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
input, select {
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 11px 14px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,140,40,.2); }
select { padding: 6px 10px; border-radius: 9px; }

/* ---------- home ---------- */
.home { max-width: 1040px; margin: 0 auto; padding: 36px 16px 30px; }
.home.narrow { max-width: 460px; }
.hero { text-align: center; margin-bottom: 26px; animation: rise .6s both; }
.hero.small { margin-bottom: 16px; }
.tagline { font-family: 'Fraunces'; font-weight: 700; color: var(--accent-2); opacity: .9; margin: 12px 0 0; font-size: 1.05rem; letter-spacing: .02em; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(8px);
}
.panel h2 { font-family: 'Fraunces'; font-weight: 900; margin: 0 0 14px; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.home-grid > * { min-width: 0; }
.home-grid > .panel:first-child { grid-column: 1 / -1; display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.home-grid > .panel:first-child .field { flex: 1; min-width: 220px; margin: 0; }
.mode { display: flex; flex-direction: column; gap: 14px; animation: rise .6s .1s both; }
.mode .btn.big { margin-top: auto; }
.mode-icon { font-size: 1.5rem; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.label { min-width: 88px; color: var(--muted); font-size: .9rem; }
.stepper { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 3px; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; border: 0; background: rgba(255,255,255,.1); font-size: 1.2rem; font-weight: 800; }
.stepper button:disabled { opacity: .3; }
.stepper b { width: 30px; text-align: center; font-size: 1.15rem; }
.opp-preview { display: flex; gap: 2px; font-size: 1.35rem; }
.opp-preview span { animation: pop .3s both; }
.seg { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 800; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--ink); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.15); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: .4em; font-weight: 900; font-size: 1.2rem; text-align: center; min-width: 0; }
.resume { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; border-color: var(--accent); }
.resume small { color: var(--muted); font-weight: 600; }
.home-foot { text-align: center; margin-top: 20px; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255,255,255,.15); border-top-color: var(--accent); margin: 30px auto 12px; animation: spin 0.9s linear infinite; }
.code-inline { font-family: 'Fraunces'; letter-spacing: .2em; color: var(--accent-2); }

/* ---------- lobby ---------- */
.lobby { max-width: 760px; margin: 0 auto; padding: 26px 16px; }
.lobby-head { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.big-code { font-family: 'Fraunces'; font-weight: 900; font-size: 3rem; letter-spacing: .18em; color: var(--accent); line-height: 1; text-shadow: 0 3px 0 #7a3908; }
.invite { flex: 1; min-width: 260px; }
.invite-row { display: flex; gap: 8px; margin-top: 6px; }
.invite-row input { flex: 1; min-width: 0; font-size: .9rem; }
.seat-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.seat-row { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 8px 12px; animation: rise .3s both; }
.seat-row.me { border-color: var(--line); }
.seat-row.open { opacity: .45; border-style: dashed; }
.seat-row .av { font-size: 1.6rem; width: 40px; height: 40px; display: grid; place-items: center; background: rgba(0,0,0,.25); border-radius: 50%; }
.seat-row .nm { flex: 1; font-weight: 800; }
.seat-row em { color: var(--muted); font-style: normal; font-weight: 600; }
.bot-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.lobby-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.waiting { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* ---------- dots ---------- */
.dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }

/* ---------- game layout ---------- */
.game { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
.game > * { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: rgba(10,4,28,.45); border-bottom: 1px solid var(--line); }
.logo-btn { background: none; border: 0; padding: 0; min-width: 36px; min-height: 36px; display: grid; place-items: center; }
.pills { flex: 1; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pill { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 5px 14px; font-size: .92rem; white-space: nowrap; }
.pill b { font-size: 1.05rem; }
.wild-pill { background: linear-gradient(180deg, rgba(242,140,40,.3), rgba(242,140,40,.12)); border-color: var(--accent); }
.wild-pill b { color: var(--accent-2); }
.round-track { display: flex; gap: 4px; }
.round-track i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.15); }
.round-track i.done { background: var(--accent-3); }
.round-track i.now { background: var(--accent); box-shadow: 0 0 0 3px rgba(242,140,40,.3); }
.top-actions { display: flex; gap: 6px; }

.seats { display: flex; justify-content: center; gap: 10px; padding: 12px 12px 0; flex-wrap: wrap; }
.seat {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 8px 12px 8px 8px; min-width: 150px;
  transition: box-shadow .25s, border-color .25s, transform .25s;
}
.seat.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(242,140,40,.5), 0 0 28px rgba(242,140,40,.35); transform: translateY(2px) scale(1.03); }
.seat.out { border-color: var(--accent); }
.seat-av { position: relative; font-size: 1.7rem; width: 46px; height: 46px; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #2f5a96, #12223d); border-radius: 50%; border: 2px solid rgba(242,140,40,.55); grid-row: span 2; }
.seat-av.sm { width: 40px; height: 40px; font-size: 1.45rem; }
.dealer { position: absolute; bottom: -4px; right: -6px; font-size: .62rem; font-weight: 900; background: #fff; color: var(--bg1); border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; border: 2px solid var(--accent); }
.out-flag { position: absolute; top: -14px; font-size: 1.1rem; animation: bob 1.4s ease-in-out infinite; }
.seat-name { font-weight: 900; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.seat-meta { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.seat-fan { grid-column: 1 / -1; display: flex; justify-content: center; height: 32px; margin-top: 6px; padding-left: 14px; }
.seat-fan .card.mini { --cw: 22px; margin-left: -14px; transform: rotate(calc((var(--i) - var(--n) / 2) * 3deg)); transform-origin: 50% 120%; flex: none; }
.seat-meta .cnt { display: none; }
.mc { display: inline-block; width: .55em; height: .78em; margin-right: .18em; vertical-align: -.08em; border-radius: 2px; background: linear-gradient(135deg, #2b528f, #10243f); border: 1px solid var(--accent); }
.sort-cycle, .emote-toggle, .meter .short, .emote-pop { display: none; }
.emote-toggle.on { background: rgba(242,140,40,.25); border-color: var(--accent); }
.me-id .seat-av { position: relative; }
.me-bubble { top: -34px; right: auto; left: 50%; transform: translateX(-50%); }
.me-text { min-width: 0; }
.status .who { font-weight: 800; }
.seat-row .nm { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-row select { min-width: 0; flex: 0 1 auto; max-width: 45%; }
.seat-row > * { flex-shrink: 0; }
.seat-row > .nm, .seat-row > select { flex-shrink: 1; }
.lobby .panel, .lobby-head, .invite { min-width: 0; }
@media (hover: none) { .keys-help, .hint-line .desk { display: none; } }
.thinking { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--ink); font-size: .68rem; font-weight: 900; padding: 1px 9px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; letter-spacing: .06em; }
.bubble { position: absolute; top: -18px; right: -6px; font-size: 1.8rem; background: #fff; border-radius: 50%; width: 46px; height: 46px; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: pop .35s cubic-bezier(.2,1.6,.4,1) both; z-index: 5; }

.table { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px; min-height: 0; }
.felt {
  position: relative; width: min(760px, 100%); height: 100%; max-height: 420px; min-height: 0;
  background: radial-gradient(ellipse at 50% 40%, var(--felt1), var(--felt2) 75%);
  border-radius: 180px; border: 6px solid #0a2a18; box-shadow: 0 0 0 3px var(--accent-3), inset 0 0 60px rgba(0,0,0,.5), 0 24px 50px rgba(0,0,0,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px 30px;
}
.felt::before { content: ''; position: absolute; inset: 10px; border-radius: 170px; border: 1px dashed rgba(242,140,40,.2); pointer-events: none; }
.piles { display: flex; gap: 36px; align-items: flex-end; --cw: clamp(48px, 12vh, 104px); flex: none; }
.pile-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pile-label { font-size: .75rem; color: rgba(255,255,255,.7); letter-spacing: .08em; text-transform: uppercase; }
.deck, .discard { position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: calc(var(--cw) * .09); }
.deck .card, .discard .card { position: absolute; inset: 0; }
.deck .under2 { transform: translate(4px, 4px); }
.deck .under1 { transform: translate(2px, 2px); }
.discard .under { transform: rotate(-7deg) translate(-4px, 2px); filter: brightness(.85); }
.card.empty { background: rgba(0,0,0,.2); border: 2px dashed rgba(255,255,255,.25); box-shadow: none; }
.can-draw { cursor: pointer; }
.can-draw .top, .can-draw > .card:last-child { animation: glow 1.6s ease-in-out infinite; }
.can-draw:hover .top { transform: translateY(-6px); }
.discard.drop-target { outline: 2px dashed rgba(242,140,40,.6); outline-offset: 8px; border-radius: 12px; }
.discard.drop-hover { outline: 3px solid var(--accent); outline-offset: 10px; }
.status { font-size: 1rem; text-align: center; min-height: 1.5em; padding: 4px 14px; border-radius: 999px; background: rgba(0,0,0,.25); max-width: 100%; }
.status.mine { background: rgba(242,140,40,.2); color: var(--accent-2); box-shadow: 0 0 0 1px rgba(242,140,40,.4); }
.status.final { background: rgba(242,140,40,.14); box-shadow: 0 0 0 1px rgba(242,140,40,.35); }
.status.hint { background: rgba(124,196,255,.2); color: #e4f2ff; box-shadow: 0 0 0 1px rgba(124,196,255,.55); border-radius: 14px; animation: pop .25s both; }
.hint-btn { border-color: rgba(124,196,255,.55); color: #dff0ff; }
.hint-btn.on { background: rgba(124,196,255,.22); }
@keyframes hintglow { 50% { box-shadow: 0 0 0 4px #7cc4ff, 0 0 30px rgba(124,196,255,.95); } }
.deck.hinted .top, .discard.hinted .top, .hand .card.hinted { animation: hintglow 1.2s ease-in-out infinite; box-shadow: 0 0 0 3px #7cc4ff, 0 0 18px rgba(124,196,255,.7); }
.hand .card.hinted.selected { transform: translateY(-24px); }
.felt-info { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; min-width: 0; }
.felt.side { flex-direction: row; gap: 14px; }
.felt.side .felt-info { flex: 0 1 46%; }
.felt.side .status { border-radius: 14px; text-align: left; }
.out-melds { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; }
.out-title { font-size: .8rem; color: var(--accent-2); font-weight: 800; background: none; border: 0; padding: 0; cursor: default; }
.out-title .see { display: none; }
.show-melds { margin: 16px 0 4px; gap: 14px; }
.show-melds .card.tiny { --cw: 54px; }
.show-melds .meld .card.tiny + .card.tiny { margin-left: -18px; }
.melds { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.meld { display: flex; }
.meld .card.tiny + .card.tiny { margin-left: -14px; }
.log { position: absolute; right: 16px; bottom: 14px; width: 240px; font-size: .76rem; color: rgba(255,255,255,.6); display: flex; flex-direction: column; gap: 2px; pointer-events: none; text-align: right; }
.log div:last-child { color: rgba(255,255,255,.9); }

.me-area { position: relative; padding: 8px 12px 10px; background: linear-gradient(180deg, rgba(10,4,28,0), rgba(10,4,28,.6) 30%); border-top: 1px solid rgba(242,140,40,.15); }
.me-bar { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; }
.me-id { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; }
.me-id.active { background: rgba(242,140,40,.18); box-shadow: 0 0 0 2px rgba(242,140,40,.5); }
.meter { font-size: .9rem; background: rgba(0,0,0,.3); padding: 5px 14px; border-radius: 999px; }
.meter b { color: var(--accent-2); }
.meter .go { color: var(--accent); }
.sorts { display: flex; gap: 6px; align-items: center; font-size: .85rem; }
.hand { --step: calc(var(--cw) * .5); --gap: 0px; min-width: 0; position: relative; display: flex; justify-content: center; align-items: flex-end; padding: 26px 12px 6px; min-height: calc(var(--cw) * 1.42 + 34px); touch-action: none; user-select: none; }
.hand .card { flex: none; margin-left: calc(var(--step) - var(--cw)); cursor: grab; transition: transform .16s ease, box-shadow .16s ease; }
.hand .card:first-child { margin-left: 0; }
.hand .card.group-start { margin-left: calc(var(--step) - var(--cw) + var(--gap)); }
.hand .card:hover { transform: translateY(-10px); z-index: 2; }
.hand .card.selected { transform: translateY(-24px); box-shadow: 0 0 0 3px var(--accent), 0 14px 26px rgba(0,0,0,.5); z-index: 3; }
.hand .card.fresh::before { content: 'NEW'; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: #ffd3a1; color: var(--ink); font: 900 .6rem 'Nunito'; padding: 1px 6px; border-radius: 999px; z-index: 2; letter-spacing: .08em; }
.hand .card.goout::after { content: '🏁'; position: absolute; top: -16px; right: -6px; font-size: 1.1rem; animation: bob 1.2s ease-in-out infinite; }
.hand .card.grouped { box-shadow: 0 5px 0 -1px var(--accent-3), 0 6px 14px rgba(0,0,0,.35); }
.hand .card.dragging { transition: none; z-index: 60; cursor: grabbing; box-shadow: 0 24px 40px rgba(0,0,0,.55); }
.hand.dealing .card { animation: deal .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 55ms); }
.insert-marker { position: absolute; top: 18px; bottom: 4px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); pointer-events: none; }
.hand-actions { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 40px; flex-wrap: wrap; }
.hint-line { font-size: .82rem; }
.emotes { position: absolute; right: 12px; bottom: 10px; display: flex; gap: 2px; background: rgba(0,0,0,.3); border-radius: 999px; padding: 3px; }
.emotes button { background: none; border: 0; font-size: 1.15rem; width: 32px; height: 32px; border-radius: 50%; }
.emotes button:hover { background: rgba(255,255,255,.12); transform: scale(1.15); }

/* ---------- cards ---------- */
.card {
  --r: calc(var(--cw) * .09);
  position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: var(--r);
  background: linear-gradient(160deg, #ffffff 0%, #fbf7ee 60%, #efe6d2 100%);
  box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 6px 14px rgba(0,0,0,.35); color: var(--sc, #222);
  border: 1px solid rgba(0,0,0,.15); overflow: visible;
}
.card .suit-icon { fill: currentColor; display: block; }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .9; }
.card .corner.tl { top: 5%; left: 6%; }
.card .corner.br { bottom: 5%; right: 6%; transform: rotate(180deg); }
.card .rank { font-family: 'Fraunces'; font-weight: 900; font-size: calc(var(--cw) * .25); letter-spacing: -.03em; }
.card .corner .suit-icon { width: calc(var(--cw) * .15); height: calc(var(--cw) * .15); margin-top: 2px; }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; }
.card .pip .suit-icon { width: 46%; height: 46%; filter: drop-shadow(0 2px 1px rgba(0,0,0,.18)); }
.card.s-moons .pip .suit-icon { stroke: #a24d05; stroke-width: 3; }
.card .face { position: absolute; inset: 0; display: grid; place-items: center; }
.card .face::before { content: ''; position: absolute; inset: 15% 12%; border: 1px solid currentColor; opacity: .35; border-radius: calc(var(--r) * .5); }
.card .face::after { content: ''; position: absolute; inset: calc(15% + 3px) calc(12% + 3px); border: 1px solid currentColor; opacity: .18; border-radius: calc(var(--r) * .4); }
.card .face-pip { position: absolute; width: 58%; height: 58%; fill: currentColor; opacity: .14; }
.card .face-letter { position: relative; font-family: 'Fraunces'; font-weight: 900; font-size: calc(var(--cw) * .46); line-height: 1; }
.card.wild { box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(242,140,40,.55), 0 6px 14px rgba(0,0,0,.35); background: linear-gradient(160deg, #fffaf3 0%, #ffe9d2 70%, #f9d3ad 100%); }
.card .ribbon {
  position: absolute; left: 50%; bottom: 17%; transform: translateX(-50%); white-space: nowrap;
  background: linear-gradient(180deg, #ffd3a1, #f28c28); color: var(--ink); font: 900 calc(var(--cw) * .085) 'Nunito';
  padding: 1px calc(var(--cw) * .06); border-radius: 999px; letter-spacing: .04em; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.card.joker { background: radial-gradient(circle at 50% 35%, #fff 0%, #fff1e4 60%, #ffdcbd 100%); color: var(--ink); }
.card.joker .jk { width: calc(var(--cw) * .15); height: calc(var(--cw) * .15); margin-top: 2px; }
.card.joker .rank { font-size: calc(var(--cw) * .2); }
.card .joker-art { position: absolute; left: 18%; right: 18%; top: 10%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #ffe2c4;
  border: calc(var(--cw) * .025) solid var(--accent); box-shadow: inset 0 0 0 calc(var(--cw) * .012) #fff; }
.card .joker-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; display: block; pointer-events: none; }
.card .joker-word { position: absolute; left: 0; right: 0; top: 66%; text-align: center; font-family: 'Fraunces'; font-weight: 900; font-size: calc(var(--cw) * .14); letter-spacing: .08em; color: var(--ink); }
.card.joker .ribbon { bottom: 9%; }
.card.joker .corner.br { display: none; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(246,241,230,.16) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(246,241,230,.16) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 50% 45%, #2b528f, #10243f 80%);
  border: calc(var(--cw) * .05) solid #f6f1e6; color: var(--accent);
}
.back-inner { position: absolute; inset: 5%; border: 1px solid rgba(242,140,40,.75); border-radius: calc(var(--r) * .6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%; }
.back-mark { width: 46%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.back-word { display: flex; flex-direction: column; align-items: center; font-family: 'Fraunces'; font-weight: 900; font-size: calc(var(--cw) * .105); line-height: 1.05; letter-spacing: .08em; color: #f6f1e6; }
.card.mini { border-width: 1.5px; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.card.mini .back-inner, .card.mini .joker-art { display: none; }
.card.tiny { --cw: 40px; box-shadow: 0 2px 5px rgba(0,0,0,.35); }
.card.tiny .ribbon { display: none; }
.card.tiny .joker-word { display: none; }
.card.tiny .corner.br { display: none; }

.flyer { position: fixed; z-index: 100; pointer-events: none; will-change: transform; }
.flyer > .card { width: 100%; height: 100%; }
#fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

/* ---------- modals ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(4,8,16,.7); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s both; }
.modal {
  width: min(920px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: linear-gradient(180deg, #132038, #0b1424);
  border: 1px solid var(--accent-3); border-radius: 22px; padding: 22px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
  animation: rise .3s both;
}
.modal-title { font-family: 'Fraunces'; font-weight: 900; text-align: center; margin: 0 0 6px; font-size: 1.7rem; color: var(--accent-2); }
.modal-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.results { display: grid; gap: 8px; margin-top: 14px; }
.res-row { display: grid; grid-template-columns: 180px 1fr 70px; align-items: center; gap: 12px; background: var(--panel-2); border-radius: 14px; padding: 8px 12px; animation: rise .35s both; }
.res-row:nth-child(2) { animation-delay: .05s; } .res-row:nth-child(3) { animation-delay: .1s; } .res-row:nth-child(4) { animation-delay: .15s; }
.res-row:nth-child(5) { animation-delay: .2s; } .res-row:nth-child(6) { animation-delay: .25s; } .res-row:nth-child(7) { animation-delay: .3s; }
.res-row.me { box-shadow: 0 0 0 1px var(--line); }
.res-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.res-who .seat-av { grid-row: auto; }
.res-melds { display: flex; flex-wrap: wrap; gap: 10px; }
.res-melds .meld.leftover { opacity: .9; }
.res-melds .meld.leftover .card { filter: saturate(.6); box-shadow: 0 0 0 2px var(--bad), 0 2px 5px rgba(0,0,0,.35); }
.res-pts { font-family: 'Fraunces'; font-weight: 900; font-size: 1.4rem; text-align: right; color: var(--bad); }
.res-pts.zero { color: var(--good); }
.trophy { text-align: center; font-size: 4rem; animation: bob 1.6s ease-in-out infinite; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 22px 0 6px; }
.podium .step { display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(130px, 27vw); min-width: 0; }
.podium .step .seat-name { max-width: 100%; }
.podium .seat-av { grid-row: auto; }
.podium .pts { font-family: 'Fraunces'; font-weight: 900; color: var(--accent-2); }
.podium .block { width: 100%; border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-family: 'Fraunces'; font-weight: 900; font-size: 2rem; color: var(--ink); background: linear-gradient(180deg, #ffb86b, #d9731a); }
.podium .p1 .block { height: 110px; }
.podium .p2 .block { height: 78px; background: linear-gradient(180deg, #f1f1f6, #9ea3b5); }
.podium .p3 .block { height: 56px; background: linear-gradient(180deg, #f3c19a, #a8653a); }
.podium .step { animation: rise .5s both; }
.podium .p1 { animation-delay: .35s; } .podium .p2 { animation-delay: .15s; }
.rest { max-width: 320px; margin: 8px auto 0; color: var(--muted); }
.rest b { float: right; color: var(--text); }
.table-scroll { overflow-x: auto; }
table.scores { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .92rem; }
.scores th, .scores td { padding: 6px 8px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.scores th { font-size: .8rem; color: var(--muted); font-weight: 800; }
.scores td:first-child, .scores th:first-child { text-align: left; }
.scores td.zero { color: var(--good); font-weight: 900; }
.scores tr.now td { background: rgba(242,140,40,.08); }
.scores tfoot td { font-family: 'Fraunces'; font-weight: 900; font-size: 1.1rem; border-bottom: 0; padding-top: 10px; }
.scores td.lead { color: var(--accent); }
.menu-list { display: flex; flex-direction: column; gap: 10px; max-width: 420px; margin: 14px auto; }
.toggle { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.rules { max-width: 640px; margin: 0 auto; line-height: 1.55; font-weight: 500; }
.rules h3 { font-family: 'Fraunces'; color: var(--accent-2); margin: 16px 0 4px; font-size: 1.05rem; }
.rules p { margin: 4px 0; }

/* ---------- toasts / banners ---------- */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #fff; color: #2a1060; padding: 9px 18px; border-radius: 999px; font-weight: 800; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: drop .3s both; transition: opacity .4s, transform .4s; }
.toast.error { background: #ffe0e3; color: #8a0d1d; }
.toast.hide { opacity: 0; transform: translateY(-8px); }
.banner {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 110; text-align: center; pointer-events: none;
  width: max-content; max-width: min(88vw, 540px); padding: 18px 26px 16px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(21,34,58,.97), rgba(7,13,25,.97)); border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(242,140,40,.18), 0 24px 60px rgba(0,0,0,.65);
  animation: zoom .45s cubic-bezier(.2,1.5,.4,1) both; transition: opacity .4s;
}
.banner.hide { opacity: 0; }
.banner-title { font-family: 'Fraunces'; font-weight: 900; font-size: clamp(1.5rem, 6.5vw, 3rem); line-height: 1.1; color: var(--accent); text-shadow: 0 3px 0 #7a3908; }
.banner-sub { font-weight: 800; margin-top: 8px; color: var(--text); font-size: clamp(.85rem, 3.6vw, 1.05rem); }
/* The Readout: the announcer button and the floating stop control once the results are closed. */
/* Blair's Readout: the big gold-and-royal call to action in the results modal. */
.readout-row { flex: 0 0 100%; min-width: 0; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: nowrap; }
.btn.readout {
  flex: 0 1 300px; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  position: relative; overflow: hidden; white-space: nowrap;
  padding: 11px 24px; font-family: 'Fraunces', serif; font-weight: 900; font-size: 1.1rem; letter-spacing: .03em;
  color: #fff; border: 2px solid var(--accent);
  background: #17a862;
  box-shadow: 0 4px 0 #05432c, 0 0 0 0 rgba(61,230,140,.55), 0 10px 28px rgba(23,184,102,.4);
  text-shadow: 0 2px 0 rgba(0,50,30,.6);
  animation: readoutPulse 2.6s ease-in-out infinite;
}
.btn.readout:hover:not(:disabled) { background: #1cbd6f; }
.btn.readout::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.6), transparent); transform: skewX(-20deg); mix-blend-mode: overlay;
  animation: readoutShimmer 3.8s ease-in-out infinite;
}
.btn.readout.live { opacity: 1; cursor: default; animation: readoutLive 1s ease-in-out infinite; }
.btn.readout.live:not(:disabled) { cursor: pointer; }
.btn.readout.live::after { animation-duration: 1.4s; }
.btn.readout:disabled { opacity: .92; }
@keyframes readoutPulse { 50% { box-shadow: 0 4px 0 #05432c, 0 0 0 7px rgba(61,230,140,.22), 0 10px 34px rgba(23,184,102,.65); } }
@keyframes readoutLive { 0%, 100% { transform: scale(1); box-shadow: 0 4px 0 #05432c, 0 0 0 3px rgba(242,140,40,.7), 0 0 22px rgba(61,230,140,.9); } 50% { transform: scale(1.04); box-shadow: 0 4px 0 #05432c, 0 0 0 9px rgba(242,140,40,.2), 0 0 44px rgba(23,184,102,1); } }
@keyframes readoutShimmer { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@media (max-width: 520px) { .btn.readout { padding: 11px 20px; font-size: 1.02rem; } }
@media (prefers-reduced-motion: reduce) {
  .btn.readout, .btn.readout.live { animation: none; }
  .btn.readout::after { display: none; }
  .btn.readout.live { box-shadow: 0 4px 0 #05432c, 0 0 0 4px rgba(242,140,40,.7), 0 0 22px rgba(61,230,140,.9); }
}
.btn.readout .dots, .readout-pill .dots { display: inline-block; flex: 0 0 auto; width: 1.1em; text-align: left; }
.btn.readout .dots::after, .readout-pill .dots::after { content: '🎙️'; animation: blink 1.2s infinite; }
/* The rotating "summoning Blair" message: a fixed width so the button does not jump between messages. */
.btn.readout [data-loading] { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-family: 'Nunito', sans-serif; font-weight: 800; letter-spacing: 0; }
@media (max-width: 520px) { .btn.readout [data-loading] { font-size: .95rem; } }
.readout-pill { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 14px; z-index: 250; font-weight: 800; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: drop .3s both; }
/* 👍 / 👎 and ⬇ Download beside the readout button. On a phone the group drops to its own small line so nothing is squeezed. */
.readout-side { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.readout-side:empty { display: none; }
.btn.small.dl { text-decoration: none; color: inherit; white-space: nowrap; display: inline-block; line-height: 1.2; }
@media (max-width: 520px) { .readout-row { flex-wrap: wrap; row-gap: 8px; } .readout-side { flex: 0 0 100%; justify-content: center; } }
/* 👍 / 👎 for the readout that just played. */
.rate { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.rate.thanks { color: var(--accent-2); font-size: .9rem; }
.btn.small.vote { padding: 6px 10px; font-size: 1.05rem; line-height: 1; }

.conn-banner { position: fixed; bottom: 0; left: 0; right: 0; background: #9c4a0a; color: #fff; text-align: center; padding: 6px; z-index: 300; font-weight: 800; }
.conn-banner.bad { background: #8a0d1d; }
.conn-banner .link { color: #fff; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 150; }

/* ---------- keyframes ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
@keyframes zoom { from { opacity: 0; transform: translate(-50%, -50%) scale(.5); } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes glow { 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 26px rgba(242,140,40,.8); } }
@keyframes deal { from { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -38vh)) scale(.45) rotate(-20deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- scorebook ---------- */
body.sb-touch .sb-keys { display: grid; }
body.sb-touch .sb-keys-help { display: none; }
.panel.scorebook { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; }
.sb { max-width: 1100px; margin: 0 auto; padding: 24px 16px 30px; }
.sb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-family: 'Fraunces'; font-weight: 900; font-size: 1.7rem; color: var(--accent-2); }
.sb-head .link { flex: 0 0 auto; padding: 0 4px; min-height: 44px; font-family: 'Nunito', sans-serif; font-size: 1.05rem; font-weight: 800; }
.sb-title { flex: 1; text-align: center; }
.sb-head-gap, .sb-menu-btn { flex: 0 0 44px; width: 44px; }
.sb-menu-btn { min-height: 44px; padding: 0; font-size: 1.3rem; line-height: 1; }
.sb-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.sb-grid > * { min-width: 0; }
.sb-pad { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
.sb .sb-card { padding: 14px; }
.sb-card .scores { margin-top: 0; }
.sb-round { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; color: var(--muted); font-size: .95rem; }
.sb-round b { font-family: 'Fraunces'; color: var(--accent-2); font-size: 1.1rem; }
.sb-track { flex-wrap: wrap; }
.sb-who { font-family: 'Fraunces'; font-size: 1.2rem; font-weight: 900; color: var(--accent-2); overflow-wrap: anywhere; }
.sb-display { width: 100%; font-size: 1.8rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; padding: 12px; min-height: 64px; }
.sb-display.warn { border-color: var(--bad); color: var(--bad); }
.sb-display.bad { border-color: var(--danger); animation: shake .3s; }
.sb-sub { color: var(--muted); font-size: .9rem; min-height: 1.3em; text-align: center; }
.sb-sub .err { color: #ffc2c8; }
.sb-sub .big-hand { color: var(--bad); font-weight: 800; }
.sb-keys { display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; touch-action: manipulation; }
.sb-keys button { min-height: 56px; font-size: 1.3rem; font-weight: 800; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: var(--text); -webkit-tap-highlight-color: transparent; user-select: none; }
.sb-keys button:active { background: rgba(255,255,255,.2); transform: translateY(1px); }
.sb-keys .next { background: var(--accent); border-color: var(--accent-2); color: var(--ink); }
.sb-keys .next:active { background: var(--accent-2); }
.sb-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sb-acts .btn { flex: 1 1 auto; min-height: 44px; padding-left: 10px; padding-right: 10px; touch-action: manipulation; }
.btn.sb-out { border-color: var(--good); color: var(--good); }
.sb-strip { background: rgba(143,216,255,.1); border: 1px solid rgba(143,216,255,.35); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: .95rem; }
.sb-strip-actions { justify-content: center; }
.sb-strip-actions .readout-row { flex: 0 0 auto; }
.sb-strip-actions .btn { min-height: 44px; }
.sb-ask { background: rgba(255,176,112,.12); border: 1px solid var(--bad); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; animation: rise .25s both; }
.sb-ask-h { font-weight: 800; }
.sb-ask .btn { min-height: 44px; }
.scores td.now { outline: 2px solid var(--accent); outline-offset: -2px; background: rgba(242,140,40,.14); }
.scores td.out::after { content: ' 🏁'; font-size: .75em; }
.scores td.warn { color: var(--bad); }
.scores td.cell { cursor: pointer; }
.scores td.cell:hover { background: rgba(255,255,255,.07); }
.sb-typing { color: var(--accent-2); }
.scores th .sb-av { position: relative; display: inline-block; font-size: 1.3rem; line-height: 1.2; }
.scores th .sb-av .dealer { bottom: -2px; right: -8px; width: 15px; height: 15px; font-size: .55rem; border-width: 1.5px; }
.scores th .sb-nm { display: block; max-width: 7em; margin: 0 auto; overflow: hidden; text-overflow: ellipsis; }
.scores tfoot tr.place td, .scores tfoot tr.behind td { font-family: 'Nunito', sans-serif; font-size: .85rem; color: var(--muted); padding-top: 2px; }
.scores tfoot tr.place td { padding-top: 4px; }

/* setup */
.sb-setup h2 { flex-wrap: wrap; row-gap: 2px; }
.sb-setup { max-width: 640px; margin: 0 auto; }
.sb-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sb-setup-row { display: grid; grid-template-columns: 24px 32px minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.sb-setup-row .sb-n { color: var(--muted); font-weight: 800; text-align: center; }
.sb-setup-row .sb-av { font-size: 1.4rem; text-align: center; }
.sb-name, .sb-edit input { width: 100%; min-width: 0; font-size: max(16px, 1rem); min-height: 44px; font-weight: 700; }
.sb-ctl { display: flex; gap: 4px; }
.sb-ic { min-width: 44px; min-height: 44px; padding: 0; border-radius: 10px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: var(--text); font-weight: 900; font-size: 1.05rem; touch-action: manipulation; }
.sb-ic.on { background: rgba(242,140,40,.2); border-color: var(--accent); color: var(--accent-2); }
.sb-ic:disabled { opacity: .35; cursor: not-allowed; }
.sb-recent { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; }
.sb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-chips .chip { min-height: 36px; padding: 4px 14px; color: var(--text); }
.sb-legend { margin: 12px 0; }
.sb-start { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 8px; }
.sb-err { color: #ffc2c8; font-size: .9rem; text-align: center; min-height: 1.3em; }

/* menu sheet + over */
.sb-edits { display: flex; flex-direction: column; gap: 8px; }
.sb-edit { display: grid; grid-template-columns: 32px minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.sb-edit .sb-av { font-size: 1.4rem; text-align: center; }
.sb .modal .scores { margin-top: 6px; }
.sb-over { max-width: 760px; margin: 0 auto; }
.sb-over .table-scroll { margin-top: 18px; }
.sb-over-actions .btn { min-height: 44px; }
.sb-over-actions .readout-row { flex: 0 0 100%; }
.sb-keys-help { margin: 4px 0 0; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (hover: none) and (pointer: coarse) { .sb-keys { display: grid; } .sb-keys-help { display: none; } }
@media (max-width: 760px) {
  .sb-grid { grid-template-columns: minmax(0, 1fr); }
  .sb-pad { position: static; }
  .sb { padding: 14px 10px 24px; }
  .sb-head { font-size: 1.35rem; margin-bottom: 10px; }
  .sb .sb-card { padding: 10px 8px; }
  .sb .sb-pad { padding: 14px 12px; }
  .sb .sb-over, .sb .sb-setup { padding: 16px 12px; }
}
@media (max-width: 560px) {
  .sb-setup-row { grid-template-columns: 22px 30px minmax(0, 1fr); row-gap: 4px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
  .sb-setup-row .sb-ctl { grid-column: 1 / -1; justify-content: flex-end; }
  .sb-ctl { gap: 6px; }
}
@media (max-width: 420px) {
  .scores tfoot tr.behind { display: none; }
  .scores th .sb-nm { max-width: 4.6em; font-size: .75rem; }
  .scores th, .scores td { padding: 4px 3px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .sb-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .sb-keys button { min-height: 44px; }
  .sb-display { min-height: 48px; padding: 6px; font-size: 1.5rem; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .log { display: none; }
  .round-track { display: none; }
}
@media (max-width: 760px) {
  html { font-size: clamp(14px, 3.85vw, 17.5px); }
  .home { padding-top: 22px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .logo-main { font-size: 2.8rem; }
  .logo-mark { width: 88px; }
  .tagline { font-size: .92rem; }
  .opp-preview { display: none; }
  .bot-add > .muted { flex-basis: 100%; }
  .big-code { font-size: 2.3rem; }
  .lobby { padding: 16px 12px; }
  .panel { padding: 18px 16px; }

  .topbar { padding: 6px 8px; gap: 6px; }
  .logo-sm .logo-word { display: none; }
  .pills { gap: 6px; justify-content: flex-start; flex-wrap: nowrap; min-width: 0; overflow: hidden; }
  .pill { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .pill { padding: 3px 10px; font-size: .8rem; }
  .wild-pill .muted:last-child { display: none; }
  .top-actions { gap: 4px; }
  .top-actions .icon-btn { width: 34px; height: 34px; font-size: .9rem; }
  .top-actions [data-act="rules"] { display: none; }


  /* Opponents: compact two-line tiles in a grid, never a card fan.
     Text is in rem and the root size scales with the screen, so big phones get bigger type. */
  .seats { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: .4rem; padding: .5rem .5rem 0; max-width: 620px; margin: 0 auto; width: 100%; }
  .seats-1 { max-width: 15rem; }
  .seats-2 { max-width: 26rem; }
  .seat { min-width: 0; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto; column-gap: .5rem; padding: .4rem .55rem .4rem .4rem; border-radius: .8rem; }
  .seat.active { transform: none; background: linear-gradient(180deg, rgba(242,140,40,.28), rgba(242,140,40,.1)); }
  .seat-av { width: 2.3rem; height: 2.3rem; font-size: 1.3rem; border-width: 1.5px; grid-row: auto; }
  .seat-info { min-width: 0; }
  .seat-name { font-size: .9rem; max-width: 100%; line-height: 1.2; }
  .seat-meta { font-size: .76rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
  .seat-meta .cnt { display: inline; }
  .seat-fan { display: none; }
  .dealer { width: 1.05rem; height: 1.05rem; font-size: .6rem; bottom: -3px; right: -5px; }
  .out-flag { top: -.8rem; font-size: 1rem; }
  .thinking { bottom: -.55rem; font-size: .6rem; padding: 0 .5rem; }
  .bubble { width: 2.5rem; height: 2.5rem; font-size: 1.5rem; top: -.9rem; right: -.3rem; }

  .table { padding: 10px 8px 8px; }
  .felt { border-radius: 48px; border-width: 4px; padding: 10px 12px; gap: 6px; box-shadow: 0 0 0 2px var(--accent-3), inset 0 0 40px rgba(0,0,0,.5), 0 14px 30px rgba(0,0,0,.4); }
  .felt::before { border-radius: 42px; inset: 6px; }
  .piles { gap: 22px; }
  .pile-wrap { gap: 3px; }
  .pile-label { font-size: .68rem; }
  .felt-info { width: 100%; }
  .status { font-size: .88rem; padding: .25rem .8rem; line-height: 1.3; max-width: calc(100% - 16px); text-wrap: balance; }
  /* Always two lines tall, so a longer message (like a hint) never nudges the deck */
  .felt .status { min-height: calc(2.6em + .5rem); display: flex; align-items: center; justify-content: center; }
  .felt .status > * { display: contents; }
  .felt.side .status { text-wrap: pretty; }
  .out-melds { gap: 2px; }
  .out-title { font-size: .7rem; }
  .melds { gap: 6px; }
  .out-melds .melds { display: none; }
  .out-title { background: rgba(0,0,0,.3); border: 1px solid rgba(242,140,40,.4); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: .74rem; min-height: 28px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .out-title .see { display: inline; color: var(--muted); }
  .out-title .wo { display: none; }
  .out-title .nm { display: inline-block; max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
  .seat-meta .diff { display: none; }
  .modal-actions { position: sticky; bottom: -18px; z-index: 2; margin: 14px -14px -18px; padding: 16px 14px 16px; background: linear-gradient(180deg, rgba(27,11,64,0) 0, #0b1424 14px); }

  .me-area { padding: 6px 8px 8px; }
  .me-bar { flex-wrap: nowrap; gap: 6px; }
  .me-id { padding: 2px 10px 2px 2px; gap: 7px; min-width: 0; flex: 0 1 auto; }
  .me-id .seat-av.sm { width: 2.2rem; height: 2.2rem; font-size: 1.2rem; }
  .me-id .seat-name { font-size: .9rem; max-width: 6.5rem; }
  .me-id .seat-meta { font-size: .74rem; }
  .meter { font-size: .84rem; padding: .3rem .7rem; white-space: nowrap; margin-left: auto; }
  .meter-spacer { margin-left: auto; }
  .meter .long { display: none; }
  .meter .short { display: inline; }
  .sorts { display: none; }
  .sort-cycle { display: inline-block; white-space: nowrap; padding: .35rem .7rem; flex: none; font-size: .88rem; min-height: 34px; }
  .emote-toggle { display: grid; width: 2.2rem; height: 2.2rem; flex: none; font-size: 1.1rem; }
  .emotes { display: none; }
  .emote-pop { display: flex; position: absolute; right: 8px; bottom: calc(100% + 6px); z-index: 20; background: #132038; border: 1px solid var(--accent-3); border-radius: 999px; padding: 4px; gap: 2px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: pop .2s both; }
  .emote-pop button { background: none; border: 0; font-size: 1.3rem; width: 38px; height: 38px; border-radius: 50%; }
  .hand { padding: 22px 6px 4px; }
  .hand .card:hover { transform: none; }
  .hand .card.selected { transform: translateY(-18px); }
  .hand-actions { min-height: 38px; gap: 8px; }
  .hand-actions .btn { padding: 8px 18px; }
  .hint-line { font-size: .8rem; text-align: center; }
  .hand-actions:has(.btn) .hint-line { display: none; }

  .modal { padding: 18px 14px; border-radius: 18px; }
  .modal-title { font-size: 1.35rem; }
  .res-row { grid-template-columns: minmax(0, 1fr) 56px; padding: 8px 10px; }
  .res-melds { grid-column: 1 / -1; grid-row: 2; gap: 8px; }
  .res-who .seat-name { max-width: 160px; }
  .card.tiny { --cw: 30px; }
  .meld .card.tiny + .card.tiny { margin-left: -11px; }
  .modal-actions { gap: 8px; }
  .modal-actions .btn.big { padding: 11px 18px; font-size: 1rem; }
  .trophy { font-size: 3rem; }
  .podium { gap: 8px; }
  .podium .p1 .block { height: 90px; }
  .podium .p2 .block { height: 64px; }
  .podium .p3 .block { height: 46px; }
  .scores { font-size: .8rem; }
  .scores th, .scores td { padding: 5px 5px; }
}

/* Tall phones have room for two columns of opponents, so names fit */
@media (max-width: 760px) and (min-height: 700px) {
  .seats { grid-template-columns: repeat(var(--cols-tall, 2), minmax(0, 1fr)); max-width: 34rem; }
  .seats-1 { max-width: 17rem; }
  .seat { padding: .45rem .7rem .45rem .45rem; }
}

/* Phones held sideways: table on the left, your hand on the right */
@media (max-height: 500px) and (orientation: landscape) {
  .game {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "top top" "seats me" "table me";
  }
  .topbar { grid-area: top; padding: 4px 10px; }
  .topbar .icon-btn { width: 30px; height: 30px; }
  .seats { grid-area: seats; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 5px; padding: 6px 6px 0; }
  .seat { min-width: 0; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; padding: 4px 6px 4px 4px; border-radius: 10px; }
  .seat.active { transform: none; }
  .seat-av { width: 28px; height: 28px; font-size: 1rem; }
  .seat-info { min-width: 0; }
  .seat-name { font-size: .75rem; max-width: 100%; }
  .seat-meta { font-size: .64rem; overflow: hidden; text-overflow: ellipsis; }
  .seat-fan { display: none; }
  .seat-meta .cnt { display: inline; }
  .seat-meta .diff { display: none; }
  .seat.active { background: linear-gradient(180deg, rgba(242,140,40,.28), rgba(242,140,40,.1)); }
  .thinking { display: none; }
  .table { grid-area: table; padding: 6px; }
  .felt { border-radius: 36px; padding: 8px; gap: 4px; border-width: 3px; }
  .felt::before { border-radius: 30px; inset: 5px; }
  .log { display: none; }
  .status { font-size: .74rem; }
  .out-melds .melds { display: none; }
  .out-title { background: rgba(0,0,0,.3); border: 1px solid rgba(242,140,40,.4); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: .7rem; min-height: 32px; }
  .out-title .see { display: inline; color: var(--muted); }
  .out-title .wo { display: none; }
  .out-title .nm { display: inline-block; max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
  .seat-meta .diff { display: none; }
  .modal-actions { position: sticky; bottom: -18px; z-index: 2; margin: 14px -14px -18px; padding: 16px 14px 16px; background: linear-gradient(180deg, rgba(27,11,64,0) 0, #0b1424 14px); }
  .me-area { grid-area: me; display: flex; flex-direction: column; justify-content: center; border-top: 0; border-left: 1px solid rgba(242,140,40,.15); background: rgba(10,4,28,.35); padding: 6px 8px; }
  .me-bar { flex-wrap: nowrap; gap: 6px; min-width: 0; }
  .me-id { min-width: 0; flex: 0 1 auto; padding-right: 8px; }
  .me-id .seat-name { max-width: 5.5rem; }
  .meter { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; font-size: .78rem; padding: 4px 10px; }
  .sorts { display: none; }
  .sort-cycle { display: inline-block; white-space: nowrap; flex: none; min-height: 32px; }
  .emote-toggle { width: 32px; height: 32px; flex: none; }
  .meter .long { display: none; }
  .meter .short { display: inline; }
  .emotes { display: none; }
  .emote-toggle { display: grid; }
  .emote-pop { display: flex; position: absolute; right: 8px; top: 44px; z-index: 20; background: #132038; border: 1px solid var(--accent-3); border-radius: 999px; padding: 4px; }
  .emote-pop button { background: none; border: 0; font-size: 1.2rem; width: 34px; height: 34px; }
  .hand { padding: 20px 4px 2px; }
  .hint-line { display: none; }
  .hand-actions { min-height: 34px; }
  .round-track { display: none; }
}

@media (max-width: 420px) {
  .round-pill .muted:first-child { display: none; }
  .round-pill::before { content: 'Rd '; color: var(--muted); }
  .pill { padding: 3px 8px; font-size: .76rem; }
  .pill b { font-size: .92rem; }
  .topbar .logo-mark { width: 28px; }
}

/* Narrow phones held sideways: tighten your info bar so the reaction button fits */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 720px) {
  .me-id .seat-name { max-width: 3.6rem; }
  .me-id { padding-right: 6px; gap: 5px; }
  .meter { font-size: .72rem; padding: 3px 8px; }
  .sort-cycle { padding: 4px 8px; font-size: .8rem; }
}
