/* Tessera — the family's phone layout: the board on top, the laws below. */
:root {
  --bg: #06070b; --surface: #10131c; --border: #262c3d; --text: #eceff7; --dim: #8b93a8;
  --accent: #f2b84b; --accent2: #5fd6c4; --warn: #ff5d62;
  --mono: ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overscroll-behavior: none; overflow: hidden;
  -webkit-user-select: none; user-select: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
#app { height: 100vh; height: 100dvh; max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 0; }
#stage { position: relative; flex: 1 1 64%; min-height: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
#actions { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 3; display: flex; gap: 6px; pointer-events: none; }
#actions button { pointer-events: auto; }
#actions #help { margin-left: auto; }
#mode, #fig { min-width: 9ch; }
#dock { flex: 0 0 auto; max-height: 40%; overflow-y: auto; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #090b11; font-family: var(--mono); font-size: 12px; }
#scrub { width: 100%; margin: 0 0 6px; accent-color: var(--accent2); }
#laws { display: grid; grid-template-columns: 1.4em minmax(9ch, auto) 1fr; gap: 3px 8px; align-items: baseline; }
#laws .m { font-weight: 700; text-align: center; }
#laws .m.ok { color: var(--accent2); } #laws .m.no { color: var(--warn); } #laws .m.so { color: var(--accent); }
#laws .k { color: var(--dim); }
#laws .v { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#say { margin: 8px 0 0; line-height: 1.5; }
.dim { color: var(--dim); }
button.primary, button.ghost { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; padding: 7px 11px; border-radius: 8px; border: 1px solid rgba(139,147,168,0.35); cursor: pointer; white-space: nowrap; }
button.ghost { background: rgba(6,7,11,0.82); color: var(--text); }
button.ghost.on { color: var(--bg); background: var(--accent2); border-color: var(--accent2); }
button.primary { background: var(--accent); color: #1a1000; border-color: var(--accent); font-size: 13px; padding: 10px 16px; }
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 16px; text-align: center; background: rgba(6,7,11,0.92); backdrop-filter: blur(3px); overflow-y: auto; }
.overlay[hidden] { display: none; }
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }
.overlay h1 { font-family: var(--mono); font-size: clamp(26px, 8vw, 40px); margin: 0; color: var(--accent); letter-spacing: 0.14em; }
.overlay h2 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin: 0; }
.overlay p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.65; max-width: 32em; }
.overlay p b { color: var(--text); }
.overlay .accent { color: var(--accent2); }
.overlay .foot { font-family: var(--mono); font-size: 12px; }
.overlay a { color: var(--dim); }

/* the game page: a score strip, the countdown bar, the board */
body.game #stage { flex: 1 1 auto; }
#top { display: flex; gap: 16px; align-items: flex-end; padding: 8px 12px 6px; font-family: var(--mono); }
#top .h { display: flex; flex-direction: column; gap: 2px; min-width: 5ch; }
#top .h.grow { margin-left: auto; align-items: flex-end; text-align: right; }
#top .lab { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
#top .val { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
#next { color: var(--accent2); }
#next.pinch { color: var(--accent); }
#next.risk { color: var(--warn); }
#clockbar { height: 4px; margin: 0 12px 6px; background: var(--surface); border-radius: 2px; overflow: hidden; }
#clockfill { height: 100%; width: 100%; background: var(--accent2); transform-origin: left; }
#clockfill.pinch { background: var(--accent); }
#clockfill.risk { background: var(--warn); }
#note { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 4; opacity: 0; transition: opacity .25s; pointer-events: none;
  font-family: var(--mono); font-size: 12px; background: var(--surface); border: 1px solid var(--border); padding: 6px 10px; border-radius: 6px; width: max-content; max-width: calc(100% - 16px); text-align: center; }
#note.show { opacity: 1; }
@media (max-width: 420px) { #top { gap: 10px; } #top .val { font-size: 14px; } }
.overlay .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.overlay .small { font-size: 12px; font-family: var(--mono); }
.overlay button.ghost { padding: 10px 14px; font-size: 13px; }
#trophy { font-size: 13px; }
