/* Observatory colors, copied from starboard design/tokens-observatory.css (dark). Gold is White, teal is Black, amber is act now. */
:root {
  color-scheme: dark;
  --bg-sky: #06080e;
  --bg-column: #0b0f1a;
  --bg-panel: #111622;
  --line: rgba(180, 164, 127, .32);
  --control-edge: #656f86;
  --text: #e6eaf2;
  --text-2: #a7afc1;
  --text-3: #7b8499;
  --you: #d7b36a;
  --them: #7fd0c8;
  --act: #ffb04a;
  --act-hi: #ffc873;
  --act-lo: #f29a2c;
  --act-ink: #1b1206;
  --brass-hi: #d1c4a0;
  --sq-light: #b8c0d2;
  --sq-dark: #5c6a86;
  --sq-coord: rgba(10, 14, 24, .55);
  --hl-last: rgba(127, 208, 200, .55);
  --hl-check: rgba(224, 107, 107, .62);
  --ov-w: 215, 179, 106;
  --ov-b: 127, 208, 200;
  --ov-c: 181, 150, 255;
  --board-ink: #06080e;
  --board-glow: 0 26px 60px -2px rgba(143, 168, 236, .5), 0 0 110px 6px rgba(215, 179, 106, .2), 0 -12px 44px -8px rgba(143, 168, 236, .2);
  --font-ui: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --font-display: "Marcellus", Georgia, serif;
  --r-control: 12px;
  --r-inner: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 30% 20%, #0d1324 0%, var(--bg-sky) 60%);
  color: var(--text);
  font: 15px/1.4 var(--font-ui);
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: 100%;
}

/* ---- board ---- */
.stage { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.board-wrap { position: relative; width: min(100%, 680px, calc(100vh - 160px)); aspect-ratio: 1; min-width: 280px; }
.board {
  display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr);
  width: 100%; height: 100%;
  border-radius: 6px; overflow: hidden;
  box-shadow: var(--board-glow);
}
.sq { position: relative; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq .ov { position: absolute; inset: 0; opacity: 0; }
/* the owner change: the squares a move took over light up in their new owner's color and fade */
.sq .ov.wash-w, .sq .ov.wash-b, .sq .ov.wash-c { animation: wash 900ms ease-out both; }
.sq .ov.wash-w { background: rgba(var(--ov-w), .45); }
.sq .ov.wash-b { background: rgba(var(--ov-b), .45); }
.sq .ov.wash-c { background: rgba(var(--ov-c), .45); }
@keyframes wash { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sq .ov.wash-w, .sq .ov.wash-b, .sq .ov.wash-c { animation: none; } }
.ticks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.ticks .tick, .ticks .rule { stroke: var(--board-ink); stroke-width: 1px; vector-effect: non-scaling-stroke; paint-order: stroke fill; }
.ticks .tick.w { fill: var(--you); }
.ticks .tick.b { fill: var(--them); }
.ticks .rule { fill: rgba(var(--ov-c), .85); }
.sq.last::before { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 4px var(--hl-last), inset 0 0 14px rgba(127, 208, 200, .25); z-index: 1; }
.sq.check::after { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle, var(--hl-check) 0%, rgba(224, 107, 107, 0) 72%); }
.sq img { position: absolute; inset: 4%; width: 92%; height: 92%; z-index: 2; pointer-events: none; }
.sq .coord { position: absolute; font-size: 11px; font-weight: 600; color: var(--sq-coord); z-index: 1; line-height: 1; }
.sq .coord.file { right: 4px; bottom: 3px; }
.sq .coord.rank { left: 4px; bottom: 3px; }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.arrows line { stroke-linecap: round; opacity: .85; }

.legend { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin: 0; padding: 0; color: var(--text-2); font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.tk { width: 11px; height: 12px; background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 5px); }
.tk-w { color: var(--you); }
.tk-b { color: var(--them); }
.ln-c { background: rgb(var(--ov-c)); height: 2px; }
.ln { width: 18px; height: 3px; border-radius: 2px; }
.ln-w { background: var(--you); }
.ln-b { background: var(--them); }
.ln-m { background: var(--act); }

/* ---- column ---- */
.column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.overline { margin: 0; font: 13px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--brass-hi); }
h1 { margin: -8px 0 0; font: 400 28px/1.25 var(--font-display); }
.sub { margin: -10px 0 0; color: var(--text-2); }
.sub:empty { display: none; }

button, select {
  font: inherit; color: var(--text);
  background: var(--bg-panel); border: 1px solid var(--control-edge); border-radius: var(--r-control);
  height: 44px; padding: 0 14px; cursor: pointer;
}
button:hover, select:hover { border-color: var(--brass-hi); }
button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--you); outline-offset: 2px; }
button.primary { background: linear-gradient(var(--act-hi), var(--act-lo)); color: var(--act-ink); border: 0; font-weight: 600; }
button.quiet { background: transparent; }

.transport { display: grid; grid-template-columns: 44px 44px 1fr 44px 44px; gap: 8px; }
.transport button { padding: 0; }
.settings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.seg-label { color: var(--text-2); font-size: 13px; }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--you); width: 16px; height: 16px; }

.now { margin: 0; min-height: 1.4em; color: var(--text-2); }
.now strong { color: var(--text); font-weight: 500; }

.moves {
  list-style: none; margin: 0; padding: 8px; flex: 1 1 auto; min-height: 120px; max-height: 360px; overflow-y: auto;
  background: var(--bg-column); border: 1px solid var(--line); border-radius: var(--r-control);
  display: grid; grid-template-columns: 36px 1fr 1fr; align-content: start; gap: 2px 4px;
  font-family: var(--font-mono); font-size: 14px;
}
.moves .num { color: var(--text-3); padding: 4px 0; text-align: right; padding-right: 6px; }
.moves button { height: auto; padding: 4px 8px; border: 0; border-radius: var(--r-inner); background: transparent; text-align: left; font-family: var(--font-mono); }
.moves button:hover { background: var(--bg-panel); }
.moves button.w.on { background: rgba(var(--ov-w), .22); color: var(--you); }
.moves button.b.on { background: rgba(var(--ov-b), .2); color: var(--them); }

.pgn { border: 1px solid var(--line); border-radius: var(--r-control); padding: 10px 12px; background: var(--bg-column); }
.pgn summary { cursor: pointer; color: var(--brass-hi); }
.pgn textarea {
  width: 100%; min-height: 140px; margin-top: 10px; resize: vertical;
  font: 13px/1.4 var(--font-mono); color: var(--text);
  background: var(--bg-sky); border: 1px solid var(--control-edge); border-radius: var(--r-inner); padding: 8px;
}
.pgn-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.error { margin: 0; color: #ff8f80; font-size: 13px; }

@media (max-width: 899px) {
  .app { grid-template-columns: 1fr; gap: 24px; padding: 16px; }
  .board-wrap { width: 100%; min-width: 0; }
  .moves { max-height: 220px; }
}
