/* NV Blockfall — Bauhaus: cream paper, black rules, flat primary colours and simple geometry. Fonts: IBM Plex (SIL OFL). */
@font-face { font-family: 'Plex Mono'; src: url('./fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Condensed'; src: url('./fonts/ibm-plex-sans-condensed-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Condensed'; src: url('./fonts/ibm-plex-sans-condensed-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
:root {
  --paper: #f1ead8; --paper-2: #fbf7ec; --ink: #1b1b1b; --soft: #5e584b; --red: #d7263d; --yellow: #f2b705; --blue: #1d4e89;
  --mono: 'Plex Mono', ui-monospace, Consolas, monospace; --sans: 'Plex Condensed', 'Arial Narrow', system-ui, sans-serif;
  --side: clamp(56px, 17vw, 150px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 500 16px/1.45 var(--sans); background: var(--paper); }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
a { color: var(--red); }
.page { width: min(860px, calc(100% - 24px)); margin: clamp(12px, 3vw, 28px) auto; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.top { text-align: center; }
.brand { margin: 0; font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--soft); }
.brand span { color: var(--ink); font-weight: 600; }
h1 { margin: 4px 0 0; display: inline-flex; align-items: center; gap: 12px; font: 600 clamp(34px, 8vw, 54px)/1 var(--sans); letter-spacing: 0.02em; text-transform: uppercase; }
h1 b { color: var(--red); font-weight: 600; }
.sq { width: 0.6em; height: 0.6em; background: var(--blue); }
.ci { width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--yellow); border: 3px solid var(--ink); }

.bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 14px; }
.seg { display: inline-flex; border: 2px solid var(--ink); }
.seg button { min-height: 34px; padding: 0 12px; border: 0; border-right: 2px solid var(--ink); background: var(--paper-2); cursor: pointer; font-weight: 600; font-size: 14px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.pick { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.pick select { min-height: 34px; border: 2px solid var(--ink); background: var(--paper-2); padding: 0 6px; }
.tog { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }
.tog input { accent-color: var(--red); width: 16px; height: 16px; }

.play { display: grid; grid-template-columns: var(--side) auto var(--side); justify-content: center; gap: clamp(8px, 2vw, 18px); align-items: start; }
.side { display: grid; gap: 10px; }
.box { border: 2px solid var(--ink); background: var(--paper-2); }
.box h2 { margin: 0; padding: 2px 8px; background: var(--ink); color: var(--paper); font: 600 12px var(--sans); letter-spacing: 0.18em; text-transform: uppercase; }
.mini { display: block; width: 100%; height: auto; }
.stats { margin: 0; display: grid; gap: 6px; }
.stats div { border-left: 6px solid var(--yellow); padding-left: 8px; }
.stats div:nth-child(2) { border-color: var(--red); }
.stats div:nth-child(3) { border-color: var(--blue); }
.stats div:nth-child(4) { border-color: var(--ink); }
.stats dt { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); }
.stats dd { margin: 0; font: 400 clamp(14px, 3.6vw, 20px)/1.2 var(--mono); word-break: break-all; }
.goal { margin: 0; font-size: 13px; color: var(--soft); }
.well { position: relative; border: 4px solid var(--ink); background: var(--paper-2); box-shadow: 8px 8px 0 var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; }
#field { display: block; }
.pop { position: absolute; left: 0; right: 0; top: 34%; margin: 0; text-align: center; pointer-events: none; font: 600 clamp(15px, 4vw, 22px)/1.2 var(--sans); text-transform: uppercase; letter-spacing: 0.06em; opacity: 0; }
.pop span { display: inline-block; padding: 4px 10px; background: var(--ink); color: var(--paper); }
.pop small { display: block; margin-top: 4px; font: 400 14px var(--mono); color: var(--red); }
.pop.show { animation: pop 1.1s ease-out; }
@keyframes pop { 0% { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px; text-align: center; background: rgba(241, 234, 216, 0.94); }
.overlay__title { margin: 0; font: 600 clamp(24px, 6vw, 34px)/1 var(--sans); text-transform: uppercase; }
.overlay__text { margin: 0; white-space: pre-line; font-size: 15px; max-width: 26ch; }
.btn { min-height: 42px; padding: 0 18px; border: 2px solid var(--ink); background: var(--paper-2); cursor: pointer; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.btn--red { background: var(--red); color: #fff; box-shadow: 4px 4px 0 var(--ink); }
.btn--red:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

.touch { display: none; grid-template-columns: repeat(4, 1fr); gap: 6px; touch-action: none; }
.touch button { min-height: 50px; border: 2px solid var(--ink); background: var(--paper-2); font-size: 20px; font-weight: 600; cursor: pointer; }
.touch button:active { background: var(--yellow); }
.touch [data-act='hard'] { background: var(--red); color: #fff; }
.touch [data-act='hold'] { font-size: 14px; text-transform: uppercase; }
@media (pointer: coarse) { .touch { display: grid; } .keys { display: none; } }
.keys { margin: 0; text-align: center; font-size: 13px; color: var(--soft); }
kbd { font: 400 11px var(--mono); border: 2px solid var(--ink); padding: 0 4px; margin: 0 1px; background: var(--paper-2); color: var(--ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.card { padding: 14px 16px; border: 2px solid var(--ink); background: var(--paper-2); }
.card h2 { margin: 0 0 8px; font: 600 14px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; }
.card h2 span { color: var(--red); }
.records { margin: 0; padding: 0 0 0 22px; display: grid; gap: 4px; font: 400 15px var(--mono); }
.records li small { font: 500 12px var(--sans); color: var(--soft); margin-left: 8px; }
.records li.now { color: var(--red); }
.rules { margin: 0 0 10px; padding-left: 18px; font-size: 14px; display: grid; gap: 2px; }
.lifetime { margin: 0 0 8px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 14px; }
.lifetime dt { color: var(--soft); }
.lifetime dd { margin: 0; font-family: var(--mono); text-align: right; }
.empty { margin: 0; color: var(--soft); font-size: 14px; }
.link { border: 0; background: none; padding: 0; color: var(--soft); text-decoration: underline; cursor: pointer; font-size: 13px; }
.foot { text-align: center; font-size: 12px; color: var(--soft); }
@media (prefers-reduced-motion: reduce) { .pop.show { animation: none; opacity: 1; } }
