/* ============================================================
   弈境 · GO ATLAS
   A quiet, editorial interface for playing Go against KataGo.
   ============================================================ */

:root {
  --bg: #0a0e0c;
  --bg-2: #0f1411;
  --panel: #151b17;
  --panel-2: #111612;
  --paper: #f1eadc;
  --paper-2: #e7ddca;
  --ink: #141814;
  --text: #f1ece2;
  --muted: #a09f93;
  --dim: #74776d;
  --line: rgba(235, 228, 214, .12);
  --line-strong: rgba(235, 228, 214, .22);
  --cinnabar: #d65a42;
  --cinnabar-soft: #a84533;
  --jade: #78b8a1;
  --jade-deep: #3d7c69;
  --gold: #d8b372;
  --gold-soft: #b89354;
  --wood: #d5ad73;
  --font-display: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
  --font-ui: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .38);
  --shadow-md: 0 16px 44px rgba(0, 0, 0, .24);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 640px at 12% -8%, rgba(70, 122, 103, .15), transparent 62%),
    radial-gradient(900px 560px at 96% 2%, rgba(176, 83, 58, .10), transparent 58%),
    linear-gradient(180deg, #0b100d 0%, #090c0a 56%, #080b09 100%);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(216, 179, 114, .28); color: #fffdf7; }

/* ---------- ambient background ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .8;
}
.glow-a {
  width: 52vw; height: 52vw;
  left: -18vw; top: -28vw;
  background: radial-gradient(circle, rgba(77, 132, 109, .14), transparent 66%);
}
.glow-b {
  width: 44vw; height: 44vw;
  right: -16vw; top: 18vh;
  background: radial-gradient(circle, rgba(172, 75, 53, .08), transparent 68%);
}
.grain {
  position: absolute;
  inset: -20%;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.page, .topbar, .site-footer { position: relative; z-index: 1; }

/* ---------- top bar ---------- */

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 14, 12, .88), rgba(10, 14, 12, .52));
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
  min-width: 190px;
}
.brand-seal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .08), transparent 45%),
    var(--cinnabar);
  color: #fff9ee;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 240, 220, .22), 0 8px 18px rgba(109, 35, 24, .32);
  transform: rotate(-2deg);
}
.brand-name {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: .07em;
  line-height: 1.2;
  color: #f3ece0;
}
.brand-name em {
  font-family: var(--font-ui);
  font-style: normal;
  font-size: 8px;
  letter-spacing: .34em;
  color: var(--dim);
  margin-top: 4px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  margin-right: auto;
}
.nav-btn {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 13px;
  letter-spacing: .08em;
  cursor: pointer;
  transition: color .18s ease, background .18s ease;
}
.nav-btn:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-btn.active { color: var(--text); }
.nav-btn.active::after {
  content: "";
  position: absolute;
  left: 15px; right: 15px; bottom: -19px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.engine-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  white-space: nowrap;
  background: rgba(255, 255, 255, .025);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 4px rgba(120, 184, 161, .09), 0 0 12px rgba(120, 184, 161, .55);
  animation: statusPulse 2.4s ease-in-out infinite;
}
.engine-label { color: #d8d2c6; }
.engine-divider { width: 1px; height: 12px; background: var(--line); }
.engine-meta { color: var(--dim); }

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

/* ---------- main layout ---------- */

.page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 34px 36px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 432px;
  gap: 26px;
  align-items: start;
}

.board-column { min-width: 0; }

/* ---------- match line ---------- */

.match-line {
  width: min(100%, max(460px, calc(100vh - 330px)), 760px);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
}
.player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.player-human { flex: 1 1 0; }
.player-ai { flex: 1.25 1 0; justify-content: flex-end; text-align: right; }
.player-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.player-copy strong {
  font-size: 14px;
  font-weight: 600;
  color: #ece5d9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-copy span {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.stone-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
}
.stone-avatar.black {
  background: radial-gradient(circle at 34% 28%, #4c4f4a 0%, #20231f 28%, #080a08 76%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10), 0 7px 14px rgba(0, 0, 0, .4);
}
.stone-avatar.white {
  background: radial-gradient(circle at 32% 26%, #fffdf6 0%, #eee4d3 42%, #c9bca8 100%);
  box-shadow: inset 0 0 0 1px rgba(50, 40, 27, .18), 0 7px 14px rgba(0, 0, 0, .35);
  color: #5a4d3b;
  font-family: var(--font-display);
  font-size: 15px;
}
.stone-avatar.white span { transform: translateY(-1px); }
.stone-avatar.black span {
  width: 14px; height: 14px;
  border: 1px solid rgba(216, 179, 114, .28);
  border-radius: 50%;
}
.player-ai .stone-avatar { order: 2; }
.player-ai .player-copy { order: 1; }
.player-ai .text-btn { display: none; }

.text-btn {
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .08em;
  padding: 5px 2px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.text-btn:hover { color: var(--gold); border-color: rgba(216, 179, 114, .4); }

.match-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}
.match-vs {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .22em;
  color: var(--dim);
}
.turn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid rgba(120, 184, 161, .25);
  border-radius: 999px;
  color: var(--jade);
  font-size: 9px;
  letter-spacing: .08em;
  background: rgba(120, 184, 161, .06);
  white-space: nowrap;
}
.turn-chip i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.turn-chip.ai-turn {
  color: var(--gold);
  border-color: rgba(216, 179, 114, .28);
  background: rgba(216, 179, 114, .06);
}
.turn-chip.ended { color: var(--muted); border-color: var(--line); background: rgba(255,255,255,.03); }

/* ---------- board ---------- */

.board-frame {
  width: min(100%, max(460px, calc(100vh - 330px)), 760px);
  margin: 0 auto;
  padding: 12px;
  border-radius: 20px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, .06), transparent 30%),
    linear-gradient(180deg, #27241d 0%, #171511 100%);
  border: 1px solid rgba(216, 179, 114, .18);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .06);
  position: relative;
}
.board-frame::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, .035);
  border-radius: 15px;
  pointer-events: none;
}
.board-frame-top, .board-frame-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 27px;
  padding: 0 6px;
  color: rgba(236, 226, 210, .62);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.board-frame-top { padding-bottom: 8px; }
.board-frame-bottom { padding-top: 8px; }
.board-kicker { color: rgba(236, 226, 210, .52); }
.board-komi { color: var(--dim); }
.board-komi b { color: var(--gold); font-weight: 500; margin-left: 3px; }

.board-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  overflow: hidden;
  background: var(--wood);
  box-shadow: inset 0 0 0 1px rgba(65, 43, 21, .5), inset 0 0 40px rgba(82, 49, 18, .16);
  touch-action: manipulation;
}
#goBoard {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
#goBoard.thinking { cursor: progress; }

.board-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 7px;
  pointer-events: none;
}
.board-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(23, 20, 14, .55);
  border: 1px solid rgba(255, 250, 235, .16);
  color: rgba(255, 250, 235, .84);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
  backdrop-filter: blur(8px);
}
.board-tool {
  pointer-events: auto;
  border: 1px solid rgba(255, 250, 235, .14);
  background: rgba(23, 20, 14, .52);
  color: rgba(255, 250, 235, .7);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 9px;
  letter-spacing: .08em;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.board-tool:hover { color: #fff9ee; border-color: rgba(255, 250, 235, .35); }
.board-tool.off { opacity: .45; }

.thinking-float {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 9px;
  border-radius: 999px;
  background: rgba(13, 16, 13, .82);
  border: 1px solid rgba(216, 179, 114, .24);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .28);
  color: #ece4d4;
  font-size: 10px;
  letter-spacing: .04em;
  backdrop-filter: blur(10px);
  z-index: 3;
}
.thinking-float b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--gold);
  font-size: 9px;
}
.thinking-ring {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(216, 179, 114, .2);
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.capture-pair { display: flex; align-items: center; gap: 7px; color: var(--dim); }
.capture-pair b { color: #d8d1c4; font-family: var(--font-mono); font-weight: 500; }
.dot-sep { width: 2px; height: 2px; border-radius: 50%; background: var(--dim); }
.board-progress { display: flex; align-items: center; gap: 8px; color: var(--dim); }
.progress-track {
  width: 72px; height: 2px;
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  overflow: hidden;
}
.progress-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--jade-deep), var(--gold));
  transition: width .4s ease;
}

.board-actions {
  width: min(100%, max(460px, calc(100vh - 330px)), 760px);
  margin: 14px auto 0;
  display: flex;
  gap: 8px;
}
.action-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  color: #d9d3c6;
  border-radius: 10px;
  height: 38px;
  padding: 0 13px;
  font-size: 11px;
  letter-spacing: .04em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .15s ease;
  white-space: nowrap;
}
.action-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .065); border-color: var(--line-strong); color: #fff9ee; }
.action-btn:active:not(:disabled) { transform: translateY(1px); }
.action-btn:disabled { opacity: .34; cursor: not-allowed; }
.action-btn .key {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 14px;
}
.action-btn.danger:hover:not(:disabled) { border-color: rgba(214, 90, 66, .45); color: #f1a18e; background: rgba(214, 90, 66, .08); }
.action-btn.primary {
  margin-left: auto;
  background: linear-gradient(135deg, #e7c88f, #c9a260);
  border-color: rgba(255, 241, 205, .22);
  color: #1c1a13;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(176, 134, 69, .18);
}
.action-btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #f3d69c, #d4ac68); color: #14130e; }
.action-btn.primary .arrow { font-size: 12px; }

.board-foot {
  width: min(100%, max(460px, calc(100vh - 330px)), 760px);
  margin: 11px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #666b61;
  font-size: 9px;
  letter-spacing: .06em;
  padding: 0 4px;
}

/* ---------- right column ---------- */

.analysis-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, .035), transparent 34%),
    linear-gradient(180deg, rgba(24, 31, 26, .96), rgba(16, 21, 17, .98));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, .035);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head.compact { align-items: center; margin-bottom: 11px; }
.eyebrow {
  display: block;
  font-family: var(--font-ui);
  font-size: 8px;
  letter-spacing: .24em;
  color: var(--gold-soft);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.panel h2, .modal h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 21px;
  letter-spacing: .04em;
  color: #f2ece1;
}
.panel-head.compact h2 { font-size: 15px; letter-spacing: .08em; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(120, 184, 161, .22);
  background: rgba(120, 184, 161, .06);
  color: var(--jade);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
  padding: 4px 8px;
}
.live-pill i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: statusPulse 1.6s ease infinite;
}
.live-pill.paused { color: var(--dim); border-color: var(--line); background: rgba(255,255,255,.025); }
.live-pill.paused i { animation: none; }

.winrate-panel { padding-bottom: 16px; }

.winrate-numbers {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.winrate-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-side { align-items: flex-end; text-align: right; }
.side-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--muted);
}
.ai-side .side-label { flex-direction: row-reverse; }
.mini-stone {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.mini-stone.black { background: #171a16; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.mini-stone.white { background: #eee5d5; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.winrate-value {
  font-family: var(--font-ui);
  font-size: clamp(34px, 3.6vw, 47px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -.055em;
  color: var(--jade);
  font-variant-numeric: tabular-nums;
  transition: color .3s ease;
}
.ai-side .winrate-value { color: #d8cdbd; }
.winrate-value small {
  font-size: .38em;
  letter-spacing: 0;
  font-weight: 400;
  margin-left: 2px;
  color: var(--dim);
}

.winrate-bar {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: rgba(238, 229, 213, .09);
  overflow: visible;
  margin: 0 0 14px;
}
.winrate-fill {
  height: 100%;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4d927c, #87c5ae 70%, #d8b372);
  box-shadow: 0 0 18px rgba(120, 184, 161, .18);
  transition: width .45s cubic-bezier(.2,.7,.2,1);
}
.winrate-mid {
  position: absolute;
  left: 50%; top: -3px;
  width: 1px; height: 11px;
  background: rgba(255, 255, 255, .25);
}
.winrate-edge {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 2px; height: 11px;
  background: #f3dfb8;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(243, 223, 184, .55);
  transform: translateX(-1px);
  transition: left .45s cubic-bezier(.2,.7,.2,1);
}

.chart-wrap {
  position: relative;
  height: 154px;
  margin: 0 -2px;
}
#winrateChart {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #666b61;
  font-size: 10px;
  letter-spacing: .04em;
  pointer-events: none;
}
.chart-tooltip {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -100%);
  background: #f0e8da;
  color: #1a1d18;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 9px;
  line-height: 1.5;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
  pointer-events: none;
  white-space: nowrap;
}
.chart-tooltip b { font-family: var(--font-mono); font-size: 10px; }
.chart-axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #6f746a;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .04em;
  margin-top: 2px;
}
.chart-axis b { color: #a5a497; font-weight: 500; }
.chart-legend { display: inline-flex; align-items: center; gap: 5px; color: #7b8076; }
.chart-legend i { width: 14px; height: 2px; border-radius: 2px; background: var(--jade); }

.analysis-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}
.stat { padding: 0 12px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; padding-left: 2px; }
.stat span { display: block; color: #6f746a; font-size: 8px; letter-spacing: .1em; margin-bottom: 3px; white-space: nowrap; }
.stat b {
  display: block;
  color: #d8d1c4;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat b.positive { color: var(--jade); }
.stat b.negative { color: #de917d; }

/* ---------- AI paper card ---------- */

.ai-panel {
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, .45), transparent 34%),
    radial-gradient(600px 220px at 100% 0%, rgba(199, 160, 101, .18), transparent 70%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  border-color: rgba(244, 232, 210, .28);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .64);
  position: relative;
  overflow: hidden;
}
.ai-panel::after {
  content: "KATAGO";
  position: absolute;
  right: -8px;
  bottom: -14px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 54px;
  letter-spacing: -.04em;
  color: rgba(20, 24, 20, .035);
  pointer-events: none;
}
.ai-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  position: relative;
  z-index: 1;
}
.ai-mark {
  position: relative;
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, #444a41 0%, #171c17 36%, #0b0e0b 78%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 8px 18px rgba(0,0,0,.22);
  display: grid;
  place-items: center;
  color: #e8dcc5;
  font-family: var(--font-display);
  font-size: 17px;
}
.ai-mark::before, .ai-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(216, 179, 114, .28);
}
.ai-mark::before { inset: -4px; border-style: dashed; opacity: .55; }
.ai-mark::after { inset: 7px; border-color: rgba(216, 179, 114, .1); }
.ai-mark i {
  position: absolute;
  right: 1px; bottom: 2px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--jade);
  border: 2px solid var(--paper);
}
.ai-title { min-width: 0; flex: 1; }
.ai-title .eyebrow { color: #8c6f42; margin-bottom: 3px; font-size: 7px; }
.ai-title h2 {
  color: #1c211b;
  font-size: 19px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-title p {
  margin: 3px 0 0;
  color: #777366;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .02em;
}
.outline-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(25, 30, 24, .2);
  background: rgba(255, 255, 255, .18);
  color: #3d4037;
  border-radius: 8px;
  height: 29px;
  padding: 0 9px;
  font-size: 9px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.outline-btn:hover { background: rgba(255, 255, 255, .38); border-color: rgba(25,30,24,.35); }

.rating-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 16px 0 12px;
  border-top: 1px solid rgba(30, 35, 27, .13);
  border-bottom: 1px solid rgba(30, 35, 27, .13);
  position: relative;
  z-index: 1;
}
.rating-cell { padding: 11px 0 10px; }
.rating-cell + .rating-cell { border-left: 1px solid rgba(30, 35, 27, .13); padding-left: 14px; }
.rating-cell span { display: block; font-size: 8px; letter-spacing: .1em; color: #8b8576; margin-bottom: 2px; }
.rating-cell strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: .01em;
  color: #242920;
  white-space: nowrap;
}
.rating-cell small { display: block; font-size: 8px; color: #9c9585; margin-top: 1px; }
.ai-blurb {
  margin: 0;
  color: #5e6156;
  font-size: 10px;
  line-height: 1.75;
  position: relative;
  z-index: 1;
}
.ai-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(30, 35, 27, .13);
  margin-top: 12px;
  padding-top: 9px;
  position: relative;
  z-index: 1;
}
.ai-latency { font-family: var(--font-mono); font-size: 8px; color: #8b8576; }
.ai-panel .link-btn { color: #6e5b3b; }
.ai-panel .link-btn:hover { color: #3f3423; }

/* ---------- move list ---------- */

.moves-panel { padding-bottom: 12px; }
.phase-pill {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .08em;
  color: var(--jade);
  border: 1px solid rgba(120, 184, 161, .22);
  background: rgba(120, 184, 161, .06);
  border-radius: 999px;
  padding: 3px 7px;
}
.phase-pill.ended { color: var(--gold); border-color: rgba(216,179,114,.24); background: rgba(216,179,114,.06); }
.move-list {
  max-height: 132px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.14) transparent;
}
.empty-moves {
  grid-column: 1 / -1;
  color: #686d63;
  font-size: 10px;
  padding: 10px 2px 14px;
}
.move-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 25px;
  padding: 0 5px;
  border-radius: 5px;
  color: #a6a599;
  font-family: var(--font-mono);
  font-size: 9px;
  border-left: 2px solid transparent;
}
.move-item:nth-child(2n) { background: rgba(255,255,255,.018); }
.move-item .move-no { color: #62685e; width: 22px; text-align: right; flex: 0 0 auto; }
.move-item .move-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.move-item .move-dot.b { background: #0c0e0c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.move-item .move-dot.w { background: #e8ddc9; }
.move-item .move-coord { color: #d6cfc2; font-size: 10px; }
.move-item .move-tag { margin-left: auto; color: #6f7469; font-size: 8px; }
.move-item.last { border-left-color: var(--cinnabar); background: rgba(214, 90, 66, .06); }
.move-item.last .move-coord { color: #f0b8a6; }
.move-item.ai-move .move-tag { color: #8a7c66; }

/* ---------- scale strip ---------- */

.scale-strip {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(255,255,255,.03), transparent 28%),
    linear-gradient(180deg, rgba(22, 28, 23, .92), rgba(13, 18, 14, .96));
  padding: 21px 24px 17px;
  box-shadow: var(--shadow-md);
}
.scale-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.scale-heading .eyebrow { margin-bottom: 5px; }
.scale-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #efe8dc;
}
.link-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .05em;
  padding: 3px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.link-btn:hover { color: var(--gold); border-color: rgba(216,179,114,.35); }
.link-btn span { margin-left: 4px; font-size: 11px; }

.ladder {
  position: relative;
  height: 98px;
  margin: 0 10px;
}
.ladder-track {
  position: absolute;
  left: 0; right: 0; top: 34px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2b332d 0%, #526056 20%, #8c927d 43%, #b88f57 68%, #e1c085 86%, #e8c886 100%);
  box-shadow: 0 0 24px rgba(216, 179, 114, .08);
}
.ladder-bands { position: absolute; inset: 0; }
.ladder-band {
  position: absolute;
  top: 44px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
  color: #7f8478;
}
.ladder-band b { font-weight: 500; color: #aaa99d; font-size: 9px; letter-spacing: .04em; }
.ladder-band span { font-family: var(--font-mono); font-size: 8px; color: #666c61; }
.ladder-band.first { align-items: flex-start; transform: none; }
.ladder-band.last { align-items: flex-end; transform: translateX(-100%); }
.ladder-markers { position: absolute; inset: 0; }
.ladder-marker {
  position: absolute;
  top: 27px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.ladder-marker::before {
  content: "";
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, .2);
}
.ladder-marker.peak::before { background: var(--gold); box-shadow: 0 0 10px rgba(216,179,114,.4); }
.ladder-marker .marker-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1.5px solid #0f1410;
  background: var(--jade);
  box-shadow: 0 0 0 1px rgba(255,255,255,.15);
  margin-top: -1px;
}
.ladder-marker.b10 .marker-dot { background: #9eb7a9; }
.ladder-marker.b18 .marker-dot { background: var(--gold); }
.ladder-marker.peak .marker-dot { background: var(--cinnabar); box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 0 14px rgba(214,90,66,.4); }
.ladder-marker .marker-label {
  position: absolute;
  top: 49px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(12, 16, 13, .94);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 8px;
  color: #bdb7aa;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .16s ease, transform .16s ease;
}
.ladder-marker:hover .marker-label { opacity: 1; transform: none; }
.ladder-marker.peak .marker-label { color: var(--gold); border-color: rgba(216,179,114,.3); }

.scale-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 12px;
  color: #777c72;
  font-size: 8px;
  letter-spacing: .04em;
}
.scale-foot span { display: inline-flex; align-items: center; gap: 5px; }
.scale-foot b { color: #b4b1a5; font-family: var(--font-mono); font-weight: 500; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.legend-dot.b6 { background: #6f9587; }
.legend-dot.b10 { background: #9eb7a9; }
.legend-dot.b18 { background: var(--gold); }
.legend-dot.top { background: var(--cinnabar); }
.scale-note { margin-left: auto; color: #5f655b; }

/* ---------- footer ---------- */

.site-footer {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 34px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #5d6259;
  font-size: 9px;
  letter-spacing: .05em;
  border-top: 1px solid rgba(235, 228, 214, .06);
}
.site-footer em { color: #777c72; font-style: normal; margin-left: 3px; font-family: var(--font-mono); }
.site-footer a { color: #8a8f83; border-bottom: 1px solid rgba(255,255,255,.08); }
.site-footer a:hover { color: var(--gold); }
.footer-mid { margin-left: auto; margin-right: auto; }

/* ---------- modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 7, 5, .74);
  backdrop-filter: blur(16px);
  overflow-y: auto;
  animation: backdropIn .2s ease both;
}
.modal-backdrop[hidden] { display: none; }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 980px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, .055), transparent 28%),
    linear-gradient(180deg, #171d18 0%, #101511 100%);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
  padding: 28px;
  animation: modalIn .24s cubic-bezier(.2,.8,.2,1) both;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.modal-head h2 { font-size: 28px; margin-bottom: 6px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; max-width: 640px; }
.icon-btn {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,.06); }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 13px;
}
.modal-foot p { margin: 0; color: #71766c; font-size: 9px; line-height: 1.6; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* roster */

.roster-modal { max-width: 1040px; }
.roster-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.filter-tabs { display: flex; gap: 3px; padding: 3px; background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 9px; }
.filter-tabs button {
  border: 0;
  background: transparent;
  color: var(--dim);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 10px;
  letter-spacing: .04em;
  cursor: pointer;
}
.filter-tabs button span { color: #777c72; margin-left: 3px; font-family: var(--font-mono); font-size: 8px; }
.filter-tabs button:hover { color: var(--text); }
.filter-tabs button.active { background: rgba(255,255,255,.09); color: #f2ece1; }
.roster-hint { color: #6c7167; font-size: 9px; letter-spacing: .04em; }
.roster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.roster-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(155deg, rgba(255,255,255,.045), rgba(255,255,255,.012));
  padding: 14px;
  cursor: pointer;
  color: var(--text);
  position: relative;
  transition: border-color .18s ease, background .18s ease, transform .16s ease;
  min-height: 196px;
  display: flex;
  flex-direction: column;
}
.roster-card:hover { border-color: rgba(216,179,114,.32); background: linear-gradient(155deg, rgba(255,255,255,.065), rgba(255,255,255,.018)); transform: translateY(-1px); }
.roster-card.active { border-color: rgba(216,179,114,.6); box-shadow: inset 0 0 0 1px rgba(216,179,114,.15); }
.roster-card.active::after {
  content: "当前";
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--gold);
  border: 1px solid rgba(216,179,114,.28);
  border-radius: 3px;
  padding: 1px 4px;
}
.roster-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.model-badge {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .04em;
  color: #bdb8ac;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
}
.tier-badge {
  font-size: 8px;
  letter-spacing: .06em;
  color: var(--dim);
}
.tier-badge.顶级 { color: var(--gold); }
.tier-badge.均衡 { color: var(--jade); }
.roster-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.3;
}
.roster-card .config-line {
  margin: 2px 0 10px;
  color: #777c72;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .03em;
}
.roster-metrics { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 9px; }
.roster-metrics span { display: block; color: #6f746a; font-size: 7px; letter-spacing: .08em; margin-bottom: 1px; }
.roster-metrics b { display: block; font-family: var(--font-mono); font-size: 10px; color: #d2ccc0; font-weight: 500; }
.roster-metrics .rank b { color: #d9bc85; font-family: var(--font-ui); font-size: 10px; }
.strength-bar { height: 2px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; margin: 10px 0 8px; }
.strength-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #4c826f, var(--gold)); }
.roster-card p { margin: 0; color: #7c8076; font-size: 9px; line-height: 1.6; flex: 1; }
.roster-card .select-hint { margin-top: 8px; color: #a88e63; font-size: 8px; letter-spacing: .04em; opacity: 0; transition: opacity .16s ease; }
.roster-card:hover .select-hint { opacity: 1; }

/* new game */

.small-modal { max-width: 540px; }
.size-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.size-options button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.size-options button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.size-options button.active { border-color: rgba(216,179,114,.55); background: rgba(216,179,114,.08); color: var(--text); }
.size-options b { display: block; font-family: var(--font-display); font-size: 27px; font-weight: 500; line-height: 1; color: #e9dfcf; margin-bottom: 4px; }
.size-options span { display: block; font-size: 8px; letter-spacing: .03em; color: #777c72; }
.size-options button.active b { color: var(--gold); }
.newgame-opponent {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: #b9b3a7;
  font-size: 10px;
}
.newgame-opponent .mini-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ebe1cf;
  color: #3a3225;
  font-family: var(--font-display);
  font-size: 12px;
}
.newgame-opponent b { color: #eee6d9; font-weight: 500; }
.newgame-opponent span { color: #73786e; font-family: var(--font-mono); font-size: 8px; margin-left: auto; }

/* scale modal */

.scale-modal { max-width: 940px; }
.scale-hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 10px;
  margin-bottom: 18px;
}
.scale-hero-main, .scale-hero-side {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 16px 18px;
  background: rgba(255,255,255,.025);
}
.scale-hero-main { background: linear-gradient(135deg, rgba(216,179,114,.10), rgba(255,255,255,.02)); border-color: rgba(216,179,114,.22); }
.scale-hero-main span, .scale-hero-side > span { font-size: 8px; letter-spacing: .12em; color: #96886f; display: block; margin-bottom: 4px; }
.scale-hero-main strong { display: block; font-family: var(--font-display); font-size: 42px; font-weight: 500; line-height: 1; color: #f0d7a5; letter-spacing: -.01em; }
.scale-hero-main strong small { font-family: var(--font-ui); font-size: 11px; letter-spacing: .08em; color: #9c8968; margin-left: 4px; }
.scale-hero-main p, .scale-hero-side p { margin: 7px 0 0; color: #7f8479; font-size: 9px; line-height: 1.65; }
.scale-hero-side { display: flex; flex-direction: column; justify-content: center; }
.scale-hero-side strong { font-family: var(--font-display); font-size: 23px; font-weight: 500; color: #ece3d4; line-height: 1.1; }
.scale-hero-side p { max-width: 360px; }
.hero-tag { color: var(--cinnabar) !important; }
.scale-table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.scale-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.scale-table th {
  text-align: left;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .1em;
  color: #777c72;
  padding: 9px 12px;
  background: rgba(255,255,255,.025);
  border-bottom: 1px solid var(--line);
}
.scale-table td { padding: 9px 12px; border-bottom: 1px solid rgba(235,228,214,.07); color: #b7b2a6; }
.scale-table tr:last-child td { border-bottom: 0; }
.scale-table td:first-child { color: #e7dfd1; font-family: var(--font-mono); font-size: 9px; }
.scale-table td:nth-child(4) { font-family: var(--font-mono); color: var(--gold); }
.scale-table tr.current td { background: rgba(216,179,114,.05); }
.scale-table .yes { color: var(--jade); font-size: 8px; }
.scale-table .no { color: #686d63; font-size: 8px; }
.human-ladder {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.human-band {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 11px;
  background: rgba(255,255,255,.02);
}
.human-band span { display: block; font-size: 8px; letter-spacing: .06em; color: #777c72; }
.human-band b { display: block; margin: 1px 0 4px; font-family: var(--font-display); font-size: 17px; font-weight: 500; color: #e5dccd; }
.human-band p { margin: 0; color: #8a8e82; font-size: 8px; line-height: 1.5; }
.human-band em { display: block; margin-top: 6px; color: #a78e64; font-family: var(--font-mono); font-size: 7px; font-style: normal; }

/* method modal */

.method-modal { max-width: 940px; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.method-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.022);
  padding: 17px 18px;
}
.method-card-wide { grid-column: 1 / -1; }
.method-index {
  position: absolute;
  right: 14px; top: 12px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: rgba(216,179,114,.45);
}
.method-card h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; font-weight: 500; color: #e9e1d3; letter-spacing: .04em; }
.method-card p { margin: 0; color: #8a8e83; font-size: 10px; line-height: 1.8; }
.method-formula {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
  font-size: 9px;
}
.method-formula span { color: #6d7268; }
.method-formula b { color: #d1c5b0; font-family: var(--font-mono); font-weight: 500; }
.source-links { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 18px; margin-top: 4px; }
.source-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  color: #bcb6a9;
  font-size: 9px;
  border-bottom: 1px solid rgba(235,228,214,.07);
}
.source-links a:hover { color: var(--gold); }
.source-links a span { color: #777c72; }
.method-disclaimer { margin-top: 12px !important; color: #666b61 !important; font-family: var(--font-mono); font-size: 8px !important; }

/* result */

.result-modal { max-width: 470px; text-align: center; padding: 30px 28px 26px; position: relative; }
.result-seal {
  width: 50px; height: 50px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--cinnabar);
  color: #fff7e9;
  font-family: var(--font-display);
  font-size: 27px;
  box-shadow: inset 0 0 0 1px rgba(255,240,220,.22), 0 12px 30px rgba(120, 38, 25, .3);
  transform: rotate(-3deg);
}
.result-modal .eyebrow { color: var(--gold-soft); }
.result-modal h2 { font-size: 30px; margin-bottom: 6px; }
.result-sub { margin: 0 auto 18px; color: var(--muted); font-size: 11px; line-height: 1.7; max-width: 340px; }
.result-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.result-score div { display: flex; flex-direction: column; gap: 2px; }
.result-score span { color: #777c72; font-size: 8px; letter-spacing: .08em; }
.result-score strong { font-family: var(--font-display); font-size: 24px; font-weight: 500; color: #e8dfd1; }
.result-vs { color: #5f655b; font-family: var(--font-display); font-size: 18px; }
.result-note { margin: 13px 0 0; color: #6f746a; font-size: 9px; line-height: 1.6; }
.result-modal .modal-actions { justify-content: center; }

/* confirm / toast */

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 7, 5, .62);
  backdrop-filter: blur(8px);
}
.confirm-backdrop[hidden] { display: none; }
.confirm-box {
  width: min(100%, 360px);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #171d18;
  padding: 22px;
  box-shadow: var(--shadow-lg);
}
.confirm-box h3 { margin: 0 0 7px; font-family: var(--font-display); font-size: 19px; font-weight: 500; }
.confirm-box p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 200;
  background: #f0e8da;
  color: #1b201a;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 10px;
  letter-spacing: .03em;
  box-shadow: 0 16px 40px rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- scrollbars ---------- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; }
  .board-frame, .match-line, .board-actions, .board-foot { width: 100%; max-width: 680px; }
  .board-frame { width: min(100%, max(460px, calc(100vh - 330px))); }
}

@media (max-width: 1020px) {
  .topbar { padding: 0 22px; gap: 18px; }
  .brand { min-width: 0; }
  .engine-pill { display: none; }
  .page { padding: 20px 22px 30px; }
  .workspace { grid-template-columns: 1fr; }
  .board-frame { width: min(100%, 720px); }
  .analysis-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .winrate-panel { grid-column: 1 / -1; }
  .moves-panel { grid-column: 1 / -1; }
  .move-list { grid-template-columns: repeat(4, 1fr); max-height: 108px; }
  .scale-strip { margin-top: 20px; }
}

@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 16px; gap: 12px; }
  .brand-seal { width: 32px; height: 32px; font-size: 20px; border-radius: 7px; }
  .brand-name { font-size: 14px; }
  .brand-name em { font-size: 7px; }
  .main-nav { gap: 0; overflow-x: auto; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .nav-btn { font-size: 11px; padding: 7px 9px; }
  .nav-btn.active::after { left: 9px; right: 9px; bottom: -13px; }
  .page { padding: 14px 12px 24px; }
  .workspace { gap: 12px; }
  .match-line { gap: 8px; margin-bottom: 10px; }
  .stone-avatar { width: 32px; height: 32px; }
  .player-copy strong { font-size: 12px; }
  .player-copy span { font-size: 8px; }
  .player-ai .text-btn { display: none; }
  .match-vs { display: none; }
  .turn-chip { font-size: 8px; padding: 3px 7px; }
  .board-frame { padding: 8px; border-radius: 14px; }
  .board-frame-top, .board-frame-bottom { height: 23px; font-size: 8px; }
  .board-actions { gap: 5px; margin-top: 10px; }
  .action-btn { height: 36px; padding: 0 9px; font-size: 10px; }
  .action-btn .key { display: none; }
  .board-foot { font-size: 8px; gap: 10px; }
  .analysis-column { grid-template-columns: 1fr; gap: 10px; }
  .winrate-panel, .moves-panel { grid-column: auto; }
  .panel { padding: 16px; border-radius: 14px; }
  .winrate-value { font-size: 38px; }
  .chart-wrap { height: 132px; }
  .move-list { grid-template-columns: 1fr 1fr; max-height: 118px; }
  .scale-strip { padding: 16px 14px 13px; }
  .scale-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .scale-heading h2 { font-size: 19px; }
  .ladder { height: 92px; margin: 0 2px; }
  .ladder-band b { font-size: 8px; }
  .ladder-band span { font-size: 7px; }
  .scale-foot { gap: 9px 14px; }
  .scale-note { margin-left: 0; width: 100%; }
  .site-footer { padding: 15px 16px 24px; flex-wrap: wrap; font-size: 8px; }
  .footer-mid { display: none; }
  .roster-grid { grid-template-columns: 1fr 1fr; }
  .modal { padding: 20px 16px; border-radius: 17px; }
  .modal-head h2 { font-size: 23px; }
  .method-grid, .scale-hero { grid-template-columns: 1fr; }
  .method-card-wide { grid-column: auto; }
  .source-links { grid-template-columns: 1fr; }
  .human-ladder { grid-template-columns: 1fr 1fr; }
  .scale-table-wrap { overflow-x: auto; }
  .scale-table { min-width: 560px; }
  .modal-backdrop { padding: 10px; }
  .roster-toolbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .roster-hint { display: none; }
  .scale-hero-main strong { font-size: 35px; }
}

@media (max-width: 480px) {
  .roster-grid { grid-template-columns: 1fr; }
  .roster-card { min-height: 168px; }
  .winrate-numbers { gap: 8px; }
  .winrate-value { font-size: 32px; }
  .analysis-stats { grid-template-columns: 1fr 1fr; row-gap: 10px; }
  .stat:nth-child(3) { grid-column: 1 / -1; border-left: 0; padding-left: 2px; }
  .size-options { grid-template-columns: 1fr; }
  .size-options button { display: flex; align-items: center; gap: 12px; padding: 11px 13px; }
  .size-options b { margin: 0; font-size: 23px; }
  .human-ladder { grid-template-columns: 1fr; }
  .board-badges { padding: 0 2px 5px; }
  .board-badge, .board-tool { font-size: 8px; padding: 4px 7px; }
}

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

/* link from the AI page to the online human-vs-human mode */
.main-nav a.nav-btn { text-decoration: none; }
.online-nav-cta { color: var(--gold) !important; }
.online-nav-cta span { font-size: 10px; margin-left: 1px; }
.resume-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1050px;
  margin: 0 auto 18px;
  padding: 10px 13px;
  border: 1px solid rgba(216,179,114,.22);
  border-radius: 10px;
  background: rgba(216,179,114,.055);
  color: #9d9f93;
  font-size: 9px;
}
.resume-banner b { color: var(--gold); font-family: var(--font-mono); letter-spacing: .1em; }
.resume-banner .action-btn { margin-left: auto; height: 30px; font-size: 9px; }
