/* Matatu Classic — premium dark blue and gold, white cards on a blue felt table.
   Landscape-only layout: the Android app is locked sideways; portrait browsers see a "turn your phone" notice. */
:root {
  --table: #10295a;        /* app background: deep blue */
  --table-2: #173a78;      /* raised surfaces */
  --table-3: #2a4f93;      /* borders */
  --navy: #0a1c42;
  --gold: #e9b949;
  --gold-2: #f6d37a;
  --gold-dark: #a97b22;
  --felt: radial-gradient(ellipse 80% 70% at 50% 46%, #1f4f9c 0%, #153c80 45%, #0d285c 80%, #0a1f4a 100%);
  --ink: #f6f4ee;
  --ink-dim: #b3c2df;
  --paper: #fbfaf5;        /* cards */
  --paper-ink: #1b1d24;
  --suit-red: #c8322b;
  --taxi-yellow: #e9b949;  /* gold: actions, timer, highlights */
  --taxi-yellow-dark: #a97b22;
  --danger: #ff7a66;
  --ok: #8fe0a3;
  --band: 0px;           /* the chequered top band is gone */
  --rail: 84px;
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: linear-gradient(180deg, #11295a, #0a1d45) fixed; color: var(--ink); }
body { font-size: 15px; line-height: 1.4; overscroll-behavior: none; overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h2 { font-size: 1.3rem; font-weight: 750; }
h3 { font-size: .95rem; font-weight: 700; margin: 14px 0 4px; color: var(--ink-dim); }
.muted { color: var(--ink-dim); margin: 4px 0 0; }
.small { font-size: .85rem; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--taxi-yellow); outline-offset: 2px; }

/* The chequered taxi band along the top of every screen */
.band { display: none; }
.band-unused {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5; height: calc(var(--band) + var(--st));
  background: conic-gradient(var(--table) 25%, var(--paper) 0 50%, var(--table) 0 75%, var(--paper) 0) 0 100% / 12px 12px, var(--table);
  background-repeat: repeat-x;
  border-bottom: 2px solid var(--paper);
}

.screen {
  position: fixed; inset: 0; overflow-y: auto;
  padding: calc(var(--band) + var(--st) + 12px) calc(16px + var(--sr)) calc(12px + var(--sb)) calc(16px + var(--sl));
}
.screen.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }

/* ---------- playing cards ---------- */
.card {
  --w: 64px;
  position: relative; display: inline-flex; flex-direction: column; justify-content: space-between;
  width: var(--w); height: calc(var(--w) * 1.42); flex: none; padding: calc(var(--w) * .07);
  background: var(--paper); color: var(--paper-ink); border-radius: calc(var(--w) * .1); border: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 4px 10px rgba(5,15,40,.35);
  font-weight: 800; line-height: 1; text-align: left; user-select: none;
}
.card b { font-size: calc(var(--w) * .3); display: inline-flex; flex-direction: column; align-items: center; align-self: flex-start; letter-spacing: -.06em; }
.card b.ten { letter-spacing: -.12em; font-size: calc(var(--w) * .26); margin-left: calc(var(--w) * -.03); }
.card b small { font-size: calc(var(--w) * .22); letter-spacing: 0; margin-top: calc(var(--w) * .02); }
.card i { font-style: normal; font-size: calc(var(--w) * .52); align-self: center; margin-bottom: calc(var(--w) * .12); }
.card .corner { position: absolute; right: calc(var(--w) * .07); bottom: calc(var(--w) * .07); font-size: calc(var(--w) * .22); transform: rotate(180deg); }
.card.red { color: var(--suit-red); }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(233,185,73,.20) 0 1px, transparent 1px calc(var(--w) * .11)),
    repeating-linear-gradient(-45deg, rgba(233,185,73,.20) 0 1px, transparent 1px calc(var(--w) * .11)),
    linear-gradient(155deg, #1d4590, #0c2253);
  border: calc(var(--w) * .055) solid #f7f3e8;
  box-shadow: inset 0 0 0 calc(var(--w) * .022) var(--gold), 0 1px 0 rgba(0,0,0,.25), 0 4px 10px rgba(5,15,40,.35);
}
/* the crest: "MC" in a gold ring, dead centre — every back identical and symmetrical */
.card.back::before {
  content: "MC"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(var(--w) * .46); height: calc(var(--w) * .46); border-radius: 50%;
  display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #234d9a, #0c2253);
  border: calc(var(--w) * .028) solid var(--gold); color: var(--gold); font-weight: 900; font-size: calc(var(--w) * .16); letter-spacing: -.03em;
  box-shadow: 0 0 0 calc(var(--w) * .03) rgba(12,34,83,.85);
}
.card.mini { --w: 52px; }

/* A card in flight between deck, hands and pile */
.flyer { position: fixed; z-index: 9; pointer-events: none; transform-origin: 0 0; will-change: transform; }
.flyer .card { box-shadow: 0 6px 14px rgba(5,15,40,.35); }

/* ---------- sign in ---------- */
.auth { display: grid; grid-template-columns: 1fr minmax(340px, 480px); gap: 28px; align-items: center; max-width: 860px; margin: 0 auto; min-height: 100%; }
.brand { text-align: center; }
.brand-cards { display: flex; justify-content: center; margin-bottom: 14px; height: 84px; }
.brand-cards .card:nth-child(1) { transform: rotate(-12deg) translate(10px, 6px); }
.brand-cards .card:nth-child(2) { transform: translateY(-4px); z-index: 1; }
.brand-cards .card:nth-child(3) { transform: rotate(12deg) translate(-10px, 6px); }
.cover { display: block; width: min(100%, 62vh, 340px); height: auto; aspect-ratio: 1; margin: 0 auto 8px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.brand h1 { font-size: clamp(2rem, 7vh, 2.8rem); font-weight: 850; letter-spacing: -.02em; }
.brand p { color: var(--ink-dim); margin: 4px 0 0; }
.auth-col { padding: 6px 0; }
.auth-step { display: flex; flex-direction: column; gap: 10px; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: #1f1f1f; padding: 13px 16px; font-size: 1rem; border-radius: 999px; box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.btn-google svg { width: 22px; height: 22px; flex: none; }
.btn-google:disabled { opacity: .6; }
.test-login { border: 2px dashed var(--table-3); border-radius: 10px; padding: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--table-2); border-radius: 999px; padding: 4px; }
.seg button { border: 0; background: none; padding: 8px; border-radius: 999px; color: var(--ink-dim); font-weight: 600; }
.seg button.on { background: var(--paper); color: var(--table); }
form { display: flex; flex-direction: column; gap: 8px; }
#auth-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; align-items: end; }
#auth-form .form-error, #auth-form .btn { grid-column: 1 / -1; }
#auth-form label.check { padding-bottom: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--ink-dim); }
label small { font-size: .78rem; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: .95rem; }
label.check input { width: 22px; height: 22px; accent-color: var(--taxi-yellow); }
input[type=text], input:not([type]), input[type=tel], input[type=password], input[type=number] {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--table-2);
  border: 2px solid var(--table-3); border-radius: 8px; padding: 9px 12px; width: 100%;
}
input:focus { border-color: var(--taxi-yellow); outline: none; }
.form-error { color: var(--danger); margin: 0; min-height: 1.1em; font-size: .85rem; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: .95rem; cursor: pointer; width: 100%; transition: transform .08s, filter .15s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; }
.btn-primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #241a05; box-shadow: 0 3px 0 var(--gold-dark), 0 6px 14px rgba(0,0,0,.25); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--taxi-yellow-dark); }
.btn-big { padding: 16px; font-size: 1.1rem; }
.btn-ghost { background: rgba(255,255,255,.04); color: var(--ink); border: 1.5px solid rgba(233,185,73,.45); }
.btn-link { background: none; color: var(--ink-dim); text-decoration: underline; padding: 6px; }
.btn-danger { background: var(--danger); color: #1b1d24; }
.btn-small { width: auto; padding: 7px 14px; font-size: .85rem; }

/* ---------- main: side rail + two columns ---------- */
#screen-main { padding-left: calc(var(--rail) + 16px + var(--sl)); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.who { display: flex; align-items: baseline; gap: 8px; font-weight: 700; }
.rating { font-weight: 500; color: var(--ink-dim); font-size: .85rem; font-variant-numeric: tabular-nums; }
.balance-chip { background: var(--paper); color: var(--table); border: 0; border-radius: 999px; padding: 6px 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.balance-chip small { font-weight: 600; font-size: .75rem; }
.test-banner { background: var(--taxi-yellow); color: #1b1d24; border-radius: 8px; padding: 6px 12px; font-size: .82rem; font-weight: 600; margin: 0 0 10px; }

.tab { display: flex; flex-direction: column; gap: 10px; }
.tab.two { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: start; }
.tab .col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stakes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stake { border: 2px solid var(--table-3); background: var(--table-2); border-radius: 8px; padding: 9px 4px; text-align: center; cursor: pointer; }
.stake strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.stake span { font-size: .75rem; color: var(--ink-dim); }
.stake[aria-checked="true"] { border-color: var(--gold); background: #1f4688; box-shadow: 0 0 0 1px var(--gold) inset; }
.stake:disabled { opacity: .4; }
.conn { text-align: center; font-size: .82rem; color: var(--ink-dim); min-height: 1.1em; margin: 0; }
.conn.bad { color: var(--danger); }

.tabbar {
  background: linear-gradient(180deg, #0d2350, #0a1b40) !important;
  position: fixed; top: calc(var(--band) + var(--st) + 2px); bottom: 0; left: 0; z-index: 4; width: calc(var(--rail) + var(--sl));
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  background: #122f66; border-right: 1px solid var(--table-3); padding: 8px 6px calc(8px + var(--sb)) calc(6px + var(--sl));
}
.tabbar button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: .75rem; color: var(--ink-dim); border-radius: 10px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--taxi-yellow); background: rgba(255,255,255,.06); }

.wallet-card { background: var(--paper); color: var(--paper-ink); border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.wallet-card > span:first-child { color: #5b6170; font-size: .85rem; }
.wallet-card strong { font-size: 2.2rem; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1.1; }
.wallet-card strong small { font-size: .95rem; font-weight: 700; color: #5b6170; }
.wallet-card .small { color: #5b6170; }
.wallet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tab .col > h3:first-child { margin-top: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--table-3); }
.list li .l { display: flex; flex-direction: column; min-width: 0; }
.list li .l small { color: var(--ink-dim); font-size: .78rem; }
.list li .r { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.list li .r small { display: block; font-weight: 600; font-size: .72rem; color: var(--ink-dim); }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.list .empty { color: var(--ink-dim); justify-content: center; border: 0; }
.ranks { counter-reset: r; max-width: 640px; }
.ranks li::before { counter-increment: r; content: counter(r); width: 28px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.ranks li .l { flex: 1; }
.ranks li.me { background: #284f96; }

.profile { display: flex; gap: 14px; align-items: center; }
.profile-text { min-width: 0; }
.nick-row { display: flex; align-items: center; gap: 6px; }
.nick-row h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Avatars: a picture (emoji) on a coloured disc */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; flex: none; line-height: 1; background: var(--av-bg, #284f96); box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.avatar.big { width: 64px; height: 64px; font-size: 36px; }
.avatar.sm { width: 26px; height: 26px; font-size: 15px; margin-right: 2px; align-self: center; }
.avatar-btn { position: relative; border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.avatar-edit { font-size: .7rem; color: var(--ink-dim); }
.icon-btn { border: 0; background: var(--table-2); color: var(--ink); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 15px; }
.icon-btn.small { width: 24px; height: 24px; font-size: 12px; vertical-align: middle; }
.facts { list-style: none; margin: 0; padding: 0; border: 2px solid var(--table-3); border-radius: 10px; }
.facts li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.facts li + li { border-top: 1px solid var(--table-3); }
.facts li span { color: var(--ink-dim); width: 64px; font-size: .85rem; }
.facts li b { flex: 1; font-variant-numeric: tabular-nums; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.avatar-grid button { border: 3px solid transparent; background: none; padding: 2px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.avatar-grid button .avatar { width: 46px; height: 46px; font-size: 26px; }
.avatar-grid button[aria-pressed="true"] { border-color: var(--taxi-yellow); }
.share-confirm { display: flex; align-items: center; gap: 12px; background: var(--table); border-radius: 10px; padding: 12px; }
.share-confirm .avatar { width: 48px; height: 48px; font-size: 26px; }
.share-confirm b { font-size: 1.15rem; }
.ranks li .avatar { width: 28px; height: 28px; font-size: 16px; margin-right: 8px; }
.acct { color: var(--ink); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.statrow div { background: var(--table-2); border-radius: 8px; padding: 8px 4px; text-align: center; }
.statrow strong { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.statrow span { font-size: .72rem; color: var(--ink-dim); }

/* ---------- searching ---------- */
.search-cards { position: relative; width: 120px; height: 96px; margin-bottom: 10px; }
.search-cards .card { --w: 52px; position: absolute; left: 34px; top: 10px; animation: deal 1.8s ease-in-out infinite; }
.search-cards .card:nth-child(2) { animation-delay: .3s; }
.search-cards .card:nth-child(3) { animation-delay: .6s; }
@keyframes deal { 0%, 100% { transform: rotate(-14deg) translateX(-18px); } 50% { transform: rotate(14deg) translateX(18px); } }
#search-time { font-variant-numeric: tabular-nums; margin-bottom: 12px; }
#cancel-search { max-width: 220px; }

/* ---------- game table: 800 x 480 world (all sizes below are world pixels) ----------
   Cards 80 x 110 for both hands. Rows (measured from the bottom, as specified): local hand y=70, opponent y=410,
   mirrored about y=240 with a 15 px margin. On screen: opponent row 15-125 from the top, your row 355-465. */
.table { padding: 0; overflow: hidden; background: var(--felt); }
#stage { position: absolute; left: 0; top: 0; width: 800px; height: 480px; transform-origin: 0 0; overflow: hidden; }
#stage .card { --w: 80px; height: 110px; }

.row-cards { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.row-cards .card { position: absolute; transition: filter .12s, transform .12s ease-out, box-shadow .12s; }
#hand .card { cursor: pointer; }   /* by default no highlighting: every card in your hand looks the same */
/* pressed card: raised a little with a soft gold edge */
#hand .card.lift { transform: translateY(-14px); box-shadow: 0 0 0 2px rgba(233,185,73,.9), 0 10px 18px rgba(5,15,40,.45); }
/* Settings → "Show playable cards": a subtle treatment for legal moves */
#stage.hl #hand .card.playable { box-shadow: 0 0 0 2px rgba(233,185,73,.85), 0 4px 10px rgba(5,15,40,.35); }
#stage.hl #hand .card.dim { filter: brightness(.82) saturate(.75); }

/* Player info in the right-hand gutter, level with each row (rows end at x 692-695) */
.pinfo { position: absolute; left: 8px; width: 106px; display: flex; flex-direction: column; }   /* both players' info on the left */
.pinfo.opp { top: 14px; }      /* beside the opponent's row (which starts at x 120) */
.pinfo.you { top: 364px; }     /* beside your row */
.pinfo.you small { padding-right: 0; }
.pinfo strong { font-size: 13px; line-height: 1.15; overflow-wrap: anywhere; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.seat-who { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.avatar.seat { width: 34px; height: 34px; font-size: 20px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.7), 0 2px 6px rgba(0,0,0,.3); transition: box-shadow .2s; }
.avatar.robot { background: radial-gradient(circle at 40% 35%, #5a6f9e, #2c3c66) !important; }
.pinfo.active .avatar.seat { box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px var(--gold), 0 0 14px 2px rgba(233,185,73,.65); animation: turnGlow 1.6s ease-in-out infinite; }
@keyframes turnGlow { 50% { box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px var(--gold), 0 0 4px 0 rgba(233,185,73,.3); } }
.pinfo.active strong { color: var(--gold-2); }
.pinfo small { color: var(--ink-dim); font-size: 12px; line-height: 1.25; }
#seat-opp.away small::after { content: " · away"; color: var(--taxi-yellow); }
.seat-top { display: flex; align-items: center; gap: 8px; }
/* Move clock: a ring that empties over 25 s, with the seconds left (25 → 0) inside */
.clock { position: relative; width: 38px; height: 38px; flex: none; visibility: hidden; }
.clock.on { visibility: visible; }
.clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock circle { fill: rgba(5,15,40,.35); stroke-width: 4; }
.clock .track { stroke: rgba(255,255,255,.16); }
.clock .arc { fill: none; stroke: var(--taxi-yellow); stroke-linecap: round; stroke-dasharray: 100.53; stroke-dashoffset: 0; transition: stroke-dashoffset .1s linear; }
.clock b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.clock.low .arc { stroke: var(--danger); }
.clock.low b { color: #ff8a80; animation: tick 1s steps(1) infinite; }
@keyframes tick { 50% { transform: scale(1.12); } }
.stage-btn { position: absolute; left: 704px; top: 12px; width: 92px; height: 42px; padding: 0; font-size: 15px; border-radius: 999px; white-space: nowrap;
  background: rgba(10,28,66,.55); border: 1.5px solid rgba(233,185,73,.55); }
.gear-btn { position: absolute; left: 704px; top: 62px; z-index: 20; width: 42px; height: 42px; border-radius: 50%; padding: 9px; cursor: pointer;
  background: rgba(10,28,66,.55); border: 1.5px solid rgba(233,185,73,.55); color: var(--ink); }
.gear-btn svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }

/* Middle band (y 125-355): the pile at the rows' centre x = 406; the deck centred at (720, 240)
   with the cut card lying crosswise under it, sticking out to the left */
.pile { position: absolute; top: 185px; width: 160px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pile-deck { left: 640px; }   /* centre (720, 240): middle right, between both players */
.deck-stack { position: relative; width: 80px; height: 110px; }
#cut-card { position: absolute; left: 0; top: 0; z-index: 0; }
#cut-card .card { transform: translateX(-40px) rotate(90deg); box-shadow: 0 2px 6px rgba(5,15,40,.35); }
.deck-stack .deck { position: relative; z-index: 1; }
.table-felt { position: absolute; left: 210px; top: 146px; width: 380px; height: 188px; border-radius: 94px;
  background: radial-gradient(ellipse at 50% 42%, rgba(255,255,255,.09), rgba(255,255,255,.02) 70%);
  box-shadow: inset 0 0 0 2px rgba(233,185,73,.35), inset 0 0 0 6px rgba(10,28,66,.25), inset 0 10px 28px rgba(0,0,0,.3); }
.pile-stack { position: absolute; left: 360px; top: 185px; width: 80px; height: 110px; z-index: 2; }
.pile-stack .pc { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; }
.pile-stack .pc .card { box-shadow: 0 2px 6px rgba(5,15,40,.35); }
.pile-label { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.deck { cursor: pointer; display: grid; place-items: center; }
.deck span { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 1; background: var(--navy); color: var(--gold-2);
  border: 1px solid rgba(233,185,73,.6); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.deck.active { box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 3px var(--gold), 0 0 16px 3px rgba(233,185,73,.55); animation: deckCall 1.2s ease-in-out infinite; }
@keyframes deckCall { 50% { box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 3px var(--gold), 0 0 4px 0 rgba(233,185,73,.25); } }
.deck:disabled { cursor: default; }
.pile-stack .pc.landed .card { animation: landGlow .7s ease-out; }
@keyframes landGlow { 0% { box-shadow: 0 0 0 3px var(--gold), 0 0 22px 6px rgba(233,185,73,.7); } 100% { box-shadow: 0 2px 6px rgba(5,15,40,.35); } }
/* short note under the opponent's info: "+1 card", "+2 cards" */
.opp-bubble { position: absolute; left: 8px; top: 128px; padding: 2px 9px; border-radius: 999px; z-index: 30; pointer-events: none;
  background: var(--navy); border: 1px solid rgba(233,185,73,.6); color: var(--gold-2); font-size: 12px; font-weight: 800; opacity: 0; }
.opp-bubble.show { animation: bubble 1.6s ease-out; }
@keyframes bubble { 0% { opacity: 0; transform: translateY(6px); } 15%, 75% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-6px); } }
.chip { display: inline-block; background: var(--paper); color: var(--paper-ink); border-radius: 999px; padding: 0 .4em; font-weight: 800; }
.chip.red { color: var(--suit-red); }
/* one line just above the table, so played cards never cover it */
.status-line { position: absolute; left: 160px; top: 127px; width: 480px; height: 18px; z-index: 3; margin: 0; font-size: 14px; font-weight: 650; line-height: 18px;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.status-line.mine { color: var(--gold-2); }

/* Asker layer: 1920x1080 geometry scaled by 800/1920, shifted 15px down so its y=540 lands on y=240 */
.asker-layer { position: absolute; left: 0; top: 15px; width: 1920px; height: 1080px; transform: scale(.416667); transform-origin: 0 0; pointer-events: none; z-index: 1000; }
.asker-layer .asker.choosing { pointer-events: auto; }

/* Bet chip: centre (180, 540); slides to x = -400 (0.5 s) while the asker is showing */
.bet-chip {
  position: absolute; left: 50px; top: 494px; width: 260px; height: 92px; border-radius: 46px; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--gold-2);
  background: linear-gradient(180deg, rgba(13,36,82,.92), rgba(9,26,62,.92));
  border: 4px solid rgba(233,185,73,.75); box-shadow: 0 8px 18px rgba(5,15,40,.4);
  transition: transform .5s linear;
}
.bet-chip small { font-size: 24px; font-weight: 700; letter-spacing: .12em; color: var(--ink-dim); }
.bet-chip b { font-size: 38px; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1.05; }
.bet-chip.away { transform: translateX(-580px); }

/* Asker panel: 291 x 291 white circle, top-left (74.5, 394.5); scales 0 → 1 over 0.5 s from its centre */
.asker {
  position: absolute; left: 74.5px; top: 394.5px; width: 291px; height: 291px; border-radius: 50%; z-index: 1000;
  background: #fff; box-shadow: 0 14px 34px rgba(5,15,40,.5);
  transform: scale(0); transform-origin: 50% 50%; transition: transform .5s ease-out; pointer-events: none;
}
.asker.showing { transform: scale(1); }
.asker.choosing { pointer-events: auto; }
.asker-suit {
  position: absolute; left: calc(var(--hx) - var(--sw) / 2); top: calc(var(--hy) - var(--sh) / 2);
  padding: 0; border: 0; background: none; cursor: pointer;
  transform: translate(0, 0) scale(0); transition: transform .5s ease-out;
}
.asker-suit svg { display: block; width: 100%; height: 100%; }
.asker.choosing .asker-suit { transform: translate(0, 0) scale(.6); }                 /* home slot at 0.6 */
.asker .asker-suit.picked { transform: translate(calc(145px - var(--hx)), calc(145px - var(--hy))) scale(1); }  /* pops to the centre */
.ask-tip {
  position: absolute; left: 400px; top: 650px; width: 260px; height: 100px; line-height: 1.15; margin: 0; z-index: 1001;
  display: flex; align-items: center; font-size: 36px; font-weight: 700; color: var(--taxi-yellow);
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.ask-tip.on { opacity: 1; }

/* ---------- sheets: centred panels in landscape ---------- */
.sheet { position: fixed; inset: 0; background: rgba(6,14,32,.7); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 12px; }
.sheet-body {
  width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; background: var(--table-2); border-radius: 16px;
  padding: 18px 16px; display: flex; flex-direction: column; gap: 8px; animation: rise .2s ease-out;
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.sheet-body.wide { max-width: 640px; }
.suits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.suits button { background: var(--paper); color: var(--paper-ink); border: 0; border-radius: 10px; font-size: 2.2rem; padding: 6px 0; }
.suits button.red { color: var(--suit-red); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick button { flex: 1; background: var(--table); border: 2px solid var(--table-3); border-radius: 8px; padding: 7px 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
#result-title { font-size: 1.8rem; font-weight: 850; }
.reveal { display: flex; flex-direction: column; gap: 6px; }
.reveal .row { display: flex; align-items: center; gap: 8px; }
.reveal .row .who { width: 84px; flex: none; font-size: .85rem; color: var(--ink-dim); }
.reveal .cards { display: flex; flex-wrap: wrap; gap: 3px; }
.reveal .card { --w: 30px; box-shadow: none; }
.result-money { font-size: 1.2rem; font-weight: 800; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.rules p { margin: 0; color: var(--ink-dim); }
.rules b { color: var(--ink); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--sb)); width: min(440px, 90vw);
  background: var(--paper); color: var(--paper-ink); padding: 10px 16px; border-radius: 8px; font-weight: 600; z-index: 40; text-align: center;
  box-shadow: 0 8px 20px rgba(5,15,40,.4);
}

/* Portrait phones in a browser: ask to rotate (the Android app is locked to landscape) */
.rotate { display: none; }
@media (orientation: portrait) and (max-width: 760px) {
  .rotate { display: flex; position: fixed; inset: 0; z-index: 100; background: var(--table); flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; font-weight: 650; }
  .rotate-phone { width: 54px; height: 92px; border: 4px solid var(--paper); border-radius: 12px; animation: turn 2s ease-in-out infinite; }
  @keyframes turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
}

/* Short screens (small phones sideways) */
@media (max-height: 360px) {
  .auth { gap: 20px; }
  .cover { width: min(100%, 52vh); }
  .tab.two { gap: 16px; }
}

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

/* ---------- splash: the cover art, whole, on a blurred copy of itself ---------- */
#splash { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; overflow: hidden; background: #1a1208; transition: opacity .45s ease; }
#splash::before { content: ""; position: absolute; inset: -40px; background: url(cover.jpg) center / cover; filter: blur(28px) brightness(.55); }
#splash img { position: relative; width: min(92vw, 88vh); height: auto; aspect-ratio: 1; border-radius: 18px; box-shadow: 0 16px 50px rgba(0,0,0,.6); }
#splash.gone { opacity: 0; pointer-events: none; }

/* Phone numbers: shown in full, but plain text — not a link, not tappable, not selectable */
.phone-text { pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; letter-spacing: .02em; }
.phone-hint { margin: -4px 0 0; font-size: .85rem; color: var(--ink-dim); min-height: 1.2em; }
.phone-hint.bad { color: #ff8a80; }
.phone-hint.good { color: #7ee2a8; }
.phone-current { margin: 0; color: var(--ink-dim); }
.phone-current b { color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.share-wide { width: 100%; margin-top: 8px; }

/* ---------- emoji reactions (sprite sheet: 12 columns x 5 rows) ---------- */
.emo { display: block; width: 100%; height: 100%; background: url(emotes.webp) no-repeat;
  background-size: 1200% 500%; background-position: calc(var(--c) * 100% / 11) calc(var(--r) * 100% / 4); }
.emote-btn { position: absolute; left: 733px; top: 413px; width: 44px; height: 44px; padding: 6px; border-radius: 50%; z-index: 20;
  border: 2px solid rgba(255,255,255,.55); background: rgba(5,15,40,.45); cursor: pointer; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.emote-btn[aria-expanded="true"] { border-color: var(--taxi-yellow); background: rgba(255,203,61,.18); }
.emote-btn:disabled { opacity: .45; }
.emote-panel { position: absolute; left: 322px; top: 146px; width: 470px; padding: 8px; z-index: 900; border-radius: 14px;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; background: rgba(8,18,44,.94); border: 2px solid rgba(255,255,255,.18); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.emote-panel[hidden] { display: none; }
.emote-panel button { width: 36px; height: 36px; padding: 3px; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.emote-panel button:hover, .emote-panel button:focus-visible { background: rgba(255,255,255,.12); }
.emote-fly { position: absolute; left: 0; top: 0; width: 72px; height: 72px; z-index: 950; pointer-events: none; will-change: transform, opacity; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }

/* Played cards: tap to scatter them round the table */
.table-felt, .pile-stack { cursor: pointer; }
.pile-stack.scattered .pc:last-child .card { box-shadow: 0 0 0 4px var(--taxi-yellow), 0 2px 8px rgba(5,15,40,.4); }  /* the card in play */
#stage .status-line { transition: opacity .2s; }
#stage.pile-open .status-line { opacity: 0; }

/* ---------- settings ---------- */
.settings .switches { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
@media (max-width: 560px) { .settings .switches { grid-template-columns: 1fr; } }
.settings .switch { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 2px; border-bottom: 1px solid rgba(255,255,255,.08); color: var(--ink); font-size: .95rem; cursor: pointer; }
.settings .switch span { display: flex; flex-direction: column; gap: 2px; }
.settings .switch small { color: var(--ink-dim); font-size: .8rem; }
.settings .switch input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 26px; border-radius: 13px; background: #3a4c75; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.settings .switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.settings .switch input:checked { background: var(--gold); }
.settings .switch input:checked::after { transform: translateX(20px); }
.settings-version { text-align: center; margin-top: 4px; }

/* ---------- results ---------- */
#result-title.win { color: var(--gold-2); }
#result-title.lose { color: #ffb4a8; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.result-stats div { background: rgba(10,28,66,.55); border: 1px solid rgba(233,185,73,.25); border-radius: 10px; padding: 7px 4px; text-align: center; }
.result-stats strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: .7rem; color: var(--ink-dim); }
.sheet-body { background: linear-gradient(180deg, #19407f, #12306a); border: 1px solid rgba(233,185,73,.25); box-shadow: 0 18px 50px rgba(0,0,0,.45); }

/* ---------- wallet ---------- */
.wallet-card { background: linear-gradient(160deg, #fbfaf5, #efe9d8); color: var(--paper-ink); border-radius: 16px; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid rgba(233,185,73,.6); box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.wallet-card .wc-label { color: #6a6252; font-size: .82rem; font-weight: 600; letter-spacing: .02em; }
.wallet-card .wc-amount { font-size: 2.1rem; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1.12; }
.wallet-card.loading .wc-amount, .wallet-card.error .wc-amount { color: #a59c88; }
.wallet-card .wc-state { font-size: .8rem; color: #6a6252; min-height: 0; }
.wallet-card.error .wc-state { color: #b3261e; font-weight: 600; }
.wallet-card .wc-retry { align-self: flex-start; padding: 2px 0; color: #1d4590; font-weight: 700; }
.wallet-card .wc-phone { color: #4e4738; font-size: .85rem; margin-top: 2px; }
.wallet-note { margin: 0; }
.hist-seg { margin-bottom: 4px; }
.hist-seg button.on { background: var(--gold); color: #241a05; }
.list.hist li, .list.games li { padding: 8px 2px; }
.list li .l span { font-weight: 650; }
.badge { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .03em; padding: 1px 7px; border-radius: 999px; margin-top: 2px; text-transform: uppercase; }
.badge.ok { background: rgba(143,224,163,.16); color: #8fe0a3; }
.badge.wait { background: rgba(233,185,73,.16); color: var(--gold-2); }
.badge.bad { background: rgba(255,122,102,.16); color: #ff9a88; }
.badge.info { background: rgba(255,255,255,.1); color: var(--ink-dim); }
.list .r .badge { display: block; margin: 3px 0 0 auto; width: max-content; }
.list .state { justify-content: center; color: var(--ink-dim); border: 0; flex-direction: column; gap: 6px; text-align: center; padding: 18px 4px; }
.list .state button { width: auto; }
.more-btn { align-self: center; margin-top: 4px; }
.ref { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .74rem; letter-spacing: .03em; }

/* money / phone / share sheets */
.method { margin: 0; padding: 8px 12px; border-radius: 10px; background: rgba(10,28,66,.5); border: 1px solid rgba(233,185,73,.3); font-size: .9rem; }
.method b { color: var(--gold-2); }
.confirm-rows { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 10px 12px; border-radius: 10px; background: rgba(10,28,66,.5); border: 1px solid rgba(233,185,73,.3); }
.confirm-rows dt { color: var(--ink-dim); font-size: .88rem; }
.confirm-rows dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.confirm-rows dd.total { color: var(--gold-2); font-size: 1.05rem; }
.pay-status { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 6px 4px 2px; }
.pay-status .icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 900; }
.pay-status .icon.wait { border: 4px solid rgba(233,185,73,.25); border-top-color: var(--gold); animation: spin 1s linear infinite; }
.pay-status .icon.ok { background: #2e9d57; color: #fff; }
.pay-status .icon.bad { background: #c8322b; color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.pay-status strong { font-size: 1.05rem; }
.pay-status p { margin: 0; color: var(--ink-dim); font-size: .88rem; }
.share-who { display: flex; align-items: center; gap: 12px; }
.share-who .avatar { width: 44px; height: 44px; font-size: 24px; }

/* ---------- profile ---------- */
.acct-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.copy-btn { border: 1px solid rgba(233,185,73,.5); background: rgba(10,28,66,.5); color: var(--gold-2); border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 700; cursor: pointer; min-height: 28px; }
.copy-btn.done { background: #2e9d57; color: #fff; border-color: #2e9d57; }
.facts li b.missing { color: var(--ink-dim); font-weight: 600; font-style: italic; }
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.statgrid div { background: rgba(10,28,66,.5); border: 1px solid rgba(233,185,73,.2); border-radius: 10px; padding: 8px 4px; text-align: center; }
.statgrid strong { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.statgrid span { font-size: .72rem; color: var(--ink-dim); }
.res { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: .85rem; margin-right: 4px; }
.res.res-w { background: rgba(143,224,163,.18); color: #8fe0a3; }
.res.res-l { background: rgba(255,122,102,.18); color: #ff9a88; }
.res.res-d, .res.res-c { background: rgba(255,255,255,.1); color: var(--ink-dim); }
.wallet-card .wc-retry { border: 0; background: none; cursor: pointer; text-decoration: underline; width: auto; }
.list.games li .l { flex: 1; }
.signout { color: #ffb4a8; }

/* Empty discard pile at the start of a game: a faint slot showing where the first card goes */
.pile-stack:empty { border: 2px dashed rgba(233,185,73,.4); border-radius: 8px; }
.pile-stack:empty::after { content: "Play any card"; position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 6px;
  color: rgba(246,211,122,.75); font-size: 12px; font-weight: 700; line-height: 1.2; }

/* "↻ Pile reshuffled" above the deck when played cards are recycled */
.deck-note { position: absolute; left: 640px; top: 160px; width: 160px; text-align: center; z-index: 30; pointer-events: none; opacity: 0;
  color: var(--gold-2); font-size: 12px; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.deck-note.show { animation: bubble 2.2s ease-out; }

/* the card in play: a thin gold edge so it stands out on a busy table */
.pile-stack .pc:last-child .card { box-shadow: 0 0 0 2px rgba(233,185,73,.9), 0 3px 8px rgba(5,15,40,.4); }

/* ---------- after a cut: two felts, one per player ---------- */
#stage.cut-mode .table-felt:not(.cb-felt), #stage.cut-mode #top-card, #stage.cut-mode #hand, #stage.cut-mode #opp-hand,
#stage.cut-mode .status-line, #stage.cut-mode #emote-panel, #stage.cut-mode .deck-note { visibility: hidden; }
.cut-board { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.cut-board .cb-felt { left: 210px; width: 380px; height: 188px; animation: cbIn .35s ease-out; }
.cut-board .cb-felt.win { box-shadow: inset 0 0 0 2px rgba(233,185,73,.95), 0 0 24px 3px rgba(233,185,73,.35), inset 0 10px 28px rgba(0,0,0,.3); }
@keyframes cbIn { from { opacity: 0; transform: scale(.94); } }
.cut-board .cb-card { position: absolute; box-shadow: 0 2px 6px rgba(5,15,40,.4); }
.cut-board .cb-total { position: absolute; left: 330px; width: 140px; text-align: center; line-height: 1.05; z-index: 60; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.cut-board .cb-total span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--ink-dim); }
.cut-board .cb-total b { font-size: 26px; font-weight: 900; color: var(--ink); }
.cut-board .cb-total.win b { color: var(--gold-2); }
.cut-board .cb-total small { font-size: 12px; font-weight: 700; }
.cut-board .cb-result { position: absolute; left: 160px; top: 220px; width: 480px; height: 40px; line-height: 40px; text-align: center; z-index: 60;
  color: var(--gold-2); font-weight: 800; font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }

/* Chat (Telegram group) */
.chat-btn { left: 754px; top: 62px; display: grid; place-items: center; text-decoration: none; }
.chat-link { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center; }
.chat-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* ---------- game over panel: on the table, in the middle band (sizes are table units) ---------- */
.result-panel { position: absolute; left: 150px; top: 146px; width: 460px; height: 188px; z-index: 1100;
  display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 12px 16px; border-radius: 14px;
  background: linear-gradient(180deg, #19407f, #12306a); border: 1px solid rgba(233,185,73,.3); box-shadow: 0 12px 30px rgba(0,0,0,.5);
  animation: rise .2s ease-out; }
.result-panel[hidden] { display: none; }
.result-panel .rp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.result-panel #result-title { font-size: 22px; font-weight: 850; }
.result-panel .result-money { font-size: 14px; margin: 0; }
.result-panel #result-detail { font-size: 11.5px; margin: 0; line-height: 1.3; }
.result-panel .result-stats { gap: 5px; }
.result-panel .result-stats div { padding: 3px 2px; border-radius: 8px; }
.result-panel .result-stats strong { font-size: 14px; }
.result-panel .result-stats span { font-size: 9.5px; }
.result-panel .row2 { gap: 6px; }
.result-panel .btn { padding: 7px; font-size: 13px; border-radius: 8px; }
#stage.result-on .status-line { visibility: hidden; }
