/* Gambit Chess - styles */
:root {
  --bg: #0e1014;
  --bg-2: #13161b;
  --panel: #171a20;
  --panel-2: #1d2128;
  --line: #272c35;
  --line-2: #323844;
  --text: #eef0f3;
  --muted: #9aa3b2;
  --faint: #6b7381;
  --accent: #4ade9a;
  --accent-2: #2fbf7c;
  --accent-ink: #062314;
  --danger: #f2626b;
  --warn: #f5b84a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --sq-light: #e3e7ed;
  --sq-dark: #8796ab;
  --sq-light-ink: #8796ab;
  --sq-dark-ink: #e3e7ed;
  --hl: rgba(255, 214, 92, .45);
  --sel: rgba(74, 222, 154, .55);
  --dot: rgba(18, 22, 28, .32);
  --check: radial-gradient(circle, rgba(242, 64, 74, .95) 0%, rgba(242, 64, 74, .55) 45%, rgba(242, 64, 74, 0) 75%);
  --hint: rgba(74, 222, 154, .42);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-2: #eceef2;
  --panel: #ffffff;
  --panel-2: #f6f7f9;
  --line: #e2e5ea;
  --line-2: #d4d8df;
  --text: #14171c;
  --muted: #5d6573;
  --faint: #8b93a1;
  --accent: #17a565;
  --accent-2: #128a54;
  --accent-ink: #ffffff;
  --shadow: 0 10px 30px rgba(20, 30, 50, .10);
}

[data-board="classic"] { --sq-light: #ecedd1; --sq-dark: #789654; --sq-light-ink: #789654; --sq-dark-ink: #ecedd1; }
[data-board="walnut"] { --sq-light: #efd9b5; --sq-dark: #b2825a; --sq-light-ink: #b2825a; --sq-dark-ink: #efd9b5; }
[data-board="ocean"] { --sq-light: #dbe9f4; --sq-dark: #4b7aa6; --sq-light-ink: #4b7aa6; --sq-dark-ink: #dbe9f4; }
[data-board="graphite"] { --sq-light: #b9bec7; --sq-dark: #5d6470; --sq-light-ink: #5d6470; --sq-dark-ink: #b9bec7; }
[data-board="rose"] { --sq-light: #f3e2e2; --sq-dark: #b77b86; --sq-light-ink: #b77b86; --sq-dark-ink: #f3e2e2; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.icon { flex: none; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 32px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 26px; height: 26px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.topnav { display: flex; gap: 6px; }
.nav-btn {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font-weight: 600; font-size: 14px; transition: background .15s, color .15s;
}
.nav-btn:hover { background: var(--panel); color: var(--text); }
.nav-btn.icon-only { width: 38px; padding: 0; justify-content: center; }

main { padding: clamp(16px, 3vw, 28px) clamp(16px, 4vw, 32px) 48px; max-width: 1240px; margin: 0 auto; }

/* ---------- Home ---------- */
.hero { padding: clamp(12px, 4vw, 40px) 0 28px; max-width: 720px; }
.eyebrow { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 12px; }
.hero h1 { font-size: clamp(32px, 5.5vw, 56px); line-height: 1.04; letter-spacing: -.035em; margin: 0 0 16px; font-weight: 800; }
.hero h1 span { color: var(--muted); }
.lede { color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); line-height: 1.6; margin: 0; max-width: 600px; }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 8px; }
.mode-card {
  position: relative; text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.mode-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.mode-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); margin-bottom: 6px; }
.mode-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.mode-desc { color: var(--muted); font-size: 14px; line-height: 1.5; }
.mode-tag { position: absolute; top: 18px; right: 18px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 4px 8px; border-radius: 999px; }
.mode-tag.accent { color: var(--accent); }

.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; border-radius: var(--radius); margin-bottom: 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, var(--panel)), var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
}
.resume strong { display: block; font-size: 15px; }
.resume span { color: var(--muted); font-size: 13px; }
.resume .row { display: flex; gap: 8px; }

.values-strip { margin-top: 32px; padding: 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1.6fr; gap: 20px; align-items: center; }
.values-head h2 { margin: 0 0 6px; font-size: 18px; }
.values-head p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.values-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.value-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.value-tile .pc { width: 40px; height: 40px; }
.value-tile b { font-family: var(--mono); font-size: 18px; }
.value-tile span { font-size: 11px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 14px; transition: filter .15s, background .15s, border-color .15s, transform .08s;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chip-btn { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 12px; padding: 6px 10px; border-radius: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

/* ---------- Game layout ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.board-col { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: max(300px, min(720px, calc(100vh - 270px))); margin: 0 auto; }
.board-area { display: flex; gap: 10px; align-items: stretch; }
.board-shell { position: relative; flex: 1; aspect-ratio: 1; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); touch-action: none; }
.board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%; user-select: none; }
.sq { position: relative; display: grid; place-items: center; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq::before { content: ''; position: absolute; inset: 0; pointer-events: none; }
.sq.last::before { background: var(--hl); }
.sq.sel::before { background: var(--sel); }
.sq.hint-sq::before { background: var(--hint); }
.sq.check::before { background: var(--check); }
.sq.drop-target::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .75); pointer-events: none; }
.coord { position: absolute; font-size: clamp(8px, 1.4vw, 12px); font-weight: 700; pointer-events: none; z-index: 1; }
.coord.rank { top: 3px; left: 4px; }
.coord.file { bottom: 2px; right: 4px; }
.sq.light .coord { color: var(--sq-light-ink); }
.sq.dark .coord { color: var(--sq-dark-ink); }
.piece { position: relative; z-index: 2; width: 92%; height: 92%; cursor: grab; will-change: transform; }
.piece svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, .28)); }
.piece.lifted { opacity: .25; }
.piece.anim { transition: transform .18s cubic-bezier(.2, .7, .3, 1); }
.mark { position: absolute; z-index: 3; pointer-events: none; }
.mark.dot { width: 30%; height: 30%; border-radius: 50%; background: var(--dot); }
.mark.ring { inset: 4%; border-radius: 50%; border: 6px solid var(--dot); }
@media (max-width: 520px) { .mark.ring { border-width: 4px; } }
.sq.legal { cursor: pointer; }
.sq.legal:hover .mark.dot { transform: scale(1.25); }
.ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%); }
.ghost svg { width: 100%; height: 100%; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .35)); }

.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.arrows line { stroke: var(--accent); stroke-width: .17; stroke-linecap: round; opacity: .85; }
.arrowhead { fill: var(--accent); }

.review-banner { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 12px; background: rgba(14, 16, 20, .88); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }

.eval-bar { position: relative; width: 14px; border-radius: 7px; overflow: hidden; background: #2b2f37; border: 1px solid var(--line); flex: none; }
.eval-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #f3f4f6; transition: height .4s ease; }
.eval-num { position: absolute; left: 50%; transform: translateX(-50%) rotate(-90deg); top: 50%; font-size: 9px; font-family: var(--mono); color: var(--faint); white-space: nowrap; mix-blend-mode: difference; }
.board-area.flipped .eval-bar { transform: rotate(180deg); }

/* Player cards */
.player-card { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); min-height: 58px; transition: border-color .2s, box-shadow .2s; }
.player-card.to-move { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.avatar { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; border: 1px solid var(--line-2); }
.avatar.w { background: #f3f4f6; }
.avatar.b { background: #8a94a3; }
.avatar svg { width: 30px; height: 30px; }
.pinfo { min-width: 0; flex: 1; }
.pname { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname .tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 6px; }
.pname .live { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.pname .live.off { background: var(--danger); }
.pcaps { display: flex; align-items: center; gap: 6px; min-height: 20px; margin-top: 2px; flex-wrap: wrap; }
.caps { display: flex; align-items: center; }
.caps .cp { width: 18px; height: 18px; margin-right: -5px; }
.caps .cp svg { width: 100%; height: 100%; }
.pts { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 6px; font-family: var(--mono); }
.adv { font-size: 12px; font-weight: 700; color: var(--accent); font-family: var(--mono); }
.clock { font-family: var(--mono); font-weight: 700; font-size: clamp(18px, 2.4vw, 24px); padding: 6px 12px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); min-width: 96px; text-align: center; font-variant-numeric: tabular-nums; }
.clock.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.clock.low { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Side panel */
.side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 80px; }
.status { padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.status .turn-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; }
.status .turn-dot.w { background: #f3f4f6; }
.status .turn-dot.b { background: #1b1e24; }
.status small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; margin-top: 2px; }
.status.alert { border-color: var(--danger); }
.status.alert .stxt { color: var(--danger); }
.offer { padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--line)); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.offer .row { display: flex; gap: 6px; }
.offer .btn { height: 34px; padding: 0 12px; font-size: 13px; }

.hint-card { padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.hint-head { display: flex; justify-content: space-between; align-items: center; }
.hint-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
.hint-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.hint-body { color: var(--muted); font-size: 14px; line-height: 1.5; }
.hint-body .best { font-size: 20px; font-weight: 800; color: var(--text); font-family: var(--mono); letter-spacing: -.01em; }
.hint-body .reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hint-body .reason { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.hint-body .evaltxt { margin-top: 8px; font-size: 13px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.tab { flex: 1; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; position: relative; }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.tab .dot { position: absolute; top: 7px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.tab-panels { border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.panel { padding: 10px; }

.moves { display: grid; grid-template-columns: 38px 1fr 1fr; gap: 2px; max-height: 240px; min-height: 120px; overflow-y: auto; align-content: start; font-family: var(--mono); font-size: 14px; }
.moves .num { color: var(--faint); padding: 6px 4px; text-align: right; }
.moves .mv { border: 0; background: transparent; text-align: left; padding: 6px 8px; border-radius: 7px; font-family: var(--mono); font-weight: 500; }
.moves .mv:hover { background: var(--panel-2); }
.moves .mv.cur { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); font-weight: 700; }
.moves .empty { grid-column: 1 / -1; color: var(--faint); font-family: var(--font); font-size: 13.5px; padding: 12px 6px; }
.nav-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.nav-row .icon-btn { width: 100%; }

.points { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.pt-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.pt-row .who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.pt-row .big { font-family: var(--mono); font-weight: 700; font-size: 20px; }
.pt-row .sub { color: var(--muted); font-size: 12px; font-weight: 500; }
.pt-bar { height: 10px; border-radius: 6px; overflow: hidden; display: flex; background: var(--panel-2); border: 1px solid var(--line); }
.pt-bar .w { background: #eceef1; transition: width .3s; }
.pt-bar .b { background: #2f343d; flex: 1; }
.pt-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pt-legend div { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pt-legend .pc { width: 22px; height: 22px; }
.pt-legend b { color: var(--text); font-family: var(--mono); margin-left: auto; }
.pt-note { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 0; }

.chat-log { height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px; font-size: 14px; }
.chat-msg { max-width: 85%; padding: 7px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); line-height: 1.4; word-wrap: break-word; }
.chat-msg.me { align-self: flex-end; background: color-mix(in srgb, var(--accent) 20%, var(--panel-2)); }
.chat-msg.sys { align-self: center; background: transparent; border: 0; color: var(--faint); font-size: 12.5px; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form input { flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); padding: 0 12px; outline: none; }
.chat-form input:focus { border-color: var(--accent); }

.toolbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.toolbar.secondary { grid-template-columns: repeat(2, 1fr); }
.tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 58px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600; transition: color .15s, border-color .15s; }
.toolbar.secondary .tool { flex-direction: row; height: 42px; gap: 8px; font-size: 13px; }
.tool:hover { color: var(--text); border-color: var(--line-2); }
.tool.danger:hover { color: var(--danger); border-color: var(--danger); }
.tool:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(5, 7, 10, .62); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); padding: 22px; animation: pop .18s ease; }
.modal.wide { max-width: 640px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.m-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.m-head h3 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.m-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.m-close { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label:not(.toggle), .field > .lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field input[type=text] { height: 44px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 0 14px; outline: none; font-size: 15px; }
.field input[type=text]:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-width: 64px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg button.on { background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); border-color: var(--accent); color: var(--text); }
.seg.big button { height: auto; padding: 10px 12px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; }
.seg.big button small { font-weight: 500; color: var(--muted); font-size: 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.toggle:last-child { border-bottom: 0; }
.toggle small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.m-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.m-actions .btn { min-width: 110px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 54px; height: 54px; border-radius: 10px; border: 2px solid transparent; padding: 0; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.swatch.on { border-color: var(--accent); }
.swatch i { display: block; }

.room-box { padding: 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); text-align: center; }
.room-code { font-family: var(--mono); font-size: 34px; font-weight: 700; letter-spacing: .18em; margin: 6px 0 12px; }
.room-link { display: flex; gap: 6px; }
.room-link input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); padding: 0 10px; font-size: 13px; color: var(--muted); }
.waiting { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14px; margin-top: 14px; }

.result-big { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.result-why { color: var(--muted); margin: 6px 0 18px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-stats div { padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.result-stats span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.result-stats b { font-family: var(--mono); font-size: 20px; }

.rules { font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.rules h4 { color: var(--text); margin: 18px 0 4px; font-size: 15px; }
.rules h4:first-child { margin-top: 0; }
.rules p { margin: 0; }

/* Promotion */
.promo { position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.promo button { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); padding: 6px; }
.promo button:hover { border-color: var(--accent); }
.promo button svg { width: 100%; height: 100%; }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: pop .2s ease; max-width: 440px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .board-col { max-width: 640px; }
  .side { position: static; max-width: 640px; width: 100%; margin: 0 auto; }
  .mode-grid { grid-template-columns: 1fr; }
  .values-strip { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main { padding: 12px 12px 40px; }
  .topbar { padding: 10px 12px; }
  .nav-btn span { display: none; }
  .nav-btn { width: 38px; padding: 0; justify-content: center; }
  .values-row { grid-template-columns: repeat(3, 1fr); }
  .clock { min-width: 78px; padding: 5px 8px; }
  .player-card { padding: 6px 8px; gap: 8px; min-height: 52px; }
  .avatar { width: 32px; height: 32px; }
  .avatar svg { width: 26px; height: 26px; }
  .field-row { grid-template-columns: 1fr; }
  .mode-card { padding: 18px; }
  .eval-bar { width: 10px; }
  .board-area { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
