@font-face { font-family: "Chakra Petch"; src: url("/fonts/chakra-petch-400-latin.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/fonts/chakra-petch-500-latin.woff2") format("woff2"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/fonts/chakra-petch-600-latin.woff2") format("woff2"); font-style: normal; font-weight: 600; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("/fonts/unbounded-latin.woff2") format("woff2"); font-style: normal; font-weight: 200 900; font-display: swap; }
/* Layout: one full-bleed canvas; HUD pinned to the four corners in bone-white type
   with accretion-disk amber as the only accent; menus on a left-hand sheet of dusk
   violet glass so the range stays visible beside them. Single dark look by design. */
:root {
  --bg: #140c16;
  --ink: #f6ead9;
  --dim: rgba(246, 234, 217, 0.66);
  --faint: rgba(246, 234, 217, 0.24);
  --amber: #ffb347;
  --amber-deep: #ff8a2a;
  --violet: #c3a6ff;
  --glass: rgba(27, 15, 31, 0.72);
  --glass-thin: rgba(27, 15, 31, 0.46);
  --display: "Unbounded", "Arial Black", "Segoe UI Black", system-ui, sans-serif;
  --text: "Chakra Petch", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --edge: clamp(14px, 2.4vmin, 28px);
  color-scheme: dark;
}

[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 14px/1.45 var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.game { position: relative; height: 100%; overflow: hidden; background: var(--bg); }
#view { display: block; width: 100%; height: 100%; outline: none; }
.game[data-mode="play"] #view { cursor: none; }
/* A canvas whose context is gone paints as a blank sheet; show the page ground instead. */
.game[data-mode="error"] #view { visibility: hidden; }

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 0.42em;
  border: 1px solid var(--faint);
  border-radius: 5px;
  background: rgba(246, 234, 217, 0.08);
  font: 600 0.86em/1.55 var(--text);
  text-align: center;
  color: var(--ink);
}

/* ---- HUD ---------------------------------------------------------------- */
.hud {
  position: absolute;
  inset: 0;
  padding: var(--edge) var(--gutter-r) var(--edge) var(--gutter-l);
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(10, 4, 12, 0.9);
  transition: opacity 0.25s;
}
.game:not([data-mode="play"]) .hud { opacity: 0; }
.game.hud-off .hud { opacity: 0; }
.hud > * { position: absolute; }

.reticle { left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; }
.reticle-dot { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1px rgba(10, 4, 12, 0.55); }
.reticle-ring {
  --v: 0;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--amber) calc(var(--v) * 360deg), rgba(246, 234, 217, 0.16) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 2.5px));
  opacity: 0;
  transition: opacity 0.12s;
}
.reticle-ring.on { opacity: 1; }

.readouts { left: var(--gutter-l); top: var(--edge); display: flex; flex-direction: column; gap: 10px; }
.brand { margin: 0; font: 900 13px/1 var(--display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); }
.stat { margin: 0; }
.stat dt, .belt-label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.stat dd { margin: 0; font: 600 26px/1.1 var(--text); font-variant-numeric: tabular-nums; }
.stat dd.done { color: var(--amber); }

.status { right: var(--gutter-r); top: var(--edge); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chip { margin: 0; padding: 3px 10px; border: 1px solid var(--faint); border-radius: 999px; background: var(--glass-thin); font-size: 12px; letter-spacing: 0.06em; max-width: min(46vw, 300px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.live { border-color: var(--amber); color: var(--amber); }
.chip.quiet { border-color: transparent; background: none; color: var(--dim); font-variant-numeric: tabular-nums; }
.tag { margin: 0; padding: 2px 10px; border-radius: 4px; background: var(--violet); color: #1b0f1f; font-weight: 600; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; text-shadow: none; opacity: 0; transition: opacity 0.15s; }
.tag.on { opacity: 1; }
.holes { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.holes li { --v: 1; display: none; align-items: center; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.holes li.on { display: flex; }
.holes li i {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle, #05020a 38%, transparent 40%), conic-gradient(var(--amber) calc(var(--v) * 360deg), rgba(246, 234, 217, 0.18) 0);
  box-shadow: 0 0 10px rgba(255, 138, 42, 0.55);
}

.belt { left: var(--gutter-l); bottom: var(--edge); display: flex; flex-direction: column; gap: 10px; }
.belt-row { display: flex; align-items: center; gap: 12px; }
.pips { display: flex; gap: 7px; }
.pips i {
  --v: 1;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--faint);
  background: linear-gradient(to top, rgba(195, 166, 255, 0.55) calc(var(--v) * 100%), transparent 0);
}
.pips i.full { border-color: var(--violet); background: radial-gradient(circle at 35% 30%, #efe6ff, var(--violet) 55%, #6f4fd0); box-shadow: 0 0 12px rgba(195, 166, 255, 0.7); }
.dash { --v: 1; width: 74px; height: 5px; border-radius: 3px; background: rgba(246, 234, 217, 0.16); overflow: hidden; }
.dash b { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--ink); }
.dash.ready b { background: var(--amber); }

.hints { left: 50%; bottom: var(--edge); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; width: min(58vw, 760px); font-size: 12.5px; color: var(--dim); }
.hints span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

.warning { left: 50%; top: 64%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.warning.on { opacity: 1; }
.warning b { font: 900 clamp(16px, 2.6vmin, 24px)/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--violet); animation: pulse 0.5s ease-in-out infinite alternate; }
.warning span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.45; } }

.rebuild { --v: 0; left: 50%; top: 40%; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; }
.rebuild.on { display: flex; }
.rebuild b { width: 180px; height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--amber) calc(var(--v) * 100%), rgba(246, 234, 217, 0.2) 0); }

.toast { left: 50%; top: calc(var(--edge) + 4px); transform: translateX(-50%); margin: 0; padding: 6px 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--faint); font-size: 13px; letter-spacing: 0.04em; white-space: nowrap; opacity: 0; transition: opacity 0.25s; }
.toast.on { opacity: 1; }

.death { --v: 0; position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: var(--v); }
.death span { font: 900 clamp(18px, min(6vmin, 3.6vw), 64px)/1 var(--display); letter-spacing: 0.5em; margin-right: -0.5em; text-transform: uppercase; color: var(--ink); transform: scaleY(calc(1 + var(--v) * 1.6)); }

/* ---- menus -------------------------------------------------------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  overflow-y: auto;
  background: linear-gradient(to right, rgba(20, 12, 22, 0.90) 0, rgba(20, 12, 22, 0.62) min(48rem, 70%), rgba(20, 12, 22, 0) 100%);
  transition: opacity 0.3s;
}
.game[data-mode="play"] .overlay { opacity: 0; pointer-events: none; }
.sheet {
  box-sizing: border-box;
  width: min(46rem, 100%);
  margin: auto 0;
  padding: clamp(20px, 5vmin, 56px) var(--gutter-r) clamp(20px, 5vmin, 56px) max(var(--gutter-l), clamp(16px, 5vw, 72px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--amber); }
h1 { margin: 0; font: 900 clamp(34px, 8.4vw, 92px)/0.92 var(--display); letter-spacing: -0.02em; text-transform: uppercase; text-wrap: balance; }
.lede { margin: 0; max-width: 34em; font-size: clamp(15px, 1.5vw, 18px); line-height: 1.5; color: var(--ink); }
.when-title, .when-paused, .when-error { display: none; flex-direction: column; align-items: flex-start; gap: 18px; }
.game[data-mode="title"] .when-title, .game[data-mode="paused"] .when-paused, .game[data-mode="error"] .when-error { display: flex; }
.game[data-mode="error"] .legend, .game[data-mode="error"] .pad-line, .game[data-mode="error"] .fine { display: none; }
.error-text { margin: 0; padding: 12px 14px; max-width: 40em; border-left: 3px solid var(--amber-deep); background: var(--glass); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }

.start {
  appearance: none;
  padding: 13px 26px;
  border: 0;
  border-radius: 4px;
  background: var(--amber);
  color: #1b0f1f;
  font: 600 15px/1 var(--text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.start:hover { background: #ffc673; transform: translateY(-1px); }
.start:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.pad-line { margin: 0; font-size: 13px; color: var(--dim); }
.pad-line.live { color: var(--amber); }

.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 18px 32px; padding-top: 14px; border-top: 1px solid var(--faint); }
.legend section { min-width: 0; }
.legend h2 { margin: 0 0 8px; font: 600 11px/1.2 var(--text); letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.legend dl { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.legend dl > div { display: grid; grid-template-columns: 7.2rem 1fr; gap: 10px; align-items: baseline; font-size: 13px; }
.legend dt { color: var(--ink); white-space: nowrap; }
.legend dd { margin: 0; color: var(--dim); min-width: 0; }
.legend kbd { margin-right: 2px; }
.fine { margin: 0; font-size: 12px; color: var(--dim); }
.legal { margin: 0; font-size: 12px; color: var(--dim); display: flex; gap: 14px; }
.legal a, .doc a { color: var(--ink); text-underline-offset: 3px; }
.legal a:hover, .doc a:hover { color: var(--amber); }
.legal a:focus-visible, .doc a:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---- text pages (privacy) ----------------------------------------------- */
body.doc-page { overflow: auto; }
.doc { box-sizing: border-box; max-width: 44rem; margin: 0 auto; padding: clamp(28px, 7vmin, 72px) var(--gutter-r) clamp(28px, 7vmin, 72px) var(--gutter-l); display: flex; flex-direction: column; gap: 14px; font-size: 15px; line-height: 1.6; }
.doc h1 { font-size: clamp(30px, 6vw, 56px); }
.doc h2 { margin: 14px 0 0; font: 600 12px/1.3 var(--text); letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); }
.doc p { margin: 0; color: var(--ink); }
.doc code { font-size: 0.92em; padding: 1px 5px; border-radius: 4px; background: rgba(246, 234, 217, 0.1); }

@media (max-width: 720px) {
  .hints { display: none; }
  .stat dd { font-size: 20px; }
  .overlay { background: rgba(20, 12, 22, 0.84); }
}
@media (max-height: 520px) {
  .hints { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .warning b { animation: none; }
  .start, .overlay, .hud { transition: none; }
}
