/* The look and the shared parts: the palette (championship navy, ivory, one gold line for "now"), fonts, the
   terrain chart and the dialogs. The page layout is in a/a.css. */
@font-face { font-family: 'Sofia Sans'; src: url('fonts/sofia-sans.woff2') format('woff2'); font-weight: 1 1000; font-display: swap; }
@font-face { font-family: 'Sofia Sans Condensed'; src: url('fonts/sofia-sans-condensed.woff2') format('woff2'); font-weight: 1 1000; font-display: swap; }

:root {
  --bg: #0B1322; --panel: #131D31; --ink: #F1EDE4; --muted: #8E9BB1; --line: #23314B;
  --safe: #4FC3A1; --safe-ink: #86E0C6; --danger: #FF6A55; --on-danger: #1B0703; --accent: #E9B949; --on-accent: #1B1503; --now: #E9B949;
  --white-mark: #F1EDE4; --white-edge: #0B1322; --black-mark: #0B1322; --black-edge: #C3CCDB;
  --tip-bg: #F1EDE4; --tip-ink: #0B1322;
  --font: 'Sofia Sans', system-ui, sans-serif; --font-chart: 'Sofia Sans Condensed', 'Sofia Sans', sans-serif;
  --disp: 'Sofia Sans Condensed', 'Sofia Sans', system-ui, sans-serif;
  --r: 4px; --h2: 800 23px/1.15 'Sofia Sans Condensed', 'Sofia Sans', sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14.5px; line-height: 1.45; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mut { color: var(--muted); }

.btn { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; line-height: 1.2; }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.quiet { background: none; border-color: transparent; color: var(--muted); }
.btn.quiet:hover:not(:disabled) { color: var(--ink); border-color: var(--line); }

/* side chips: a white or a black piece-coloured dot */
.chip { display: inline-block; width: .8em; height: .8em; border-radius: 50%; flex: none; }
.chip.w { background: var(--white-mark); box-shadow: inset 0 0 0 1.5px var(--white-edge); }
.chip.b { background: var(--black-mark); box-shadow: inset 0 0 0 1.5px var(--black-edge); }

/* tooltip */
.tip { position: fixed; z-index: 50; display: none; pointer-events: none; max-width: 260px; background: var(--tip-bg); color: var(--tip-ink); border-radius: var(--r); padding: 7px 10px; font-size: 12.5px; line-height: 1.4; box-shadow: 0 6px 20px rgb(0 0 0 / .28); }
.tip b { font-weight: 700; }
.tip div + div { margin-top: 1px; }
.tip .t-sub { opacity: .78; }

/* board */
.cg-wrap { width: var(--bs); height: var(--bs); border-radius: 3px; overflow: hidden; }
.cg-wrap coords { font-family: var(--font); font-weight: 600; opacity: .7; }

/* move symbols in text (the board badges take their colours from GLYPHS in kit.js) */
.gl { font-weight: 800; margin-left: 1px; }
.gl-blunder { color: var(--danger); }
.gl-mistake { color: #F59E3B; }
.gl-dubious { color: var(--accent); }
.gl-good { color: #6EA8FF; }

/* terrain wing chart */
.wg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; font-family: var(--font-chart); user-select: none; }
.wg-grid { stroke: var(--line); stroke-width: 1; }
.wg-zero { stroke: var(--muted); stroke-width: 1.25; }
.wg-ax { fill: var(--muted); font-size: 11.5px; }
.wg-ax.zero { fill: var(--ink); font-weight: 650; }
.wg-band { fill: var(--safe); opacity: .1; }
.wg-safe { fill: var(--safe); opacity: .42; }
.wg-danger { fill: var(--danger); opacity: .2; }
.wg-bandlbl { fill: var(--safe-ink); font-size: 11.5px; font-weight: 650; letter-spacing: .02em; }
.wg-base { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.wg-line { fill: none; stroke: var(--ink); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.wg-pt { stroke-width: 1.75; }
.wg-pt.w { fill: var(--white-mark); stroke: var(--white-edge); }
.wg-pt.b { fill: var(--black-mark); stroke: var(--black-edge); }
.wg-lbl { fill: var(--ink); font-size: 13px; font-weight: 700; letter-spacing: .01em; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }
.wg-lbl.drop { fill: var(--muted); font-weight: 500; }
.wg-lbl.bad { fill: var(--danger); }
.wg-lbl.played { fill: var(--ink); font-weight: 800; font-size: 14.5px; }
.wg-lbl.played.bad { fill: var(--danger); }
.wg-ring { fill: none; stroke: var(--now); stroke-width: 3.5; }
.wg-halo { fill: var(--now); opacity: .2; }
.wg-now { stroke: var(--now); stroke-width: 2; stroke-dasharray: 7 5; }
.wg-nowlbl { fill: var(--now); font-size: 13px; font-weight: 800; }
.wg-bar-b { fill: #04060A; }
.wg-bar-w { fill: var(--white-mark); }
.wg-bar-b.past { opacity: .55; }  /* the side that just moved: the evaluation before its move */
.wg-bar-w.past { opacity: .35; }
.wg-locked { opacity: .5; }
.wg-hit { fill: transparent; cursor: default; }

/* legal-move squares */
.sqs { display: flex; flex-wrap: wrap; gap: 2px; }
.sq { width: 7px; height: 7px; border-radius: 1.5px; }
.sq.hold { background: var(--safe); }
.sq.steep { background: var(--muted); opacity: .55; }
.sq.lose { background: var(--danger); }
.sq.none { box-shadow: inset 0 0 0 1px var(--muted); opacity: .6; }

/* empty states over a wing */
.wingbox { position: relative; min-width: 0; }
.wing-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; color: var(--muted); font-size: 13px; pointer-events: none; }
.wing-empty > * { pointer-events: auto; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* dialogs */
.dlg { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: calc(var(--r) * 2); padding: 0; width: min(540px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 24px 60px rgb(0 0 0 / .35); }
.dlg::backdrop { background: rgb(8 12 16 / .5); }
.dlg-in { padding: 20px 22px 22px; display: grid; gap: 14px; }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg h2 { font: var(--h2); }
.dlg h3 { font-size: 12.5px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.dlg section { display: grid; gap: 8px; justify-items: start; }
.dlg section + section, .pk-form { border-top: 1px solid var(--line); padding-top: 14px; }
.pk-list { display: grid; gap: 6px; }
.pk-game { display: grid; grid-template-columns: 1fr auto; gap: 1px 14px; width: 100%; text-align: left; background: none; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.pk-game:hover { border-color: var(--accent); }
.pk-title { font-weight: 650; font-size: 15px; }
.pk-tag { margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--on-accent); background: var(--accent); border-radius: 99px; padding: 1px 7px; vertical-align: 1px; }
.pk-meta { grid-column: 1; color: var(--muted); font-size: 12.5px; }
.pk-state { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); font-size: 12px; text-align: right; max-width: 150px; }
.pk-form { display: grid; gap: 6px; }
.pk-form label { font-weight: 650; }
.pk-form textarea { width: 100%; resize: vertical; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; font-size: 13px; }
.pk-hint, .en-sub { color: var(--muted); font-size: 12.5px; }
.pk-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 4px; }
.pk-err { color: var(--danger); font-size: 12.5px; flex: 1; }
.en-state { font-weight: 650; font-size: 15px; }
.en-row { display: flex; gap: 8px; }
.en-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; }
.en-grid input, .en-grid select { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 8px; width: 84px; }
.en-unit { margin-left: 8px; color: var(--muted); font-size: 12.5px; }
.help-list { display: grid; gap: 9px; }
.help-list li { padding-left: 14px; position: relative; max-width: 62ch; }
.help-list li::before { content: ''; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }

@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } * { transition: none !important; } }
