/* Classics — a games parlour after dark: plum walls, lacquer-red turn marker,
   brass details. Each game brings its own surface (wood board, teal baize,
   chalkboard) inside .c-stage. One dark theme on purpose: it's a room. */
:root {
  --plum: #24162a;
  --plum-2: #31203a;
  --plum-3: #44304f;
  --line: rgba(243, 234, 217, 0.14);
  --ivory: #f3ead9;
  --muted: #bfaec6;
  --lacquer: #d2473b;
  --lacquer-2: #f06a5c;
  --brass: #d9b26a;
  --baize: #1d5e5a;
  --baize-2: #154744;
  --wood-l: #d3a56d;
  --wood-d: #6e4325;
  --good: #5cc28a;
  --bad: #ef6b5e;
  --f-display: 'Young Serif', Georgia, 'Times New Roman', serif;
  --f-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-s: 8px; --r-m: 14px; --r-l: 22px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--plum); color: var(--ivory);
  font: 16px/1.5 var(--f-ui);
  background-image: radial-gradient(120% 60% at 50% 0%, #3a2343 0%, rgba(36, 22, 42, 0) 70%);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
body.busy .c-actions button, body.busy .c-stage button { cursor: progress; }

/* ---------- top bar ---------- */
.c-top { display: flex; align-items: center; gap: 10px; max-width: 1040px; margin: 0 auto; padding: 12px 16px; }
.c-back { color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.c-back:hover { color: var(--ivory); }
.c-name { font-family: var(--f-display); font-size: 1.15rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-code { background: var(--plum-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em; }
.c-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--plum-2); border: 1px solid var(--line); }
.c-icon.off { opacity: 0.45; text-decoration: line-through; }
.c-main { max-width: 1040px; margin: 0 auto; padding: 0 16px 32px; }

/* ---------- buttons & fields ---------- */
.c-btn {
  border: 1px solid var(--line); background: var(--plum-3); border-radius: var(--r-m); padding: 11px 16px; font-weight: 700;
  min-height: 44px; transition: background 0.15s, transform 0.08s;
}
.c-btn:hover:not(:disabled) { background: #523b5e; }
.c-btn:active:not(:disabled) { transform: translateY(1px); }
.c-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.c-primary { background: var(--lacquer); border-color: transparent; color: #fff; }
.c-primary:hover:not(:disabled) { background: var(--lacquer-2); }
.c-link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 8px 4px; }
.c-link:hover { color: var(--ivory); }
.c-row { display: flex; gap: 10px; flex-wrap: wrap; }
.c-row > * { flex: 1 1 140px; }
.c-field { display: grid; gap: 6px; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.c-field input, .c-field select, .c-join input {
  background: #1a0f1f; border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; color: var(--ivory); font-weight: 600; min-height: 44px;
}
.c-inline { grid-template-columns: 1fr auto; align-items: center; }
.c-inline select { min-width: 9.5rem; }
.c-error { color: var(--bad); min-height: 1.4em; margin: 0; font-weight: 600; }

/* ---------- start screen ---------- */
.c-menu { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px 40px; align-items: start; padding-top: 24px; }
.c-hero h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(2.6rem, 8vw, 4.6rem); line-height: 1; margin: 0 0 14px; letter-spacing: -0.01em; }
.c-tag { font-size: 1.25rem; margin: 0 0 6px; max-width: 30ch; }
.c-players { color: var(--brass); margin: 0; font-weight: 600; }
.c-panel { background: var(--plum-2); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; display: grid; gap: 12px; grid-row: span 2; }
.c-opts { display: grid; gap: 10px; }
.c-join { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.c-join input { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 800; }
.c-rules { max-width: 60ch; }
.c-rules summary { font-family: var(--f-display); font-size: 1.2rem; cursor: pointer; margin-bottom: 6px; }
.c-rules ul { margin: 0; padding-left: 1.2rem; color: var(--muted); display: grid; gap: 6px; }

/* ---------- waiting room ---------- */
.c-wait { max-width: 560px; margin: 24px auto 0; display: grid; gap: 14px; justify-items: center; text-align: center; }
.c-wait-lead { margin: 0; color: var(--muted); max-width: 44ch; }
.c-bigcode {
  font: 400 clamp(2.6rem, 12vw, 4rem)/1 var(--f-display); letter-spacing: 0.18em; padding: 14px 22px 14px 32px; border-radius: var(--r-l);
  background: var(--plum-2); border: 1px dashed var(--brass); color: var(--brass);
}
.c-seats { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; text-align: left; }
.c-seats li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-m); background: var(--plum-2); border: 1px solid var(--line); font-weight: 700; }
.c-seats li.me { border-color: var(--brass); }
.c-seats li.empty { color: var(--muted); font-weight: 500; border-style: dashed; background: none; }
.c-seats i { font-style: normal; font-weight: 600; font-size: 0.78rem; color: var(--muted); background: var(--plum-3); padding: 1px 8px; border-radius: 999px; }
.c-host { width: 100%; display: grid; gap: 12px; text-align: left; }
.c-wait-note { color: var(--muted); margin: 0; }
.c-av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brass); color: #2b1a10; font-weight: 800; flex: none; text-transform: uppercase; font-size: 0.9rem; }

/* ---------- the table ---------- */
.c-table { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.c-table > * { min-width: 0; }
.c-players { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.c-players::-webkit-scrollbar { display: none; }
.c-players li {
  flex: 1 0 auto; min-width: 118px; max-width: 220px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 8px 10px; border-radius: var(--r-m); background: var(--plum-2); border: 2px solid transparent; transition: border-color 0.2s;
}
.c-players li .c-av { grid-row: span 2; }
.c-players li.me { background: var(--plum-3); }
.c-players li.turn { border-color: var(--lacquer); box-shadow: 0 0 0 4px rgba(210, 71, 59, 0.18); }
.c-players li.won { border-color: var(--brass); }
.c-players li.away { opacity: 0.6; }
.c-pn { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.c-pn i { font-style: normal; font-size: 0.7rem; font-weight: 700; color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.c-pi { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.c-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; border-radius: var(--r-m); background: #1a0f1f; font-weight: 700; min-height: 42px; }
.c-status.mine { background: var(--lacquer); color: #fff; }
.c-clock { font-variant-numeric: tabular-nums; font-weight: 800; }
.c-clock.low { color: #ffd2cc; }
.c-status:not(.mine) .c-clock.low { color: var(--bad); }
.c-stage { position: relative; min-height: 200px; }
.c-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; min-height: 0; }
.c-actions:empty { display: none; }
.c-actions .c-btn { flex: 0 1 auto; min-width: 120px; }
.c-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.c-last { flex: 1 1 260px; margin: 0; color: var(--muted); font-size: 0.92rem; }
.c-last b { color: var(--ivory); }

/* ---------- dialogs & toasts ---------- */
.c-dialog { background: var(--plum-2); color: var(--ivory); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px; width: min(440px, calc(100vw - 32px)); max-height: 80vh; }
.c-dialog::backdrop { background: rgba(10, 4, 12, 0.6); }
.c-dialog h2 { font: 400 1.7rem/1.1 var(--f-display); margin: 0 0 10px; }
.c-log { margin: 0 0 14px; padding-left: 1.2rem; display: grid; gap: 6px; max-height: 50vh; overflow: auto; color: var(--muted); }
.c-log b { color: var(--ivory); }
.c-result { text-align: center; display: none; }
.c-result[open] { display: grid; gap: 10px; }
.c-result h2 { font-size: 2.2rem; }
.c-scores { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; text-align: left; }
.c-scores li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: var(--r-s); background: var(--plum-3); }
.c-scores li.won { outline: 2px solid var(--brass); }
.c-toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(420px, calc(100vw - 32px)); }
.c-toast { background: #120a15; border: 1px solid var(--line); padding: 10px 14px; border-radius: var(--r-m); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); font-weight: 600; }
.c-toast.bad { border-color: var(--bad); }

/* ---------- playing cards (shared) ---------- */
.card {
  --w: 64px; width: var(--w); height: calc(var(--w) * 1.42); border-radius: calc(var(--w) * 0.1); background: #fbf7ef; color: #1d1a20;
  position: relative; display: inline-flex; flex-direction: column; justify-content: space-between; padding: calc(var(--w) * 0.07) calc(var(--w) * 0.09);
  font: 800 calc(var(--w) * 0.3)/1 var(--f-ui); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 6px 14px rgba(0, 0, 0, 0.25); flex: none; user-select: none;
}
.card.red { color: #c0262d; }
.card .s { align-self: flex-end; font-size: calc(var(--w) * 0.42); line-height: 0.9; }
.card.back { background: repeating-linear-gradient(45deg, #7a2f3b 0 6px, #8d3846 6px 12px); border: 3px solid #fbf7ef; }
.card.back > * { display: none; }
.card.small { --w: 44px; }
.card.tiny { --w: 32px; }
button.cardbtn { padding: 0; border: 0; background: none; border-radius: 8px; transition: transform 0.12s; }
button.cardbtn:disabled { cursor: default; }
button.cardbtn:disabled .card { filter: brightness(0.72) saturate(0.6); }
button.cardbtn.ok:not(:disabled):hover { transform: translateY(-6px); }
button.cardbtn.sel { transform: translateY(-14px); }
button.cardbtn.sel .card { outline: 3px solid var(--brass); outline-offset: 1px; }
.hand { display: flex; gap: 6px; overflow-x: auto; padding: 18px 6px 8px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; justify-content: safe center; }
.hand > * { scroll-snap-align: start; }
.felt { background: radial-gradient(ellipse at 50% 30%, var(--baize) 0%, var(--baize-2) 75%); border-radius: var(--r-l); padding: 14px; border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35); }
.pile { display: grid; justify-items: center; gap: 4px; font-size: 0.8rem; color: #cfe7e2; font-weight: 700; }
.pile button { padding: 0; border: 0; background: none; border-radius: 8px; }
.pile button:disabled { cursor: default; }
.pile button.ok:not(:disabled) .card { outline: 3px solid var(--brass); }
.chip-line { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 760px) {
  .c-menu { grid-template-columns: 1fr; gap: 18px; padding-top: 8px; }
  .c-panel { grid-row: auto; }
  .c-hero h1 { margin-bottom: 8px; }
  .c-tag { font-size: 1.1rem; }
  .card { --w: 54px; }
  .c-players li { min-width: 104px; padding: 6px 8px; }
  .c-actions .c-btn { flex: 1 1 40%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- checkers & reversi boards ---------- */
.ck-board, .rv-board {
  --cell: min(11vw, 64px); display: grid; grid-template-columns: repeat(8, var(--cell)); grid-auto-rows: var(--cell);
  width: max-content; margin: 0 auto; border: 10px solid var(--wood-d); border-radius: 12px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}
.ck-board .sq { border: 0; padding: 0; display: grid; place-items: center; position: relative; }
.ck-board .l { background: var(--wood-l); }
.ck-board .d { background: #7b4a2a; }
.ck-board .d.can { box-shadow: inset 0 0 0 3px rgba(217, 178, 106, 0.6); }
.ck-board .d.last { background: #8f5a35; }
.ck-board .d.sel { background: #a0683d; box-shadow: inset 0 0 0 3px var(--brass); }
.ck-board .d.target::after { content: ''; width: 30%; height: 30%; border-radius: 50%; background: var(--brass); opacity: 0.85; }
.pc { width: 78%; height: 78%; border-radius: 50%; position: relative; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), inset 0 -4px 0 rgba(0, 0, 0, 0.18); }
.pc.dk { background: radial-gradient(circle at 35% 30%, #4d4450, #18121b); }
.pc.lt { background: radial-gradient(circle at 35% 30%, #fff5e4, #d9c7a5); }
.pc.king::after { content: '♛'; position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cell) * 0.38); color: var(--brass); }
.ck-board .target .pc { display: none; }
.rv-board { background: #1f6b4f; border-color: #3a2416; gap: 1px; }
.rv-sq { border: 0; padding: 0; background: #23785a; display: grid; place-items: center; }
.rv-sq.can { cursor: pointer; }
.rv-sq.can::after { content: ''; width: 22%; height: 22%; border-radius: 50%; background: rgba(243, 234, 217, 0.45); }
.rv-sq.can:hover::after { background: var(--brass); }
.rv-sq.last { background: #2c8c69; }
.disc { width: 80%; height: 80%; border-radius: 50%; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.disc.b { background: radial-gradient(circle at 35% 30%, #4a4a52, #0d0d12); }
.disc.w { background: radial-gradient(circle at 35% 30%, #ffffff, #d8d2c6); }
.disc.flip { animation: flip 0.35s ease-out; }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: none; } }

/* ---------- mancala ---------- */
.mc-board {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: stretch; max-width: 820px; margin: 0 auto; padding: 14px;
  background: linear-gradient(180deg, #8a5630, #6e4325); border-radius: 60px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.15), 0 14px 30px rgba(0, 0, 0, 0.45);
}
.mc-rows { display: grid; gap: 10px; }
.mc-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.mc-pit, .mc-store {
  position: relative; border: 0; border-radius: 50%; aspect-ratio: 1; background: radial-gradient(circle at 50% 35%, #4e2d16, #3a2010);
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.55); display: grid; place-items: center; padding: 0; min-width: 0;
}
.mc-store { border-radius: 40px; aspect-ratio: auto; width: clamp(54px, 11vw, 90px); }
.mc-store small { position: absolute; bottom: 8px; font-size: 0.7rem; color: var(--wood-l); max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-pit.can { cursor: pointer; box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.55), 0 0 0 3px var(--brass); }
.mc-pit.can:hover { background: radial-gradient(circle at 50% 35%, #5f381c, #3a2010); }
.mc-pit:disabled { cursor: default; }
.mc-pit.hit, .mc-store.hit { box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.55), 0 0 0 2px rgba(243, 234, 217, 0.35); }
.stones { position: absolute; left: 50%; top: 50%; width: 56%; aspect-ratio: 1; transform: translate(-50%, -50%); }
.mc-store .stones { width: min(56px, 70%); }
.stones i { position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; margin: -11% 0 0 -11%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d6f0ff, #4b8bb1); transform: rotate(var(--a)) translateX(calc(var(--d) * 110%)); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); }
.cnt { position: absolute; top: 4px; right: 8px; font-size: 0.85rem; color: var(--ivory); text-shadow: 0 1px 2px #000; }
.mc-store .cnt { top: 10px; right: auto; font-size: 1.2rem; }
@media (max-width: 560px) {
  /* the board turns a quarter: your pits run down the left, your store at the bottom */
  .mc-board { grid-template-columns: 1fr; border-radius: 40px; padding: 12px; max-width: 230px; }
  .mc-rows { grid-template-columns: 1fr 1fr; }
  .mc-row { grid-template-columns: 1fr; }
  .mc-row:last-child { order: -1; }
  .mc-store { width: auto; height: 74px; border-radius: 30px; }
  .mc-pit { max-width: 78px; justify-self: center; width: 100%; }
  .mc-store { height: 62px; }
}

/* ---------- backgammon ---------- */
.bg-wrap { display: grid; grid-template-columns: 1fr auto; gap: 8px; max-width: 900px; margin: 0 auto; }
.bg-board {
  --pt: min(6.4vw, 56px); position: relative; display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr 1fr; gap: 0 0;
  background: #2d5f4b; border: 10px solid var(--wood-d); border-radius: 12px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45); min-height: calc(var(--pt) * 9);
}
.bg-q { display: grid; grid-template-columns: repeat(6, 1fr); }
.bg-pt { position: relative; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; min-width: 0; height: calc(var(--pt) * 4.4); }
.bg-pt.bot { flex-direction: column-reverse; align-self: end; }
.bg-pt .tri { position: absolute; left: 6%; right: 6%; top: 0; height: 88%; clip-path: polygon(0 0, 100% 0, 50% 100%); background: #c99a62; }
.bg-pt.e .tri { background: #8a3c32; }
.bg-pt.bot .tri { top: auto; bottom: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.bg-pt small { position: absolute; font-size: 0.62rem; color: rgba(243, 234, 217, 0.55); }
.bg-pt.top small { bottom: -2px; } .bg-pt.bot small { top: -2px; }
.stk { position: relative; display: flex; flex-direction: inherit; align-items: center; }
.ck { width: min(calc(var(--pt) * 0.86), 46px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 0.8rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.2); margin: -1px 0; }
.ck.w { background: radial-gradient(circle at 35% 30%, #fff8ea, #d6c6a6); color: #3a2a1a; }
.ck.r { background: radial-gradient(circle at 35% 30%, #e46a5c, #8e2219); color: #fff; }
.bg-pt.from .stk .ck:last-child { box-shadow: 0 0 0 3px var(--brass); }
.bg-pt.bot.from .stk .ck:first-child { box-shadow: 0 0 0 3px var(--brass); }
.bg-pt.bot.from .stk .ck:last-child { box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.bg-pt.sel .tri { filter: brightness(1.35); }
.bg-pt.tgt::after { content: ''; position: absolute; left: 30%; right: 30%; aspect-ratio: 1; border-radius: 50%; border: 3px dashed var(--brass); }
.bg-pt.top.tgt::after { bottom: 14%; } .bg-pt.bot.tgt::after { top: 14%; }
.bg-pt.tgt, .bg-pt.from { cursor: pointer; }
.bg-pt.last .tri { filter: brightness(1.18); }
.bg-bar { width: calc(var(--pt) * 0.95); background: #5a3720; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.bg-bar.low { justify-content: flex-end; }
.bg-bar button { border: 0; background: none; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ivory); }
.bg-bar button.from .ck { box-shadow: 0 0 0 3px var(--brass); }
.bg-dice { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 6px; pointer-events: none; }
.die { font-size: calc(var(--pt) * 0.95); line-height: 1; color: #fff8ea; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
.die.used { opacity: 0.3; }
.bg-off { width: clamp(54px, 9vw, 84px); border: 2px dashed var(--line); border-radius: 12px; background: #1a0f1f; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 10px 4px; font-size: 0.72rem; color: var(--muted); text-align: center; }
.bg-off b { display: block; font-size: 1.3rem; color: var(--ivory); }
.bg-off.tgt { border-color: var(--brass); color: var(--brass); cursor: pointer; }
.bg-off .lbl { font-weight: 700; }
@media (max-width: 560px) { .bg-board { border-width: 6px; } .bg-wrap { gap: 4px; } .bg-off { padding: 6px 2px; } }
.c-last b.you, .c-log b.you, #resText b.you { color: var(--brass); }
@media (max-width: 760px) { .c-last { flex-basis: 100%; } .c-foot { justify-content: flex-end; } }

/* ---------- hearts ---------- */
.ht-table { position: relative; height: clamp(300px, 46vw, 380px); max-width: 760px; margin: 0 auto; }
.ht-seat { position: absolute; display: grid; justify-items: center; gap: 4px; font-weight: 700; font-size: 0.85rem; color: #e1f3ef; }
.ht-seat.n { top: 10px; left: 50%; transform: translateX(-50%); }
.ht-seat.w { left: 10px; top: 50%; transform: translateY(-50%); }
.ht-seat.e { right: 10px; top: 50%; transform: translateY(-50%); }
.ht-seat.turn .ht-name { background: var(--lacquer); }
.ht-name { padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-backs { display: flex; align-items: center; }
.ht-backs .card { margin-left: -18px; } .ht-backs .card:first-child { margin-left: 0; }
.ht-backs b { margin-left: 6px; }
.ht-center { position: absolute; left: 50%; top: 50%; width: 220px; height: 210px; transform: translate(-50%, -50%); }
.ht-play { position: absolute; }
.ht-play.s { left: 50%; bottom: 0; transform: translateX(-50%); }
.ht-play.n { left: 50%; top: 0; transform: translateX(-50%); }
.ht-play.w { left: 0; top: 50%; transform: translateY(-50%); }
.ht-play.e { right: 0; top: 50%; transform: translateY(-50%); }
.ht-won, .ht-note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; width: 200px; text-align: center; font-size: 0.85rem; color: #e1f3ef; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.ht-won b, .ht-note b { color: #fff; }
.card.new { box-shadow: 0 0 0 3px #6fd1c2, 0 6px 14px rgba(0, 0, 0, 0.25); }
@media (max-width: 560px) { .ht-center { width: 170px; height: 190px; } .ht-seat.w, .ht-seat.e { top: 38%; } .ht-name { max-width: 80px; } }

/* ---------- crazy eights ---------- */
.c8-table { display: flex; justify-content: center; align-items: center; gap: clamp(16px, 5vw, 48px); padding: 26px 14px; max-width: 640px; margin: 0 auto; }
.c8-table .card { --w: 76px; }
.c8-suit { display: grid; justify-items: center; color: #e1f3ef; font-size: 0.75rem; font-weight: 700; }
.c8-suit b { font-size: 2.4rem; line-height: 1; color: #fbf7ef; }
.c8-suit.red b { color: #ff8f8f; }
.c8-suit.called b { text-shadow: 0 0 14px var(--brass); }
.c8-ask { align-self: center; font-weight: 700; color: var(--muted); }
.c-actions .c8-s { min-width: 56px; font-size: 1.4rem; flex: 0 0 auto; }
.c-actions .c8-s.red { color: #ff8f8f; }
@media (max-width: 560px) { .c8-table .card { --w: 60px; } }

/* ---------- rummy ---------- */
.rm-table { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; max-width: 900px; margin: 0 auto; }
.rm-piles { display: flex; gap: 12px; }
.rm-melds { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; min-height: 90px; }
.rm-empty { color: #cfe7e2; margin: 0; font-size: 0.9rem; align-self: center; }
.rm-meld { display: flex; padding: 6px 10px 6px 6px; border-radius: 12px; border: 2px solid transparent; background: rgba(0, 0, 0, 0.18); }
.rm-meld .card { margin-right: -22px; } .rm-meld .card:last-child { margin-right: 0; }
.rm-meld.ok { border-color: var(--brass); cursor: pointer; }
.rm-meld:disabled { cursor: default; }
@media (max-width: 560px) { .rm-table { grid-template-columns: 1fr; } .rm-piles { justify-content: center; } .rm-meld .card { --w: 38px; margin-right: -16px; } }

/* ---------- go fish ---------- */
.gf-table { display: grid; gap: 14px; max-width: 820px; margin: 0 auto; }
.gf-targets { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.gf-target { display: grid; justify-items: center; gap: 4px; padding: 10px 14px; border-radius: 14px; border: 2px solid transparent; background: rgba(0, 0, 0, 0.2); color: #e1f3ef; min-width: 120px; }
.gf-target.ok { border-color: var(--brass); cursor: pointer; }
.gf-target.ok:hover { background: rgba(0, 0, 0, 0.32); }
.gf-target:disabled { cursor: default; }
.gf-n { font-weight: 800; }
.gf-books { font-size: 0.78rem; color: #b9dcd6; }
.gf-mid { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.gf-last { margin: 0; max-width: 34ch; color: #e1f3ef; }
.gf-last b { color: #fff; }
.gf-mine { text-align: center; color: #e1f3ef; font-weight: 700; }
.gf-book { display: inline-grid; place-items: center; min-width: 30px; height: 30px; margin: 0 2px; border-radius: 6px; background: #fbf7ef; color: #1d1a20; font-weight: 800; }

/* ---------- blackjack ---------- */
.bj-table { display: grid; gap: 14px; justify-items: center; max-width: 900px; margin: 0 auto; padding: 18px 12px; border-radius: 0 0 200px 200px / 0 0 80px 80px; }
.bj-dealer { display: grid; justify-items: center; gap: 6px; }
.bj-cards { display: flex; min-height: 62px; }
.bj-cards .card { margin-left: -18px; } .bj-cards .card:first-child { margin-left: 0; }
.bj-total { font-weight: 800; color: #e1f3ef; min-height: 1.4em; }
.bj-rules { margin: 0; color: #a6d1ca; font-size: 0.82rem; }
.bj-spots { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.bj-spot { display: grid; justify-items: center; gap: 4px; padding: 10px; border-radius: 16px; min-width: 120px; border: 2px solid transparent; background: rgba(0, 0, 0, 0.16); }
.bj-spot.me { background: rgba(0, 0, 0, 0.28); }
.bj-spot.turn { border-color: var(--lacquer); }
.bj-who { font-weight: 800; }
.chip { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--lacquer); color: #fff; font-weight: 800; font-size: 0.8rem; border: 3px dashed #fbf7ef; }
.bj-badge { font-size: 0.78rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); }
.bj-badge.win, .bj-badge.blackjack { background: var(--good); color: #0f2a1b; }
.bj-badge.lose, .bj-badge.bust { background: var(--bad); color: #2a0d0a; }
.c-actions .chipbtn { min-width: 64px; border-radius: 999px; }

/* ---------- quiz (chalkboard) ---------- */
.qz-board { max-width: 760px; margin: 0 auto; background: #20302a; border: 12px solid var(--wood-d); border-radius: 16px; padding: clamp(16px, 4vw, 30px); display: grid; gap: 14px;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45), 0 14px 30px rgba(0, 0, 0, 0.4); }
.qz-meta { margin: 0; color: #a8c4b6; font-weight: 600; }
.qz-q { font: 400 clamp(1.35rem, 4.2vw, 2rem)/1.25 var(--f-display); margin: 0; color: #f6f3ea; }
.qz-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.qz-bar i { display: block; height: 100%; width: 100%; background: var(--brass); }
.qz-bar.rev i { background: #8fb5a6; }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qz-opt { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; gap: 2px 12px; text-align: left; padding: 12px 14px; min-height: 64px;
  border-radius: 12px; border: 2px solid rgba(246, 243, 234, 0.25); background: rgba(0, 0, 0, 0.18); color: #f6f3ea; font-weight: 700; }
.qz-opt:hover:not(:disabled) { border-color: var(--brass); background: rgba(0, 0, 0, 0.3); }
.qz-opt:disabled { cursor: default; }
.qz-l { grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(246, 243, 234, 0.14); }
.qz-who { display: flex; gap: 2px; } .qz-who .c-av { width: 20px; height: 20px; font-size: 0.65rem; }
.qz-opt.picked { border-color: var(--brass); background: rgba(217, 178, 106, 0.18); }
.qz-opt.right { border-color: var(--good); background: rgba(92, 194, 138, 0.25); }
.qz-opt.wrong { border-color: var(--bad); background: rgba(239, 107, 94, 0.2); }
.qz-opt.dim { opacity: 0.5; }
.qz-gain { margin: 0; text-align: center; font-weight: 700; color: #cfe0d8; }
.qz-gain.good { color: var(--good); } .qz-gain.bad { color: var(--bad); }
.mr-q { font-size: clamp(2rem, 9vw, 3.4rem); text-align: center; }
.mr-ans { color: var(--good); }
.mr-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; max-width: 380px; width: 100%; margin: 0 auto; }
.mr-form input { font: 800 1.6rem var(--f-ui); text-align: center; padding: 8px; border-radius: 12px; border: 2px solid rgba(246, 243, 234, 0.3); background: rgba(0, 0, 0, 0.25); color: #f6f3ea; min-width: 0; }
.mr-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 380px; width: 100%; margin: 0 auto; }
.mr-pad .c-btn { font-size: 1.3rem; background: rgba(0, 0, 0, 0.25); }
@media (pointer: fine) { .mr-pad { display: none; } }
@media (max-width: 560px) { .qz-opts { grid-template-columns: 1fr; } .qz-board { border-width: 8px; } }
@media (max-width: 560px) {
  .c-back span { display: none; }
  .c-back { font-size: 1.4rem; line-height: 1; padding: 0 4px; }
  .bg-pt small { display: none; }
}

/* ---------- color cards (uno-style) ---------- */
.uno-table { max-width: 720px; margin: 0 auto; padding: 22px 14px; border-radius: var(--r-l);
  background: radial-gradient(ellipse at 50% 40%, #3d2a63 0%, #241640 70%); border: 1px solid rgba(255, 255, 255, 0.08); display: grid; gap: 12px; }
.uno-center { display: flex; justify-content: center; align-items: center; gap: clamp(16px, 6vw, 48px); }
.uno-center .pile span { color: #d9cdf2; }
.uno-state { display: grid; justify-items: center; gap: 6px; }
.uno-col { width: 46px; height: 46px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 18px currentColor; }
.uno-col.red { background: #e5343a; color: #e5343a; } .uno-col.yellow { background: #f6c12b; color: #f6c12b; }
.uno-col.green { background: #2fa85a; color: #2fa85a; } .uno-col.blue { background: #2f6fde; color: #2f6fde; }
.uno-dir { font-size: 1.8rem; color: #fff; line-height: 1; }
.uno-pend { margin: 0; text-align: center; font-weight: 800; color: #ffd27a; }
.uc { --w: 66px; width: var(--w); height: calc(var(--w) * 1.48); border-radius: calc(var(--w) * 0.14); position: relative; display: inline-grid; place-items: center;
  border: 3px solid #fff; color: #fff; font-family: var(--f-ui); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 8px 16px rgba(0, 0, 0, 0.3); flex: none; overflow: hidden; }
.uc::before { content: ''; position: absolute; width: 74%; height: 92%; border-radius: 50%; background: #fff; transform: rotate(28deg); }
.uc b { position: relative; font-size: calc(var(--w) * 0.44); font-weight: 900; line-height: 1; -webkit-text-stroke: 1px rgba(0, 0, 0, 0.25); }
.uc i { position: absolute; top: 4px; left: 6px; font-style: normal; font-weight: 900; font-size: calc(var(--w) * 0.2); }
.uc i.br { top: auto; left: auto; bottom: 4px; right: 6px; transform: rotate(180deg); }
.uc.red { background: #e5343a; } .uc.red b { color: #e5343a; }
.uc.yellow { background: #f6c12b; } .uc.yellow b { color: #d9a400; }
.uc.green { background: #2fa85a; } .uc.green b { color: #2fa85a; }
.uc.blue { background: #2f6fde; } .uc.blue b { color: #2f6fde; }
.uc.wild { background: #1b1b1f; }
.uc.wild::before { background: conic-gradient(#e5343a 0 25%, #2f6fde 0 50%, #2fa85a 0 75%, #f6c12b 0); }
.uc.wild b { color: #fff; -webkit-text-stroke: 1.5px #111; }
.uc.back { background: #1b1b1f; }
.uc.back::before { background: #e5343a; }
.uc.back b { color: #f6c12b; font-size: calc(var(--w) * 0.28); transform: rotate(-20deg); -webkit-text-stroke: 1px #111; }
.uc.big { --w: 84px; }
.ucb { padding: 0; border: 0; background: none; border-radius: 12px; transition: transform 0.12s; }
.ucb:disabled { cursor: default; }
.ucb:disabled .uc { filter: brightness(0.7) saturate(0.7); }
.ucb.ok:hover { transform: translateY(-8px); }
.ucb.sel { transform: translateY(-14px); }
.ucb.sel .uc, .ucb.new .uc { outline: 3px solid var(--brass); outline-offset: 2px; }
.pile button.ok .uc { outline: 3px solid var(--brass); outline-offset: 2px; }
.uno-hand { padding-top: 20px; }
.uno-tag { color: #ffd27a; font-weight: 900; }
.c-actions .uno-pick { min-width: 90px; color: #fff; border: 0; }
.uno-pick.red { background: #e5343a; } .uno-pick.yellow { background: #f6c12b; color: #2a1d00; } .uno-pick.green { background: #2fa85a; } .uno-pick.blue { background: #2f6fde; }
.uno-shout { font-weight: 900; letter-spacing: 0.04em; }
.uno-shout.on { background: #f6c12b; color: #2a1d00; border-color: transparent; }
@media (max-width: 560px) { .uc { --w: 56px; } .uc.big { --w: 72px; } .uno-col { width: 38px; height: 38px; } }
