/* Layout: a pinned header over a flat felt table (left) and a plain-text coach column (right); one column on phones.
   Palette: stone paper, ink, one saperavi accent, gold reserved for trumps. */
:root {
  --bg: #eeede9;
  --surface: #fbfbf9;
  --ink: #18181b;
  --muted: #64636a;
  --line: #d9d8d2;
  --accent: #7a1d3a;
  --accent-ink: #ffffff;
  --felt: #2f1621;
  --felt-line: #4a2a39;
  --felt-ink: #f1e8ec;
  --felt-muted: #b9a3ad;
  --gold: #a77816;
  --card: #fbf9f4;
  --card-ink: #1a1a1d;
  --card-red: #b4232f;
  --back: #5b1830;
  --good: #23704a;
  --warn: #94580a;
  --bad: #a3263a;
  --bar: #dedcd5;
  --sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --ka: 'Noto Serif Georgian', 'Sylfaen', serif;
  --head-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --surface: #1a1a1d; --ink: #ececee; --muted: #9b9aa2; --line: #2d2d33;
    --accent: #e27c9c; --accent-ink: #1a0d13;
    --felt: #24111a; --felt-line: #3d2230; --felt-ink: #f1e8ec; --felt-muted: #a9939d;
    --gold: #d8a447; --card: #f4f1ea; --back: #6c1f3a;
    --good: #5bbf88; --warn: #e0a24e; --bad: #ee6a7c; --bar: #2c2c32;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121214; --surface: #1a1a1d; --ink: #ececee; --muted: #9b9aa2; --line: #2d2d33;
  --accent: #e27c9c; --accent-ink: #1a0d13;
  --felt: #24111a; --felt-line: #3d2230; --felt-ink: #f1e8ec; --felt-muted: #a9939d;
  --gold: #d8a447; --card: #f4f1ea; --back: #6c1f3a;
  --good: #5bbf88; --warn: #e0a24e; --bad: #ee6a7c; --bar: #2c2c32;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; line-height: 1.25; text-wrap: balance; letter-spacing: -0.01em; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Header (pinned) ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.top-in { max-width: 1200px; margin: 0 auto; padding-inline: 16px; height: var(--head-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; flex-shrink: 0; }
.mark { font-family: var(--ka); font-size: 1.55rem; color: var(--accent); line-height: 1; }
.brand-sub { font-size: .85rem; color: var(--muted); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 16px 12px 14px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 560px) {
  .brand-sub { display: none; }
  .tabs button { padding-inline: 7px; }
  .tab-long { display: none; }
  .top-in { gap: 8px; }
}

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 40px; }
.page-head { margin-bottom: 20px; max-width: 68ch; }
.page-head h1, .prose h1 { font-size: 1.6rem; margin: 4px 0 6px; }
.page-head p { margin: 0; color: var(--muted); }

/* ---------- Controls ---------- */
select, .btn {
  height: 38px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 12px; cursor: pointer;
}
select { padding-right: 28px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.btn { font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-quiet { background: transparent; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .88rem; color: var(--muted); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.field { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); }
.field select { color: var(--ink); font-size: .95rem; }

.bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.bar select:first-child { flex: 1 1 200px; max-width: 280px; }
.table-head { flex-wrap: wrap; }
.bar-check { padding-inline: 4px; }
.bar-check span { font-family: var(--ka); color: var(--ink); }
@media (max-width: 560px) {
  .bar select:first-child { max-width: none; flex-basis: 100%; }
  .bar select, .bar .btn { flex: 1; }
}

/* ---------- Play ---------- */
.play-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.play-grid > * { min-width: 0; }
@media (max-width: 920px) { .play-grid { grid-template-columns: minmax(0, 1fr); } }

.table {
  position: relative; background: var(--felt); color: var(--felt-ink); border-radius: 10px;
  padding: 14px 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  box-shadow: inset 0 0 0 1px var(--felt-line);
}
.table-head { display: flex; justify-content: space-between; gap: 12px; font-size: .85rem; color: var(--felt-muted); }
.trump-label { color: var(--gold); font-weight: 600; }
.stake { font-family: var(--mono); color: var(--felt-ink); }
.stake b { font-family: var(--ka); font-weight: 700; color: var(--gold); margin-left: 4px; }
.raise-box { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 12px; border-radius: 8px; background: rgba(0,0,0,.22); box-shadow: inset 0 0 0 1px var(--gold); }
.raise-box p { margin: 0; }
.raise-call { font-size: 1.05rem; font-weight: 600; }
.raise-call .ka { font-family: var(--ka); color: var(--gold); font-size: 1.2rem; }
.raise-help { font-size: .88rem; color: var(--felt-muted); max-width: 46ch; }
#btn-raise .ka { font-family: var(--ka); margin-left: 2px; }
.match-line { font-weight: 600; }
.seat { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.seat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .85rem; }
.seat-head > span:first-child { font-weight: 600; }
.pile { font-family: var(--mono); font-size: .8rem; color: var(--felt-muted); text-align: right; }
.hand { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 96px; align-items: center; }
.middle { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.prompt { margin: 0; text-align: center; min-height: 1.5em; font-size: .92rem; color: var(--felt-muted); }
.btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btns .btn { min-width: 120px; }
.btn-bura { box-shadow: 0 0 0 2px var(--gold); }
.table .btn-quiet { color: var(--felt-ink); border-color: var(--felt-line); }
.table .btn-quiet:hover { border-color: var(--felt-muted); }

.stock { display: grid; justify-items: center; gap: 4px; font-size: .78rem; color: var(--felt-muted); }
.stock-stack { position: relative; width: 98px; height: 92px; }
.stock-stack .card { position: absolute; top: 0; }
.stock-stack .card.back { left: 0; }
.stock-stack .trump-card { left: 36px; top: 6px; }

.trick { display: grid; gap: 6px; justify-items: center; align-content: center; min-height: 150px; border-radius: 8px; padding: 10px; background: rgba(0,0,0,.14); }
.trick-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; }
.trick-cap { font-size: .82rem; color: var(--felt-muted); text-align: center; }
.trick-who { font-size: .75rem; color: var(--felt-muted); min-width: 5.5em; text-align: right; }
.trick.stale .card { opacity: .85; }

/* ---------- Cards ---------- */
.card {
  --w: 62px; width: var(--w); height: calc(var(--w) * 1.42); border-radius: 6px;
  background: var(--deck-face, var(--card)); color: var(--deck-ink, var(--card-ink)); position: relative; flex: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.25);
  user-select: none; -webkit-user-select: none; font-family: var(--sans);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card .idx { position: absolute; display: grid; justify-items: center; line-height: 1; font-weight: 600; font-size: calc(var(--w) * .24); }
.card .idx i { font-style: normal; font-size: .85em; margin-top: 1px; }
.card .idx.tl { top: 5px; left: 5px; }
.card .idx.br { bottom: 5px; right: 5px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--w) * .46); line-height: 1; }
.card.red { color: var(--deck-red, var(--card-red)); }
/* Decks with a frame inside the card edge. */
.card:not(.back)::before { content: ''; position: absolute; inset: 3px; border-radius: 4px; border: var(--deck-frame, 0 solid transparent); pointer-events: none; }
.card.trump { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0,0,0,.25); }
.card.back {
  background-color: var(--deck-back, var(--back));
  background-image: var(--deck-pattern, repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 1px, transparent 1px 7px),
                    repeating-linear-gradient(-45deg, rgba(255,255,255,.12) 0 1px, transparent 1px 7px));
  background-size: var(--deck-pattern-size, auto);
  border: 4px solid var(--deck-edge, var(--card));
}
.card.small { --w: 44px; }
.card.small .idx.br { display: none; }
.card.small .pip { font-size: calc(var(--w) * .5); padding-top: 8px; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { transform: translateY(-3px); }
.card.selected { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--accent-ink), 0 0 0 5px var(--accent), 0 8px 14px rgba(0,0,0,.35); }
.card.dim { opacity: .35; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
@media (max-width: 560px) {
  .card { --w: 54px; }
  .card.small { --w: 40px; }
  .table { padding: 12px; gap: 12px; }
  .hand { min-height: 84px; }
  .stock-stack { width: 86px; height: 80px; }
  .stock-stack .trump-card { left: 30px; }
  .trick { min-height: 120px; }
  .middle { gap: 10px; }
}

/* ---------- Result ---------- */
.result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 5, 10, .55); border-radius: 10px; padding: 12px; }
.result-card { background: var(--surface); color: var(--ink); border-radius: 8px; padding: 20px; max-width: 460px; width: 100%; max-height: calc(100% - 8px); overflow-y: auto; display: grid; gap: 12px; justify-items: start; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.result-card h2 { margin: 0; font-size: 1.3rem; }
.result-card p { margin: 0; }
.reveal { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--muted); }
.review { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; width: 100%; }
.review h3 { margin: 0; font-size: 1rem; }
.review p { margin: 0; }
.review ul { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: .9rem; }

/* ---------- Online ---------- */
.text { height: 38px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); padding: 0 10px; color: var(--ink); min-width: 0; }
.text::placeholder { color: var(--muted); }
.online { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.online-lobby, .online-room { display: grid; gap: 12px; }
.online-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.online-top h2 { margin: 0; font-size: 1.1rem; }
.online .field { max-width: 320px; }
.online .field .text { font-size: .95rem; }
.online-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.online-opt { display: grid; gap: 8px; align-content: start; justify-items: start; border-top: 1px solid var(--line); padding-top: 12px; margin: 0; }
.online-opt h3 { margin: 0; font-size: 1rem; }
.online-opt .small-note { margin: 0; }
.join-row, .invite-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; width: 100%; }
#net-code { width: 9em; text-transform: uppercase; letter-spacing: .12em; }
#net-link { flex: 1 1 220px; font-size: .85rem; color: var(--muted); }
.code-big { font-size: 1.5rem; font-weight: 500; letter-spacing: .14em; color: var(--accent); }
.net-err { margin: 0; color: var(--bad); font-size: .9rem; }
.net-err:empty { display: none; }
.net-status { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.net-invite { display: grid; gap: 8px; }
.net-invite p { margin: 0; color: var(--muted); font-size: .92rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--good); }
.dot.off { background: var(--warn); }
.net-wait { background: var(--felt); }
.net-wait .result-card { justify-items: center; text-align: center; max-width: 340px; }

.seat { position: relative; }
.floats { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 3; display: grid; justify-items: center; gap: 6px; }
.floats-opp { top: 28px; }
.floats-me { bottom: 100%; height: 0; }
.float-chat {
  max-width: min(80%, 34ch); background: var(--card); color: var(--card-ink); border-radius: 12px 12px 12px 3px;
  padding: 7px 12px; font-size: .9rem; line-height: 1.35; box-shadow: 0 6px 18px rgba(0,0,0,.35);
  overflow-wrap: anywhere; animation: chat-pop 6s ease forwards;
}
.float-react { position: absolute; top: 0; font-size: 2.2rem; line-height: 1; animation: react-rise 2.4s ease-out forwards; }
.floats-opp .float-react { top: 10px; animation-name: react-drop; }
@keyframes chat-pop { 0% { opacity: 0; transform: translateY(-6px); } 6%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes react-rise { 0% { opacity: 0; transform: translateY(0) scale(.6); } 12% { opacity: 1; transform: translateY(-14px) scale(1.15); } 100% { opacity: 0; transform: translateY(-90px) scale(1); } }
@keyframes react-drop { 0% { opacity: 0; transform: translateY(0) scale(.6); } 12% { opacity: 1; transform: translateY(8px) scale(1.15); } 100% { opacity: 0; transform: translateY(70px) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .float-react, .floats-opp .float-react { animation: chat-pop 2.4s linear forwards; }
}
.react-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; padding-top: 4px; border-top: 1px solid var(--felt-line); }
.react { width: 40px; height: 38px; border: 0; border-radius: 8px; background: transparent; font-size: 1.35rem; line-height: 1; cursor: pointer; transition: transform .1s ease, background .1s ease; }
.react:hover { background: rgba(255,255,255,.08); transform: translateY(-2px); }
.react:active { transform: scale(.9); }
@media (max-width: 560px) { .react-bar { gap: 2px; } .react { width: 36px; height: 34px; font-size: 1.2rem; } }

.chat { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.chat-head { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.chat-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; max-height: 220px; min-height: 60px; overflow-y: auto; font-size: .9rem; overflow-wrap: anywhere; }
.chat-log b { font-weight: 600; }
.chat-mine b { color: var(--accent); }
.chat-sys { color: var(--muted); font-size: .8rem; font-style: italic; }
.chat-form { display: flex; gap: 6px; }
.chat-form .text { flex: 1; }

/* ---------- Coach ---------- */
.coach { display: grid; gap: 14px; align-content: start; }
.coach-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.coach-head h2 { margin: 0; font-size: 1.1rem; margin-right: auto; }
.advice { margin: 0; font-size: 1.02rem; font-weight: 500; }
.advice:empty { display: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 16px; margin: 0; }
.stats div { display: grid; }
.stats dt { font-size: .78rem; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--mono); font-size: 1rem; }
.stats dd.good { color: var(--good); }
.notes { display: grid; gap: 8px; font-size: .92rem; }
.notes p { margin: 0; }
.notes .warn b { color: var(--warn); }
.notes .win { color: var(--good); font-weight: 600; }
.off { margin: 0; color: var(--muted); }

.odds { width: 100%; border-collapse: collapse; font-size: .9rem; }
.odds th { text-align: left; font-weight: 500; color: var(--muted); font-size: .78rem; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.odds td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.odds th.num, .odds td.num { text-align: right; padding-right: 0; }
.odds tr.pick { cursor: pointer; }
.odds tr.pick:hover td { background: color-mix(in srgb, var(--line) 35%, transparent); }
.odds tr.on td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.odds .cards { font-weight: 600; white-space: nowrap; }
.odds .red, .red { color: var(--card-red); }
.odds .sugg { display: block; font-weight: 400; font-size: .75rem; color: var(--accent); }
.odds .group td { font-size: .78rem; color: var(--muted); padding-top: 14px; border-bottom: 0; }
.odds .words { color: var(--muted); font-size: .85rem; }
.meter { display: flex; align-items: center; gap: 8px; min-width: 104px; }
.meter .track { flex: 1; height: 6px; background: var(--bar); border-radius: 3px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--ink); opacity: .75; }
.meter span { font-family: var(--mono); font-size: .85rem; width: 3.3em; text-align: right; }
.scroll { overflow-x: auto; }
.small-note { color: var(--muted); font-size: .8rem; margin: 6px 0 0; }

.fold { border-top: 1px solid var(--line); padding-top: 10px; }
.fold summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.fold ol { padding-left: 1.3em; margin: 8px 0 0; display: grid; gap: 3px; font-size: .86rem; }

/* Card tracker / compact card lists */
#tracker { display: grid; gap: 4px; margin-top: 10px; }
.mini-row { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.mini-suit { width: 1.4em; text-align: center; }
.mini-suit.is-trump { color: var(--gold); }
.mini-suit.red:not(.is-trump) { color: var(--card-red); }
.mini { min-width: 2em; text-align: center; font-family: var(--mono); font-size: .78rem; padding: 2px 3px; border-radius: 4px; }
.mini.out { background: var(--ink); color: var(--bg); }
.mini.mine { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); font-weight: 500; }
.mini.theirs { background: var(--gold); color: #1a1a1d; }
.mini.gone { color: var(--muted); opacity: .45; }
.mini.upcard { box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); }

/* ---------- Odds Lab ---------- */
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.lab-grid > * { min-width: 0; }
@media (max-width: 920px) { .lab-grid { grid-template-columns: minmax(0, 1fr); } }
.lab-setup { display: grid; gap: 24px; }
.step { display: grid; gap: 12px; }
.step h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ink); font-family: var(--mono); font-size: .8rem; font-weight: 500; }
.step-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.step-help { margin: 0; color: var(--muted); font-size: .9rem; max-width: 60ch; }
.step-help b { color: var(--ink); font-weight: 600; }
.suit-pick { display: flex; gap: 6px; }
.suit-pick button { width: 48px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; cursor: pointer; }
.suit-pick button.red { color: var(--card-red); }
.suit-pick button[aria-checked="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1.5px var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.lab-deck { background: var(--felt); border-radius: 10px; padding: 12px; display: grid; gap: 8px; box-shadow: inset 0 0 0 1px var(--felt-line); }
.lab-suit { display: flex; flex-wrap: wrap; gap: 6px; }
.card.inhand { box-shadow: 0 0 0 3px var(--accent-ink), 0 0 0 5px var(--accent); }
.card.inhand::after { content: 'yours'; position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.card.gone { opacity: .28; }
.card.gone::after { content: 'played'; position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--card-ink); }
.lab-out { display: grid; gap: 16px; align-content: start; }
.lab-out h3 { margin: 8px 0 0; font-size: 1rem; }
.answer { font-size: 1.05rem; display: grid; gap: 6px; }
.answer p { margin: 0; }
.answer .big { font-size: 1.25rem; font-weight: 600; }
.detail { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 14px 16px; display: grid; gap: 10px; font-size: .93rem; }
.detail h3 { margin: 0; font-size: 1rem; }
.detail p { margin: 0; }
.detail ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.dist { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; font-size: .88rem; }
.dist .track { height: 10px; background: var(--bar); border-radius: 3px; overflow: hidden; }
.dist .fill { height: 100%; background: var(--gold); }
.dist .num { font-size: .85rem; }

/* ---------- Quiz ---------- */
.quiz-score { color: var(--muted); margin: -8px 0 14px; font-family: var(--mono); font-size: .85rem; }
.quiz-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.quiz-grid > * { min-width: 0; }
@media (max-width: 920px) { .quiz-grid { grid-template-columns: minmax(0, 1fr); } }
.quiz-table { background: var(--felt); color: var(--felt-ink); border-radius: 10px; padding: 14px; display: grid; gap: 14px; box-shadow: inset 0 0 0 1px var(--felt-line); }
.quiz-meta { margin: 0; font-size: .85rem; color: var(--felt-muted); }
.quiz-meta b { color: var(--gold); }
.quiz-seen { display: grid; gap: 4px; }
.quiz-seen .small-note { color: var(--felt-muted); margin: 0 0 2px; }
.quiz-seen .mini { background: var(--card); color: var(--card-ink); font-weight: 500; }
.quiz-seen .mini.red { color: var(--card-red); }
.quiz-seen .mini-suit.red:not(.is-trump) { color: #f0a0aa; }
.quiz-seen .none { font-size: .8rem; color: var(--felt-muted); }
.quiz-q { display: grid; gap: 14px; }
.quiz-prompt { margin: 0; font-size: 1.1rem; font-weight: 500; text-wrap: balance; }
.quiz-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.quiz-opt { padding: 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; text-align: left; }
.quiz-opt:hover:not(:disabled) { border-color: var(--ink); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { border-color: var(--good); box-shadow: inset 0 0 0 1.5px var(--good); }
.quiz-opt.wrong { border-color: var(--bad); box-shadow: inset 0 0 0 1.5px var(--bad); }
.quiz-opt.dim { opacity: .5; }
.quiz-pct { display: block; font-weight: 400; color: var(--muted); font-family: var(--mono); font-size: .82rem; }
.quiz-feedback { display: grid; gap: 10px; }
.quiz-feedback p { margin: 0; }
.fb-right { color: var(--good); font-weight: 600; }
.fb-wrong { color: var(--bad); font-weight: 600; }
.quiz-why ul { margin: 4px 0; padding-left: 1.1em; font-size: .92rem; }
.quiz-why .small-note { margin: 0; }
.quiz-q .btn { justify-self: start; }

/* ---------- Rules ---------- */
.prose { max-width: 70ch; }
.prose h3 { margin: 28px 0 6px; font-size: 1.1rem; }
.prose li { margin-bottom: 5px; }
.prose .note { color: var(--muted); font-size: .9rem; }
.values, .baseline { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.values th, .values td { border: 1px solid var(--line); padding: 6px 12px; text-align: center; }
.values td { font-family: var(--mono); }
.baseline { font-size: .92rem; }
.baseline th, .baseline td { border-bottom: 1px solid var(--line); padding: 6px 12px 6px 0; text-align: left; }
.baseline th { font-weight: 500; color: var(--muted); font-size: .82rem; }
.baseline td.num { text-align: right; }
.defs { margin: 0; }
.defs dt { font-weight: 600; margin-top: 12px; }
.defs dd { margin: 2px 0 0; }

.foot { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; max-width: 70ch; }

/* ---------- Online match: full screen ----------
   Once an online match is on, the page is the table (and the chat beside it
   on wide screens, in a drawer on phones). Cards grow with the screen. */
.game-top { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--felt-muted); position: relative; z-index: 5; }
.game-room { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.icon-btn { position: relative; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--felt-line); background: rgba(0,0,0,.18); color: var(--felt-ink); font-size: .85rem; font-weight: 500; cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--felt-muted); }
.badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: .7rem; font-weight: 600; line-height: 18px; text-align: center; }
.link-btn { border: 0; background: none; padding: 2px 4px; color: var(--muted); font-size: .82rem; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--ink); }
.link-btn[aria-pressed="true"] { color: var(--warn); }
.chat-head .link-btn:first-of-type { margin-left: auto; }
.chat-close { display: none; }
.chat-hint { margin: 0; font-size: .8rem; color: var(--warn); min-height: 1.2em; }
.chat-hint:empty { display: none; }

body.in-match { --cw: clamp(58px, min(19vw, 11.5vh), 118px); }
body.in-match .top, body.in-match .bar, body.in-match #online, body.in-match .foot { display: none; }
body.in-match .wrap { max-width: none; padding: 0; }
body.in-match .play-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 0; height: 100dvh; align-items: stretch; }
body.in-match .table { border-radius: 0; min-height: 100dvh; padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); grid-template-rows: auto auto auto 1fr auto; gap: 10px; align-content: stretch; }
body.in-match .table[data-hand="5"] { --cw: clamp(52px, min(16vw, 10vh), 104px); }
body.in-match .table .card { --w: var(--cw); }
body.in-match .table .card.small { --w: calc(var(--cw) * .66); }
body.in-match .hand { min-height: calc(var(--cw) * 1.42 + 8px); }
body.in-match .middle { align-self: center; }
body.in-match .stock-stack { width: calc(var(--cw) * 1.6); height: calc(var(--cw) * 1.52); }
body.in-match .stock-stack .trump-card { left: calc(var(--cw) * .58); top: calc(var(--cw) * .1); }
body.in-match .trick { min-height: calc(var(--cw) * 1.42 + 40px); }
body.in-match .seat-head { font-size: .95rem; }
body.in-match .prompt { font-size: 1rem; }
body.in-match .result, body.in-match .net-wait { border-radius: 0; }

/* Chat column (wide) / drawer (phones). Nothing else from the coach column. */
body.in-match .coach { display: block; border-left: 1px solid var(--line); background: var(--surface); }
body.in-match .coach > :not(.chat) { display: none; }
body.in-match .chat { height: 100dvh; border: 0; border-radius: 0; grid-template-rows: auto minmax(0, 1fr) auto auto; padding: 14px 14px max(14px, env(safe-area-inset-bottom)); }
body.in-match .chat-log { max-height: none; }
body.in-match .chat-btn { display: none; }

@media (max-width: 920px) {
  body.in-match .play-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  body.in-match .chat-btn { display: inline-block; }
  body.in-match .chat-close { display: inline; }
  body.in-match .coach {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: min(70dvh, 520px);
    border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; overflow: hidden;
    box-shadow: 0 -12px 40px rgba(0,0,0,.35);
    transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
  }
  body.in-match.chat-open .coach { transform: none; visibility: visible; transition: transform .22s ease; }
  body.in-match .chat { height: 100%; }
  body.in-match .table { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) { body.in-match .coach { transition: none; } }

/* ---------- Account ---------- */
.acct-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .88rem; font-weight: 500; cursor: pointer; max-width: 180px; }
.acct-btn:hover { border-color: var(--muted); }
.acct-btn-av { font-size: 1.1rem; line-height: 1; }
.acct-btn-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn-av.none { display: none; }
@media (max-width: 560px) {
  .acct-btn { width: 34px; padding: 0; justify-content: center; }
  .acct-btn-av.none { display: inline; filter: grayscale(1); }
  .acct-btn-name { display: none; }
}
.acct-view { max-width: 520px; }
.acct-card > .btn { justify-self: start; }
.acct-card { display: grid; gap: 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 18px; }
.acct-form { display: grid; gap: 10px; justify-items: start; margin: 0; }
.acct-form .field { width: 100%; }
.acct-form .text { width: 100%; font-size: 1rem; }
.acct-form p { margin: 0; }
#acct-code { letter-spacing: .2em; max-width: 12em; }
.btn-google { justify-self: start; }
.acct-me { display: flex; align-items: center; gap: 12px; }
.acct-me b { font-size: 1.2rem; }
.acct-avatar { font-size: 2.6rem; line-height: 1; }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.avatar-opt { height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.avatar-opt:hover { border-color: var(--muted); }
.avatar-opt[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.ok-note { color: var(--good); font-size: .9rem; }
.net-as { margin: 0; font-weight: 500; }
.acct-stats { display: grid; gap: 10px; }
.acct-stats h3, .acct-edit-h { margin: 6px 0 0; font-size: 1rem; }
.acct-edit-h { border-top: 1px solid var(--line); padding-top: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stat-row div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.stat-row dt { font-size: .78rem; color: var(--muted); }
.stat-row dd { margin: 0; font-family: var(--mono); font-size: 1.4rem; }
.rivals, .recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rivals li, .recent li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rival-name { font-weight: 500; margin-right: auto; overflow-wrap: anywhere; }
.recent .rival-name { margin-right: 0; }
.recent .small-note { margin: 0 0 0 auto; text-align: right; }
.rival-score { font-family: var(--mono); font-size: 1.05rem; }
.rival-score.ahead { color: var(--good); }
.rival-score.behind { color: var(--bad); }
.wl { font-family: var(--mono); font-weight: 600; width: 1.4em; text-align: center; border-radius: 4px; color: #fff; }
.wl.w { background: var(--good); }
.wl.l { background: var(--bad); }
.h2h-line { margin: 0; font-weight: 500; }

/* ---------- 2 vs 2 ----------
   Lobby or table on the left, the table chat on the right (a drawer on
   phones once the match is on). The other three sit in a row above the
   middle: left opponent, partner, right opponent. */
body.four-on .bar, body.four-on #online, body.four-on .play-grid { display: none; }
.four { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.four > * { min-width: 0; }
@media (max-width: 920px) { .four { grid-template-columns: minmax(0, 1fr); } }
.four-lobby { margin: 0; }
.four-side .chat-log { max-height: 320px; }
.four-side .small-note { margin: 0; }

.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.team-box { display: grid; gap: 6px; align-content: start; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--bg); }
.team-box h3 { margin: 0 0 2px; font-size: .85rem; font-weight: 500; color: var(--muted); }
.seat-btn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.seat-btn:disabled { cursor: default; }
.seat-btn:not(:disabled):hover { border-color: var(--muted); }
.seat-btn.empty .seat-who { color: var(--muted); font-style: italic; }
.seat-btn.mine { border-color: var(--accent); }
.seat-btn.picked { box-shadow: inset 0 0 0 2px var(--gold); }
.seat-no { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ink); font-family: var(--mono); font-size: .8rem; flex: none; }
.seat-who { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }

.others { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: start; }
.seat4 { position: relative; display: grid; justify-items: center; gap: 4px; padding: 6px 4px; border-radius: 8px; text-align: center; }
.seat4-body { display: grid; justify-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.seat4.turn { box-shadow: inset 0 0 0 1.5px var(--gold); }
.seat4-name { font-weight: 600; font-size: .88rem; overflow-wrap: anywhere; }
.seat4.turn .seat4-name { color: var(--gold); }
.seat4-name .away { font-weight: 400; color: var(--warn); }
.seat4-tag { font-size: .72rem; color: var(--felt-muted); text-transform: uppercase; letter-spacing: .06em; }
.seat4.partner .seat4-tag { color: var(--felt-ink); }
.backs { display: flex; justify-content: center; padding-left: 18px; }
.backs .card { --w: 30px; margin-left: -18px; }
.backs .card.back { border-width: 2px; }
.seat4 .floats-opp { top: 100%; }

.felt4 {
  --tw: 54px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas: "stock top ." "left center right" ". bottom .";
  gap: 6px 10px; align-items: center; justify-items: center;
  padding: 10px; border-radius: 10px; background: rgba(0,0,0,.14);
}
.stock4 { grid-area: stock; justify-self: start; align-self: start; font-size: .75rem; }
.stock4 .card { --w: 40px; }
.stock4 .stock-stack { width: 66px; height: 62px; }
.stock4 .stock-stack .trump-card { left: 24px; top: 4px; }
.spot-top { grid-area: top; } .spot-left { grid-area: left; } .spot-right { grid-area: right; } .spot-bottom { grid-area: bottom; }
.center4 { grid-area: center; text-align: center; font-size: .9rem; color: var(--felt-muted); max-width: 28ch; }
.spot { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: calc(var(--tw) * 1.42 + 24px); min-width: 0; max-width: 100%; }
.spot .card { --w: var(--tw); }
.fan { display: flex; justify-content: center; padding: 3px; border-radius: 8px; }
.fan .card + .card { margin-left: calc(var(--w) * -0.4); }
.spot.taking .fan { box-shadow: 0 0 0 2px var(--gold); }
.spot.stale .fan { opacity: .88; }
.spot-cap { font-size: .78rem; color: var(--felt-muted); text-align: center; overflow-wrap: anywhere; }
.taking-tag { color: var(--gold); font-weight: 600; }
.last4 { margin: 0; min-height: 1.4em; font-size: .82rem; color: var(--felt-muted); text-align: center; }
.last4 .red { color: #f0a0aa; }
.last4 b { color: var(--felt-ink); font-weight: 600; }
.clock { margin-left: 6px; font-family: var(--mono); font-weight: 500; color: var(--felt-ink); }
.clock.low { color: var(--gold); }
.my-clock { margin: -4px 0 0; text-align: center; font-size: 1.05rem; }
@media (max-width: 560px) {
  .felt4 { --tw: 36px; gap: 4px 6px; padding: 8px 6px; }
  .fan .card + .card { margin-left: calc(var(--w) * -0.5); }
  .stock4 .card { --w: 32px; }
  .stock4 .stock-stack { width: 54px; height: 50px; }
  .stock4 .stock-stack .trump-card { left: 18px; }
}

/* In a match: full screen, like 1v1. */
body.four-match { --cw: clamp(52px, min(16vw, 9vh), 100px); }
body.four-match .top, body.four-match .foot { display: none; }
body.four-match .wrap { max-width: none; padding: 0; }
body.four-match .four { grid-template-columns: minmax(0, 1fr) 320px; gap: 0; height: 100dvh; align-items: stretch; }
body.four-match .table4 { border-radius: 0; min-height: 100dvh; padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); grid-template-rows: auto auto auto 1fr auto auto; gap: 10px; align-content: stretch; }
body.four-match .felt4 { --tw: clamp(34px, min(6.4vw, 8.5vh), 84px); align-self: stretch; align-content: center; }
body.four-match .table4 .seat-me .card { --w: var(--cw); }
body.four-match .table4 .hand.mine { min-height: calc(var(--cw) * 1.42 + 8px); }
body.four-match .result, body.four-match .net-wait { border-radius: 0; }
body.four-match .four-side { border-left: 1px solid var(--line); background: var(--surface); }
body.four-match .four-side .chat { height: 100dvh; border: 0; border-radius: 0; grid-template-rows: auto minmax(0, 1fr) auto auto auto; padding: 14px 14px max(14px, env(safe-area-inset-bottom)); }
body.four-match .four-side .chat-log { max-height: none; }
.table4 .chat-btn { display: none; }
@media (max-width: 920px) {
  body.four-match .four { grid-template-columns: minmax(0, 1fr); height: auto; }
  body.four-match .table4 .chat-btn { display: inline-block; }
  body.four-match .four-side .chat-close { display: inline; }
  body.four-match .four-side {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: min(70dvh, 520px);
    border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; overflow: hidden;
    box-shadow: 0 -12px 40px rgba(0,0,0,.35);
    transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
  }
  body.four-match.four-chat-open .four-side { transform: none; visibility: visible; transition: transform .22s ease; }
  body.four-match .four-side .chat { height: 100%; }
  body.four-match .table4 { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) { body.four-match .four-side { transition: none; } }

/* 2v2 lobby: bots */
.bot-btn { justify-self: start; padding-left: 2px; }
.bots-field { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 6px; }

/* ---------- Feels like an app while playing ----------
   Tables never select text or flash on tap; double-tap doesn't zoom. During
   a match the whole page is locked down the same way (chat stays usable),
   and nothing bounces or scrolls behind it. */
.table, .table4, .card {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
body.in-match, body.four-match {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; overscroll-behavior: none;
}
body.in-match input, body.four-match input, body.in-match .chat-log, body.four-match .chat-log { -webkit-user-select: text; user-select: text; }
html:has(body.in-match), html:has(body.four-match) { overscroll-behavior: none; }
/* iPhones zoom into any input under 16px when it's tapped. */
@media (pointer: coarse) { input.text, select { font-size: 16px; } }

.home-tip {
  position: fixed; z-index: 40; left: 12px; right: 12px; top: max(56px, calc(env(safe-area-inset-top) + 48px));
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); color: var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.35); border: 1px solid var(--line);
}
.home-tip p { margin: 0; font-size: .9rem; flex: 1; }
.home-tip .icon-btn { background: var(--accent); color: var(--accent-ink); border: 0; }

/* ---------- Decks (shop) ----------
   A deck is a set of --deck-* variables on body (your deck) or on a shop
   preview. Unset means the classic look. Ids match CATALOG in js/economy.js. */
.deck-classic { --deck-face: initial; --deck-ink: initial; --deck-red: initial; --deck-back: initial; --deck-edge: initial; --deck-pattern: initial; --deck-pattern-size: initial; --deck-frame: initial; }
.deck-noir {
  --deck-face: #1c1c20; --deck-ink: #f2efe8; --deck-red: #ff7a87; --deck-back: #0c0c0e; --deck-edge: #2c2c33;
  --deck-pattern: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 1px, transparent 1px 6px), repeating-linear-gradient(-45deg, rgba(255,255,255,.07) 0 1px, transparent 1px 6px);
  --deck-frame: 1px solid rgba(255,255,255,.1);
}
.deck-emerald {
  --deck-face: #fbf8ee; --deck-ink: #14281f; --deck-red: #a1252f; --deck-back: #0f4d34; --deck-edge: #fbf8ee;
  --deck-pattern: radial-gradient(circle, rgba(232,206,140,.55) 1.3px, transparent 1.8px); --deck-pattern-size: 7px 7px;
  --deck-frame: 1px solid rgba(15,77,52,.25);
}
.deck-borjgali {
  --deck-face: #fffaf2; --deck-ink: #2a1218; --deck-red: #9e1b32; --deck-back: #5b1830; --deck-edge: #d8a447;
  --deck-pattern: radial-gradient(circle at 50% 50%, rgba(216,164,71,.95) 0 9%, transparent 10%),
                  repeating-conic-gradient(from 0deg at 50% 50%, rgba(216,164,71,.5) 0 7deg, transparent 7deg 22.5deg);
  --deck-frame: 1px solid rgba(158,27,50,.3);
}
.deck-gold {
  --deck-face: #fffdf6; --deck-ink: #1e1a10; --deck-red: #a8202e; --deck-back: #b8862b; --deck-edge: #f1d58a;
  --deck-pattern: linear-gradient(135deg, rgba(255,255,255,.4), transparent 45%, rgba(0,0,0,.2)), repeating-linear-gradient(45deg, rgba(255,240,200,.3) 0 2px, transparent 2px 8px);
  --deck-frame: 1.5px solid #c9a24a;
}

/* ---------- Coins, shop ---------- */
.coin-ico { display: inline-block; width: .95em; height: .95em; border-radius: 50%; vertical-align: -.12em; margin-right: .3em; flex: none;
  background: radial-gradient(circle at 35% 30%, #fbe7a1, #d9a62e 60%, #a77816); box-shadow: inset 0 0 0 1.5px rgba(120,80,10,.55); }
.coin-btn { flex: none; position: relative; display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 .88rem var(--mono); font-variant-numeric: tabular-nums; cursor: pointer; }
.coin-btn:hover { border-color: var(--muted); }
.coin-dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.coin-short { display: none; }
/* Phones: a round coin the size of the account button; the amount is in the shop. */
@media (max-width: 560px) {
  .coin-btn { width: 34px; padding: 0; justify-content: center; }
  .coin-btn .coin-ico { margin: 0; width: 18px; height: 18px; }
  .coin-full, .coin-short { display: none; }
}
.tabs button { position: relative; }
.tab-badge { top: 4px; right: -4px; }
.coin-flash { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 22px; background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: coin-flash 1.8s ease forwards; }
@keyframes coin-flash { 0% { opacity: 0; transform: translate(-50%, 8px); } 12%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .coin-flash { animation: none; } }

.shop-view, .admin-view { max-width: 760px; }
.shop-h { font-size: 1.1rem; margin: 26px 0 4px; }
.shop-hn { margin: 0 0 12px; }
.shop-daily h2 { font-size: 1rem; margin: 0; }
.shop-balance { margin: 0; font-size: 1.05rem; }
.shop-balance b { font: 600 1.6rem var(--mono); font-variant-numeric: tabular-nums; margin-right: 4px; }
.daily-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.daily-strip .day { display: grid; gap: 2px; justify-items: center; padding: 8px 2px; border-radius: 8px; border: 1px solid var(--line); font-size: .72rem; color: var(--muted); }
.daily-strip .day b { font: 600 .85rem var(--mono); color: var(--ink); }
.daily-strip .day.done { background: color-mix(in srgb, var(--good) 14%, var(--surface)); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.daily-strip .day.now { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--ink); }
.daily-strip .day.next { border-style: dashed; border-color: var(--muted); }
@media (max-width: 560px) { .daily-strip { gap: 3px; } .daily-strip .day { font-size: .62rem; } .daily-strip .day b { font-size: .72rem; } }
.shop-daily .step-row { align-items: center; flex-wrap: wrap; }
.shop-daily .small-note { margin: 0; }

.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.deck-item { display: grid; gap: 10px; align-content: start; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 14px; }
.deck-item.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.deck-item h3 { margin: 0; font-size: 1rem; }
.deck-item .small-note { margin: 2px 0 0; }
.deck-item .btn { justify-self: start; }
.deck-preview { display: flex; gap: 6px; padding: 12px; border-radius: 8px; background: var(--felt); justify-content: center; }
.deck-price { margin: 6px 0 0; font: 600 .95rem var(--mono); font-variant-numeric: tabular-nums; }
.owned { font-family: var(--sans); color: var(--good); }

.photo-row { display: flex; gap: 14px; align-items: center; }
.photo-row .small-note { margin: 4px 0 0; }
.shop-photo > .btn, .file-btn { justify-self: start; }
.file-btn { position: relative; cursor: pointer; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.photo-rules { border-left: 3px solid var(--warn); padding: 2px 0 2px 10px; margin: 0; }

/* Avatars: an approved picture, or the emoji. */
.av-photo { display: inline-block; width: 1.3em; height: 1.3em; border-radius: 50%; object-fit: cover; vertical-align: -.3em; background: var(--line); }
.av-photo.big { width: 64px; height: 64px; vertical-align: middle; }
.av-emoji.big { font-size: 2.6rem; line-height: 1; }
.av-photo.tiny { width: 1.25em; height: 1.25em; }
.acct-btn .av-photo { width: 24px; height: 24px; vertical-align: middle; }
.opp-coins { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Report dialog ---------- */
.dlg { width: min(460px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dlg::backdrop { background: rgba(0,0,0,.45); }
.dlg h2 { margin: 0; font-size: 1.15rem; }
.dlg textarea { width: 100%; resize: vertical; font: 1rem/1.4 var(--sans); }
.dlg #report-done { display: grid; gap: 12px; justify-items: start; }
.dlg #report-done p { margin: 0; }
.report-reasons { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.report-reasons legend { padding: 0; margin-bottom: 6px; font-size: .82rem; color: var(--muted); }
.report-reasons .check { font-size: .95rem; color: var(--ink); }

/* ---------- Admin ---------- */
.adm-list { display: grid; gap: 12px; }
.adm-photo, .adm-player { display: grid; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 14px; }
.adm-photo { grid-template-columns: 128px minmax(0, 1fr); align-items: start; }
.adm-photo img, .adm-noimg { width: 128px; height: 128px; border-radius: 8px; object-fit: cover; background: var(--line); display: grid; place-items: center; font-size: .8rem; color: var(--muted); }
.adm-photo .adm-acts { grid-column: 1 / -1; }
.adm-player.flagged { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
.adm-who { display: flex; gap: 12px; align-items: center; }
.adm-who .small-note { margin: 2px 0 0; }
.adm-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.adm-acts .btn { padding-inline: 10px; font-size: .85rem; }
.adm-player > .link-btn { justify-self: start; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.tag { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 2px; }
.tag.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.tag.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.adm-reports { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: .88rem; }
.adm-reports p { margin: 0; }
.adm-note { white-space: pre-wrap; overflow-wrap: anywhere; border-left: 3px solid var(--line); padding-left: 8px; margin-top: 4px !important; }
.adm-snap { width: 96px; height: 96px; border-radius: 8px; object-fit: cover; margin-top: 6px; }
.adm-chat { list-style: none; margin: 6px 0 0; padding: 8px; border-radius: 8px; background: var(--bg); display: grid; gap: 3px; max-height: 260px; overflow: auto; overflow-wrap: anywhere; }
.adm-chat .them b { color: var(--bad); }

/* ---------- Playing for coins ---------- */
.coin-play .coin-ico { margin-right: 6px; }
.wager-bar { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 8px; padding: 6px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--gold) 22%, rgba(0,0,0,.25)); color: var(--felt-ink); font-size: .85rem; font-weight: 500; position: relative; z-index: 5; }
.wager-bar .coin-ico { margin-right: 6px; }
.wager-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wager-chips .btn { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.wager-chips .btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
#wager-body p { margin: 0; }
#wager-body .field input { max-width: 10em; font-size: 1rem; }
@media (max-width: 560px) { .coin-play { font-size: 0; padding: 0 10px; } .coin-play .coin-ico { margin: 0; font-size: 1rem; } }
.sig { font-size: .75rem; color: var(--muted); }
.sig.ok { color: var(--good); }
.sig.bad { color: var(--bad); font-weight: 600; }
.sig-sum { font-weight: 400; color: var(--muted); }
