/* Storm — monochrome instrument around a Lichess board. Nothing scrolls but the line.
   Light and dark follow the phone. */
@property --eval-percent { syntax: '<percentage>'; inherits: false; initial-value: 50%; }

:root {
  --bg: #f2f2f0;
  --paper: #ffffff;
  --ink: #111111;
  --ink2: #6b6b6b;
  --ink3: #a3a3a3;
  --rule: #d5d5d2;
  --press: rgba(0, 0, 0, 0.06);
  --scrim: rgba(0, 0, 0, 0.32);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --glide: cubic-bezier(0.3, 0.9, 0.4, 1);
  /* Lichess "brown" board, cburnett pieces */
  --light: #f0d9b5;
  --dark: #b58863;
  --coord-on-light: #946f51;
  --coord-on-dark: #f0d9b5;
  /* Lichess eval gauge, light theme */
  --gauge-black: #606060;
  --gauge-white: #ffffff;
  --gauge-tick: #cccccc;
  /* fixed geometry: the board takes what is left */
  --top-h: 50px;
  --row-h: 44px;
  --strip-h: 60px;
  --gauge-w: 12px;
  --gap: 4px;
  --readout-min: 78px;
  --board: min(
    calc(100vw - var(--gauge-w) - var(--gap) - 14px),
    calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--top-h) - 2 * var(--row-h) - var(--strip-h) - var(--readout-min) - 4px),
    680px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --paper: #171717;
    --ink: #ececec;
    --ink2: #8d8d8d;
    --ink3: #555555;
    --rule: #2b2b2b;
    --press: rgba(255, 255, 255, 0.07);
    --scrim: rgba(0, 0, 0, 0.6);
    --gauge-black: #444444;
    --gauge-white: #c0c0c0;
    --gauge-tick: #888888;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  overflow: hidden; overscroll-behavior: none;
  /* the page colour behind everything is the strip's: if iOS ever leaves a band under the fixed column,
     it reads as the strip continuing to the edge (the column and header paint their own --bg) */
  background: var(--paper); color: var(--ink);
  font: 13px/1.4 var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
button:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
svg:not(.arrows):not(.bolt):not(.mark) { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* (15:50) No min-height trick for the iOS short-viewport bug: David's iPhone reports the full viewport (innerHeight
   894 = 956 - status bar, strip bottom 894), and the trick made the page 34 px taller than the screen, i.e.
   scrollable under the fixed board. The document is exactly the viewport. */

/* ---------- top bar ----------
   iOS 26+ lays a frosted "scroll edge" blur over the top of home-screen web apps. WebKit skips it when
   a position:fixed, full-width, >10px-tall box with a solid background sits at the top edge, and uses
   that colour instead. This bar is that box. */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  background-color: var(--bg);
  padding-top: env(safe-area-inset-top);
}
.top-in {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--top-h); width: calc(var(--board) + var(--gauge-w) + var(--gap)); margin: 0 auto;
  border-bottom: 1px solid var(--rule);
}
/* The lockup (David 17:09 picked option 4 of the header sheet): the Gale pawn with 14 stripes and all 14 wind lines,
   no tile, in the ink colour (white on his dark-mode header). Drawn in device pixels (tools/mark2.py rows=14): stripe
   period 6 px at 3x = 2 css px (4 on, 2 off), wind 2 px on each stripe's centre, so every edge sits on a physical pixel.
   The row is 27 px in the 49 px box, so the mark's top lands on a whole pixel (11).
   STORM: Archivo Expanded ExtraBold (OFL; only S T O R M embedded), capitals exactly six stripes tall (stripes 5-10:
   top on stripe 5's top, baseline on stripe 10's bottom), tracked .14em, 11 px from the pawn. */
@font-face { font-family: "Storm Wordmark"; src: url(data:font/woff;base64,d09GRgABAAAAAAdkAA8AAAAACMQAAQABAAAAAAAAAAAAAAAAAAAAAAAAAABHREVGAAABWAAAABYAAAAWABE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BFVrVidIuVCcTEV7UB3K+oQqb7KFaec01Tk6WbAizKLyuU/tG+lGKXdRpqwJG8q1LT2Z1BD3S/kU5vGPxQ6UuiTaNqulOYnLP2accrM+3Os2UIm6fun3tg5a+kucaP3+joXO1+rfsSTcp48s/kkddU6Five/XE4dh731d9WJDzIBS/9TevsUM4E4hLdK0tvoml8ZeYV974Bu7NlJQAAAAMAAAAAAAD/bAAsAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format("woff"); font-display: block; }
.word { display: flex; align-items: flex-start; height: 27px; gap: 11px; color: var(--ink); }
.word .mark { display: block; flex: none; }
.word .wm { position: relative; top: 0.43px; font: 800 16.2px/27px "Storm Wordmark", var(--mono); letter-spacing: 0.14em; margin-right: -0.14em; white-space: nowrap; }
.rules-tag { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink2); }

.menu {
  position: fixed; z-index: 40;
  bottom: calc(var(--strip-h) + env(safe-area-inset-bottom) + 6px);
  left: max(8px, calc((100vw - min(100vw, 680px)) / 2 + 8px));
  width: min(290px, calc(100vw - 16px));
  background: var(--paper); border: 1px solid var(--ink); border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: drop 0.18s ease-out;
}
@keyframes drop { from { opacity: 0; transform: translateY(4px); } }
.menu button { display: block; width: 100%; padding: 11px 12px 11px 30px; text-align: left; position: relative; }
.menu button + button { border-top: 1px solid var(--rule); }
.menu b { display: block; font-size: 13px; font-weight: 700; }
.menu small { display: block; font-size: 11px; color: var(--ink2); margin-top: 2px; line-height: 1.35; }
.menu button[aria-checked="true"]::before { content: ""; position: absolute; left: 12px; top: 15px; width: 8px; height: 8px; background: var(--ink); }
.menu button:active { background: var(--press); }

/* ---------- the column ---------- */
.app {
  position: fixed; left: 0; right: 0; bottom: 0;
  top: calc(env(safe-area-inset-top) + var(--top-h));
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg);
}
.table { width: calc(var(--board) + var(--gauge-w) + var(--gap)); flex: none; }

/* player rows */
.bar { display: flex; align-items: center; gap: 9px; height: var(--row-h); padding-left: calc(var(--gauge-w) + var(--gap)); }
.bar .tile { width: 26px; height: 26px; flex: none; background-color: var(--light); background-position: center; background-size: 100%; background-repeat: no-repeat; border-radius: 3px; }
.tile.w { background-image: url(wp.svg); }
.tile.b { background-image: url(bp.svg); }
.bar .name { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.bar .status { font-size: 12px; color: var(--ink2); }
.bar.turn .status { color: var(--ink); }
.bar.turn .status::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: var(--ink); vertical-align: 1px; }
.dots::after { content: "…"; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; animation: think 1.2s steps(4) infinite; }
@keyframes think { 0% { width: 0; } 100% { width: 1.2em; } }
.engine {
  margin-left: auto;
  display: grid; place-items: center;
  width: 34px; height: 28px;
  border: 1px solid var(--rule); border-radius: 4px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.engine svg { width: 19px; height: 19px; stroke-width: 1.7; }
.engine[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.engine:active { opacity: 0.6; }

/* ---------- eval gauge (Lichess's) ---------- */
.field { display: flex; gap: var(--gap); }
.gauge {
  position: relative; flex: none;
  width: var(--gauge-w); height: var(--board);
  border-radius: 3px; overflow: hidden;
  --eval-percent: 50%;
  background: linear-gradient(to bottom, var(--gauge-black) var(--eval-percent), var(--gauge-white) var(--eval-percent));
  transition: --eval-percent 1s ease;
}
.gauge.reverse { transform: rotateX(180deg); }
.gauge.empty { opacity: 0.5; }
.gauge::after { content: ""; position: absolute; inset: 0; border-radius: 3px; box-shadow: 0 0 5px rgb(0 0 0 / 0.5) inset; }
.gauge i { position: absolute; left: 0; width: 100%; opacity: 0.4; border-bottom: 2px ridge var(--gauge-tick); }
.gauge i.zero { opacity: 1; margin-top: -3px; border-bottom: 7px solid rgb(128 128 128 / 0.35); }
.app.no-eval .gauge { visibility: hidden; }

/* ---------- board (Lichess brown, cburnett, Lichess square states) ---------- */
.board {
  position: relative; flex: none; width: var(--board); height: var(--board);
  container-type: inline-size;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overflow: hidden; border-radius: 2px;
}
.squares { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); }
.sq { position: relative; background: var(--light); }
.sq.dk { background: var(--dark); }
.sq::before, .sq::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.sq.last::before { background: rgb(155 199 0 / 0.41); }
/* Lichess's own square states, green (David 16:21: back to before the colour experiments) */
.sq.sel::before { background: rgb(20 85 30 / 0.5); }
.sq.dest::after { background: radial-gradient(rgb(20 85 30 / 0.5) 19%, rgb(0 0 0 / 0) 20%); }
.sq.dest.oc::after { background: radial-gradient(transparent 0%, transparent 79%, rgb(20 85 0 / 0.3) 80%); }
.sq.dest.hover::after { background: rgb(20 85 30 / 0.3); }
.coord { position: absolute; z-index: 1; font: 700 clamp(8px, 2.6cqw, 13px)/1 -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif; pointer-events: none; color: var(--coord-on-light); }
.sq.dk .coord { color: var(--coord-on-dark); }
.coord.rank { right: 0.45cqw; top: 0.35cqw; }
.coord.file { left: 0.75cqw; bottom: 0.35cqw; }

.pc {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: var(--sq, 12.5%); height: var(--sq, 12.5%);
  transition: opacity 0.2s ease-out;
  pointer-events: none; will-change: transform;
}
.pc > i { display: block; width: 100%; height: 100%; background: center / 100% no-repeat; transition: transform 0.12s ease-out; }
.pc.w > i { background-image: url(wp.svg); }
.pc.b > i { background-image: url(bp.svg); }
.pc.w.queen > i { background-image: url(wq.svg); }
.pc.b.queen > i { background-image: url(bq.svg); }
.pc.gone { opacity: 0; }
.pc.dragging { transition: none; z-index: 6; }
.pc.dragging > i { transform: scale(1.12); }
.pc.crowning > i { animation: crown 0.55s var(--glide); }
@keyframes crown { 0% { transform: scale(0.6); opacity: 0.3; } 55% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }

.arrows { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; overflow: hidden; opacity: 0.6; } /* Lichess .cg-shapes */
.bolt { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; overflow: hidden; }
.bolt g.strike { animation: strike 0.42s ease-out; }
@keyframes strike { 0% { opacity: 0; } 18% { opacity: 1; } 34% { opacity: 0.35; } 52% { opacity: 1; } 100% { opacity: 1; } }

/* ---------- result ---------- */
.result { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(0, 0, 0, 0.22); animation: fade 0.25s ease-out; }
.result-card {
  width: min(74%, 270px); padding: 16px 18px 18px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 4px; text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  animation: rise 0.3s var(--glide);
}
.result-piece { display: block; width: 56px; height: 56px; margin: 0 auto; background: center / 100% no-repeat; }
.result-piece.w { background-image: url(wp.svg); }
.result-piece.b { background-image: url(bp.svg); }
.result-piece.wq { background-image: url(wq.svg); }
.result-piece.bq { background-image: url(bq.svg); }
.result-card h2 { margin: 2px 0 0; font-size: 16px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.result-card p { margin: 4px 0 14px; font-size: 12px; color: var(--ink2); }
.btn { width: 100%; height: 40px; border-radius: 3px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: var(--ink); color: var(--bg); }
.btn:active { opacity: 0.8; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- the line ---------- */
.side { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; }
.well {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  width: calc(var(--board) + var(--gauge-w) + var(--gap));
  padding: 4px 0 10px calc(var(--gauge-w) + var(--gap));
  border-top: 1px solid var(--rule);
}
.nav {
  position: sticky; top: -4px; z-index: 1;
  display: flex; align-items: center; gap: 6px;
  margin: -4px 0 4px; padding: 6px 0;
  background: var(--bg);
}
.move-no { margin-right: auto; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink2); }
.nav button {
  display: grid; place-items: center;
  width: 66px; height: 40px;
  border: 1px solid var(--rule); border-radius: 4px;
}
.nav button svg { width: 21px; height: 21px; stroke-width: 2; }
.nav button:active { background: var(--press); }
.nav button:disabled { color: var(--ink3); border-color: var(--rule); opacity: 0.5; cursor: default; background: none; }
.readout { padding: 2px 0 8px; transition: opacity 0.2s; }
.readout:empty { display: none; }
.readout:not(:empty) { border-bottom: 1px dashed var(--rule); margin-bottom: 6px; }
.readout.stale { opacity: 0.4; }
.verdict { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.verdict .tile { width: 18px; height: 18px; border-radius: 2px; background-color: var(--light); background-position: center; background-size: 100%; background-repeat: no-repeat; }
.pv { margin-top: 4px; font-size: 14px; line-height: 1.75; font-variant-numeric: tabular-nums; }
.pv .n { color: var(--ink3); margin: 0 2px 0 8px; }
.pv .n:first-child { margin-left: 0; }
.pv .mv { margin-right: 2px; }
.pv .mv.next { font-weight: 800; }
.pv .more { padding: 0 6px; margin: 0 2px 0 6px; border: 1px solid var(--rule); border-radius: 3px; color: var(--ink2); line-height: 1.5; }
.pv .end { color: var(--ink2); font-size: 12px; margin-left: 6px; white-space: nowrap; }
.readout .wait { height: 10px; background: var(--rule); margin: 8px 0; animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.5; } to { opacity: 1; } }

/* ---------- score sheet ---------- */
.sheet { padding-top: 4px; font-size: 14px; line-height: 1.85; font-variant-numeric: tabular-nums; }
.sheet .n { color: var(--ink3); margin: 0 3px 0 9px; }
.sheet .n:first-child { margin-left: 0; }
.sheet .mv { padding: 1px 4px; border-radius: 2px; }
.sheet .mv:active { background: var(--press); }
.sheet .mv.cur { background: var(--ink); color: var(--bg); }
.sheet .mv.fut { color: var(--ink3); }
.sheet .score { margin-left: 10px; font-weight: 800; }
.caret { display: inline-block; width: 0.55em; height: 1.05em; margin: 0 2px -0.16em 4px; background: var(--ink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- command strip ---------- */
.strip {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr);
  width: 100%; max-width: 680px;
  height: calc(var(--strip-h) + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--rule);
}
.strip button {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px;
  padding: 12px 0 env(safe-area-inset-bottom);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink);
}
.strip button[aria-expanded="true"] { background: var(--press); }
.strip button + button { border-left: 1px solid var(--rule); }
.strip svg { width: 20px; height: 20px; }
.strip span { white-space: nowrap; }
.strip .solid { fill: currentColor; stroke: none; }
.strip button:active { background: var(--press); }
.strip button:disabled { color: var(--ink3); cursor: default; background: none; }
.strip button[aria-pressed] span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border: 1.2px solid currentColor; vertical-align: 0; }
.strip button[aria-pressed="true"] span::before { background: currentColor; }

/* ---------- confirm (only for a rules change mid-game) ---------- */
.alert-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--scrim); animation: fade 0.18s ease-out; }
.alert {
  width: 280px; padding: 18px 18px 14px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 4px;
  animation: rise 0.22s var(--glide);
}
.alert h3 { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.alert p { margin: 6px 0 16px; font-size: 12px; color: var(--ink2); line-height: 1.45; }
.alert-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.alert-buttons button { height: 38px; border: 1px solid var(--ink); border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.alert-buttons .primary { background: var(--ink); color: var(--bg); }
.alert-buttons button:active { opacity: 0.7; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--strip-h) + 14px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%); max-width: calc(100% - 32px); padding: 9px 14px;
  background: var(--ink); color: var(--bg); border-radius: 3px; font-size: 12px; text-align: center;
  animation: rise 0.25s var(--glide);
}

/* ---------- wide screens: the line and the strip move beside the board ---------- */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  :root {
    --gauge-w: 16px; --gap: 6px;
    --board: min(calc(100dvh - var(--top-h) - 2 * var(--row-h) - 48px), calc(100vw - 500px), 820px);
    --side: 372px;
  }
  .top-in { width: calc(var(--board) + var(--gauge-w) + var(--gap) + 36px + var(--side)); }
  .app { flex-direction: row; align-items: flex-start; justify-content: center; gap: 36px; padding-top: 16px; }
  .side { flex: none; align-items: stretch; display: flex; flex-direction: column; width: var(--side); height: calc(var(--board) + 2 * var(--row-h)); }
  .well { width: var(--side); padding-left: 0; order: 2; }
  .strip { order: 1; width: var(--side); height: var(--strip-h); border: 1px solid var(--rule); border-radius: 4px; margin: var(--row-h) 0 14px; overflow: hidden; }
  .strip button { padding-bottom: 0; }
  .menu { bottom: auto; top: calc(var(--top-h) + 16px + var(--row-h) + var(--strip-h) + 6px); left: auto; right: max(8px, calc((100vw - var(--board) - var(--gauge-w) - var(--gap) - 36px - var(--side)) / 2)); }
}
