*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0a0d12;
  --panel: #121722;
  --line: #222b3a;
  --text: #dbe2ec;
  --dim: #8b95a7;
  --amber: #ffc26b;
  --green: #54d1a6;
  --red: #ff6b5e;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, Menlo, Consolas, "SF Mono", monospace;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

.modebar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cpu-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
  margin-left: 8px;
}

.cpu {
  display: inline-flex;
  gap: 4px;
}

.cpu button {
  padding: 7px 10px;
  font-size: 10px;
}

/* The opponent's numbers only mean anything when there is an opponent. */
.stat.them {
  display: none;
}

body.is-versus .stat.them {
  display: flex;
}

body.is-versus .stat.them b {
  color: #8fb6ff;
}

body.is-versus .stat.them.lost b {
  color: var(--red);
}

.head h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.22em;
  font-weight: 700;
}

.tag {
  margin: 6px 0 20px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  border-bottom: none;
  transition: background 0.15s;
}

.statusbar.stunned {
  background: #2a1418;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}

/* display:flex beats the hidden attribute unless told otherwise — the exact
   bug that once put the opponent picker on the main menu, back for the
   hearts and the distance stat in versus. Attribute wins now, everywhere. */
.stat[hidden] {
  display: none;
}

.stat .k {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
}

.stat b {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.stat.lost b {
  color: var(--red);
}

.sep {
  flex: 1;
}

.stage {
  position: relative;
  line-height: 0;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
  /* Zoom is a CSS transform on the canvas. Origin must be the top-left corner
     or the pan maths below has a moving reference point. */
  transform-origin: 0 0;
  will-change: transform;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 11, 16, 0.82);
  backdrop-filter: blur(2px);
}

.overlay.hidden {
  display: none;
}

.card {
  text-align: center;
  line-height: 1.5;
  padding: 8px 24px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: 0.16em;
}

.card p {
  margin: 0 0 18px;
  color: var(--dim);
  font-size: 13px;
}

.row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

button {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text);
  background: #1b2230;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
}

button:hover {
  background: #232c3d;
}

button.on {
  background: #4a3316;
  border-color: var(--amber);
  color: var(--amber);
}

button.primary {
  background: #17392f;
  border-color: var(--green);
  color: var(--green);
}

/* Loadout sits directly under your own field, like a game's item bar. */
.loadout {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #141a20, #0f141a);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.loadout-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.loadout-hint {
  font-size: 11px;
  color: var(--dim);
  opacity: 0.75;
}

.powers {
  display: inline-flex;
  gap: 8px;
}

.powers button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 11px;
  border-width: 2px;
  border-radius: 7px;
}

.powers button b {
  font-size: 15px;
  line-height: 1;
}

.powers button i {
  font-style: normal;
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  background: #0b0f14;
  border-radius: 4px;
  padding: 2px 7px;
  min-width: 22px;
  text-align: center;
}

.powers button kbd {
  font: inherit;
  font-size: 9px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 4px;
}

.powers button.ready {
  border-color: #6ed2ff;
  color: #cfefff;
  box-shadow: 0 0 0 1px rgba(110, 210, 255, 0.15), 0 0 14px rgba(110, 210, 255, 0.12);
}

.powers button.empty {
  opacity: 0.4;
  cursor: default;
}

.powers button.armed {
  background: #123243;
  border-color: #6ed2ff;
  color: #6ed2ff;
  animation: pulse 1.1s ease-in-out infinite;
}

.powers button.armed i {
  color: #6ed2ff;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(110, 210, 255, 0.35), 0 0 10px rgba(110, 210, 255, 0.18); }
  50% { box-shadow: 0 0 0 1px rgba(110, 210, 255, 0.7), 0 0 22px rgba(110, 210, 255, 0.4); }
}

/* ---------------------------------------------------------- title screen */

.title-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
  background:
    radial-gradient(1200px 500px at 50% 0%, rgba(150, 30, 26, 0.16), transparent 70%),
    radial-gradient(900px 420px at 50% 100%, rgba(84, 209, 166, 0.09), transparent 70%);
}

.title-screen[hidden] {
  display: none;
}

.title-inner {
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.big-title {
  margin: 0;
  font-size: clamp(30px, 8vw, 52px);
  letter-spacing: 0.3em;
  font-weight: 700;
  text-shadow: 0 0 30px rgba(255, 194, 107, 0.18);
}

.big-tag {
  margin: 10px 0 34px;
  color: var(--dim);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 15px 18px;
  background: #141a22;
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}

.menu-item:hover:not(:disabled) {
  background: #1d2836;
  border-color: var(--amber);
  transform: translateX(4px);
}

.mi-name {
  font-size: 14px;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.mi-desc {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.02em;
}

.menu-item.locked {
  opacity: 0.42;
  cursor: not-allowed;
}

.mi-name i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--amber);
  border: 1px solid rgba(255, 194, 107, 0.4);
  border-radius: 3px;
  padding: 2px 5px;
  margin-left: 8px;
  vertical-align: middle;
}

.menu-cpu[hidden] {
  /* `display: flex` below beats the hidden attribute, so the difficulty picker
     was showing on the main menu where there is no opponent to apply it to. */
  display: none !important;
}

.menu-cpu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.menu-audio {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 22px;
}

.spacer {
  flex: 1;
}

.seedline {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.08em;
}

.seedline code {
  color: var(--amber);
}

.rules {
  margin-top: 34px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.rules h3 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--dim);
  text-transform: uppercase;
}

.rules ul {
  margin: 0;
  padding-left: 18px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.75;
}

.rules b {
  color: var(--text);
  font-weight: 700;
}

.ver {
  color: var(--amber);
  letter-spacing: 0.08em;
}

.rel {
  margin-bottom: 18px;
}

.relhead {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
  margin-bottom: 6px;
}

.relhead b {
  color: var(--amber);
}

.relhead span {
  color: var(--dim);
  font-size: 11px;
}

.relhead i {
  color: var(--text);
  font-style: normal;
}

.rel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.7;
}

@media (max-width: 640px) {
  .statusbar {
    gap: 12px;
  }
  .stat b {
    font-size: 16px;
  }
}

.stat.score b {
  color: var(--amber);
}

.stat.endless-only {
  display: none;
}

body.is-endless .stat.endless-only {
  display: flex;
}

body.is-versus .stat.score {
  display: none;
}

.menu-item.back .mi-name {
  font-size: 12px;
  color: var(--dim);
}

.menu[hidden] {
  display: none;
}

.best-line {
  margin-top: 8px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
}

.best-line b {
  color: var(--amber);
}

.breakdown {
  margin: 0 auto 18px;
  max-width: 340px;
  text-align: left;
  font-size: 11.5px;
}

.brow {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0;
  color: var(--dim);
}

.brow b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.brow.total {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 8px;
  color: var(--text);
  letter-spacing: 0.14em;
}

.brow.total b {
  color: var(--amber);
  font-size: 15px;
}

.zoombar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.zoombar button {
  padding: 7px 12px;
  min-width: 38px;
}

.zoombar button:disabled {
  opacity: 0.35;
  cursor: default;
}

.zoomlevel {
  font-size: 11px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
}

button.fb {
  border-color: #4a5a72;
}

.fbcard {
  width: min(440px, 92vw);
  text-align: left;
}

.fbcard h2 {
  text-align: center;
}

.fbcard p {
  text-align: center;
}

.fbkinds {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.fbkinds button {
  flex: 1;
  font-size: 10px;
  padding: 8px 6px;
}

#fbText {
  width: 100%;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: #0d1219;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  resize: vertical;
  margin-bottom: 14px;
}

#fbText:focus {
  outline: none;
  border-color: var(--amber);
}

/* ------------------------------------------------------------- the tally */

.tally {
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, #10161d, #0c1116);
  text-align: left;
}

.tally h3 {
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.tally-note {
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.7;
  margin-left: 8px;
}

.tally-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tally-grid.sub {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ty {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ty b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.ty span {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--dim);
  text-transform: uppercase;
}

.ty.good b {
  color: var(--green);
}

.ty.bad b {
  color: var(--red);
}

.tally-none {
  font-size: 11px;
  color: var(--dim);
}

@media (max-width: 520px) {
  .tally-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* -------------------------------------------------------- leaderboard */

.lb-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.lb-tabs button {
  font-size: 9px;
  padding: 6px 8px;
  letter-spacing: 0.08em;
}

.lb-row {
  display: grid;
  grid-template-columns: 22px 1fr 52px 74px;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid rgba(34, 43, 58, 0.6);
  font-size: 12px;
}

.lb-row.head {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
  border-bottom-color: var(--line);
}

.lb-row.head b {
  font-weight: 400;
}

.lb-rank {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.lb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-lives {
  text-align: right;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.lb-score {
  text-align: right;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.lb-row.first .lb-name {
  color: var(--amber);
}

.lb-row.first .lb-lives {
  font-size: 14px;
}

/* ---------------------------------------------------------- cutscenes */

.cutscene {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: #05070a;
  padding: 16px;
  cursor: pointer;
}

.cutscene[hidden] {
  display: none;
}

.cut-frame {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #0b0f14;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#cutCanvas {
  display: block;
  width: 100%;
  height: min(38vh, 280px);
  touch-action: auto;
  cursor: pointer;
  transform: none;
}

.cut-box {
  border-top: 2px solid var(--line);
  background: linear-gradient(180deg, #121821, #0c1016);
  padding: 14px 18px 12px;
  min-height: 152px;
  display: flex;
  flex-direction: column;
}

.cut-plate {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.cut-plate b {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--amber);
}

.cut-plate span {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
}

#cutText {
  margin: 0;
  flex: 1;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  min-height: 66px;
}

.cut-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cut-foot span {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--dim);
  animation: blink 1.4s steps(2, start) infinite;
}

@keyframes blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.25; }
}

#cutSkip {
  font-size: 9px;
  padding: 6px 10px;
}

/* ---------------------------------------------------------- missions */

.mission {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #141a22;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}

.mission:hover:not(:disabled) {
  background: #1d2836;
  border-color: var(--amber);
}

.mission:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.mi-num {
  font-size: 15px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  min-width: 20px;
}

.mi-body {
  flex: 1;
}

.mi-title {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.mi-brief {
  display: block;
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 2px;
}

.mi-state {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-align: right;
}

.mi-state.done {
  color: var(--green);
}

/* --------------------------------------------------- title screen layout */

.title-inner {
  max-width: 620px;
}

.title-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  margin-bottom: 26px;
}

.title-head .big-title {
  font-size: clamp(26px, 6.5vw, 42px);
}

.title-head .big-tag {
  margin: 8px 0 0;
}

/* Settings belong in a corner, not stacked at the bottom of the page where a
   phone user has to scroll past everything to mute the thing. */
.title-settings {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.title-settings button {
  font-size: 9px;
  padding: 7px 9px;
}

.title-settings button.on {
  background: #4a3316;
  border-color: var(--amber);
  color: var(--amber);
}

/* The authored mode leads, at a size that says so. */
.hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 18px 20px;
  background: linear-gradient(135deg, #1d2433, #151b26);
  border: 1px solid #35405a;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s, background 0.15s;
}

.hero:hover {
  border-color: var(--amber);
  background: linear-gradient(135deg, #26304a, #1a2130);
  transform: translateY(-1px);
}

.hero-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.hero-name {
  font-size: 19px;
  letter-spacing: 0.22em;
  font-weight: 700;
}

.hero-go {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--amber);
}

.hero-desc {
  font-size: 11.5px;
  color: var(--dim);
}

.hero-progress {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--green);
}

.hero-progress:empty {
  display: none;
}

.mode-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.mode-row .menu-item {
  padding: 12px 12px;
  gap: 3px;
}

.mode-row .mi-name {
  font-size: 11px;
  letter-spacing: 0.1em;
}

.mode-row .mi-desc {
  font-size: 9.5px;
  line-height: 1.35;
}

@media (max-width: 520px) {
  .mode-row {
    grid-template-columns: 1fr;
  }
  .title-head {
    flex-direction: column;
  }
}

/* One stats panel, two tabs. */
.stat-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.stat-tabs button {
  font-size: 9px;
  padding: 6px 10px;
  letter-spacing: 0.14em;
}

.stat-note {
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.04em;
  margin-left: auto;
  opacity: 0.75;
}

#boardPane[hidden],
#tallyPane[hidden] {
  display: none;
}

.title-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.foot-ver {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

/* The feedback modal lives at body level so it can open from the title screen
   as well as mid-game, which means it has to position against the viewport. */
.overlay.fixed {
  position: fixed;
  z-index: 60;
}

/* --------------------------------------------------------------- countdown */

#countdown {
  background: rgba(6, 9, 13, 0.55);
  pointer-events: none;
}

.cd-inner {
  text-align: center;
}

.cd-num {
  font-size: clamp(64px, 16vw, 132px);
  font-weight: 700;
  line-height: 1;
  color: var(--amber);
  text-shadow: 0 0 40px rgba(255, 194, 107, 0.45);
  letter-spacing: 0.05em;
}

/* Re-triggered per tick by swapping the class, so each number lands with its
   own pop rather than the whole element easing once. */
.cd-num.tick {
  animation: cdpop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes cdpop {
  0% { transform: scale(1.9); opacity: 0; }
  22% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.94); opacity: 0.85; }
}

.cd-cry {
  margin-top: 10px;
  font-size: clamp(15px, 3.6vw, 26px);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #fff1d8;
  text-shadow: 0 0 26px rgba(255, 140, 90, 0.6);
  min-height: 1.3em;
}

.cd-cry.go {
  animation: cdgo 0.9s ease-out;
}

@keyframes cdgo {
  0% { transform: scale(0.7); opacity: 0; }
  30% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ------------------------------------------------------------------ back */

/* BACK was a dim row that looked like every other menu item and read as part
   of the list rather than a way out of it. It now sits at the TOP of a panel,
   left, and is styled as a control instead of an option. */
.backbtn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 9px 16px 9px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--amber);
  background: #241a10;
  border: 1px solid rgba(255, 194, 107, 0.55);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.14s, transform 0.1s, border-color 0.14s;
}

.backbtn:hover {
  background: #33240f;
  border-color: var(--amber);
  transform: translateX(-3px);
}

/* The title is the way home from anywhere, so it has to look touchable. */
.big-title,
.head h1 {
  cursor: pointer;
  transition: color 0.15s, text-shadow 0.15s;
}

.big-title:hover,
.head h1:hover {
  color: var(--amber);
  text-shadow: 0 0 34px rgba(255, 194, 107, 0.4);
}

/* ============================================================== retro pass
   The title screen read as a developer tool: rounded corners, soft shadows,
   hinted system type. A 16-bit menu is the opposite of all three — hard edges,
   bevelled frames, blocky type, and a CRT sitting over the whole thing. */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.big-title {
  line-height: 0;
}

#titleArt {
  display: block;
  width: min(100%, 560px);
  height: auto;
  /* The scaling IS the style — smoothing this turns pixel type back into a
     blurry logo. */
  image-rendering: pixelated;
}

/* Scanlines over the whole title screen, plus a vignette. Kept above the
   content and click-through, so it tints without eating input. */
.title-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.22) 0 1px,
      rgba(0, 0, 0, 0) 1px 3px
    ),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.title-screen {
  position: relative;
}

/* --- hard-edged, bevelled panels ---------------------------------------- */

.title-screen .menu-item,
.title-screen .hero,
.title-screen .tally,
.title-screen .backbtn,
.title-screen .menu-cpu button,
.title-screen .title-settings button,
.title-screen .fb {
  border-radius: 0;
  /* Outer dark rule, inner light rule: the classic window bevel, done with
     shadows so it costs no extra elements. */
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.14),
    inset -1px -1px 0 rgba(0, 0, 0, 0.65),
    0 0 0 1px #0a0d12;
}

.title-screen .hero:hover,
.title-screen .menu-item:hover:not(:disabled) {
  transform: none;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.22),
    inset -1px -1px 0 rgba(0, 0, 0, 0.7),
    0 0 0 1px var(--amber),
    0 0 18px rgba(255, 194, 107, 0.16);
}

/* --- a selection cursor, the way a console menu marks its row ------------ */

.title-screen .menu-item,
.title-screen .hero {
  position: relative;
}

.title-screen .menu-item::before,
.title-screen .hero::before {
  content: 'B6';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--amber);
  opacity: 0;
  transition: opacity 0.1s;
}

.title-screen .menu-item:hover:not(:disabled)::before,
.title-screen .hero:hover::before,
.title-screen .menu-item:focus-visible::before,
.title-screen .hero:focus-visible::before {
  opacity: 1;
  animation: cursorblink 0.9s steps(2, start) infinite;
}

@keyframes cursorblink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0.25; }
}

.title-screen .menu-item,
.title-screen .hero {
  padding-left: 20px;
}

/* --- typography ---------------------------------------------------------- */

.big-tag {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 10.5px;
}

.title-screen .mi-name,
.title-screen .hero-name {
  letter-spacing: 0.22em;
}

@media (prefers-reduced-motion: reduce) {
  .title-screen .menu-item::before,
  .title-screen .hero::before {
    animation: none;
  }
}

/* --------------------------------------------------------------- embers */

.embers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
}

.embers.back {
  z-index: 1;
}

/* Above the scanlines, so the foreground layer really is in front of
   everything — including the CRT overlay. */
.embers.front {
  z-index: 6;
}

.title-inner {
  position: relative;
  z-index: 2;
}


/* --- attract mode ------------------------------------------------------- */
/* Above everything on the title screen including the front ember layer — it
   is a takeover, not another element competing for the same space. */
.attract {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  cursor: default;
}

/* --- the face ----------------------------------------------------------- */
/* Beside the field in the footer row, never over it. As an overlay he covered
   the bottom-left corner of the map — which is live ground, not chrome. */
.fieldfoot {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.fieldfoot-bars {
  flex: 1;
  min-width: 0;
}

.facehud {
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding-top: 6px;
}

.facehud canvas {
  /* Big enough that the blood and the shadows under his eyes actually read.
     At 86px the wear was there and invisible, which is the same as absent. */
  width: 122px;
  height: 138px;
  display: block;
  image-rendering: pixelated;
  cursor: default;
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.55), rgba(10, 14, 20, 0.85));
  border: 1px solid rgba(255, 210, 150, 0.28);
  /* Hard bevel rather than a soft shadow, to sit with the rest of the retro
     furniture instead of looking like a web widget dropped on the field. */
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.1),
    inset -1px -1px 0 rgba(0, 0, 0, 0.55),
    0 2px 0 rgba(0, 0, 0, 0.5);
}

.face-name {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: #cbb28c;
  text-shadow: 1px 1px 0 #000;
  background: rgba(10, 14, 20, 0.8);
  border: 1px solid rgba(255, 210, 150, 0.2);
  padding: 1px 5px;
}

.facehud[hidden] { display: none; }

@media (max-width: 620px) {
  .facehud canvas { width: 74px; height: 84px; }
  .face-name { font-size: 7px; padding: 1px 3px; }
}


/* --- minimap ------------------------------------------------------------- */
/* The whole crossing in one strip. Sits flush on top of the stage so the two
   read as one instrument. */
.minimap {
  display: block;
  width: 100%;
  height: 44px;
  background: #10150e;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  touch-action: none;
}

.minimap[hidden] { display: none; }

/* The stage under a minimap gives up its top corners to it. */
.minimap:not([hidden]) + .stage {
  border-radius: 0 0 8px 8px;
}

#followBtn.on {
  color: var(--gold, #e0a33c);
  border-color: currentColor;
}


/* --- clearer health ------------------------------------------------------ */
.hp-stat b {
  color: #e0526b;
  letter-spacing: 2px;
}

.hp-stat b.low {
  animation: hp-pulse 1.1s steps(2) infinite;
}

@keyframes hp-pulse {
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .hp-stat b.low { animation: none; }
}


/* --- the bag ------------------------------------------------------------- */
.bag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: rgba(16, 21, 14, 0.55);
  margin-top: 4px;
}

.bag-item.empty { opacity: 0.45; }

.bag-icon { font-size: 15px; width: 18px; text-align: center; }

.bag-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.bag-body b { font-size: 10px; letter-spacing: 0.12em; }

.bag-desc {
  font-size: 9px;
  color: #93a08b;
  line-height: 1.25;
}

.bag-count {
  font-size: 13px;
  color: var(--gold, #e0a33c);
  min-width: 18px;
  text-align: right;
}

/* --- hearts under the portrait ------------------------------------------- */
.face-hearts {
  /* Zelda rules: each heart is its own object, with air between them. */
  font-size: 15px;
  color: #e0526b;
  letter-spacing: 6px;
  text-shadow: 1px 1px 0 #000, 0 0 6px rgba(224, 82, 107, 0.35);
  margin-top: 2px;
}

.face-hearts.low { animation: hp-pulse 1.1s steps(2) infinite; }

.face-hearts[hidden] { display: none; }

/* --- slow-mo ------------------------------------------------------------- */
/* Aiming time. Cool tint plus a whisper of a label — enough to explain why
   the field crawls, quiet enough to leave the thinking alone. */
.stage.slowmo::after {
  content: 'TAKE YOUR TIME';
  position: absolute;
  inset: 0;
  background: rgba(70, 110, 160, 0.10);
  color: rgba(190, 215, 240, 0.55);
  font-size: 10px;
  letter-spacing: 0.35em;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
  pointer-events: none;
}


/* --- briefing ------------------------------------------------------------ */
.briefing-card {
  min-width: 300px;
  max-width: 420px;
}

.briefing-card #brRoad {
  color: #b9c4ae;
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* --- the camp ------------------------------------------------------------ */
.camp-card {
  min-width: 320px;
  max-width: 440px;
}

#campFire {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.camp-talk {
  font-size: 11px;
  font-style: italic;
  color: #d8cdb4;
  line-height: 1.5;
  border-left: 2px solid rgba(255, 170, 70, 0.5);
  padding-left: 8px;
  text-align: left;
}

.camp-actions button { font-size: 10px; }

.camp-shop {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0;
}

.camp-shop.hidden { display: none; }

/* --- quartermaster ------------------------------------------------------- */
.quartermaster {
  margin-top: 10px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: rgba(14, 18, 12, 0.5);
}

.qm-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #cbb28c;
  margin-bottom: 6px;
}

.qm-head b { color: var(--gold, #e0a33c); }

.qm-item {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 10px;
  margin-top: 4px;
}

.qm-item b { color: #8fae7c; float: right; }

.qm-note {
  font-size: 9px;
  color: #7b8672;
  margin-top: 6px;
  line-height: 1.4;
}


/* --- how to play --------------------------------------------------------- */
.howto {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.how-row {
  border: 1px solid var(--line);
  background: rgba(16, 21, 14, 0.5);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.how-row b { font-size: 10px; letter-spacing: 0.14em; color: #e0c48f; }

.how-row span { font-size: 10px; color: #a8b39d; line-height: 1.5; }

.howbtn {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  opacity: 0.85;
}

/* --- tally icons --------------------------------------------------------- */
/* Little standing figures, drawn in CSS: a head and a body, nothing more.
   The tally is a memorial column, not a chart. */
.ty-ico {
  display: inline-block;
  width: 9px;
  height: 15px;
  position: relative;
  margin-right: 6px;
  vertical-align: -2px;
}

.ty-ico::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffc26b;
}

.ty-ico::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 9px;
  border-radius: 2px 2px 0 0;
  background: #ffc26b;
}

.ty-ico.woman::before { background: #ffcf8d; box-shadow: -2px 1px 0 0 #8a5a2a; }
.ty-ico.woman::after { background: #ffcf8d; clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%); }

.ty-ico.child { transform: scale(0.72); transform-origin: bottom center; }
.ty-ico.child::before, .ty-ico.child::after { background: #ffd9a3; }


/* --- overlays that never clip ------------------------------------------- */
/* The camp card outgrew the stage and the stage clips. Fixed overlays center
   in the VIEWPORT, and a tall card scrolls inside itself. */
.briefing-card,
.camp-card {
  max-height: 92vh;
  overflow-y: auto;
}

#brScene {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

/* --- vendors ------------------------------------------------------------- */
.camp-vendor {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(14, 18, 12, 0.6);
  padding: 8px;
  margin: 6px 0;
}

.camp-vendor.hidden { display: none; }

.vendor-face {
  width: 60px;
  height: 66px;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  background: #171d14;
  flex: none;
}

.vendor-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.vendor-body > b { font-size: 10px; letter-spacing: 0.14em; color: #e0c48f; }

.vendor-body > span {
  font-size: 10px;
  font-style: italic;
  color: #b9ab8f;
  line-height: 1.45;
}
