/* Space Cadet homage — machine chrome + DOM overlays.
   The playfield itself is canvas; this file covers page frame, touch HUD,
   and the overlay system (fade-slide entrances per design territory). */

:root {
  --ink: #04060f;
  --panel: #0c1235;
  --steel: #8fa2c9;
  --amber: #ffd23e;
  --redled: #ff4633;
  --cyan: #49b7ff;
  --text: #eef3ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background:
    radial-gradient(1200px 700px at 50% -10%, #101a4a 0%, var(--ink) 62%);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  background: var(--ink);
  image-rendering: auto;
  border-radius: 6px;
  box-shadow: 0 0 0 1px #1b2a6b, 0 22px 80px rgba(0, 0, 0, 0.65);
  touch-action: none;
}

/* ------------------------------------------------------------------ HUD */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.chip {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.chip button {
  font: 700 11px/1 "Avenir Next", "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  color: #bcd0ff;
  background: rgba(10, 16, 48, 0.82);
  border: 1px solid rgba(110, 140, 230, 0.5);
  border-radius: 7px;
  padding: 9px 11px;
  min-width: 44px;
  min-height: 34px;
  cursor: pointer;
}
.chip button:active { background: #182a6e; }
.chip button.off { opacity: 0.55; }

.touch {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30%;
  min-height: 130px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  pointer-events: none;
}

.flipzone {
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
}

.flipzone .hint {
  font: 800 13px/1 inherit;
  letter-spacing: 0.14em;
  color: rgba(200, 220, 255, 0.5);
  border: 2px solid rgba(140, 170, 255, 0.28);
  background: rgba(16, 26, 74, 0.34);
  border-radius: 14px;
  padding: 14px 18px;
}

#plungeBtn {
  position: absolute;
  right: 10px;
  bottom: calc(30% + 10px);
  pointer-events: auto;
  writing-mode: vertical-rl;
  font: 800 12px/1 inherit;
  letter-spacing: 0.22em;
  color: var(--amber);
  background: linear-gradient(180deg, #571410, #38100d);
  border: 1px solid rgba(255, 106, 88, 0.6);
  border-radius: 12px;
  padding: 14px 9px;
  cursor: grab;
}

#nudgePad {
  position: absolute;
  left: 10px;
  bottom: calc(30% + 10px);
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

#nudgePad button {
  width: 46px;
  height: 40px;
  font: 800 14px/1 inherit;
  color: #bcd0ff;
  background: rgba(10, 16, 48, 0.85);
  border: 1px solid rgba(110, 140, 230, 0.5);
  border-radius: 10px;
}
#nudgePad button:active { background: #24367c; }

/* -------------------------------------------------------------- overlays */
.ovl-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 16, 0.66);
  backdrop-filter: blur(2px);
  z-index: 20;
  pointer-events: auto;
}
.ovl-backdrop.transparent { background: transparent; pointer-events: none; }

.ovl-card {
  max-width: min(92vw, 760px);
  max-height: 86vh;
  overflow: auto;
  background: linear-gradient(180deg, #131a45, #0c1235);
  border: 1px solid rgba(120, 150, 240, 0.55);
  border-radius: 16px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.7);
  padding: 26px 30px;
}

/* fade-slide entrance (design territory) */
.fade-slide { opacity: 0; transform: translateY(14px); transition: opacity 0.24s ease-out, transform 0.24s ease-out; }
.fade-slide.in { opacity: 1; transform: translateY(0); }

.big-title {
  margin: 0 0 6px;
  font-size: clamp(26px, 6vw, 44px);
  letter-spacing: 0.12em;
  color: var(--amber);
  text-shadow: 0 0 22px rgba(255, 210, 80, 0.45);
  text-align: center;
}
.sub-title {
  margin: 0 0 18px;
  text-align: center;
  color: #9db0ea;
  letter-spacing: 0.28em;
  font-size: 12px;
}
.blink { animation: blink 1.15s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.keyrows { display: grid; gap: 7px; margin-top: 14px; }
.keyrow { display: flex; align-items: baseline; gap: 10px; font-size: 13px; color: #bcd0ff; }
.kbd {
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #ffe9a8;
  background: #232c58;
  border: 1px solid #4a5a94;
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 4px 7px;
  white-space: nowrap;
}

.score-huge {
  text-align: center;
  font: 800 clamp(30px, 7vw, 52px)/1.1 ui-monospace, Menlo, monospace;
  color: var(--redled);
  text-shadow: 0 0 18px rgba(255, 70, 51, 0.4);
  margin: 8px 0 4px;
}

.hstable { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.hstable td { padding: 5px 4px; border-bottom: 1px solid rgba(90, 110, 180, 0.25); }
.hstable tr.top td { color: var(--amber); }
.hstable td:last-child { text-align: right; font-family: ui-monospace, Menlo, monospace; }

.btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.btn {
  font: 700 13px/1 inherit;
  letter-spacing: 0.1em;
  color: #0a1030;
  background: var(--amber);
  border: none;
  border-radius: 9px;
  padding: 12px 18px;
  cursor: pointer;
  min-height: 44px;
}
.btn.ghost { background: transparent; color: #bcd0ff; border: 1px solid #4a5a94; }
.btn:active { transform: translateY(1px); }

.tally-rows { margin: 12px 0 4px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.tally-rows .r { display: flex; justify-content: space-between; gap: 24px; padding: 3px 2px; color: #bcd0ff; }
.tally-rows .r.on { color: var(--text); }
.tally-rows .r.mult { color: #79ffa9; margin-top: 6px; border-top: 1px dashed #33406f; padding-top: 8px; }
.tally-rows .r.total { color: var(--amber); font-weight: 800; }

.toast-banner {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 12px 26px;
  font: 800 clamp(18px, 4vw, 30px)/1 inherit;
  letter-spacing: 0.18em;
  color: var(--amber);
  background: rgba(10, 14, 40, 0.9);
  border: 1px solid rgba(255, 210, 80, 0.55);
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(255, 210, 80, 0.25);
}

.pause-badge {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(3, 5, 16, 0.55);
  z-index: 25;
  color: var(--text);
  font: 800 clamp(22px, 5vw, 36px) / 1 inherit;
  letter-spacing: 0.3em;
}
.pause-badge small { font: 600 13px/1.4 inherit; letter-spacing: 0.08em; color: #9db0ea; }

/* initials entry */
.initials { display: flex; gap: 14px; justify-content: center; margin: 20px 0 4px; }
.slot {
  width: 64px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 44px/1 ui-monospace, Menlo, monospace;
  color: var(--text);
  background: #0a1030;
  border: 2px solid #35406f;
  border-radius: 10px;
  cursor: pointer;
}
.slot.sel { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 18px rgba(255, 210, 62, 0.35); }
.slot-arrows { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.slot-arrows button {
  font: 800 16px/1 inherit;
  width: 52px;
  height: 44px;
  color: #ffe9a8;
  background: #232c58;
  border: 1px solid #4a5a94;
  border-radius: 8px;
}

/* ------------------------------------------------------- help broadsheet */
/* Broadsheet multi-column styling is reserved by design territory for the
   authored help overlays only; it never styles machine UI surfaces.        */
.help-broadsheet {
  color: #211607;
  background:
    repeating-linear-gradient(0deg, rgba(80, 50, 10, 0.05) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, #f7edd4, #efe0bd);
  border: 1px solid #8a6c34 !important;
  font-family: Georgia, "Times New Roman", serif;
}
.help-broadsheet .masthead {
  text-align: center;
  border-bottom: 3px double #8a6c34;
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.help-broadsheet h1 {
  font-size: 30px;
  letter-spacing: 0.04em;
  margin: 0;
  color: #2c1c05;
  text-transform: uppercase;
}
.help-broadsheet .dateline {
  font-size: 11px;
  font-style: italic;
  color: #6d5626;
  margin-top: 4px;
}
.help-broadsheet .columns {
  column-count: 2;
  column-gap: 26px;
  column-rule: 1px solid rgba(107, 84, 38, 0.4);
  font-size: 13px;
  line-height: 1.5;
}
@media (max-width: 620px) {
  .help-broadsheet .columns { column-count: 1; }
}
.help-broadsheet h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 6px;
  break-after: avoid;
}
.help-broadsheet p { margin: 0 0 8px; }
.help-broadsheet table { width: 100%; border-collapse: collapse; font-size: 12px; }
.help-broadsheet td { padding: 3px 4px; border-bottom: 1px dotted rgba(107, 84, 38, 0.5); vertical-align: top; }
.help-broadsheet td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.help-broadsheet .kbd { background: #e7d9b4; border-color: #a8894f; color: #33240a; }

.mission-preview { text-align: center; color: #9db0ea; font-size: 13px; margin-top: 12px; line-height: 1.6; }
.mission-preview b { color: var(--text); }
