/* The one look for every page's chrome: start screens, HUD lines, panels, prompts, captions,
   the controls legend and the way home. Mono type, cyan for what you can act on, amber for
   warnings, red only for alarms. Pages link this file and use the classes below; ui.js adds the
   controls legend and the Menu button. */
:root {
  color-scheme: dark;
  --ink: #d7e2f2;          /* body text */
  --ink-hi: #eef6ff;       /* titles, pressed buttons */
  --dim: #93a3c0;          /* secondary text: 7:1 on --bg */
  --hud: #9fd8ff;          /* HUD readouts */
  --accent: #5fd4ff;       /* anything you can press or use */
  --warn: #ffb547;
  --alarm: #ff6060;
  --ok: #7be08a;
  --bg: #05070d;
  --panel: #0b1120;
  --glass: #05070de6;      /* panels over the 3D view */
  --line: #1d2a44;
  --line-hi: #5fd4ff66;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: 'InterK', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;   /* words a person reads in panels (the brief, the ship's log) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --r: 4px;
  --shadow: 0 1px 3px #000, 0 0 8px #000c;
}
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; color: var(--ink); font: 15px/1.5 var(--mono); }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- start screen (also the pause screen: Esc brings it back) ---- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: var(--s4);
  background: linear-gradient(#05070dcc, #05070df2); z-index: 10; }
.gate > div { width: min(560px, 100%); }
.gate h1 { font-size: 28px; line-height: 1.2; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 var(--s2); font-weight: 600; color: var(--ink-hi); }
.gate p { margin: 0 0 var(--s4); color: var(--dim); }
.gate .tag { display: inline-block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--warn); border: 1px solid #ffb54755; border-radius: var(--r); padding: 1px var(--s2); margin: 0 0 var(--s3); }
.btn { font: inherit; font-size: 16px; padding: 10px 22px; border: 1px solid var(--accent); background: var(--panel); color: var(--ink-hi); cursor: pointer; border-radius: var(--r); }
.btn:hover:not(:disabled) { background: #0e1a30; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.quiet { font-size: 13px; padding: 6px 12px; border-color: var(--line); color: var(--ink); }
.btn.quiet:hover { border-color: var(--accent); }
.links { margin: var(--s3) 0 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: 14px; }
.home { display: inline-block; margin: 0 0 var(--s4); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); text-decoration: none; }
.home:hover, .home:focus-visible { color: var(--accent); }
.touchnote { display: none; margin: var(--s4) 0 0; padding: var(--s2) var(--s3); border: 1px solid #ffb54755; border-radius: var(--r); background: #ffb5470f; color: var(--ink); font-size: 13px; }
@media (pointer: coarse) { .touchnote { display: block; } }
.err { color: #ff8080; }

/* ---- keys: the same chips on the start screen and in the in-game legend ---- */
.keys { margin: var(--s4) 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px var(--s3); font-size: 13px; color: var(--dim); align-items: baseline; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; }
.keys .sub { grid-column: 1 / -1; margin-top: var(--s1); color: var(--ink); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
kbd { font: 12px/1 var(--mono); color: var(--ink-hi); background: var(--panel); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 2px 5px; }

/* ---- in-game readouts ---- */
.hud { position: fixed; top: var(--s3); left: var(--s3); padding: 6px 10px; font-size: 13px; color: var(--hud); letter-spacing: 0.06em;
  text-shadow: var(--shadow); background: #05070d8c; border-radius: var(--r); pointer-events: none; max-width: calc(100vw - 2 * var(--s3)); box-sizing: border-box; }
.hud b { color: var(--accent); font-weight: 600; letter-spacing: 0.14em; }
.hud .dim { color: var(--dim); } .hud .warn { color: var(--warn); } .hud .alarm { color: var(--alarm); }
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) 10px; font-size: 12px; line-height: 1.45; color: var(--hud); }
.panel .head { color: var(--accent); letter-spacing: 0.08em; }
.panel .warn { color: var(--warn); }
.prompt { position: fixed; left: 50%; top: 58%; transform: translateX(-50%); font-size: 14px; color: var(--ink-hi); background: var(--glass); border: 1px solid var(--line-hi); padding: var(--s1) 10px; border-radius: var(--r); pointer-events: none; white-space: nowrap; }
.caption { position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); width: max-content; max-width: min(calc(100vw - 32px), 720px); box-sizing: border-box; text-align: center; font-size: 17px; color: #cfe8ff;
  background: #05070db3; border-radius: var(--r); padding: 6px var(--s3); text-shadow: 0 1px 4px #000; opacity: 0; transition: opacity 0.4s ease; pointer-events: none; z-index: 8; }
.caption.show { opacity: 1; }
.crosshair { position: fixed; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #cfe8ffaa; pointer-events: none; }
.readout { position: fixed; top: var(--s3); right: var(--s3); font-size: 13px; color: var(--hud); text-shadow: var(--shadow); letter-spacing: 0.06em; pointer-events: none; }
.errline { position: fixed; left: var(--s4); right: var(--s4); bottom: 90px; color: #ff8080; z-index: 20; }
@media (prefers-reduced-motion: reduce) { .caption { transition: none; } }

/* ---- the controls legend (ui.js): bottom left while playing; H or × hides it ---- */
.legend { position: fixed; left: var(--s3); bottom: var(--s3); z-index: 6; width: max-content; max-width: min(340px, calc(100vw - 24px)); box-sizing: border-box; }
.legend .keys { margin: var(--s1) 0 0; font-size: 12px; gap: 1px var(--s2); }
.legend kbd { font-size: 11px; padding: 1px 4px; }
.legend .keys .sub { font-size: 11px; }
.legend .top { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.legend .x { font: inherit; font-size: 12px; color: var(--dim); background: none; border: 0; padding: 2px var(--s1); cursor: pointer; }
.legend .x:hover { color: var(--accent); }
.legend-tab { position: fixed; left: var(--s3); bottom: var(--s3); z-index: 6; }
/* a legend only makes sense while playing; pages without a start screen are always "playing" */
body.hud-gated:not(.hud-playing) .legend, body.hud-gated:not(.hud-playing) .legend-tab { display: none; }
/* the menu button: only when playing without a captured mouse (a phone, or pointer lock refused) */
.menu-btn { position: fixed; right: var(--s3); bottom: var(--s3); z-index: 7; display: none; }
body.hud-playing:not(.hud-locked) .menu-btn { display: block; }
