.arcade [hidden] { display: none !important; }

.cabinet button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}

.cabinet :is(button, summary, a, input):focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}

.arcade {
  width: min(calc(100% - 24px), 960px);
  margin-inline: auto;
  padding-bottom: 36px;
}

.arcade .breadcrumb { padding-top: 18px; color: var(--muted); font-size: .88rem; }
.arcade .breadcrumb a { color: var(--forest); font-weight: 700; text-decoration: none; }

.scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cabinet .eyebrow, .scoreboard, .stage-stamp {
  font: 700 .75rem/1.2 ui-monospace, Consolas, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.scoreboard i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px #ff7b6970;
}

.game-intro { margin: 9px 0 16px; }
.game-intro h1 {
  max-width: none;
  margin-bottom: 4px;
  font-size: clamp(1.95rem, 5vw, 4.4rem);
}
.game-intro p { margin: 0; color: var(--muted); font-size: .95rem; }
.cabinet .eyebrow { margin: 0; color: var(--teal); }

.cabinet {
  color-scheme: dark;
  --paper: #f8eee0;
  --muted: #c5bdb0;
  --ink: #131827;
  --panel: #212735;
  --line: #414858;
  --amber: #ffd47a;
  --teal: #92e8d0;
  --red: #ff7b69;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel);
  color: var(--paper);
  font: 16px/1.45 system-ui, sans-serif;
  box-shadow: 0 22px 60px #080b145c;
}
.scoreboard {
  min-height: 48px;
  padding: 0 11px;
  background: #141a28;
  font-size: clamp(.58rem, 2.2vw, .75rem);
  letter-spacing: .055em;
}
.scoreboard > span:first-child { display: flex; align-items: center; min-width: 0; flex: 1; }
.scoreboard i { flex-shrink: 0; }
#scene { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.scoreboard #sound { min-height: 40px; padding: 5px 9px; font-size: .75rem; }
.cabinet:has(#selection:not([hidden])) .scoreboard :is(#distance, #record) { display: none; }
#distance { margin-left: auto; color: var(--amber); white-space: nowrap; font-variant-numeric: tabular-nums; }
#record { color: var(--muted); white-space: nowrap; }
.stage { position: relative; background: #253448; aspect-ratio: 1.4; }
#track { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.stage-stamp {
  position: absolute;
  right: 10px;
  bottom: 8px;
  pointer-events: none;
  color: #e4ded1b8;
}
.stage-stamp span { color: var(--red); }
.protection {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border: 1px solid #ffe0a1;
  border-radius: 5px;
  background: #3f2c16e8;
  color: #fff0c9;
  font-size: .76rem;
  font-weight: 700;
  pointer-events: none;
}
.briefing { padding: 13px; background: #252f36; border-top: 1px solid #5a746f; }
.briefing p { margin: 0 0 10px; font-size: .88rem; color: #e1d7c5; }
.caption {
  position: absolute;
  top: 9px;
  left: 9px;
  max-width: calc(100% - 18px);
  margin: 0;
  padding: 6px 9px;
  border-left: 3px solid var(--amber);
  border-radius: 0 5px 5px 0;
  background: #0f1628ed;
  font-size: .86rem;
  font-weight: 650;
  pointer-events: none;
}
.caption #speaker {
  display: block;
  margin-bottom: 2px;
  color: #ffd47a;
  font-size: .65rem;
  font-weight: 750;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.caption.runner-line { border-color: var(--teal); }
.caption.runner-line #speaker { color: var(--teal); }
.control-hint { margin: 0; padding: 0 12px 10px; color: var(--muted); font-size: .76rem; }

.start-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2.2;
  object-fit: cover;
  object-position: center 34%;
  background: #253448;
}
.start-options, .result { padding: 12px; }
.cabinet h2 { margin: 0 0 8px; color: inherit; font: 700 1.06rem/1.12 system-ui, sans-serif; letter-spacing: -.02em; }
.cabinet h2:focus { outline: none; }
.start-options h2 { font-size: 1.2rem; }
#start-error { color: var(--red); }
.runner-grid { display: grid; gap: 7px; }
.runner-card {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 4px 8px 4px 4px;
  gap: 8px;
  text-align: left;
  background: #282f40;
  border: 1px solid #495264;
  border-radius: 9px;
}
.runner-card canvas { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 6px; }
.runner-card strong, .runner-card small { display: block; }
.runner-card strong { line-height: 1.2; }
.runner-card small { margin-top: 4px; color: #d4caba; font-size: .8rem; line-height: 1.25; }
.arrow { color: var(--amber); margin-left: auto; padding: 0 5px; font-size: .8rem; }
.runner-card:hover { border-color: var(--amber); background: #33394a; }
.runner-card:disabled { cursor: wait; opacity: .6; }

.controls, .result-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.controls { padding: 9px 10px; flex-wrap: nowrap; }
.controls .primary { flex: 1; }
.primary, .secondary, .small-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: .9rem;
  font-weight: 750;
}
.primary { background: var(--amber); color: var(--ink); border: 1px solid var(--amber); }
.primary:hover { background: #ffe5aa; }
.secondary, .small-button { background: #222a39; border: 1px solid #566074; }
.secondary:hover, .small-button:hover { background: #354057; }
.small-button { white-space: nowrap; }
.small-button[aria-pressed="true"] { border-color: var(--teal); color: var(--teal); }
kbd { display: none; }
.result h2 { margin: 3px 0; font-size: clamp(1.65rem, 7vw, 2.7rem); line-height: 1.04; }
.result p { margin: 7px 0 10px; }
.result .share-status { color: var(--teal); margin: 5px 0; font-size: .88rem; }
.share-status:empty { display: none; }
.source-card { margin-top: 11px; border-top: 1px solid var(--line); padding-top: 7px; }
.score-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.score-fields input, .leaderboard select {
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid #68758b;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
}
.score-fields input { flex: 1 1 10rem; width: 100%; min-width: 0; }
#score-hint, #score-list-status { margin: 4px 0 8px; color: var(--muted); font-size: .85rem; }
.leaderboard {
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.leaderboard summary { color: var(--forest-dark); font-weight: 750; }
.leaderboard select { margin: 6px 0 0 6px; border-color: var(--line); background: var(--paper); color: var(--ink); }
.leaderboard ol { margin: 0; padding-left: 2ch; }
.leaderboard li { padding: 5px 2px; border-bottom: 1px solid var(--line); }
.leaderboard li:last-child { border-bottom: 0; }
.leaderboard li div { display: flex; justify-content: space-between; gap: 10px; overflow-wrap: anywhere; }
.leaderboard li strong { color: var(--forest); white-space: nowrap; font-variant-numeric: tabular-nums; }
.arcade summary { cursor: pointer; padding: 5px 0; }
.cabinet details p { max-width: 65ch; }
.cabinet a { color: var(--teal); }

@media (min-width: 680px) {
  .game-intro { margin: 15px 0 24px; }
  .stage { aspect-ratio: 2.5; }
  .start-cover { aspect-ratio: 2.7; }
  .scoreboard { padding-inline: 16px; gap: 18px; }
  .runner-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .runner-card { min-height: 95px; }
  .runner-card canvas { width: 82px; height: 82px; }
  .start-options, .result { padding: 15px; }
  .controls { padding: 10px 15px; }
}

@media (hover: hover) and (pointer: fine) {
  kbd {
    display: inline;
    margin-left: 5px;
    padding: 1px 4px;
    border: 1px solid #675633;
    border-radius: 3px;
    font-size: .72rem;
  }
}

.game-info { display: grid; gap: 16px; padding-top: 22px; }
.game-info section { border: 1px solid var(--line); border-radius: 8px; padding: clamp(16px, 3vw, 28px); background: var(--paper); }
.game-info h2 { margin-bottom: 10px; font-size: clamp(1.3rem, 3vw, 1.75rem); }
.game-info p { max-width: 66ch; }
.game-info p:last-child { margin-bottom: 0; }
.game-info nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.game-info nav a { color: var(--forest); font-weight: 700; }

@media (max-width: 560px) {
  .arcade { width: min(100% - 24px, 430px); }
  .arcade .breadcrumb { padding-top: 9px; }
  .game-intro { margin: 7px 0 12px; }
  .start-cover { aspect-ratio: 2.35; }
  .start-options { padding: 9px 12px; }
  .start-options h2 { margin-bottom: 6px; font-size: 1.1rem; }
  .runner-grid { gap: 6px; }
}
