/* Ifdika — the look.

   A card room, not a holiday house: green baize under warm light, a walnut rail,
   gold lettering, cream cards. Deliberately single-theme — a card table is the same
   colour at midnight as at noon — so there is no light mode to keep in step.
   Nothing here is shared with the Straddie app and nothing should be. */

:root {
  --felt: #0f5a40;
  --felt-deep: #083a2a;
  --felt-edge: #052b1f;
  --rail: #4a2e18;
  --rail-hi: #7a4f2b;
  --rail-lo: #2c1a0d;
  --gold: #e3b95a;
  --gold-hi: #f6dc93;
  --gold-lo: #9c7a2c;
  --cream: #f6efdd;
  --cream-dim: #d9cfb6;
  --ink: #1b1b20;
  --red: #c7322c;
  --red-hi: #e8544d;
  --blue: #3b7dd8;
  --chip-bg: #121a16;
  --text: #f3ead3;
  --muted: #a9b9ae;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --radius: 14px;
  --display: 'Cinzel', 'Times New Roman', serif;
  --loud: 'Bungee', 'Impact', 'Arial Black', sans-serif;
  --body: 'Nunito', -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--body); color: var(--text); font-size: 15px; line-height: 1.4;
  background: radial-gradient(ellipse at 50% 30%, var(--felt) 0%, var(--felt-deep) 60%, var(--felt-edge) 100%) fixed;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
a { color: var(--gold-hi); }

/* ---------- views ---------- */
.view { display: none; min-height: 100%; }
.view.on { display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }

/* ---------- brand bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20; padding-top: var(--safe-t);
  background: linear-gradient(180deg, var(--rail-hi), var(--rail) 55%, var(--rail-lo));
  box-shadow: 0 3px 0 var(--gold-lo), 0 6px 16px rgba(0,0,0,.5);
}
.bar .wrap { display: flex; align-items: center; gap: 10px; height: 54px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .14em; color: var(--gold); text-shadow: 0 1px 0 #000, 0 0 18px rgba(227,185,90,.35); }
.brand small { font-family: var(--body); font-weight: 600; letter-spacing: .18em; font-size: 9px; color: var(--cream-dim); display: block; margin-top: -4px; }
.bar .title { font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .06em; color: var(--gold-hi); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.bar .sub { display: block; font-family: var(--body); font-size: 11px; letter-spacing: .1em; color: var(--cream-dim); font-weight: 600; }
.ib { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-hi); position: relative; flex: none; }
.ib:active { background: rgba(255,255,255,.08); }
.ib svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ib .badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--rail); }
.spacer { flex: 1; }

/* ---------- lobby ---------- */
.lobby-body { flex: 1; padding-block: 16px calc(96px + var(--safe-b)); }
.hello { font-family: var(--display); color: var(--gold-hi); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; margin: 4px 0 12px; }
.section { margin: 18px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.section h2 { font-family: var(--display); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 0; }
.section .n { color: var(--muted); font-size: 12px; font-weight: 700; }
.gamecard {
  display: block; width: 100%; text-align: left; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(0,0,0,.18));
  border: 1px solid rgba(227,185,90,.35); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); position: relative; overflow: hidden; color: var(--text);
}
.gamecard:active { transform: translateY(1px); }
.gamecard.turn { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(227,185,90,.35); }
.gamecard .top { display: flex; align-items: center; gap: 10px; }
.gamecard .name { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--gold-hi); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gamecard .meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pill.go { background: var(--gold); color: var(--ink); animation: pulse 1.6s ease-in-out infinite; }
.pill.wait { background: rgba(255,255,255,.1); color: var(--cream-dim); }
.pill.done { background: rgba(0,0,0,.35); color: var(--gold-hi); border: 1px solid var(--gold-lo); }
.pill.chat { background: var(--red); color: #fff; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(227,185,90,.6); } 50% { box-shadow: 0 0 0 7px rgba(227,185,90,0); } }
.chips { display: flex; }
.chip { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 12px; color: var(--cream); background: var(--chip-bg); border: 2px solid var(--gold-lo); margin-left: -8px; box-shadow: 0 2px 6px rgba(0,0,0,.5); position: relative; }
.chip:first-child { margin-left: 0; }
.chip.bot { background: #2a2a30; border-style: dashed; color: var(--cream-dim); }
.chip.bot svg { width: 16px; height: 16px; }
.chip.me { border-color: var(--gold-hi); }
.empty { text-align: center; color: var(--muted); padding: 30px 16px; font-size: 14px; }
.empty b { display: block; color: var(--gold-hi); font-family: var(--display); font-size: 15px; letter-spacing: .08em; margin-bottom: 6px; }

.fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(72px + var(--safe-b)); z-index: 25;
  height: 52px; padding: 0 20px 0 16px; border-radius: 26px; display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); color: var(--ink);
  font-family: var(--display); font-weight: 700; letter-spacing: .08em; font-size: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.5);
}
.fab svg { width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 2.4; stroke-linecap: round; }
.fab:active { transform: scale(.97); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; justify-content: space-around;
  padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + var(--safe-b)) max(8px, env(safe-area-inset-right));
  background: linear-gradient(180deg, var(--rail-hi), var(--rail) 40%, var(--rail-lo)); box-shadow: 0 -3px 0 var(--gold-lo), 0 -6px 16px rgba(0,0,0,.5);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--cream-dim); font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border-radius: 10px; }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--gold-hi); }

/* ---------- score tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.tbl th { text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 8px 6px; border-bottom: 1px solid rgba(227,185,90,.35); font-weight: 800; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,.07); }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl .rank { font-family: var(--display); color: var(--gold); font-weight: 700; width: 28px; }
.tbl tr.me td { background: rgba(227,185,90,.08); }
.tbl .nm { font-weight: 800; }
.tbl .bust { color: var(--red-hi); font-weight: 800; }
.tblwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
.card-panel { background: rgba(0,0,0,.28); border: 1px solid rgba(227,185,90,.3); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.leagues .gamecard .name { font-size: 15px; }

/* ---------- table view ---------- */
.table.on { position: fixed; inset: 0; display: flex; flex-direction: column; }
.table .bar { position: relative; }
.table-main { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
/* the baize: seats round the top, the piles in the middle, yours at the bottom */
.baize { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 8px;
  padding: 10px max(8px, env(safe-area-inset-left)) 10px max(8px, env(safe-area-inset-right)); }
.seats { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 8px; }
.seat { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px 7px 8px; border-radius: 14px; position: relative;
  background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.14)); border: 1px solid rgba(227,185,90,.22); transition: box-shadow .3s, border-color .3s, background .3s; }
.seat.turn { border-color: var(--gold); background: linear-gradient(180deg, rgba(227,185,90,.16), rgba(0,0,0,.12)); box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(227,185,90,.35); }
.seat .head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.seat .head .chip { margin: 0; width: 26px; height: 26px; font-size: 10px; flex: none; }
.seat .head .chip.bot svg { width: 14px; height: 14px; }
.seat .head .nm { font-size: 12.5px; font-weight: 900; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .head .sc { font-family: var(--display); font-weight: 700; color: var(--gold-hi); font-size: 15px; line-height: 1; }
.seat .tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; min-height: 15px; }
.tag { padding: 1px 6px; border-radius: 6px; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.tag.d { background: var(--cream); color: var(--ink); }
.tag.down { background: var(--blue); color: #fff; }
.tag.up { background: var(--gold); color: var(--ink); animation: pulse 1.6s ease-in-out infinite; }

/* the backs of their hand, held in a fan; the number is on the front of it */
.backs { position: relative; height: 54px; margin: 2px auto 0; width: 100%; max-width: 150px; }
.backs .bk { position: absolute; left: 50%; bottom: 0; width: 26px; height: 38px; margin-left: -13px; border-radius: 4px; transform-origin: 50% 140%;
  background: var(--bk); box-shadow: 0 1px 3px rgba(0,0,0,.5), inset 0 0 0 2px var(--cream), inset 0 0 0 3px var(--gold-lo); }
.backs .n { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); min-width: 24px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--ink); color: var(--gold-hi); border: 2px solid var(--gold); font-weight: 900; font-size: 12px; display: grid; place-items: center; z-index: 2; }
.backs .n.last { background: var(--red); color: #fff; border-color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.backs.bump { animation: bump .45s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12) translateY(-3px); } 100% { transform: none; } }

/* each player's melds live in their own seat */
.seat .ml { display: flex; flex-wrap: wrap; gap: 6px 4px; justify-content: center; padding-top: 4px; border-top: 1px dashed rgba(227,185,90,.25); margin-top: 2px; min-height: 18px; }
.seat .ml .none, .myseg .none { font-size: 10.5px; color: rgba(246,239,221,.38); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 0; }
.centre { display: flex; flex-direction: column; align-items: center; }
.piles { display: flex; justify-content: center; align-items: flex-start; gap: 26px; padding: 6px 0 4px; }
.myseg { border-radius: 14px; padding: 8px 8px 12px; border: 1px dashed rgba(227,185,90,.45); background: rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 6px; transition: box-shadow .3s, border-color .3s; }
.myseg.turn { border-style: solid; border-color: var(--gold); box-shadow: 0 0 20px rgba(227,185,90,.25); }
.myseg .head { display: flex; align-items: center; gap: 6px; }
.myseg .head .chip { margin: 0; width: 26px; height: 26px; font-size: 10px; }
.myseg .head .nm { font-weight: 900; font-size: 12.5px; flex: 1; }
.myseg .head .sc { font-family: var(--display); color: var(--gold-hi); font-weight: 700; font-size: 15px; }
.myseg .ml { display: flex; flex-wrap: wrap; gap: 10px 6px; min-height: 30px; align-items: center; }
.pile { display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; }
.pile .lbl { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.pile .lbl b { color: var(--cream); }
.pile .slot { position: relative; width: 62px; height: 88px; }
.pile .slot .card { position: absolute; left: 0; top: 0; }
.pile .slot .card:nth-child(2) { transform: translate(2px, -2px); }
.pile .slot .card:nth-child(3) { transform: translate(4px, -4px); }
.pile .empty-slot { width: 62px; height: 88px; border: 2px dashed rgba(246,239,221,.3); border-radius: 7px; display: grid; place-items: center; color: rgba(246,239,221,.35); font-size: 10px; text-align: center; font-weight: 800; letter-spacing: .06em; }
.pile.can .slot, .pile.can .empty-slot { animation: glow 1.4s ease-in-out infinite; border-radius: 8px; cursor: pointer; }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 rgba(227,185,90,.0), 0 0 14px rgba(227,185,90,.3); } 50% { box-shadow: 0 0 0 3px rgba(227,185,90,.6), 0 0 26px rgba(227,185,90,.6); } }
.turnbar { text-align: center; font-size: 12.5px; color: var(--cream-dim); font-weight: 700; letter-spacing: .04em; padding: 2px 0 6px; min-height: 24px; }
.turnbar b { color: var(--gold-hi); font-family: var(--display); letter-spacing: .08em; }
.turnbar .nudge { margin-left: 8px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--gold-lo); color: var(--gold-hi); font-size: 11px; font-weight: 800; }

.melds { flex: 1; min-height: 70px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 8px; display: flex; flex-direction: column; gap: 8px; }
.meldgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.meldgroup .who { width: 100%; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 800; display: flex; align-items: center; gap: 6px; }
.meldgroup .who i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--gold-lo); }
.meld { display: flex; padding: 3px 3px 9px 0; border-radius: 8px; border: 1px solid transparent; position: relative; transition: box-shadow .25s, border-color .25s, background .25s; }
.meld .card { margin-left: -22px; }
.meld .card.xs { margin-left: -19px; }
.meld .card:first-child { margin-left: 3px; }
.meld.can { border-color: var(--gold); background: rgba(227,185,90,.12); box-shadow: 0 0 16px rgba(227,185,90,.35); cursor: pointer; }
.meld.claim { border-color: var(--blue); background: rgba(59,125,216,.14); box-shadow: 0 0 16px rgba(59,125,216,.4); cursor: pointer; }
.meld.new { animation: land .5s ease-out; }
@keyframes land { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.nomelds-unused { color: rgba(246,239,221,.4); font-size: 12.5px; text-align: center; padding: 14px 0; font-weight: 700; letter-spacing: .04em; }

/* ---------- cards ---------- */
.card {
  width: 62px; height: 88px; border-radius: 7px; background: var(--cream); color: var(--ink); position: relative; flex: none;
  box-shadow: 0 2px 4px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.08); font-family: var(--body); will-change: transform;
}
.card.sm { width: 46px; height: 66px; border-radius: 5px; }
.card.red { color: var(--red); }
.card .r { position: absolute; top: 4px; left: 6px; font-weight: 900; font-size: 17px; line-height: 1; letter-spacing: -.02em; }
.card .s { position: absolute; top: 22px; left: 6px; font-size: 14px; line-height: 1; }
.card .big { position: absolute; right: 7px; bottom: 5px; font-size: 30px; line-height: 1; opacity: .9; }
.card.sm .r { font-size: 14px; top: 3px; left: 4px; }
.card.sm .s { font-size: 11px; top: 18px; left: 4px; }
.card.sm .big { font-size: 22px; right: 5px; bottom: 4px; }
.card.xs { width: 34px; height: 48px; border-radius: 4px; }
.card.xs .r { font-size: 12px; top: 2px; left: 3px; }
.card.xs .s { font-size: 9.5px; top: 15px; left: 3px; }
.card.xs .big { font-size: 15px; right: 3px; bottom: 3px; }
.card.xs .as { font-size: 8px; padding: 1px 4px; bottom: -7px; }
.card.wild { background: linear-gradient(160deg, #fff7df, var(--cream) 50%, #f2dca3); box-shadow: 0 2px 4px rgba(0,0,0,.45), inset 0 0 0 2px var(--gold); }
.card.wild .big { color: var(--gold-lo); }
.card .as { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); background: var(--ink); color: var(--gold-hi); font-size: 9.5px; font-weight: 900; padding: 2px 6px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--gold); letter-spacing: .02em; }
.card .as.red { color: #fff; background: var(--red); border-color: #fff; }
.card.back { background: var(--bk); box-shadow: 0 2px 4px rgba(0,0,0,.45), inset 0 0 0 3px var(--cream), inset 0 0 0 4px var(--gold-lo); }
.card.back::after { content: ''; position: absolute; inset: 8px; border: 1px solid rgba(227,185,90,.6); border-radius: 4px; }
.card.sel { transform: translateY(-16px); box-shadow: 0 10px 18px rgba(0,0,0,.5), 0 0 0 2px var(--gold), inset 0 0 0 1px rgba(0,0,0,.08); }
.card.drawn::before { content: ''; position: absolute; inset: -3px; border-radius: 9px; border: 2px solid var(--blue); pointer-events: none; }
.card.fly { transition: transform .45s cubic-bezier(.2,.8,.2,1); }

/* ---------- my hand ---------- */
.hand-area { background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.35)); padding: 6px 0 0; border-top: 1px solid rgba(227,185,90,.25); }
.hand-tools { display: flex; align-items: center; gap: 8px; padding: 0 max(12px, env(safe-area-inset-left)) 4px max(12px, env(safe-area-inset-right)); font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hand-tools .pts { color: var(--gold-hi); }
.hand-tools .sort { margin-left: auto; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--gold-lo); color: var(--gold-hi); }
.hand { display: flex; padding: 18px 10px 8px; overflow-x: auto; scrollbar-width: none; min-height: 112px; --ov: -24px; }
.hand::-webkit-scrollbar { display: none; }
.hand .fan { display: flex; margin: 0 auto; flex: none; }
.hand .card { margin-left: var(--ov); transition: transform .18s ease; }
.hand .card:first-child { margin-left: 0; }
.actions .btn { width: auto; }
.actions { display: flex; gap: 8px; padding: 4px max(12px, env(safe-area-inset-left)) calc(10px + var(--safe-b)) max(12px, env(safe-area-inset-right)); min-height: calc(62px + var(--safe-b)); align-items: center; }
.btn { width: 100%; flex: 1; height: 46px; border-radius: 12px; font-family: var(--display); font-weight: 700; letter-spacing: .08em; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); box-shadow: 0 5px 12px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.5); }
.btn:disabled { opacity: .35; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.red { background: linear-gradient(180deg, var(--red-hi), var(--red) 55%, #8d1f1b); color: #fff; }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--gold-hi); box-shadow: none; border: 1px solid var(--gold-lo); }
.hint { flex: 1; text-align: center; font-size: 12.5px; color: var(--cream-dim); font-weight: 700; }
.hint b { color: var(--gold-hi); }

/* ---------- sheets & popups ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86vh; display: flex; flex-direction: column; transform: translateY(105%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  background: linear-gradient(180deg, #1c2a24, #101a16); border-radius: 18px 18px 0 0; border-top: 2px solid var(--gold); box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
.sheet.on { transform: none; }
.sheet .sh { display: flex; align-items: center; gap: 10px; padding: 12px 16px 8px; }
.sheet .sh h3 { margin: 0; font-family: var(--display); color: var(--gold); letter-spacing: .1em; font-size: 15px; text-transform: uppercase; flex: 1; }
.sheet .sb { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(16px + var(--safe-b)); }
.x { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--cream-dim); background: rgba(255,255,255,.08); font-size: 18px; }
.field { margin: 10px 0 14px; }
.field label { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field select { width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--gold-lo); background: rgba(0,0,0,.3); color: var(--text); padding: 0 12px; outline: none; }
.field input:focus { border-color: var(--gold); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--gold-lo); color: var(--cream-dim); font-weight: 800; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.pick.on { background: var(--gold); color: var(--ink); border-color: var(--gold-hi); }
.pick .chip { width: 22px; height: 22px; font-size: 10px; margin: 0; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold-lo); color: var(--gold-hi); font-size: 20px; font-weight: 800; }
.stepper b { font-family: var(--display); font-size: 22px; color: var(--gold-hi); min-width: 30px; text-align: center; }
.stepper small { color: var(--muted); font-size: 12px; }
.note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* chat */
.chatlog { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 10px; min-height: 120px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.08); font-size: 14px; line-height: 1.35; -webkit-user-select: text; user-select: text; }
.msg .who { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); display: block; margin-bottom: 2px; }
.msg.me { align-self: flex-end; background: rgba(227,185,90,.2); border: 1px solid rgba(227,185,90,.3); }
.msg.sys { align-self: center; background: none; color: var(--muted); font-size: 12px; font-style: italic; }
.chatin { display: flex; gap: 8px; padding: 8px 16px calc(12px + var(--safe-b)); border-top: 1px solid rgba(227,185,90,.25); }
.chatin input { flex: 1; height: 44px; border-radius: 22px; border: 1px solid var(--gold-lo); background: rgba(0,0,0,.3); color: var(--text); padding: 0 16px; outline: none; }
.chatin button { width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; }
.chatin button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* toasts (move narration) */
.toasts { position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: rgba(10,18,14,.92); border: 1px solid var(--gold-lo); color: var(--cream); padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); animation: tin .3s ease-out; max-width: 100%; text-align: center; }
.toast.err { border-color: var(--red-hi); color: #ffd9d7; }
@keyframes tin { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* the big popups */
.pop { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.6); }
.pop.on { display: flex; }
.popin { width: min(92vw, 440px); max-height: 86vh; overflow-y: auto; background: linear-gradient(180deg, #1f2d26, #0f1a15); border: 2px solid var(--gold); border-radius: 20px; padding: 20px 18px calc(18px + var(--safe-b)); box-shadow: 0 20px 60px rgba(0,0,0,.7), 0 0 60px rgba(227,185,90,.2); animation: popin .45s cubic-bezier(.2,1.4,.3,1); text-align: center; }
@keyframes popin { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.popin h2 { font-family: var(--display); color: var(--gold); letter-spacing: .12em; font-size: 20px; margin: 0 0 4px; text-transform: uppercase; }
.popin p { margin: 6px 0; color: var(--cream-dim); }
.popin .tbl { margin: 10px 0 14px; }
.popin .btn { width: 100%; margin-top: 8px; }
.splash { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; pointer-events: none; }
.splash.on { display: flex; }
.splash .word { font-family: var(--loud); font-size: clamp(44px, 14vw, 96px); color: var(--gold-hi); text-shadow: 0 0 30px rgba(246,220,147,.8), 0 6px 0 var(--gold-lo), 0 10px 30px rgba(0,0,0,.7); animation: zap .9s cubic-bezier(.2,1.6,.3,1); letter-spacing: .02em; text-align: center; line-height: .95; padding: 0 12px; }
.splash .word.bust { color: var(--red-hi); text-shadow: 0 0 30px rgba(232,84,77,.8), 0 6px 0 #6d1512, 0 10px 30px rgba(0,0,0,.7); transform: rotate(-8deg); }
.splash .word small { display: block; font-family: var(--display); font-size: 16px; letter-spacing: .2em; color: var(--cream); text-shadow: 0 2px 6px #000; margin-top: 6px; }
@keyframes zap { 0% { transform: scale(.2) rotate(-10deg); opacity: 0; } 60% { transform: scale(1.15) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
.stamp { display: inline-block; font-family: var(--loud); color: var(--red-hi); border: 3px solid var(--red-hi); padding: 2px 8px; border-radius: 6px; font-size: 12px; transform: rotate(-6deg); letter-spacing: .04em; }
.trophy { width: 90px; height: 90px; margin: 0 auto 6px; }
.confetti { position: fixed; inset: 0; z-index: 65; pointer-events: none; }

/* sign-in gate */
.gate { flex: 1; display: grid; place-items: center; padding: 30px 20px calc(30px + var(--safe-b)); }
.gatein { width: 100%; max-width: 340px; text-align: center; }
.gate .brand { font-size: 40px; margin-bottom: 18px; }
.gform { text-align: left; background: rgba(0,0,0,.28); border: 1px solid var(--gold-lo); border-radius: var(--radius); padding: 18px 16px 14px; box-shadow: var(--shadow); }
.gform h2 { margin: 0 0 4px; font-family: var(--display); color: var(--gold); font-size: 18px; letter-spacing: .06em; text-wrap: balance; }
.gform .lead { margin: 0 0 6px; color: var(--cream-dim); font-size: 14px; }
.gform .btn { margin-top: 6px; }
.gform .field { margin: 10px 0 12px; }
.gswap { text-align: center; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.linkish { color: var(--gold-hi); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.gnote { margin: 14px auto 0; max-width: 320px; font-size: 12.5px; color: var(--muted); }
.gwarn { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(199,50,44,.18); border: 1px solid rgba(232,84,77,.5); color: var(--cream); font-size: 13px; }

/* the "you" menu */
.menu { display: grid; gap: 8px; margin: 4px 0 6px; }
.menu > button { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--gold-lo); background: rgba(255,255,255,.04); font-weight: 800; color: var(--cream); }
.menu > button small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; margin-top: 2px; }
.menu > button:active { background: rgba(227,185,90,.15); }
.menu > button.out { color: var(--red-hi); border-color: rgba(232,84,77,.45); }
.linkbox { display: flex; gap: 8px; margin: 8px 0; }
.linkbox input { flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--gold-lo); background: rgba(0,0,0,.3); color: var(--text); padding: 0 10px; font-size: 13px; }
.linkbox .btn { flex: none; width: auto; padding: 0 14px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(156,122,44,.3); }
.prow .chip { margin: 0; flex: none; }
.prow .who { flex: 1; min-width: 0; }
.prow .who b { display: block; }
.prow .who small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow.off .who b { text-decoration: line-through; color: var(--muted); }
.prow .acts { display: flex; gap: 6px; flex: none; }
.prow .acts button { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--gold-lo); font-size: 12px; font-weight: 800; color: var(--gold-hi); }

/* picker rows inside popups */
.choice { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px; border-radius: 12px; border: 1px solid var(--gold-lo); margin: 8px 0; width: 100%; }
.choice:active { background: rgba(227,185,90,.15); }
.choice .card { margin-left: -16px; }
.choice .card:first-child { margin-left: 0; }
.suitrow { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.suitrow button, .rankrow button { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--gold-lo); font-weight: 900; font-size: 16px; background: var(--cream); color: var(--ink); }
.suitrow button.red, .rankrow button.red { color: var(--red); }
.suitrow button.on, .rankrow button.on { box-shadow: 0 0 0 3px var(--gold); }
.rankrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
.rankrow button { width: 36px; height: 36px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-height: 640px) { .card { width: 54px; height: 76px; } .pile .slot, .pile .empty-slot { width: 54px; height: 76px; } .hand { min-height: 98px; padding-top: 14px; } }

/* The piles give up a little height so your own segment stays in view. */
.centre .card, .centre .pile .slot, .centre .pile .empty-slot { width: 52px; height: 74px; }
.centre .card .big { font-size: 26px; }
.centre .piles { gap: 22px; padding-top: 2px; }
.seat .ml .meld { padding-bottom: 8px; }

/* Seats line up by their tops rather than all stretching to the tallest one. */
.seats { align-items: start; }
/* The pot and throw-outs stay in reach however many seats there are: they ride the
   bottom of the table while the seats scroll behind them. */
.centre { position: sticky; bottom: -10px; z-index: 3; margin: 0 -8px; padding: 6px 8px 8px;
  background: linear-gradient(180deg, rgba(8,58,42,0), rgba(8,58,42,.92) 22%, rgba(8,58,42,.97)); }
/* A big table: smaller seats so more of them fit. */
.seats.compact { gap: 6px; }
.seats.compact .seat { padding: 6px 5px; gap: 3px; }
.seats.compact .backs { height: 42px; max-width: 110px; }
.seats.compact .backs .bk { width: 20px; height: 30px; margin-left: -10px; }
.seats.compact .backs .n { min-width: 20px; height: 19px; font-size: 11px; }
.seats.compact .seat .head .chip { width: 22px; height: 22px; }
.seats.compact .seat .head .nm { font-size: 11.5px; }
.seats.compact .tags:empty { display: none; }

/* ---------- card backs ----------
   Each is a pattern you'd find on a real deck, drawn in CSS so it stays crisp at
   every size from the pot down to a thumbnail fan. The class sits on any element
   and everything inside it that is a back picks it up. */
:root, .bk-baize { --bk: repeating-linear-gradient(135deg, #1f6e52 0 3px, #0f4d3a 3px 6px); }
.bk-claret { --bk: repeating-conic-gradient(#a3222d 0 25%, #74141e 0 50%) 0 0/7px 7px; }
.bk-navy { --bk: repeating-linear-gradient(45deg, #3b62a8 0 1.5px, transparent 1.5px 6px), repeating-linear-gradient(-45deg, #3b62a8 0 1.5px, transparent 1.5px 6px), #142a52; }
.bk-walnut { --bk: repeating-radial-gradient(ellipse at 15% 130%, #7a4f2b 0 2px, #5a3820 2px 5px, #6a4425 5px 7px); }
.bk-gilt { --bk: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(90,60,10,.25) 0 1px, transparent 1px 5px), linear-gradient(160deg, #f6dc93, #c9a14a 55%, #9c7a2c); }
.bk-tartan { --bk: repeating-linear-gradient(90deg, rgba(12,50,32,.6) 0 4px, transparent 4px 6px, rgba(255,226,140,.45) 6px 7px, transparent 7px 12px), repeating-linear-gradient(0deg, rgba(12,50,32,.6) 0 4px, transparent 4px 6px, rgba(255,226,140,.45) 6px 7px, transparent 7px 12px), #a8262c; }
.bk-midnight { --bk: radial-gradient(circle, #f6dc93 0 .8px, transparent 1.3px) 0 0/9px 9px, radial-gradient(circle, rgba(246,239,221,.75) 0 .6px, transparent 1px) 4px 5px/13px 11px, linear-gradient(180deg, #232a5c, #0c0f26); }
.bk-jet { --bk: repeating-linear-gradient(90deg, rgba(227,185,90,.6) 0 1px, transparent 1px 5px), #141418; }
.bk-rose { --bk: radial-gradient(circle, #f6efdd 0 1.3px, transparent 1.8px) 0 0/7px 7px, radial-gradient(circle, #f6efdd 0 1.3px, transparent 1.8px) 3.5px 3.5px/7px 7px, #c4506e; }
.bk-tide { --bk: radial-gradient(circle at 50% 100%, transparent 0 3.5px, #79c7d8 3.5px 4.6px, transparent 5px) 0 0/9px 6px, linear-gradient(180deg, #1d6b84, #0f3e52); }

.swatch { display: block; width: 20px; height: 28px; border-radius: 3px; background: var(--bk); box-shadow: inset 0 0 0 1.5px var(--cream), inset 0 0 0 2.5px var(--gold-lo), 0 1px 3px rgba(0,0,0,.5); }
.swatch.sm { width: 13px; height: 18px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--cream), 0 1px 2px rgba(0,0,0,.5); }
.hand-tools .deck { margin-left: 0; padding: 2px 7px; display: grid; place-items: center; }
.backpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 14px 10px; padding: 4px 0 8px; }
.backpick button { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; color: var(--cream-dim); padding: 8px 0 6px; border-radius: 12px; border: 1px solid transparent; }
.backpick button .card { pointer-events: none; }
.backpick button.on { border-color: var(--gold); background: rgba(227,185,90,.1); color: var(--gold-hi); box-shadow: 0 0 18px rgba(227,185,90,.25); }
.backpick button:active { transform: scale(.97); }
.backnote { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }

/* ---------- arranging your own hand ---------- */
.hand .fan { position: relative; }
.hand .card { touch-action: none; }
.hand .card.drag { z-index: 30; transition: none !important; box-shadow: 0 16px 28px rgba(0,0,0,.55), 0 0 0 2px var(--gold-hi); cursor: grabbing; }
.hand .card.slide { transition: transform .2s cubic-bezier(.2,.8,.2,1); }

/* ---------- a big table: everyone round the rail ----------
   At five or more players there isn't room for a full seat each, so the others sit
   as pods round the far rail, poker-room style (backs of their hand, how many,
   their score), and whoever has put down gets a segment below for their melds. */
.seats.ring { display: flex; flex-direction: column; gap: 8px; }
.rail { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; padding: 4px 2px 22px; }
.rail::before { content: ''; position: absolute; left: -2px; right: -2px; top: 26px; bottom: 0; border-radius: 50% 50% 0 0 / 70% 70% 0 0;
  border: 2px solid rgba(227,185,90,.28); border-bottom: 0; background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.05), transparent 70%); pointer-events: none; }
.pod { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 1px 4px; border-radius: 12px; transform: translateY(var(--y, 0)); transition: background .3s, box-shadow .3s; }
.pod.turn { background: rgba(227,185,90,.16); box-shadow: 0 0 0 1.5px var(--gold), 0 0 18px rgba(227,185,90,.4); }
.pod .backs { height: 40px; max-width: 54px; margin: 0; }
.pod .backs .bk { width: 19px; height: 27px; margin-left: -9.5px; border-radius: 3px; transform-origin: 50% 170%; box-shadow: 0 1px 2px rgba(0,0,0,.5), inset 0 0 0 1.5px var(--cream); }
.pod .backs .n { min-width: 20px; height: 18px; font-size: 11px; bottom: -5px; padding: 0 4px; border-width: 1.5px; }
.pod .pn { margin-top: 4px; max-width: 100%; font-size: 10.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; border-bottom: 2px solid var(--pc, var(--gold-lo)); line-height: 1.25; }
.pod .ps { font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--gold-hi); line-height: 1; display: flex; align-items: center; gap: 3px; }
.pod .ps i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.pod .dbtn { position: absolute; top: 0; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--cream); color: var(--ink); font-size: 8.5px; font-weight: 900; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.6), inset 0 0 0 1.5px var(--gold-lo); z-index: 3; }
.pod .upflag { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--ink); font-size: 8px; font-weight: 900; letter-spacing: .08em; padding: 1px 5px; border-radius: 5px; z-index: 3; animation: pulse 1.6s ease-in-out infinite; }
.segs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.seg { min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 3px; padding: 5px 6px 4px; border-radius: 10px; background: rgba(0,0,0,.22); border: 1px solid rgba(227,185,90,.2); border-left: 3px solid var(--pc, var(--gold-lo)); transition: box-shadow .3s; }
.seg.flash { animation: segflash 1.1s ease-out; }
@keyframes segflash { 0%, 40% { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(227,185,90,.55); } 100% { box-shadow: none; } }
.seg .sh2 { font-size: 9.5px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--cream-dim); }
.seg .sm2 { display: flex; flex-wrap: wrap; gap: 5px 3px; }
.segs .none { font-size: 10.5px; color: rgba(246,239,221,.38); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 0; }
