﻿:root {
  --cell-size: 17.5px; /* projected 3D cell size, fed by the renderer */
  --ink: #f6f0dd;
  --muted: #a9a28d;
  --panel: rgba(19, 22, 20, 0.78);
  --panel-line: rgba(224, 196, 126, 0.18);
  --gold: #d9bd75;
  --green: #0d3c2f;
  --green-2: #123a32;
  --line: rgba(232, 207, 139, 0.34);
  --line-strong: rgba(250, 225, 151, 0.62);
  --shadow: rgba(0, 0, 0, 0.5);
  --serif: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(28, 24, 16, 0.55), rgba(5, 5, 4, 0.96) 70%),
    linear-gradient(180deg, rgba(10, 9, 7, 0.93), rgba(6, 6, 5, 0.97)),
    url("assets/gen/pbr/wood_color.png") center / 1200px fixed,
    #070605;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  min-height: 100vh;
  padding: 16px 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: min(1920px, calc(100vw - 28px));
  margin: 0 auto 14px;
  padding-bottom: 12px;
  border-bottom: 3px double rgba(202, 169, 94, 0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.92), rgba(244, 231, 185, 0.88) 32%, transparent 33%),
    radial-gradient(circle at 70% 70%, rgba(5, 7, 8, 0.96), rgba(22, 28, 31, 0.96) 41%, transparent 42%),
    linear-gradient(135deg, #d7be74, #5c4826);
  border: 1px solid rgba(255, 235, 176, 0.36);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.4), inset 0 0 18px rgba(255, 244, 190, 0.2);
}

h1,
p {
  margin: 0;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.7vw, 1.55rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #e9dcba;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

h1::after {
  content: "◆";
  font-size: 0.45em;
  color: rgba(202, 169, 94, 0.7);
  margin-left: 12px;
  vertical-align: middle;
}

.brand p {
  margin-top: 5px;
  color: var(--muted);
  min-height: 1.4em;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.command,
.segment,
.side-choice,
.zoom-choice,
.finish-choice,
.opening-choice {
  border: 1px solid rgba(202, 169, 94, 0.24);
  background: linear-gradient(180deg, rgba(19, 23, 20, 0.95), rgba(9, 11, 10, 0.95));
  color: #c6ba98;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

.command:hover,
.segment:hover,
.side-choice:hover,
.zoom-choice:hover,
.finish-choice:hover,
.opening-choice:hover {
  border-color: rgba(233, 205, 134, 0.55);
  color: #f2e8cc;
}

.command:active,
.segment:active,
.side-choice:active,
.zoom-choice:active,
.finish-choice:active,
.opening-choice:active {
  background: rgba(8, 10, 9, 0.95);
}

.command:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(154px, 210px) minmax(0, 1fr) minmax(164px, 220px);
  align-items: start;
  justify-content: center;
  gap: 12px;
  max-width: min(1920px, calc(100vw - 28px));
  margin: 0 auto;
}

.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(17, 22, 19, 0.95), rgba(10, 13, 11, 0.97));
  border: 1px solid rgba(202, 169, 94, 0.2);
  border-radius: 3px;
  padding: 18px 16px 16px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Map-corner ornaments: fine gold ticks in each panel corner. */
.panel::before {
  content: "";
  position: absolute;
  inset: 5px;
  pointer-events: none;
  opacity: 0.55;
  background:
    linear-gradient(#caa95e, #caa95e) left 0 top 0 / 12px 1px,
    linear-gradient(#caa95e, #caa95e) left 0 top 0 / 1px 12px,
    linear-gradient(#caa95e, #caa95e) right 0 top 0 / 12px 1px,
    linear-gradient(#caa95e, #caa95e) right 0 top 0 / 1px 12px,
    linear-gradient(#caa95e, #caa95e) left 0 bottom 0 / 12px 1px,
    linear-gradient(#caa95e, #caa95e) left 0 bottom 0 / 1px 12px,
    linear-gradient(#caa95e, #caa95e) right 0 bottom 0 / 12px 1px,
    linear-gradient(#caa95e, #caa95e) right 0 bottom 0 / 1px 12px;
  background-repeat: no-repeat;
}

.score-panel,
.detail-panel {
  display: grid;
  gap: 10px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 9px;
}

.score-row:last-of-type {
  border-bottom: 0;
}

.score-disc {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: inset -8px -9px 18px rgba(0, 0, 0, 0.38), inset 6px 6px 15px rgba(255, 255, 255, 0.16), 0 10px 18px rgba(0, 0, 0, 0.25);
}

.score-disc.black {
  background: url("assets/stone-dark.png") center / 180%;
}

.score-disc.white {
  background: url("assets/stone-light.png") center / 180%;
}

.score-label,
.control-label,
.metric span {
  color: rgba(200, 180, 130, 0.72);
  font-family: var(--serif);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Section labels carry a fading hairline rule, like fine stationery. */
.control-block > .control-label,
.variants summary.control-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-block > .control-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(202, 169, 94, 0.35), transparent);
}

.score-row strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.9rem;
  line-height: 1;
  color: #f0e6ca;
  font-variant-numeric: tabular-nums;
}

.control-block {
  display: grid;
  gap: 7px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.segmented-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-three button {
  padding: 0 2px;
  font-size: 0.58rem;
  letter-spacing: 0.05em;
}

.segment,
.side-choice,
.zoom-choice,
.opening-choice {
  width: 100%;
}

.segment.active,
.side-choice.active,
.zoom-choice.active,
.finish-choice.active,
.opening-choice.active {
  color: #1d1508;
  background: linear-gradient(180deg, #dcc389, #b0904c 85%, #99793c);
  border-color: rgba(120, 94, 42, 0.9);
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 3px rgba(90, 66, 24, 0.45), 0 1px 3px rgba(0, 0, 0, 0.5);
}

input[type="range"] {
  width: 100%;
  height: 18px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, rgba(202, 169, 94, 0.55), rgba(202, 169, 94, 0.18));
  border-radius: 1px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0dca4, #c3a458 55%, #8d6f34);
  border: 1px solid rgba(90, 66, 24, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: linear-gradient(90deg, rgba(202, 169, 94, 0.55), rgba(202, 169, 94, 0.18));
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0dca4, #c3a458 55%, #8d6f34);
  border: 1px solid rgba(90, 66, 24, 0.9);
}

.difficulty-readout {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.difficulty-readout strong {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #17140b;
  background: linear-gradient(180deg, #f2dda0, #b99142);
}

.difficulty-readout span {
  color: var(--ink);
  font-weight: 680;
}

/* ------------------------------------------------------------- 3D stage */

.board-stage {
  display: grid;
  place-items: stretch;
  width: 100%;
  min-width: 0;
}

.stage3d {
  position: relative;
  width: 100%;
  height: min(calc(100vh - 132px), 1100px);
  min-height: 420px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(246, 220, 150, 0.24);
  background:
    radial-gradient(circle at 50% 30%, rgba(20, 46, 36, 0.6), rgba(4, 9, 7, 0.9) 70%),
    #050a08;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -16px 34px rgba(0, 0, 0, 0.34);
  transition: box-shadow 260ms ease;
}

.stage3d.ai-thinking {
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.54),
    0 0 42px rgba(217, 189, 117, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -16px 34px rgba(0, 0, 0, 0.34);
}

#glCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

.webgl-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
}

.webgl-fallback[hidden] {
  display: none;
}

/* ---------------------------------------------------------- game modes */

.variants summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.variants summary::after {
  content: " ▸";
  color: var(--gold);
}

.variants[open] summary::after {
  content: " ▾";
}

.variants[open] {
  gap: 8px;
}

.mode-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mode-chip {
  border: 1px solid rgba(202, 169, 94, 0.22);
  background: rgba(11, 14, 12, 0.9);
  color: #c6ba98;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 2px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.mode-chip:hover {
  border-color: rgba(202, 169, 94, 0.55);
  color: #eee2c2;
}

.mode-chip.active {
  color: #1d1508;
  background: linear-gradient(180deg, #dcc389, #b0904c);
  border-color: rgba(120, 94, 42, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mode-config {
  display: grid;
  gap: 7px;
}

.mode-config:empty {
  display: none;
}

/* ------------------------------------------------------------------ HUD */

.hud {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 8;
  display: grid;
  gap: 10px;
  justify-items: end;
  pointer-events: none;
}

.blitz-clock {
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
}

.blitz-clock[hidden] {
  display: none;
}

.blitz-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(#f2d88a 360deg, rgba(255, 255, 255, 0.09) 0deg);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%);
  mask: radial-gradient(circle, transparent 58%, #000 60%);
}

.blitz-seconds {
  position: relative;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff2c4;
  text-shadow: 0 1px 3px #000;
}

.blitz-clock.urgent .blitz-ring {
  animation: blitzUrgent 0.5s ease-in-out infinite;
}

.blitz-clock.urgent .blitz-seconds {
  color: #ffb188;
}

@keyframes blitzUrgent {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.5); transform: scale(1.06); }
}

.momentum-hud {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(12, 15, 13, 0.78);
  border: 1px solid rgba(224, 196, 126, 0.22);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  min-width: 168px;
}

.momentum-hud[hidden] {
  display: none;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meter-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  width: 28px;
}

.meter {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c9a757, #f3df9e);
  transition: width 300ms ease;
}

.meter.ai span {
  background: linear-gradient(90deg, #5a707c, #9fc3d4);
}

.momentum-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.hud-btn {
  border: 1px solid rgba(233, 205, 134, 0.3);
  background: rgba(13, 16, 15, 0.85);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  cursor: pointer;
}

.hud-btn:hover:not(:disabled) {
  border-color: rgba(233, 205, 134, 0.6);
}

.hud-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hud-btn.selecting {
  color: #16140d;
  background: linear-gradient(180deg, #f3df9e, #c9a757);
}

/* ------------------------------------------------- prompts & dialogs */

.prompt-card {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: grid;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(16, 19, 17, 0.94);
  border: 1px solid rgba(233, 205, 134, 0.4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.prompt-card[hidden] {
  display: none;
}

.prompt-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(3, 5, 4, 0.7);
  backdrop-filter: blur(6px);
}

.dialog-scrim[hidden] {
  display: none;
}

.dialog-card {
  width: min(560px, calc(100vw - 40px));
  max-height: min(70vh, 640px);
  overflow: auto;
  padding: 16px;
  border-radius: 12px;
  background: rgba(16, 19, 17, 0.97);
  border: 1px solid rgba(233, 205, 134, 0.35);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.replays-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.replays-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.replays-list small {
  color: var(--muted);
}

.replay-empty {
  color: var(--muted);
  justify-content: center;
}

.replay-controls {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(14, 17, 15, 0.92);
  border: 1px solid rgba(233, 205, 134, 0.35);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}

.replay-controls[hidden] {
  display: none;
}

.replay-speeds {
  display: flex;
  gap: 4px;
}

.replay-speeds .command.active {
  color: #16140d;
  background: linear-gradient(180deg, #f3df9e, #c9a757);
}

.replay-progress {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 64px;
  text-align: right;
}

/* ----------------------------------------------------------- dither lab */

.dither-lab {
  display: grid;
  gap: 8px;
}

.palette-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.palette-swatch {
  width: 18px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.5);
}

.dither-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dither-label {
  width: 58px;
  flex-shrink: 0;
  font-family: var(--serif);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(200, 180, 130, 0.72);
}

.dither-row input[type="range"] {
  flex: 1;
}

.dither-value {
  width: 34px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.7rem;
  color: #d8cfb4;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------- multiplayer */

.command.invite {
  color: #1d1508;
  background: linear-gradient(180deg, #dcc389, #b0904c);
  border-color: rgba(120, 94, 42, 0.9);
  font-weight: 700;
}

.room-chip {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 3px;
  background: rgba(14, 17, 15, 0.94);
  border: 1px solid rgba(202, 169, 94, 0.4);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #e6dcc0;
}

.room-chip[hidden] {
  display: none;
}

.invite-copy {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 12px;
}

.invite-row {
  display: flex;
  gap: 8px;
}

.invite-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 2px;
  border: 1px solid rgba(202, 169, 94, 0.3);
  background: rgba(6, 8, 7, 0.9);
  color: #efe6ca;
  font-size: 0.8rem;
  font-family: ui-monospace, Menlo, monospace;
}

.webgl-fallback a {
  color: var(--gold);
}

/* ------------------------------------------------------- magnifier lens */

.focus-lens {
  position: absolute;
  z-index: 9;
  left: 0;
  top: 0;
  width: clamp(74px, calc(var(--cell-size) * 7.2), 136px);
  height: clamp(74px, calc(var(--cell-size) * 7.2), 136px);
  border-radius: 50%;
  display: grid;
  place-items: end center;
  padding-bottom: 9px;
  color: #fff4c8;
  font-size: 0.68rem;
  font-weight: 800;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.84);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.focus-lens canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.focus-lens span {
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 3px #000, 0 0 10px rgba(255, 226, 137, 0.72);
}

.board-64 .focus-lens {
  border: 2px solid rgba(255, 239, 181, 0.74);
  background:
    radial-gradient(circle at 31% 24%, rgba(255, 255, 255, 0.34), transparent 17%),
    radial-gradient(circle at 50% 50%, rgba(255, 226, 137, 0.18), rgba(5, 38, 29, 0.24) 42%, rgba(1, 10, 8, 0.08) 72%);
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.62),
    0 10px 26px rgba(0, 0, 0, 0.42),
    0 0 30px rgba(230, 190, 84, 0.32),
    inset 0 0 24px rgba(255, 244, 192, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.board-64 .focus-lens::before,
.board-64 .focus-lens::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.board-64 .focus-lens::before {
  left: 21%;
  top: 15%;
  width: 34%;
  height: 17%;
  border-radius: 50%;
  border-top: 2px solid rgba(255, 255, 255, 0.54);
  transform: rotate(-22deg);
}

.board-64 .focus-lens::after {
  right: -25%;
  bottom: 3%;
  width: 42%;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f1d887, #6c5027 72%, #20150b);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: rotate(43deg);
  transform-origin: left center;
}

.board-64 .focus-lens.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.board-64.zoom-focus .focus-lens {
  width: clamp(96px, calc(var(--cell-size) * 8.6), 160px);
  height: clamp(96px, calc(var(--cell-size) * 8.6), 160px);
}

/* -------------------------------------------------------------- metrics */

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.metric strong {
  text-align: right;
  font-size: 0.95rem;
  color: #ece2c6;
  font-variant-numeric: tabular-nums;
}

.move-log-wrap {
  display: grid;
  gap: 10px;
}

.move-log {
  display: grid;
  gap: 6px;
  max-height: clamp(120px, calc(100vh - 470px), 220px);
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.move-log li {
  padding: 4px 0;
}

.move-log b {
  color: var(--ink);
}

.thinking-dot::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: dots 1s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

@media (max-width: 1060px) {
  .layout {
    grid-template-columns: minmax(220px, 1fr) minmax(320px, auto);
  }

  .detail-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .move-log-wrap {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 14px;
  }

  .topbar,
  .layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: stretch;
  }

  .command {
    flex: 1 1 auto;
  }

  .score-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-row {
    min-height: 62px;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .control-block {
    grid-column: 1 / -1;
  }

  .detail-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage3d {
    height: min(calc(100vh - 220px), 92vw);
    min-height: 340px;
  }
}

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

