:root {
  color-scheme: dark;
  --bg: #0b1316; --bg-deep: #080f12; --surface: #131f23; --surface-raised: #1b292d; --surface-soft: #172428; --surface-hover: #243638;
  --ink: #f0efe5; --muted: #a7b9b2; --faint: #81978e; --line: #314341; --line-soft: #233633;
  --jade: #8ad5b4; --jade-deep: #2b6755; --jade-wash: #1c3c32; --gold: #ddbd7f; --gold-wash: #372f23; --danger: #efa595;
  --green: var(--jade); --green-dark: var(--jade-deep); --accent: var(--gold); --paper: var(--bg); --white: var(--surface);
  --red: #e38479; --blue: #85b4d2; --yellow: #ddbc75; --purple: #b5a0d7; --teal: #7dcdb8; --pink: #dfa2b7;
  --board-top: #3b5f4c; --board-bottom: #2b4b3b; --board-edge: #72957b; --board-rim: #4c765a;
  --hole-center: #1b392d; --hole-edge: #aec0a0; --hole-rim: #809c7d; --board-grid: #6e9377; --color-label: #c6d5be;
  --route: #ffe7ae; --route-underlay: #192c27; --target-fill: #d8f7d5;
  --shadow: 0 18px 40px #03070935, inset 0 1px 0 #ffffff06;
  --rail-width: 84px;
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  font-size: 14px; font-synthesis: none; color: var(--ink); background: var(--bg);
}
body[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f0e8; --bg-deep: #e8eade; --surface: #fafbf5; --surface-raised: #ffffff; --surface-soft: #f0f3e9; --surface-hover: #e7eee1;
  --ink: #243e34; --muted: #556c5e; --faint: #5c6d5d; --line: #ccd8c9; --line-soft: #e1e7db;
  --jade: #216b51; --jade-deep: #195b45; --jade-wash: #e2eddf; --gold: #806027; --gold-wash: #f2ead5; --danger: #ad5545;
  --green: var(--jade); --green-dark: var(--jade-deep); --accent: var(--gold); --paper: var(--bg); --white: var(--surface);
  --board-top: #ded4b6; --board-bottom: #c8b98d; --board-edge: #a98d5d; --board-rim: #a89568;
  --hole-center: #ddd4b5; --hole-edge: #ab9464; --hole-rim: #b2a078; --board-grid: #a89570; --color-label: #506845;
  --route: #69511e; --route-underlay: #fff9df; --target-fill: #467c4f;
  --shadow: 0 16px 36px #243e3410, inset 0 1px 0 #ffffffa0;
}
* { box-sizing: border-box; }
html { min-width: 280px; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(ellipse at 48% 8%, #426c4820, transparent 65%), var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { min-height: 36px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); color: var(--ink); font-size: 13px; font-weight: 550; cursor: pointer; transition: background .16s, border-color .16s, color .16s, transform .16s; }
button:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--faint); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .42; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--jade); outline-offset: 3px; }
a { color: var(--jade); text-decoration: none; }
a:hover { color: var(--gold); }
button svg, a svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
button.primary, .primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 20px; background: linear-gradient(140deg, #a0dfbf, #70baa0); border-color: #a0d2b8; color: #143528; font-weight: 700; box-shadow: 0 4px 15px #07150d24, inset 0 1px 0 #ffffff30; }
.primary:hover:not(:disabled) { background: linear-gradient(140deg, #b2e8cb, #85c6ad); border-color: #b6dec8; }
body[data-theme="light"] .primary { background: linear-gradient(140deg, #357d60, #205d47); border-color: #286b51; color: #f6fff4; }
body[data-theme="light"] .primary:hover:not(:disabled) { background: #286c51; }
.secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--jade-wash); border-color: color-mix(in srgb, var(--jade) 28%, var(--line)); color: var(--jade); font-weight: 600; }
.full { width: 100%; }
.quiet, .icon-btn, .text-btn { background: transparent; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; min-height: 34px; padding: 0; border: 1px solid transparent; font-size: 20px; color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }
.text-btn { min-height: 28px; padding: 3px 0; border: 0; color: var(--jade); font-size: 12px; }
.hidden, [hidden] { display: none !important; }

/* The narrow navigation rail leaves room for the board and analysis. */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: var(--rail-width); padding: 22px 10px 16px; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--surface), var(--bg-deep)); border-right: 1px solid var(--line-soft); }
.brand { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 750; letter-spacing: 2px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 44px; border: 1px solid #87ad7938; border-radius: 13px; background: linear-gradient(145deg, #315645, #16352c); color: #e2c68e; font-size: 33px; box-shadow: inset 0 1px 0 #c5e7b61a; }
.brand-name { text-align: center; }
.brand small { display: none; }
.nav-label { margin: 30px 0 12px; text-align: center; color: var(--faint); font-size: 10px; letter-spacing: 2px; }
.sidebar nav { display: flex; flex-direction: column; gap: 7px; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 66px; padding: 10px 6px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 11px; font-weight: 550; }
.nav-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-text { line-height: 1.3; }
.nav-item.active { color: var(--jade); background: var(--jade-wash); border-color: color-mix(in srgb, var(--jade) 20%, transparent); box-shadow: inset 0 1px 0 #cdeec50a; }
.nav-item i { display: none; }
.side-note { margin-top: auto; padding: 20px 2px 0; text-align: center; color: var(--muted); }
.note-star { display: block; margin-bottom: 8px; color: var(--gold); font-size: 24px; }
.side-note b { display: none; }
.side-note p { display: none; }
.side-note button { min-height: 32px; padding: 4px 0; border: 0; background: transparent; color: var(--faint); font-size: 10px; }
.side-note button span { display: none; }
.local-status { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; color: var(--faint); font-size: 10px; }
.local-status small { font-size: 10px; }
.local-status > span, .live-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--jade); box-shadow: 0 0 0 3px color-mix(in srgb, var(--jade) 8%, transparent); }
.workspace { margin-left: var(--rail-width); }
.topbar { height: 58px; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--surface) 82%, transparent); }
.breadcrumb { display: flex; align-items: center; gap: 13px; color: var(--faint); font-size: 12px; white-space: nowrap; }
.breadcrumb b { color: var(--muted); font-weight: 550; }
.mobile-brand { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.local-pill { display: flex; align-items: center; gap: 8px; margin-right: 8px; color: var(--muted); font-size: 11px; }
.theme-toggle, .focus-toggle { border-color: var(--line-soft); }
.focus-toggle[aria-pressed="true"] { color: var(--jade); border-color: var(--jade-deep); background: var(--jade-wash); }
main { max-width: 1680px; margin: 0 auto; padding: 22px 26px 18px; }
.view { display: none; }
.view.active { display: block; }
.page-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 66px; margin-bottom: 18px; }
.eyebrow, .section-kicker { color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: 2.6px; line-height: 1.4; }
.page-intro .eyebrow { display: block; }
h1 { margin: 5px 0 4px; font-size: 26px; font-weight: 650; letter-spacing: .5px; line-height: 1.3; }
h1 > span { margin-left: 14px; color: var(--gold); font-size: 22px; }
.page-intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.page-intro > .primary { flex: 0 0 auto; font-size: 13px; white-space: nowrap; }

/* A bounded central stage keeps the last move and controls in view. */
.game-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr) 300px; grid-template-areas: "art board panel"; gap: 18px; height: calc(100dvh - 202px); min-height: 550px; max-height: 900px; align-items: stretch; }
.board-card { grid-area: board; position: relative; display: grid; grid-template-rows: 44px 48px auto minmax(0, 1fr) auto 24px auto; min-width: 0; min-height: 0; height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(140deg, color-mix(in srgb, var(--surface-raised) 58%, var(--surface)), var(--surface) 55%); box-shadow: var(--shadow); scroll-margin-top: 12px; }
.board-top { grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); }
.board-top > div:first-child { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; }
.board-top b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.tag { padding: 3px 6px; border: 1px solid var(--line-soft); border-radius: 4px; background: var(--surface-soft); color: var(--faint); font-size: 10px; white-space: nowrap; }
.board-tools { display: flex; gap: 3px; flex: 0 0 auto; }
.board-tools .icon-btn { width: 30px; min-height: 30px; }
.board-tools .icon-btn svg { width: 17px; height: 17px; }
.board-tools .active { color: var(--jade); background: var(--jade-wash); }
.player-strip { grid-row: 2; display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 48px; width: 50%; padding: 8px 0 8px 18px; }
.player-strip.bottom { position: absolute; grid-row: auto; grid-column: auto; top: 44px; right: 18px; width: calc(50% - 20px); padding: 8px 0; }
.player-icon { display: grid; place-items: center; flex: 0 0 auto; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); font-size: 17px; }
.player-strip > div { min-width: 0; }
.player-strip b { display: block; overflow: hidden; font-size: 13px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.player-strip small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.progress-badge { margin-left: auto; padding-right: 12px; color: var(--faint); font-size: 10px; white-space: nowrap; }
.player-strip.bottom .progress-badge { padding-right: 0; }
.record-source { grid-row: 3; margin: 4px 14px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--gold) 25%, var(--line)); border-radius: 6px; background: var(--gold-wash); color: var(--muted); font-size: 11px; line-height: 1.7; }
.record-source small { display: block; color: var(--gold); }
.board-wrap { grid-row: 4; position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 0 10px; }
#board { display: block; width: 100%; height: 100%; max-height: none; overflow: visible; filter: drop-shadow(0 10px 15px #00000022); touch-action: manipulation; }
#board .hole { cursor: pointer; outline: none; }
#board .hole:focus-visible > circle:last-of-type, #board .hole:focus > circle:nth-of-type(2) { stroke: var(--gold); stroke-width: 4; }
#board .target { animation: breathe 1.7s ease-in-out infinite; }
.last-action { grid-row: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 47px; min-width: 0; margin: 5px 14px 3px; padding: 7px 10px; border: 1px solid color-mix(in srgb, var(--gold) 22%, var(--line)); border-left: 3px solid var(--gold); border-radius: 7px; background: var(--jade-wash); color: var(--ink); }
.last-action > div { min-width: 0; }
.last-action b { display: block; color: var(--gold); font-size: 12px; font-weight: 600; }
.last-action small { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.last-action button { flex: 0 0 auto; min-height: 29px; padding: 5px 8px; border-color: color-mix(in srgb, var(--gold) 25%, var(--line)); color: var(--gold); background: var(--surface); font-size: 11px; }
.turn-message { grid-row: 6; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 24px; padding: 0 10px; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: center; }
.turn-message .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.board-bottom { grid-row: 7; display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 51px; padding: 9px 12px; border-top: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 24%, var(--surface)); }
.main-controls { display: flex; align-items: center; gap: 5px; }
.board-bottom button { min-height: 32px; padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.board-bottom .quiet { padding-right: 3px; border-color: transparent; color: var(--muted); }

/* Original character art sits in a quiet frame, separate from controls. */
.opponent-art { grid-area: art; position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #70976a45; border-radius: 15px; background: #162922; box-shadow: var(--shadow); }
.opponent-art-image { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 65% 40%; }
.opponent-art::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg, #08191510 20%, #08191545 50%, #0a1a16ed 82%, #0b1c17 100%); }
.opponent-art::after { content: ""; position: absolute; z-index: -1; inset: 8px; border: 1px solid #e0c58930; border-radius: 10px; pointer-events: none; }
.opponent-art > .section-kicker { position: absolute; top: 25px; left: 18px; color: #e5d2a9; font-size: 9px; letter-spacing: 2px; }
.portrait-ornament { position: absolute; top: 46px; left: 20px; color: #ebd39c; font-size: 22px; opacity: .85; }
.opponent-profile { position: relative; margin-top: auto; padding: 24px 17px 20px; color: #f0f3e7; }
.opponent-profile h2 { margin: 12px 0 9px; color: #f3f2df; font-size: 26px; font-weight: 600; letter-spacing: 2px; line-height: 1.3; }
.profile-tag { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 7px; border: 1px solid #e0c58945; border-radius: 5px; background: #21352caa; color: #e5c88f; font-size: 11px; white-space: nowrap; }
.opponent-profile p { margin: 0; color: #c5d7c3; font-size: 12px; line-height: 1.85; }
.profile-status { display: flex; align-items: center; gap: 8px; margin-top: 19px; color: #accab3; font-size: 10px; }
.profile-status .live-dot { width: 5px; height: 5px; background: #8bd5a3; }
body[data-theme="light"] .opponent-art { border-color: #a39868; }

/* Analysis is readable by default; optional detail lives in disclosures. */
.match-panel { grid-area: panel; display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; height: 100%; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; }
.panel { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: inset 0 1px 0 #ffffff04; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.panel h2 { margin: 0; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.4; }
.mini-label, .engine-pill { padding: 3px 6px; border: 1px solid var(--line-soft); border-radius: 5px; background: var(--surface-soft); color: var(--muted); font-size: 10px; white-space: nowrap; }
.engine-pill.thinking { border-color: color-mix(in srgb, var(--gold) 28%, var(--line)); background: var(--gold-wash); color: var(--gold); }
.panel-disclosure { flex: 0 0 auto; padding: 0; overflow: hidden; }
.panel-disclosure > .disclosure-heading { display: flex; position: relative; align-items: center; justify-content: flex-start; min-height: 48px; margin: 0; padding: 13px 15px; list-style: none; cursor: pointer; user-select: none; }
.panel-disclosure > .disclosure-heading::-webkit-details-marker { display: none; }
.panel-disclosure > .disclosure-heading > span { margin-left: auto; }
.panel-disclosure > .disclosure-heading::after { content: "⌄"; width: 12px; margin-left: 4px; color: var(--faint); font-size: 16px; line-height: 1; transform: translateY(-2px); transition: transform .16s; }
.panel-disclosure[open] > .disclosure-heading { border-bottom: 1px solid var(--line-soft); }
.panel-disclosure[open] > .disclosure-heading::after { transform: rotate(180deg) translateY(-2px); }
.panel-disclosure > .disclosure-heading:hover { background: var(--surface-soft); }
.panel-disclosure > .disclosure-heading:focus-visible { outline-offset: -3px; }
.panel-body { padding: 14px 15px 16px; }
.seat { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 9px 0; }
.seat:not(:last-child) { border-bottom: 1px solid var(--line-soft); }
.seat-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-soft); font-size: 17px; }
.seat-name { font-size: 13px; font-weight: 600; }
.seat-detail { margin-top: 4px; color: var(--muted); font-size: 11px; }
.seat-progress { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.seat-progress small { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; }
.seat.current .seat-name::after { content: " · 行棋"; color: var(--gold); font-size: 10px; font-weight: 400; }
.match-meta { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 11px; }
.match-meta span { display: flex; gap: 7px; }
.match-meta b { color: var(--muted); font-weight: 500; }
.search-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.search-metrics b { display: block; color: var(--jade); font-family: Bahnschrift, "Segoe UI", sans-serif; font-size: 23px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.search-metrics span { display: block; margin-top: 5px; color: var(--faint); font-size: 10px; }
.search-summary { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.fine-print { margin-bottom: 0; color: var(--faint); font-size: 11px; line-height: 1.8; }
.candidates { margin-top: 8px; font-size: 12px; }
.candidate { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.candidate:first-child { color: var(--jade); }
.candidate:last-child { border-bottom: 0; }
.search-plan { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.search-plan summary { color: var(--jade); font-weight: 600; cursor: pointer; }
.search-plan ol { padding-left: 21px; line-height: 1.9; }
.search-plan .fine-print { margin: 8px 0; }
.position-head { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; }
.position-head b { flex: none; white-space: nowrap; color: var(--jade); font-family: Bahnschrift, "Segoe UI", sans-serif; font-size: 30px; font-weight: 500; font-variant-numeric: tabular-nums; }
.position-head span { flex: 1 1 140px; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
#trend-chart { display: block; width: 100%; height: auto; margin: 10px 0 14px; }
#trend-chart text { fill: var(--faint); }
#trend-chart circle { cursor: pointer; }
#trend-chart circle:focus-visible { stroke: var(--gold); stroke-width: 3; outline: none; }
.analysis-detail-disclosure { margin: 9px 0 13px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.analysis-detail-disclosure > summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.analysis-detail-disclosure[open] > summary { margin-bottom: 10px; color: var(--jade); }
.analysis-side, .comparison-row { color: var(--muted); font-size: 12px; line-height: 1.85; }
.analysis-blocked { margin: 4px 0 7px; color: var(--gold); font-size: 11px; line-height: 1.8; }
.risk-pieces { margin: 8px 0 0; color: var(--gold); font-size: 11px; line-height: 1.85; }
.risk-link { display: inline-block; min-height: 26px; margin: 3px 3px 0 0; padding: 4px 6px; border-color: color-mix(in srgb, var(--gold) 25%, var(--line)); background: var(--gold-wash); color: var(--gold); font-size: 11px; }
.analysis-panel .secondary { font-size: 12px; }
.analysis-panel details.fine-print { margin-top: 13px; }
.analysis-panel details.fine-print > summary { cursor: pointer; }
#level-comparison { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.85; }
.history-controls { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.history-controls button { width: 30px; min-height: 29px; padding: 2px 6px; font-size: 15px; }
.history-controls span { margin: 0 auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.move-list { height: 152px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.empty { padding: 30px 8px; color: var(--faint); font-size: 12px; line-height: 1.9; text-align: center; }
.empty small { font-size: 11px; }
.move-row { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 33px; padding: 7px; border: 0; border-radius: 5px; background: transparent; font-size: 11px; text-align: left; }
.move-row.selected { color: var(--jade); background: var(--jade-wash); }
.move-row > small { width: 22px; flex: 0 0 auto; color: var(--faint); font-size: 10px; }
.color-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; }
.jump-count { margin-left: auto; color: var(--faint); font-size: 10px; }
.return-live { width: 100%; margin-top: 9px; border-color: transparent; color: var(--jade); background: var(--jade-wash); font-size: 12px; }
.history-panel #export-game { display: block; margin-top: 6px; }
.bottom-note { display: flex; align-items: center; gap: 8px; margin-top: 13px; color: var(--faint); font-size: 10px; }
.bottom-note > span { color: var(--gold); }
.bottom-note small { margin-left: auto; font-size: 10px; }

/* Supporting rooms use the same typography, materials and spacing. */
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
.lab-main { padding: 28px; }
.lab-main h2 { margin: 12px 0; font-size: 26px; }
.lab-main > p { max-width: 76ch; color: var(--muted); font-size: 14px; line-height: 1.95; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 25px; }
.feature-grid article { padding: 20px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--surface-soft); }
.feature-grid article > b { color: var(--gold); font-size: 12px; font-weight: 500; }
.feature-grid h3 { margin: 13px 0 9px; font-size: 15px; font-weight: 600; }
.feature-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.85; }
.lab-config h2 { margin-bottom: 22px; font-size: 17px; }
.lab-config label, dialog label { display: flex; flex-direction: column; gap: 8px; margin-bottom: 17px; color: var(--muted); font-size: 13px; }
select, input[type="number"] { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); color: var(--ink); font-size: 14px; }
select { cursor: pointer; }
.honesty { display: flex; align-items: flex-start; gap: 18px; margin-top: 20px; padding: 21px 24px; border: 1px solid color-mix(in srgb, var(--gold) 25%, var(--line)); border-radius: 11px; background: var(--gold-wash); }
.honesty > span { flex: 0 0 auto; color: var(--gold); font-size: 25px; }
.honesty b { color: var(--gold); font-size: 14px; font-weight: 600; }
.honesty p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.85; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.archive-card { padding: 23px; }
.archive-card h2 { margin: 11px 0; font-size: 18px; }
.archive-card p { color: var(--muted); font-size: 13px; line-height: 1.85; }
.archive-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.archive-actions button { font-size: 12px; }
.master-card { margin-bottom: 18px; border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.master-card .eyebrow { color: var(--gold); }
#master-library:empty { display: none; }
.rules-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; }
.prose { padding: 27px; }
.prose h2 { margin-bottom: 18px; font-size: 21px; }
.prose h3 { margin-top: 26px; margin-bottom: 10px; font-size: 15px; }
.prose p { color: var(--muted); font-size: 14px; line-height: 1.95; }
.prose a { color: var(--jade); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--jade) 35%, transparent); text-underline-offset: 4px; }
.prose .secondary { margin-top: 15px; font-size: 13px; text-decoration: none; }
dialog { width: 460px; max-width: calc(100vw - 30px); max-height: calc(100dvh - 40px); padding: 27px; overflow-y: auto; border: 1px solid color-mix(in srgb, var(--jade) 25%, var(--line)); border-radius: 15px; background: var(--surface); color: var(--ink); box-shadow: 0 26px 80px #00000055, inset 0 1px 0 #ffffff08; }
dialog::backdrop { background: #03090bbb; backdrop-filter: blur(6px); }
body[data-theme="light"] dialog::backdrop { background: #19382b70; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 25px; }
.dialog-head h2 { margin: 8px 0 0; font-size: 25px; font-weight: 600; }
.dialog-head .icon-btn { font-size: 26px; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
dialog .check-label { flex-direction: row; align-items: center; gap: 9px; line-height: 1.6; }
input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--jade-deep); }
dialog .fine-print { margin: 0 0 20px; }
#toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; max-width: min(560px, 84vw); padding: 13px 20px; border: 1px solid var(--jade-deep); border-radius: 9px; background: var(--surface-raised); color: var(--ink); box-shadow: 0 10px 30px #00000030; font-size: 13px; line-height: 1.6; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 25px); transition: opacity .18s, transform .18s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

body.focus-mode #view-play > .page-intro, body.focus-mode #view-play .opponent-art, body.focus-mode .side-note { display: none; }
body.focus-mode .game-layout { grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "board panel"; height: calc(100dvh - 110px); min-height: 550px; }
body.focus-mode #view-play .bottom-note { margin-top: 9px; }
@keyframes breathe { 50% { opacity: .55; } }

@media (min-width: 1760px) {
  :root { --rail-width: 180px; }
  .sidebar { padding: 27px 18px 20px; }
  .brand { flex-direction: row; gap: 12px; font-size: 20px; letter-spacing: 1px; }
  .brand-name { text-align: left; }
  .brand small { display: block; margin-top: 5px; color: var(--faint); font-size: 8px; letter-spacing: 2px; }
  .nav-label { text-align: left; margin: 35px 0 12px 11px; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 48px; padding: 12px; font-size: 13px; }
  .side-note { padding: 21px 12px; text-align: left; }
  .side-note b, .side-note p { display: block; }
  .side-note b { color: var(--ink); font-size: 13px; }
  .side-note p { margin: 10px 0 0; color: var(--faint); font-size: 12px; line-height: 1.85; }
  .side-note button { margin-top: 10px; font-size: 12px; }
  .side-note button span { display: inline; margin-left: 10px; }
  main { padding: 24px 32px 20px; }
  .game-layout { grid-template-columns: 210px minmax(0, 1fr) 320px; gap: 22px; height: calc(100dvh - 202px); }
  body.focus-mode .game-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1390px) {
  main { padding-left: 20px; padding-right: 20px; }
  .game-layout { grid-template-columns: 170px minmax(0, 1fr) 286px; gap: 14px; }
  .panel { padding: 14px; }
  .panel-disclosure { padding: 0; }
  .opponent-profile { padding-left: 15px; padding-right: 15px; }
  .opponent-profile h2 { font-size: 24px; }
  .progress-badge { display: none; }
  body.focus-mode .game-layout { grid-template-columns: minmax(0, 1fr) 286px; }
}
@media (max-width: 1280px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 286px; grid-template-rows: 80px minmax(0, 1fr); grid-template-areas: "art panel" "board panel"; gap: 12px 16px; min-height: 580px; }
  .opponent-art { border-radius: 11px; }
  .opponent-art-image { inset: 0 auto auto -20px; width: 174px; height: 261px; object-position: 50% 0; }
  .opponent-art::before { background: linear-gradient(90deg, #0a1a1610 40px, #0a1a16e8 150px, #0b1c17 100%); }
  .opponent-art::after { inset: 5px; border-radius: 7px; }
  .portrait-ornament, .opponent-art > .section-kicker { display: none; }
  .opponent-profile { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 10px; margin: 0 0 0 125px; padding: 11px 16px 11px 0; }
  .opponent-profile h2 { grid-column: 1; grid-row: 1; margin: 0; font-size: 20px; letter-spacing: 1px; }
  .profile-tag { grid-column: 2; grid-row: 1; min-height: 23px; padding: 3px 6px; font-size: 10px; }
  .opponent-profile p { grid-column: 1 / -1; grid-row: 2; overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
  .profile-status { display: none; }
  .board-card { grid-template-rows: 42px 40px auto minmax(0, 1fr) auto 22px auto; }
  .board-top { height: 42px; padding: 0 14px; }
  .player-strip { min-height: 40px; padding: 6px 0 6px 15px; }
  .player-strip.bottom { top: 42px; right: 15px; padding: 6px 0; }
  .player-icon { width: 27px; height: 27px; font-size: 15px; }
  .player-strip b { font-size: 12px; }
  .player-strip small { font-size: 10px; }
  .turn-message { min-height: 22px; }
  .board-bottom { min-height: 48px; padding: 8px 10px; }
  body.focus-mode .game-layout { grid-template-rows: minmax(0, 1fr); grid-template-areas: "board panel"; min-height: 550px; }
}
@media (max-width: 1040px) {
  :root { --rail-width: 74px; }
  .sidebar { padding-left: 7px; padding-right: 7px; }
  main { padding: 18px 16px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 260px; height: calc(100dvh - 182px); gap: 12px; }
  .page-intro { min-height: 62px; margin-bottom: 16px; }
  h1 { font-size: 23px; }
  .local-pill { display: none; }
  .opponent-art-image { left: -22px; width: 160px; height: 240px; }
  .opponent-profile { margin-left: 106px; padding-right: 12px; }
  .board-bottom button { padding-left: 7px; padding-right: 7px; font-size: 11px; }
  .main-controls { gap: 4px; }
  .lab-grid, .rules-grid { grid-template-columns: 1fr; }
  .lab-config { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .lab-config > h2, .lab-config > .fine-print, .lab-config > button { grid-column: 1 / -1; }
  .lab-config > .fine-print { margin-top: 0; margin-bottom: 17px; }
  body.focus-mode .game-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 900px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 80px auto auto; grid-template-areas: "art" "board" "panel"; height: auto; min-height: 0; max-height: none; }
  .board-stage { height: max(460px, calc(100dvh - 280px)); max-height: 770px; }
  .opponent-art-image { left: -20px; width: 174px; height: 261px; }
  .opponent-profile { margin-left: 125px; padding-right: 16px; }
  .match-panel { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "match analysis" "search analysis" "history history"; gap: 12px; height: auto; overflow: visible; align-items: start; }
  .opponent-panel { grid-area: match; }
  .analysis-panel { grid-area: analysis; }
  .search-panel { grid-area: search; }
  .history-panel { grid-area: history; }
  .progress-badge { display: inline; }
  .board-bottom button { padding-left: 10px; padding-right: 10px; font-size: 12px; }
  .bottom-note small { display: none; }
  body.focus-mode .game-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; grid-template-areas: "board" "panel"; height: auto; min-height: 0; }
  body.focus-mode .board-stage { height: max(520px, calc(100dvh - 113px)); max-height: 900px; }
}
@media (max-width: 600px) {
  .sidebar { inset: auto 0 0; width: 100%; height: calc(58px + env(safe-area-inset-bottom)); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-right: 0; background: var(--surface); }
  .sidebar .brand, .nav-label, .side-note, .local-status { display: none; }
  .sidebar nav { flex-direction: row; justify-content: space-around; gap: 6px; }
  .nav-item { flex-direction: column; gap: 3px; min-height: 49px; width: min(80px, 25%); padding: 5px 8px; border-radius: 7px; font-size: 10px; }
  .nav-icon { width: 20px; height: 20px; }
  .workspace { margin-left: 0; padding-bottom: calc(69px + env(safe-area-inset-bottom)); }
  .topbar { height: 50px; padding: 0 12px; }
  .breadcrumb { gap: 9px; font-size: 11px; }
  .mobile-brand { display: inline; color: var(--gold); font-weight: 650; }
  .desktop-brand { display: none; }
  .top-actions { gap: 5px; }
  .top-actions .icon-btn { width: 40px; min-height: 40px; }
  .top-actions #help { display: none; }
  main { padding: 10px; }
  .page-intro { min-height: 50px; margin-bottom: 10px; gap: 10px; }
  .page-intro .eyebrow, .page-intro p, h1 > span { display: none; }
  h1 { margin: 0; font-size: 20px; letter-spacing: 0; }
  .page-intro > .primary { min-height: 36px; padding: 8px 12px; font-size: 12px; }
  .game-layout { grid-template-rows: 80px auto auto; gap: 10px; }
  .opponent-art { height: 80px; }
  .opponent-art-image { inset: 0 auto auto -18px; width: 160px; height: 240px; }
  .opponent-profile { margin-left: 112px; padding: 11px 13px 11px 0; gap: 4px 6px; }
  .opponent-profile h2 { font-size: 20px; }
  .opponent-profile p { font-size: 11px; }
  .profile-tag { font-size: 10px; padding: 3px 5px; }
  .board-stage { height: max(430px, calc(100dvh - 284px)); max-height: none; }
  .board-card { grid-template-rows: 40px 0 auto minmax(0, 1fr) auto 21px auto; border-radius: 12px; }
  .board-top { height: 40px; padding: 0 12px; }
  .board-top > div:first-child { gap: 6px; font-size: 11px; }
  .tag { padding: 3px 5px; font-size: 9px; }
  .board-tools { gap: 1px; }
  .board-tools .icon-btn { width: 36px; min-height: 36px; }
  .board-tools .icon-btn svg { width: 16px; height: 16px; }
  .player-strip { position: absolute; grid-row: auto; grid-column: auto; z-index: 1; top: 45px; left: 12px; width: 44%; min-height: 0; padding: 0; gap: 7px; pointer-events: none; }
  .player-strip.bottom { top: 45px; left: auto; right: 12px; width: 44%; padding: 0; justify-content: flex-end; }
  .player-icon { width: 25px; height: 25px; border-radius: 7px; font-size: 14px; }
  .player-strip b { font-size: 11px; }
  .player-strip small { margin-top: 2px; font-size: 9px; }
  .progress-badge { display: none; }
  .board-wrap { padding: 14px 3px 0; }
  .record-source { position: relative; z-index: 2; margin: 35px 10px 3px; font-size: 10px; }
  .last-action { min-height: 42px; margin: 3px 10px 2px; padding: 6px 8px; gap: 7px; }
  .last-action b { font-size: 11px; }
  .last-action small { font-size: 10px; }
  .last-action button { min-height: 40px; padding: 5px 7px; font-size: 10px; }
  .turn-message { min-height: 21px; font-size: 10px; }
  .board-bottom { min-height: 58px; padding: 7px 9px; gap: 4px; }
  .main-controls { gap: 4px; }
  .board-bottom button { min-height: 44px; padding: 6px 8px; font-size: 11px; }
  .board-bottom .quiet { padding-right: 0; }
  .match-panel { grid-template-columns: 1fr; grid-template-areas: none; gap: 10px; }
  .match-panel > .panel { grid-area: auto; }
  .panel { padding: 15px; }
  .panel-disclosure { padding: 0; }
  .panel h2 { font-size: 14px; }
  .panel-body { padding: 15px; }
  .fine-print { font-size: 12px; }
  .analysis-side, .comparison-row, .search-summary { font-size: 13px; }
  .search-metrics b { font-size: 25px; }
  .search-metrics span { font-size: 11px; }
  .move-list { height: 158px; }
  .move-row { min-height: 36px; font-size: 12px; }
  .history-controls button { width: 40px; min-height: 40px; }
  .secondary, .archive-actions button { min-height: 44px; }
  .risk-link { min-height: 36px; padding-top: 7px; padding-bottom: 7px; }
  .bottom-note { margin-top: 11px; font-size: 10px; }
  .lab-main { padding: 22px; }
  .lab-main h2 { font-size: 23px; }
  .feature-grid { grid-template-columns: 1fr; gap: 12px; }
  .feature-grid article { padding: 18px; }
  .lab-config { grid-template-columns: 1fr; }
  .lab-config > * { grid-column: auto; }
  .honesty { gap: 12px; padding: 18px; }
  .honesty > span { font-size: 21px; }
  .archive-grid { grid-template-columns: 1fr; gap: 12px; }
  .archive-card { padding: 21px; }
  .prose { padding: 22px; }
  .prose h2 { font-size: 21px; }
  dialog { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 23px; }
  .dialog-head h2 { font-size: 23px; }
  .dialog-head .icon-btn { width: 40px; min-height: 40px; }
  #toast { bottom: calc(74px + env(safe-area-inset-bottom)); font-size: 12px; }
  body.focus-mode .board-stage { height: max(480px, calc(100dvh - 141px)); max-height: none; }
}
@media (max-width: 380px) {
  .breadcrumb { gap: 7px; font-size: 10px; }
  h1 { font-size: 18px; }
  .page-intro > .primary { padding-left: 10px; padding-right: 10px; font-size: 11px; }
  .opponent-art-image { width: 150px; height: 225px; }
  .opponent-profile { margin-left: 99px; padding-right: 10px; }
  .opponent-profile h2 { font-size: 18px; }
  .opponent-profile p { font-size: 10px; }
  .profile-tag { font-size: 9px; }
  .board-bottom button { padding-left: 6px; padding-right: 6px; font-size: 10px; }
  .main-controls { gap: 3px; }
}
@media (max-width: 600px) and (max-height: 700px) {
  #view-play .opponent-art { display: none; }
  .game-layout { grid-template-rows: auto auto; grid-template-areas: "board" "panel"; }
  .board-stage { height: max(400px, calc(100dvh - 190px)); }
  body.focus-mode .board-stage { height: max(400px, calc(100dvh - 140px)); }
}
@media (max-height: 760px) and (min-width: 901px) {
  main { padding-top: 14px; }
  .page-intro { min-height: 52px; margin-bottom: 12px; }
  .page-intro .eyebrow { display: none; }
  h1 { margin-top: 0; font-size: 23px; }
  .page-intro p { font-size: 12px; }
  .game-layout { height: calc(100dvh - 147px); min-height: 490px; }
  .board-card { grid-template-rows: 40px 38px auto minmax(0, 1fr) auto 21px auto; }
  .board-top { height: 40px; }
  .player-strip { min-height: 38px; padding-top: 5px; padding-bottom: 5px; }
  .player-strip.bottom { top: 40px; }
  .last-action { min-height: 42px; }
  .turn-message { min-height: 21px; }
  .board-bottom { min-height: 46px; padding-top: 7px; padding-bottom: 7px; }
  body.focus-mode .game-layout { height: calc(100dvh - 94px); min-height: 490px; }
}
@media (min-width: 901px) and (max-width: 1280px) and (max-height: 760px) {
  .game-layout { grid-template-columns: 140px minmax(0, 1fr) 260px; grid-template-rows: minmax(0, 1fr); grid-template-areas: "art board panel"; gap: 14px; }
  .opponent-art { height: auto; border-radius: 15px; }
  .opponent-art-image { inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 40%; }
  .opponent-art::before { background: linear-gradient(180deg, #08191510 20%, #08191545 50%, #0a1a16ed 82%, #0b1c17 100%); }
  .opponent-art::after { inset: 8px; border-radius: 10px; }
  .opponent-art > .section-kicker { display: block; top: 23px; left: 13px; font-size: 8px; letter-spacing: 1.5px; }
  .portrait-ornament { display: block; top: 43px; left: 14px; }
  .opponent-profile { display: block; margin: auto 0 0; padding: 20px 12px 18px; }
  .opponent-profile h2 { margin: 12px 0 9px; font-size: 24px; letter-spacing: 2px; }
  .profile-tag { min-height: 23px; padding: 3px 6px; font-size: 10px; }
  .opponent-profile p { overflow: visible; font-size: 11px; line-height: 1.85; white-space: normal; }
  .profile-status { display: flex; margin-top: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Visible in fullscreen; never intercepts moves. */
.creator-watermark{position:absolute;right:18px;bottom:6px;z-index:2;pointer-events:none;font-size:11px;font-weight:500;letter-spacing:.08em;color:var(--muted,#827b76);padding:4px 8px;border:1px solid color-mix(in srgb,currentColor 16%,transparent);border-radius:6px;background:color-mix(in srgb,var(--surface,#fff) 78%,transparent);max-width:calc(100% - 24px);white-space:nowrap;}
@media(max-width:600px){.creator-watermark{right:8px;bottom:3px;font-size:10px;letter-spacing:0;}}
