:root {
  --bg: #0b1220;
  --bg-2: #0f1a2e;
  --card: #132038;
  --card-2: #182844;
  --line: #24365a;
  --text: #e7eefc;
  --muted: #8ea3c7;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --water: #10264a;
  --water-hover: #173664;
  --ship: #64748b;
  --ship-edge: #94a3b8;
  --miss: #9fb3d6;
  --hit: #f97316;
  --sunk: #dc2626;
  --ok: #22c55e;
  --bad: #ef4444;
  --heat: 250, 204, 21;
  --win: #22c55e;
  --lose: #f43f5e;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #16305a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
button, select, input { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 16px 24px; border-bottom: 1px solid var(--line); background: rgba(11, 18, 32, .7);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 20px; letter-spacing: .3px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.logo { font-size: 28px; color: var(--accent); }
.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; gap: 8px;
}
.tabs button.active { background: var(--accent-2); color: #fff; }
.tabs button.locked { opacity: .75; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #334155; color: #cbd5e1; }
.view { padding: 20px 24px 8px; max-width: 1400px; margin: 0 auto; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
.loading, .error { color: var(--muted); text-align: center; padding: 48px 0; }
.error { color: var(--bad); }

.soon { text-align: center; padding: 80px 16px; }
.soon-icon { font-size: 72px; }
.soon h2 { margin: 12px 0 8px; }
.soon p { color: var(--muted); }

/* ---------------------------------------------------------------- controls */
.btn {
  border: 1px solid var(--line); background: var(--card-2); padding: 8px 14px; border-radius: 10px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; }
select { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.bot-pick { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status {
  margin: 14px 0; padding: 10px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  min-height: 44px; transition: border-color .2s;
}
.status.flash { border-color: var(--bad); }
.status.win { border-color: var(--win); background: rgba(34, 197, 94, .12); }
.status.lose { border-color: var(--lose); background: rgba(244, 63, 94, .12); }

/* ---------------------------------------------------------------- layout */
.bs-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- grids */
.grid-wrap { width: 100%; }
.grid {
  display: grid; grid-template-columns: 22px repeat(10, minmax(0, 1fr)); gap: 3px; user-select: none;
}
.lbl { display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.cell {
  position: relative; aspect-ratio: 1; border: 0; border-radius: 4px; padding: 0; background: var(--water);
  cursor: default; overflow: hidden;
}
.cell .heat {
  position: absolute; inset: 0; background: rgb(var(--heat)); opacity: 0; pointer-events: none; transition: opacity .25s;
  mix-blend-mode: screen;
}
.cell .mark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }

.is-placing .grid-player .cell { cursor: pointer; }
.cell.ship { background: var(--ship); box-shadow: inset 0 0 0 2px #cbd5e1; }
.cell.ship .mark { z-index: 1; }
.cell.preview-ok { background: rgba(34, 197, 94, .55); }
.cell.preview-bad { background: rgba(239, 68, 68, .55); }

.cell.miss .mark::after { content: ""; width: 26%; height: 26%; border-radius: 50%; background: var(--miss); opacity: .8; }
.cell.hit { background: var(--hit); }
.cell.hit .mark::after { content: "✕"; color: #fff; font-weight: 700; font-size: clamp(10px, 1.4vw, 16px); }
.cell.sunk { background: var(--sunk); }
.cell.sunk .mark::after { content: "✕"; color: #fff; font-weight: 700; font-size: clamp(10px, 1.4vw, 16px); }
.cell.revealed:not(.hit):not(.sunk) { box-shadow: inset 0 0 0 2px var(--ship-edge); background: #1f3358; }
.cell.last { outline: 2px solid #fff; outline-offset: -2px; animation: pulse 1s ease-out 2; }
.cell.top { outline: 2px dashed rgb(var(--heat)); outline-offset: -2px; }
.cell.aimable { cursor: crosshair; }
.cell.aimable:hover { background: var(--water-hover); box-shadow: inset 0 0 0 2px var(--accent); }
.cell.pending { background: var(--water-hover); }
.is-busy .grid-target { opacity: .85; }
@keyframes pulse { from { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); } to { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }

.legend { display: flex; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg.miss { background: var(--water); box-shadow: inset 0 0 0 3px var(--water), inset 0 0 0 6px var(--miss); }
.lg.hit { background: var(--hit); }
.lg.sunk { background: var(--sunk); }

/* ---------------------------------------------------------------- dock */
.dock { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dock-ship {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line); font-size: 13px;
}
.dock-ship.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56, 189, 248, .3); }
.dock-ship.placed { opacity: .5; }
.pips { display: inline-flex; gap: 2px; }
.pips i { width: 8px; height: 8px; border-radius: 2px; background: var(--ship-edge); }

/* ---------------------------------------------------------------- coach */
.coach { display: grid; gap: 14px; }
.coach-card h4 { margin: 14px 0 8px; font-size: 14px; }
.coach-card > h4:first-child, .row-between h4 { margin-top: 0; }
.kicker { color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.coach-title h3 { margin: 2px 0 4px; font-size: 20px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
.center { text-align: center; }
.warn { color: #fbbf24; font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.tile { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.tile b { display: block; font-size: 18px; }
.tile span { color: var(--muted); font-size: 11px; }
.habits { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--accent); }
.live { margin: 0; display: grid; gap: 6px; font-size: 13px; }
.live div { display: flex; justify-content: space-between; gap: 12px; }
.live dt { color: var(--muted); }
.live dd { margin: 0; text-align: right; }
.heat-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.heat-scale i { flex: 1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--water), rgb(var(--heat))); }
.score { display: flex; align-items: center; justify-content: center; gap: 18px; }
.score div { display: grid; text-align: center; }
.score b { font-size: 30px; }
.score span { color: var(--muted); font-size: 12px; }
.score .vs { color: var(--muted); }


/* ---------------------------------------------------------------- chess */
.cb-card { display: grid; gap: 12px; }
.cb-play { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: stretch; max-width: 720px; width: 100%; margin: 0 auto; }
.cb-board-wrap { position: relative; width: 100%; aspect-ratio: 1; }
.cb-board {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%;
  border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 2px var(--line); user-select: none;
}
.cb-sq { --sq: #6f8bb8; position: relative; border: 0; padding: 0; background: var(--sq); cursor: default; display: grid; place-items: center; }
.cb-sq.light { --sq: #c9d6ea; }
.cb-sq.last { background: color-mix(in srgb, var(--sq) 55%, #facc15); }
.cb-sq.selected { background: color-mix(in srgb, var(--sq) 40%, #38bdf8); }
.cb-sq.mine, .cb-sq.target, .cb-sq.capture { cursor: pointer; }
.cb-sq.target::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(15, 23, 42, .35); }
.cb-sq.capture::after { content: ""; position: absolute; inset: 4%; border-radius: 50%; box-shadow: inset 0 0 0 5px rgba(15, 23, 42, .35); }
.cb-sq.check { background: radial-gradient(circle, #ef4444 0%, rgba(239, 68, 68, .5) 45%, var(--sq) 75%); }
.cb-piece {
  font-size: clamp(22px, 6.2vw, 58px); line-height: 1; pointer-events: auto; font-variant-emoji: text;
  font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", system-ui, sans-serif; z-index: 1;
}
.cb-piece.pw { color: #fff; text-shadow: 0 0 1px #0b1220, 0 0 2px #0b1220, 0 1px 2px rgba(0, 0, 0, .6); }
.cb-piece.pb { color: #0b1220; text-shadow: 0 0 1px #e2e8f0, 0 1px 1px rgba(255, 255, 255, .35); }
.cb-sq.mine .cb-piece { cursor: grab; }
.cb-rank, .cb-file { position: absolute; font-size: 10px; font-weight: 600; color: rgba(15, 23, 42, .65); pointer-events: none; }
.cb-rank { top: 2px; left: 4px; }
.cb-file { bottom: 1px; right: 4px; }
.cb-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.cb-promo {
  position: absolute; inset: 30% 15%; z-index: 3; background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 12px;
}
.cb-promo p { width: 100%; text-align: center; margin: 0; color: var(--muted); }
.cb-piece-btn { font-size: 40px; width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--line); background: #c9d6ea; cursor: pointer; }
.cb-piece-btn.pw { color: #fff; text-shadow: 0 0 2px #0b1220, 0 0 2px #0b1220; }
.cb-piece-btn.pb { color: #0b1220; }
.cb-eval { position: relative; border-radius: 6px; overflow: hidden; background: #1e293b; box-shadow: 0 0 0 1px var(--line); }
.cb-eval-fill { position: absolute; left: 0; right: 0; bottom: 0; background: #e2e8f0; transition: height .4s; }
.cb-eval.flip .cb-eval-fill { bottom: auto; top: 0; }
.cb-eval-lbl { position: absolute; left: 0; right: 0; bottom: 4px; font-size: 10px; text-align: center; color: var(--accent-2); font-weight: 700; }
.cb-moves-head { margin: 4px 0 0; }
.cb-moves {
  margin: 0; padding: 0 0 0 28px; max-height: 150px; overflow-y: auto; font: 13px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace;
  columns: 3 160px; column-gap: 18px;
}
.cb-moves li { break-inside: avoid; }
.cb-moves li span { display: inline-block; min-width: 64px; }
.cb-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.cb-winbar { height: 10px; border-radius: 5px; background: var(--lose); overflow: hidden; margin-bottom: 4px; }
.cb-winbar i { display: block; height: 100%; background: var(--win); transition: width .4s; }
.cb-cands { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.cb-cands li { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 8px; }
.cb-cands .bar { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.cb-cands .bar i { display: block; height: 100%; background: rgb(var(--heat)); }
.cb .is-busy .cb-board, .cb.is-busy .cb-board { cursor: progress; }
.cb .bs-main { grid-template-columns: minmax(0, 1fr) 360px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .bs-main, .cb .bs-main { grid-template-columns: 1fr; }
  .coach { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 720px) {
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
  .boards { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- Color Clash */
.cc {
  --cc-red: #e5484d; --cc-yellow: #f2b705; --cc-green: #2fa866; --cc-blue: #3b82f6;
  --cc-wild: conic-gradient(from 45deg, var(--cc-red) 0 25%, var(--cc-yellow) 0 50%, var(--cc-green) 0 75%, var(--cc-blue) 0);
}
.cc .bs-main { grid-template-columns: minmax(0, 1fr) 360px; }
.cc-table { display: grid; gap: 14px; }
.cc-opps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.cc-opp { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 8px; transition: border-color .2s, box-shadow .2s; }
.cc-opp.turn { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56, 189, 248, .25); }
.cc-opp.hit { animation: cc-shake .4s; border-color: var(--bad); }
.cc-opp.winner { border-color: var(--win); }
.cc-count { font-size: 12px; color: var(--muted); }
.cc-count.last { color: #fff; background: var(--bad); padding: 1px 8px; border-radius: 999px; font-weight: 700; animation: pulse 1s ease-out 2; }
.cc-fan { display: flex; min-height: 50px; padding-left: 14px; }
.cc-fan .cc-card { margin-left: -14px; }
.cc-fan.revealed { flex-wrap: wrap; row-gap: 4px; }
.cc-lacks { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.c-red { background: var(--cc-red); } .dot.c-yellow { background: var(--cc-yellow); }
.dot.c-green { background: var(--cc-green); } .dot.c-blue { background: var(--cc-blue); }
.dot.c-wild { background: var(--cc-wild); }

.cc-center { display: flex; align-items: center; justify-content: center; gap: 28px; padding: 18px 8px; border-radius: 12px;
  background: radial-gradient(circle at 50% 50%, #17375f 0%, #10223f 70%); border: 1px solid var(--line); flex-wrap: wrap; }
.cc-pile { position: relative; border: 0; background: none; padding: 0; cursor: default; display: grid; justify-items: center; gap: 6px; }
.cc-pile .cc-card { box-shadow: 3px 3px 0 #0b1220, 6px 6px 0 #1e293b; }
.cc-pile.ready { cursor: pointer; }
.cc-pile.ready .cc-card { outline: 3px solid var(--accent); outline-offset: 2px; animation: pulse 1.2s ease-out infinite; }
.cc-pile-lbl { font-size: 12px; color: var(--muted); }
.cc-discard { border-radius: 16px; padding: 6px; box-shadow: 0 0 0 4px var(--ring, var(--line)); transition: box-shadow .3s; }
.cc-center-info { display: grid; gap: 4px; justify-items: center; min-width: 110px; text-align: center; }
.cc-dir { font-size: 34px; line-height: 1; color: var(--accent); }
.cc-color-name.t-red { color: var(--cc-red); } .cc-color-name.t-yellow { color: var(--cc-yellow); }
.cc-color-name.t-green { color: var(--cc-green); } .cc-color-name.t-blue { color: var(--cc-blue); }

.cc-card {
  --w: 74px; position: relative; width: var(--w); aspect-ratio: 5 / 7.4; flex: none; border-radius: 10px;
  background: #fff; padding: 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); user-select: none; color: #fff;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.cc-card.small { --w: 34px; border-radius: 5px; padding: 2px; }
.cc-card.big { --w: 96px; }
.cc-card .cc-face {
  position: absolute; inset: 5px; border-radius: 7px; display: grid; place-items: center; overflow: hidden; background: var(--fill);
}
.cc-card.small .cc-face { inset: 2px; border-radius: 3px; }
.cc-card .cc-face::before { /* a tilted diamond panel in the middle */
  content: ""; position: absolute; width: 62%; aspect-ratio: 1; transform: rotate(45deg); border-radius: 18%;
  background: rgba(255, 255, 255, .92); box-shadow: 0 0 0 3px rgba(0, 0, 0, .08);
}
.cc-card .cc-face b { position: relative; font-size: calc(var(--w) * .36); font-weight: 900; color: var(--fill-text, var(--fill)); letter-spacing: -1px; }
.cc-card .cc-corner { position: absolute; z-index: 1; font-size: calc(var(--w) * .17); font-weight: 800; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); line-height: 1; }
.cc-card .cc-corner.tl { top: 9px; left: 9px; }
.cc-card .cc-corner.br { bottom: 9px; right: 9px; transform: rotate(180deg); }
.cc-card.small .cc-corner { display: none; }
.cc-card.small .cc-face b { font-size: 13px; }
.cc-card.c-red { --fill: var(--cc-red); } .cc-card.c-yellow { --fill: var(--cc-yellow); }
.cc-card.c-green { --fill: var(--cc-green); } .cc-card.c-blue { --fill: var(--cc-blue); }
.cc-card[class*="c-wild"] { --fill: #1e293b; --fill-text: #1e293b; }
.cc-card[class*="c-wild"] .cc-face { background: var(--cc-wild); }
.cc-card.c-wild-red .cc-face::before { background: var(--cc-red); } .cc-card.c-wild-yellow .cc-face::before { background: var(--cc-yellow); }
.cc-card.c-wild-green .cc-face::before { background: var(--cc-green); } .cc-card.c-wild-blue .cc-face::before { background: var(--cc-blue); }
.cc-card[class*="c-wild-"] .cc-face b { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.cc-back { background: #0f1a2e; }
.cc-back .cc-face { background: repeating-linear-gradient(45deg, #1d3b6a 0 6px, #16305a 6px 12px); }
.cc-back .cc-face::before { background: #0b1220; width: 50%; }
.cc-back .cc-face b { color: var(--accent); font-size: calc(var(--w) * .3); }
.cc-card.small.cc-back .cc-face b { font-size: 11px; }
.cc-empty { background: transparent; border: 2px dashed var(--line); box-shadow: none; }

.cc-hand-wrap { position: relative; }
.cc-hand { display: flex; flex-wrap: wrap; gap: 8px; min-height: 120px; padding: 10px 2px 2px; }
.cc-hand .cc-card.playable { cursor: pointer; transform: translateY(-8px); box-shadow: 0 0 0 3px var(--accent), 0 6px 12px rgba(0, 0, 0, .5); }
.cc-hand .cc-card.playable:hover, .cc-hand .cc-card.playable:focus-visible { transform: translateY(-14px); outline: none; }
.cc-hand .cc-card.dim { opacity: .45; }
.cc-hand .cc-card.advised { box-shadow: 0 0 0 3px rgb(var(--heat)), 0 0 18px rgba(var(--heat), .7); }
.cc-hand .cc-card.drawn::after { content: "new"; position: absolute; top: -10px; right: -6px; z-index: 2; font-size: 11px; font-weight: 700;
  background: var(--accent-2); color: #fff; padding: 0 6px; border-radius: 999px; }
.cc-hand-actions { display: flex; align-items: center; gap: 8px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.cc-picker { position: absolute; inset: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  background: rgba(11, 18, 32, .92); border-radius: 12px; padding: 12px; }
.cc-picker p { width: 100%; text-align: center; margin: 0; color: var(--muted); }
.cc-pick { border: 0; border-radius: 12px; padding: 12px 18px; color: #fff; font-weight: 700; cursor: pointer; display: grid; gap: 2px; min-width: 92px; }
.cc-pick small { font-weight: 400; opacity: .85; font-size: 11px; }
.cc-pick.c-red { background: var(--cc-red); } .cc-pick.c-yellow { background: var(--cc-yellow); color: #1e293b; }
.cc-pick.c-green { background: var(--cc-green); } .cc-pick.c-blue { background: var(--cc-blue); }
.cc-pick.advised { box-shadow: 0 0 0 3px rgb(var(--heat)); }
.cc-pick:hover { filter: brightness(1.1); }
.cc-log { margin: 0; padding-left: 22px; max-height: 160px; overflow-y: auto; font-size: 13px; color: var(--muted); display: grid; gap: 2px; }
.cc-log li:last-child { color: var(--text); }
.cc-rules summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.cc-rules ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.cc-cands li { grid-template-columns: 110px 1fr auto; }
.cc-unseen { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-chip { display: inline-flex; align-items: center; gap: 6px; }
.cc.is-busy .cc-hand { cursor: progress; }
@keyframes cc-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (max-width: 1100px) { .cc .bs-main { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .cc-card { --w: 58px; }
  .cc-card.big { --w: 78px; }
  .cc-center { gap: 16px; }
}

/* ================================================================ polish pass */
.brand { color: inherit; text-decoration: none; }
.brand:hover .logo { transform: rotate(45deg); }
.logo { transition: transform .3s; display: inline-block; }
.tabs { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { white-space: nowrap; flex: none; }
.tabs button:hover:not(.active) { color: var(--text); background: rgba(56, 189, 248, .1); }
a.btn { display: inline-block; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* loading + errors */
.loading { display: grid; justify-items: center; gap: 12px; }
.loading p { margin: 0; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { max-width: 460px; margin: 48px auto; text-align: center; padding: 28px 20px; background: var(--card);
  border: 1px solid var(--bad); border-radius: var(--radius); display: grid; gap: 10px; justify-items: center; }
.error-icon { font-size: 40px; color: var(--bad); line-height: 1; }
.soon { display: grid; justify-items: center; gap: 8px; }

/* bot thinking indicator on the status bar */
.is-busy .status { position: relative; padding-right: 44px; }
.is-busy .status::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}

/* home */
.home { max-width: 1100px; margin: 0 auto; padding: 12px 0 24px; }
.hero { text-align: center; padding: 24px 8px 28px; }
.hero h2 { font-size: clamp(26px, 5vw, 40px); margin: 6px 0 10px; }
.hero .muted { max-width: 560px; margin: 0 auto; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.game-card {
  --tone: #0ea5e9; position: relative; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: inherit; text-decoration: none;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--tone); box-shadow: 0 10px 30px -10px var(--tone); }
.game-card.locked { opacity: .65; }
.tone-sea { --tone: #0ea5e9; } .tone-wood { --tone: #d6a35c; } .tone-fire { --tone: #e5484d; } .tone-gold { --tone: #facc15; } .tone-neon { --tone: #e879f9; }
.gc-art {
  height: 130px; display: grid; place-items: center; font-size: 68px;
  background: radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--tone) 55%, transparent), transparent 70%), var(--bg-2);
  border-bottom: 1px solid var(--line); text-shadow: 0 4px 18px rgba(0, 0, 0, .5);
}
.gc-body { padding: 16px 16px 4px; display: grid; gap: 8px; align-content: start; }
.gc-body h3 { font-size: 20px; }
.gc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.gc-record { font-size: 12px; color: var(--muted); }
.gc-play { margin: 12px 16px 16px; padding: 9px; border-radius: 10px; text-align: center; font-weight: 700;
  background: color-mix(in srgb, var(--tone) 85%, #000); color: #fff; }

/* phones: compact header, bigger tap targets, stacked toolbars */
@media (max-width: 720px) {
  .topbar { padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .brand p { display: none; }
  .brand h1 { font-size: 18px; }
  .logo { font-size: 22px; }
  .tabs { width: 100%; }
  .tabs button { padding: 8px 12px; }
  .view { padding-top: 14px; }
  .btn, select { min-height: 40px; }
  .toolbar { align-items: stretch; }
  .toolbar > *, .toolbar .actions { width: 100%; }
  .bot-pick { flex: 1 1 140px; justify-content: space-between; }
  .bot-pick select { flex: 1; min-width: 0; }
  .actions .btn { flex: 1 1 auto; }
  .card { padding: 12px; }
  .status { font-size: 14px; }
  .gc-art { height: 100px; font-size: 54px; }
  .hero { padding: 10px 4px 18px; }
}
@media (max-width: 420px) {
  .tabs .tab-label { display: none; }
  .tabs button.active .tab-label { display: inline; }
  .grid { grid-template-columns: 16px repeat(10, minmax(0, 1fr)); gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* chess: legend for the yellow "bot expects you to play" arrows */
.cb-arrow-key { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 8px 12px; border-radius: 10px;
  background: rgba(250, 204, 21, .08); border: 1px solid rgba(250, 204, 21, .35); }
.cb-arrow-key b { color: rgb(250, 204, 21); }
.cb-arrow-swatch { flex: none; width: 28px; height: 4px; border-radius: 2px; background: rgb(250, 204, 21); position: relative; }
.cb-arrow-swatch::after { content: ""; position: absolute; right: -6px; top: -4px; border: 6px solid transparent; border-left: 8px solid rgb(250, 204, 21); border-right: 0; }

/* chess: press-and-drag pieces */
.cb-sq.mine { touch-action: none; }
.cb-sq.mine .cb-piece { cursor: grab; }
.cb-sq.drag-from .cb-piece { opacity: .3; }
.cb-sq.drag-over { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .85); }
.cb-ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; line-height: 1; cursor: grabbing;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)); }
body:has(.cb-ghost) { cursor: grabbing; user-select: none; }

/* ================================================================ big polish pass (2026-11-27) */
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.icon-btn { border: 1px solid var(--line); background: var(--bg-2); border-radius: 999px; width: 40px; height: 40px; flex: none;
  cursor: pointer; font-size: 17px; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--accent); }
.btn.small { min-height: 0; }

/* shared game header */
.game-head { --tone: #0ea5e9; display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 12px 14px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 22%, var(--card)), var(--card) 60%); }
.gh-icon { font-size: 34px; line-height: 1; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px;
  background: color-mix(in srgb, var(--tone) 30%, var(--bg-2)); flex: none; }
.gh-text { flex: 1; min-width: 0; }
.gh-text h2 { font-size: 22px; }
.gh-text p { margin: 2px 0 0; }
.game-root .toolbar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.game-root .status { margin-top: 12px; }

/* AI Coach fold (phones only) */
.coach-toggle { display: none; width: 100%; }

/* win / lose banner + confetti */
.fx-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
.fx-banner { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 10, 20, .7); animation: fx-fade .25s ease-out; }
.fx-card { width: min(420px, 100%); text-align: center; padding: 26px 22px 20px; border-radius: 18px; background: var(--card);
  border: 2px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .55); display: grid; gap: 8px; justify-items: center;
  animation: fx-pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.fx-banner.win .fx-card { border-color: var(--win); background: linear-gradient(180deg, rgba(34, 197, 94, .16), transparent 55%), var(--card); }
.fx-banner.lose .fx-card { border-color: var(--lose); background: linear-gradient(180deg, rgba(244, 63, 94, .14), transparent 55%), var(--card); }
.fx-banner.draw .fx-card { border-color: var(--accent); }
.fx-icon { font-size: 56px; line-height: 1.1; }
.fx-card h2 { font-size: 24px; }
.fx-card p { margin: 0; }
.fx-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
@keyframes fx-fade { from { opacity: 0; } }
@keyframes fx-pop { from { transform: scale(.85); opacity: 0; } }

/* home extras */
.name-box { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 6px 8px 6px 14px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line); max-width: 100%; flex-wrap: wrap; justify-content: center; }
.name-input { background: transparent; border: 0; outline: none; min-width: 0; width: 230px; padding: 6px 0; }
.name-box:focus-within { border-color: var(--accent); }
.name-saved { padding-right: 8px; }
.home-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.live-strip { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 14px; border-radius: 12px;
  background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .45); color: inherit; text-decoration: none; }
.live-strip span:nth-child(2) { flex: 1; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: 1px; color: #fda4af; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lose); animation: live-blink 1.4s ease-in-out infinite; }
@keyframes live-blink { 50% { opacity: .3; } }

/* pages: live list, watch, scores */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 6px 0 16px; }
.page-head h2 { font-size: 26px; margin: 2px 0 4px; }
.live-page, .scores-page, .watch-page { max-width: 1100px; margin: 0 auto; display: grid; gap: 14px; }
.live-list { display: grid; gap: 10px; }
.live-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.live-row:hover { border-color: var(--accent); transform: translateY(-2px); }
.live-row.over { opacity: .7; }
.live-icon { font-size: 28px; width: 44px; text-align: center; flex: none; }
.live-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.live-main b, .live-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.empty { text-align: center; padding: 40px 16px; }
.empty-icon { font-size: 48px; }
.empty p { margin: 6px 0; }
.watch-page .back { justify-self: start; }
.watch-page .page-head { margin: 0; }
.watch-chess { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 16px; align-items: start; }
.watch-side { display: grid; gap: 8px; }
.watch-side h4 { margin: 8px 0 0; }
.watch-side .cb-moves { max-height: 320px; }
.watch-board .cb-sq { cursor: default; }
.watch-cc { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.watch-hand { min-height: 0; }
.score-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.score-table th, .score-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.score-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.score-table tbody tr:last-child td { border-bottom: 0; }
.score-table tr.me td { background: rgba(56, 189, 248, .08); }
.table-wrap { overflow-x: auto; }
.bot-records { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.bot-records .tile span:first-child { display: block; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .watch-chess, .watch-cc { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar-right { width: 100%; }
  .topbar-right .tabs { flex: 1; width: auto; }
  .game-head { padding: 10px; gap: 10px; }
  .gh-icon { width: 42px; height: 42px; font-size: 26px; }
  .gh-text h2 { font-size: 18px; }
  .gh-text p { display: none; }
  .coach-toggle { display: block; }
  .coach.folded { display: none; }
  /* Battleship: during the battle, show the grid you fire at first */
  .bs.is-playing .boards .board-card:last-child { order: -1; }
  .hide-sm { display: none; }
  .page-head h2 { font-size: 22px; }
  .name-input { width: 170px; }
  .fx-icon { font-size: 46px; }
}

/* ---------------------------------------------------------------- four in a row */
.f4 { --f4-red: #ef4444; --f4-yellow: #facc15; --f4-frame: #1d4ed8; --f4-hole: #0b1220; }
.f4-card { display: grid; gap: 10px; }
.f4-wrap { width: min(100%, 560px); margin: 0 auto; }
.f4-strip, .f4-numbers { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; padding: 0 2.2%; }
.f4-strip-cell { position: relative; aspect-ratio: 1 / .78; display: grid; place-items: center; }
.f4-ghost { width: 70%; aspect-ratio: 1; border-radius: 50%; opacity: 0; transition: opacity .12s; }
.f4-ghost.red { background: var(--f4-red); opacity: .8; }
.f4-ghost.yellow { background: var(--f4-yellow); opacity: .8; }
.f4-rate { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--muted); pointer-events: none; }
.f4-rate.expect { color: rgb(var(--heat)); }
.f4-ghost:not(.red):not(.yellow) + .f4-rate { opacity: 1; }
.f4-ghost.red + .f4-rate, .f4-ghost.yellow + .f4-rate { opacity: 0; }
.f4-numbers span { text-align: center; color: var(--muted); font-size: 12px; padding-top: 4px; }
.f4-board {
  display: grid; grid-template-columns: repeat(7, 1fr); padding: 2.2%; border-radius: 16px;
  background: linear-gradient(180deg, #2563eb, var(--f4-frame)); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .25), 0 12px 30px -12px #1d4ed8;
  touch-action: manipulation; overflow: hidden;
}
.f4-col { display: flex; flex-direction: column; border: 0; padding: 0; margin: 0; background: transparent; border-radius: 10px;
  cursor: default; -webkit-tap-highlight-color: transparent; }
.f4-col.open { cursor: pointer; }
.f4-col.open:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
@media (hover: hover) { .f4-col.open:hover { background: rgba(255, 255, 255, .1); } }
.f4-cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; }
.f4-cell::before { content: ""; position: absolute; inset: 9%; border-radius: 50%; background: var(--f4-hole);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, .6); }
.f4-disc { position: relative; width: 82%; aspect-ratio: 1; border-radius: 50%; z-index: 1; }
.f4-disc.red { background: radial-gradient(circle at 35% 30%, #fca5a5, var(--f4-red) 45%, #b91c1c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.f4-disc.yellow { background: radial-gradient(circle at 35% 30%, #fef9c3, var(--f4-yellow) 45%, #ca8a04); box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.f4-disc.drop { animation: f4-drop calc(.18s + var(--fall, 6) * .05s) cubic-bezier(.5, 0, .9, .6) both; }
@keyframes f4-drop {
  0% { transform: translateY(calc(var(--fall, 6) * -122% - 40%)); }
  80% { transform: translateY(0); }
  90% { transform: translateY(-7%); }
  100% { transform: translateY(0); }
}
.f4-disc.last::after { content: ""; position: absolute; inset: 34%; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7); }
.f4-disc.win { animation: f4-win .9s ease-in-out infinite alternate; box-shadow: 0 0 0 3px #fff, 0 0 18px 4px rgba(255, 255, 255, .7); }
@keyframes f4-win { from { transform: scale(1); } to { transform: scale(.86); } }
.f4-mark { position: absolute; inset: 30%; border-radius: 50%; z-index: 2; pointer-events: none; }
.f4-mark.t-you, .f4-mark.t-bot, .f4-mark.t-both { border: 3px dashed; animation: f4-pulse 1.4s ease-in-out infinite; }
.f4-mark.red { border-color: var(--f4-red); }
.f4-mark.yellow { border-color: var(--f4-yellow); }
.f4-mark.t-both { border-color: #fff; }
@keyframes f4-pulse { 50% { opacity: .45; } }
.f4-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; min-height: 20px; }
.f4-legend span { display: inline-flex; align-items: center; gap: 6px; }
.f4-key { width: 14px; height: 14px; border-radius: 50%; border: 3px dashed; display: inline-block; }
.f4-key.red { border-color: var(--f4-red); } .f4-key.yellow { border-color: var(--f4-yellow); }
.f4-toggles { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 12px; }
.f4-proven { margin: 10px 0; padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.f4-proven.win { background: rgba(244, 63, 94, .12); border: 1px solid rgba(244, 63, 94, .45); }
.f4-proven.loss { background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .45); }
.cb-cands li.chosen b { color: rgb(var(--heat)); }
.f4-heat-wrap { margin-top: 12px; display: grid; gap: 6px; }
.f4-heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; width: 168px; }
.f4-heat i { aspect-ratio: 1; border-radius: 50%; display: block; }
.watch-f4 .f4-col { cursor: default; }
.watch-page .f4 { --f4-red: #ef4444; }
.watch-body, .ar-board, .pv-body, .pv-page { --f4-red: #ef4444; --f4-yellow: #facc15; --f4-frame: #1d4ed8; --f4-hole: #0b1220; }
@media (max-width: 720px) {
  .f4-rate { font-size: 10px; }
  .f4-board { border-radius: 12px; }
}

/* ---------------------------------------------------------------- bot arena */
.arena-page { max-width: 1100px; margin: 0 auto; display: grid; gap: 14px; }
.arena-page .page-head { margin: 0; }
.row-between.wrap { flex-wrap: wrap; }
.chip-good { border-color: var(--win); background: rgba(34, 197, 94, .14); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.seg-btn { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 14px; }
.seg-btn:hover:not(:disabled) { color: var(--text); }
.seg-btn.active { background: var(--accent-2); color: #fff; font-weight: 600; }
.seg-btn.capped { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.ar-controls p { margin: 6px 0 0; }
.ar-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.ar-title { display: grid; gap: 6px; margin-bottom: 12px; }
.ar-names { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.ar-name { display: inline-flex; align-items: center; gap: 6px; }
.ar-name > i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ar-board .watch-chess, .ar-board .boards, .ar-board .cc { margin: 0; }
.ar-board .card { background: var(--card-2); }
.ar-recent { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; max-height: 260px; overflow: auto; }
.ar-recent li { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ar-sub { margin: 16px 0 6px; }
.ar-off td { opacity: .6; }
.ar-chart { margin-top: 8px; }
.ar-plot { position: relative; }
.ar-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ar-grid { stroke: var(--line); stroke-width: 1; }
.ar-axis { fill: var(--muted); font-size: 11px; }
.ar-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ar-line.dashed { stroke-dasharray: 5 5; stroke-width: 1.5; opacity: .8; }
.ar-dot { stroke: var(--card); stroke-width: 2; }
.ar-endlabel { fill: var(--text); font-size: 11px; }
.ar-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.ar-tip { position: absolute; top: 4px; min-width: 150px; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line);
  font-size: 12px; pointer-events: none; display: grid; gap: 3px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.ar-tip-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 6px; align-items: center; }
.ar-tip-row i { width: 10px; height: 10px; border-radius: 50%; }
.ar-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text); }
.ar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ar-legend i { width: 16px; height: 0; border-top: 2px solid var(--c); }
.ar-legend i.dashed { border-top-style: dashed; }
@media (max-width: 900px) { .ar-main { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .seg-btn { padding: 6px 9px; font-size: 13px; }
  .ar-endlabel { font-size: 13px; }
}

/* ---------------------------------------------------------------- Neon Rally */
.rl-card { display: grid; gap: 10px; }
.rl-court { position: relative; width: 100%; max-width: 900px; margin: 0 auto; border-radius: 14px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(167, 139, 250, .35), 0 0 32px rgba(232, 121, 249, .15); touch-action: none; user-select: none;
  -webkit-user-select: none; cursor: none; }
.rl-watch .rl-court, .ar-board .rl-court { cursor: default; }
.rl .rl-court { max-width: min(900px, calc((100vh - 150px) * 1.6)); }
.ar-recent li.muted { display: block; }
.rl-canvas { display: block; width: 100%; aspect-ratio: 8 / 5; }
.rl-under { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }
.rl-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.rl-contact { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.rl-bigscore { font-size: 40px; font-weight: 800; margin: 4px 0; }
.rl-bigscore .you { color: #22d3ee; } .rl-bigscore .bot { color: #f472b6; }
@media (max-width: 700px) { .rl-court { border-radius: 10px; } .rl-bigscore { font-size: 30px; } }

/* Neon Rally on phones: full-screen play */
.rl-fbar { display: none; }
.rl .rl-court.rl-full { position: fixed; inset: 0; z-index: 40; max-width: none; margin: 0; border-radius: 0; box-shadow: none;
  display: flex; align-items: center; justify-content: center; background: #070a1c;
  padding: calc(max(8px, env(safe-area-inset-top)) + 48px) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
.rl-court.rl-full .rl-canvas { aspect-ratio: auto; border-radius: 10px; box-shadow: 0 0 0 1px rgba(167, 139, 250, .35); }
.rl-court.rl-full .rl-fbar { display: flex; gap: 8px; position: absolute; z-index: 2;
  top: max(6px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
.rl-fbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(167, 139, 250, .5); background: rgba(11, 16, 48, .75);
  color: var(--text); font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
html.rl-lock, html.rl-lock body { overflow: hidden; overscroll-behavior: none; }
@media (orientation: landscape) {
  .rl .rl-court.rl-full { padding: max(8px, env(safe-area-inset-top)) calc(max(8px, env(safe-area-inset-right)) + 52px) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .rl-court.rl-full .rl-fbar { flex-direction: column; top: 50%; transform: translateY(-50%); }
}

/* ---------------------------------------------------------------- PvP lobbies (pvp.js) */
.pv-page { max-width: 1100px; margin: 0 auto; display: grid; gap: 14px; }
.pv-page .page-head { margin: 0; flex-wrap: wrap; }
.pv-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pv-create, .pv-join { display: grid; gap: 12px; }
.pv-create h3, .pv-join h3, .pv-sub { margin: 0; }
.pv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pv-row[hidden] { display: none; }
.pv-row .name-box { margin-top: 0; }
.pv-code-input, .pv-link { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: inherit; }
.pv-code-input { width: 8ch; font-size: 22px; font-weight: 800; letter-spacing: 4px; text-transform: uppercase; text-align: center; }
.pv-code-input:focus, .pv-link:focus { outline: none; border-color: var(--accent); }
.pv-link { width: 100%; font-size: 13px; }
.pv-code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 3px; color: var(--accent); }
.pv-bigcode { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(44px, 12vw, 72px); font-weight: 800; letter-spacing: 10px;
  margin: 0; color: var(--accent); }
.pv-invite, .pv-joinhere { display: grid; gap: 10px; justify-items: center; text-align: center; max-width: 520px; margin: 0 auto; width: 100%; }
.pv-invite p { margin: 0; }
.pv-seats { display: flex; flex-wrap: wrap; gap: 8px; }
.pv-seat { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); font-size: 14px; }
.pv-seat.me { border-color: var(--accent-2); }
.pv-seat.turn { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56, 189, 248, .25); }
.pv-seat > i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.pv-seat > i.on { background: var(--win); }
.pv-seat small { color: var(--muted); font-size: 11px; }
.pv-seat small.ok { color: var(--win); }
.status.pv-yourturn { border-color: var(--accent); background: rgba(56, 189, 248, .1); font-weight: 600; }
.pv-actions { justify-content: flex-end; }
.pv-who { margin: 4px 0; display: flex; align-items: center; gap: 8px; }
.pv-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; }
.pv-dot.red { background: var(--f4-red); } .pv-dot.yellow { background: var(--f4-yellow); }
.pv-promo { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.pv-lastshot { margin: 0 0 10px; color: var(--muted); }
.pv-page button.cell { font: inherit; color: inherit; }
.pv-page button.cb-sq { font: inherit; }
.pv-page .cc-hand-wrap .card-head { margin: 14px 0 0; align-items: center; }
.pv-page .cc-hand-wrap .card-head h4 { margin: 0; }
.pv-lobby .live-side { gap: 10px; }
.is-busy .pv-body { cursor: progress; }
@media (max-width: 760px) {
  .pv-top { grid-template-columns: 1fr; }
  .pv-actions { justify-content: stretch; }
}

/* player accounts + PvP ladder (account.js) */
.acc-btn { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 12px; text-decoration: none; color: inherit; }
.acc-btn-label { font-size: 13px; font-weight: 600; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-chip { text-decoration: none; color: inherit; padding-right: 14px; }
.name-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; }
.acc-link { color: var(--accent); margin-top: 18px; }
.pv-row .acc-link { margin-top: 0; }
.acc-page { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.acc-page .page-head { margin: 0; flex-wrap: wrap; }
.acc-card { display: grid; gap: 14px; max-width: 440px; width: 100%; }
.acc-form { display: grid; gap: 12px; }
.acc-field { display: grid; gap: 4px; }
.acc-input { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: inherit; font: inherit; width: 100%; }
.acc-input:focus { outline: none; border-color: var(--accent); }
.acc-msg { margin: 0; min-height: 1.2em; }
.acc-more summary { cursor: pointer; font-weight: 600; }
.acc-more[open] summary { margin-bottom: 12px; }
.acc-ladder-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.acc-ladder-head h3 { margin: 0; }
.acc-games { margin: 10px 0; flex-wrap: wrap; }
.acc-recent h4 { margin: 14px 0 6px; }
.acc-recent p { margin: 4px 0; }
.acc-win { font-weight: 700; }
.acc-up { color: var(--win); }
.acc-down { color: var(--lose); }
.pv-seat small.pv-elo { color: var(--accent); font-weight: 700; }
@media (max-width: 560px) { .acc-btn-label { display: none; } .acc-btn { padding: 0; width: 40px; justify-content: center; } }
.topbar-tools { display: flex; align-items: center; gap: 6px; flex: none; }
