:root {
  color-scheme: dark;
  --ink: #e9f1ff;
  --muted: #9aa9c3;
  --panel: #111b2b;
  --cyan: #54f4ed;
  --pink: #ff4d9d;
  --yellow: #ffd460;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 0%, #1b2e4c 0, #0a1220 48%, #050912 100%);
  font-family: "Segoe UI", sans-serif;
}

.layout {
  width: min(100% - 28px, 860px);
  margin: 0 auto;
  padding: 26px 0 32px;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--cyan);
  font: 9px/1.6 "Lucida Console", "Courier New", monospace;
  letter-spacing: .04em;
}

h1 {
  margin: 0;
  font: 22px/1.25 "Lucida Console", "Courier New", monospace;
  color: #fff;
  text-shadow: 3px 3px 0 #903b85;
}

.subtitle, .note { color: var(--muted); }
.subtitle { margin: 0 0 3px; font-size: 18px; }

.cabinet {
  overflow: hidden;
  border: 1px solid #435a78;
  border-radius: 12px;
  background: linear-gradient(145deg, #19273b, #09111d 60%);
  box-shadow: 0 22px 70px #0009, inset 0 1px #ffffff18;
}

.screen-wrap {
  position: relative;
  width: min(100%, 540px);
  margin: 0 auto;
  background: #071020;
  border-inline: 1px solid #40526a;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(#07102086, #071020d9);
}

.overlay[hidden] { display: none; }

.overlay-card {
  width: min(100%, 400px);
  padding: 24px 20px;
  border: 2px solid var(--cyan);
  background: #071020ed;
  box-shadow: 6px 6px 0 #e73687;
  text-align: center;
}

.overlay-card h2 {
  margin: 14px 0;
  color: var(--yellow);
  font: 18px/1.6 "Lucida Console", "Courier New", monospace;
  text-shadow: 2px 2px #b43c79;
}

.overlay-card p:not(.eyebrow) {
  margin: 0 0 20px;
  color: #dce8fa;
  font-size: 19px;
  line-height: 1.3;
}

button { color: inherit; font: inherit; cursor: pointer; }
.primary-button {
  border: 0;
  padding: 13px 20px;
  background: var(--pink);
  color: #fff;
  font: 11px "Lucida Console", "Courier New", monospace;
  box-shadow: 0 4px 0 #9c255e;
}
.primary-button:hover { background: #ff70ae; transform: translateY(-1px); }
.primary-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #9c255e; }

.cabinet-footer { padding: 12px 18px 16px; }
.status-row, .controls-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status-row {
  padding-bottom: 10px;
  border-bottom: 1px solid #34445d;
  color: var(--yellow);
  font: 9px "Lucida Console", "Courier New", monospace;
}
.controls-row { flex-wrap: wrap; padding-top: 10px; color: #d6e2f4; font-size: 15px; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 5px;
  border: 1px solid #526681;
  border-radius: 3px;
  background: #18263b;
  color: var(--cyan);
  font: 11px "Lucida Console", "Courier New", monospace;
  text-align: center;
}
.sound-button {
  border: 1px solid #526681;
  border-radius: 3px;
  padding: 4px 9px;
  background: #18263b;
  color: var(--cyan);
}
.note { margin: 12px 2px 0; font-size: 14px; }
.note a { color: var(--cyan); text-underline-offset: 3px; }
.music-player { margin-top:16px; padding:16px; background:#102e4b; border:1px solid #548098; border-radius:12px; color:#e7f4ff; font:14px 'Segoe UI',sans-serif; }
.music-title { margin:8px 0 12px; font-weight:700; overflow-wrap:anywhere; }
.music-actions { display:flex; gap:10px; flex-wrap:wrap; }
.music-player button { background:#193e58; color:#c6fff0; border:1px solid #7da6b8; border-radius:6px; padding:8px 12px; cursor:pointer; }
.music-player progress { display:block; width:100%; height:5px; margin:12px 0; accent-color:#4edcb9; }
.track-choice { display:grid; gap:6px; }
.music-player select { min-width:0; width:100%; padding:9px; background:#092239; color:#fff; border:1px solid #7da6b8; border-radius:6px; }
.audio-settings { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; margin-top:14px; align-items:center; }
.audio-settings label:not(.audio-mute) { display:grid; gap:5px; }
.audio-settings input[type=range] { width:100%; accent-color:#4edcb9; }
.audio-mute { display:flex; align-items:center; gap:5px; font-size:12px; }
#music-status { margin:8px 0 0; color:#ffe1a1; font-size:13px; }

.runner-edition { background: radial-gradient(ellipse at 50% 0%, #1b4766, #091b30 55%, #061321); }
.runner-edition h1 { font: 800 28px/1.2 "Segoe UI", sans-serif; text-shadow: none; letter-spacing: -.03em; }
.runner-edition .eyebrow { color: #8eebde; font: 700 11px/1.5 "Segoe UI", sans-serif; letter-spacing: .12em; }
.runner-edition .screen-wrap { width: min(100%, 520px); }
.runner-edition canvas { image-rendering: pixelated; touch-action: none; cursor: ew-resize; }
.runner-edition .overlay { background: linear-gradient(#09223940, #092239b8); }
.runner-edition .overlay-card { border: 1px solid #a7e5f780; border-radius: 18px; background: #102e4bed; box-shadow: 0 16px 60px #00172e80; }
.runner-edition .overlay-card h2 { font: 900 30px/1.15 "Segoe UI", sans-serif; text-shadow: none; color: #fff4cc; }
.runner-edition .overlay-card p:not(.eyebrow) { font-size: 17px; line-height: 1.5; }
.runner-edition .primary-button { font: 800 16px "Segoe UI", sans-serif; background: #37c4aa; color: #062d35; border-radius: 10px; box-shadow: 0 4px #167d73; }
.runner-edition .status-row { font: 700 11px "Segoe UI", sans-serif; }

@media (max-width: 640px) {
  .layout { width: min(100% - 16px, 540px); padding-top: 18px; }
  .masthead { display: block; }
  h1 { font-size: 16px; }
  .subtitle { margin-top: 10px; font-size: 16px; }
  .cabinet-footer { padding: 10px; }
  .status-row { font-size: 7px; gap: 6px; }
  .controls-row { justify-content: flex-start; gap: 8px 12px; font-size: 13px; }
}

.runner-edition .music-player { margin:0 0 16px; padding:12px 16px; }
.runner-edition .music-player .eyebrow { margin-bottom:4px; }
.runner-edition .music-title { margin:4px 0 8px; font-size:14px; }
.audio-options summary { cursor:pointer; padding:4px 0; color:#9fdfd3; }
.audio-options .track-choice { margin-top:10px; }

/* Keep the road visible within the browser panel, with compact audio controls. */
.runner-edition .layout { width:min(100% - 16px,calc((100dvh - 190px) * 2 / 3 + 2px)); padding:8px 0; }
.runner-edition .masthead { margin-bottom:8px; align-items:center; }
.runner-edition .masthead h1 { font-size:20px; }
.runner-edition .masthead .eyebrow, .runner-edition .subtitle { display:none; }
.runner-edition .music-player { position:relative; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 10px; padding:8px 10px; margin:0 0 8px; }
.runner-edition .music-player>.eyebrow { display:none; }
.runner-edition .music-player .music-title { margin:0; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; align-self:center; }
.runner-edition .music-actions { gap:5px; }
.runner-edition .music-player button { padding:5px 7px; font-size:11px; }
.runner-edition .music-player progress { position:absolute; bottom:0; left:0; margin:0; height:2px; }
.runner-edition .audio-options { grid-column:1 / -1; font-size:11px; }
.runner-edition .audio-options summary { padding:0; }
.runner-edition .audio-options[open] { position:absolute; top:100%; left:0; right:0; padding:12px; background:#102e4b; border:1px solid #7da6b8; border-radius:8px; z-index:10; box-shadow:0 10px 30px #0009; }
.runner-edition #music-status { grid-column:1 / -1; margin:0; }
.runner-edition #music-status:empty { display:none; }
.runner-edition .screen-wrap { width:100%; border-inline:0; }
.runner-edition .cabinet-footer { padding:6px 10px; }
.runner-edition .status-row { display:none; }
.runner-edition .controls-row { justify-content:center; padding:0; gap:4px 10px; font-size:10px; }
.runner-edition .controls-row>span:nth-child(3) { display:none; }
.runner-edition kbd { font-size:9px; padding:1px 3px; min-width:14px; }
.runner-edition .sound-button { padding:3px 5px; font-size:10px; }
.runner-edition .overlay { padding:10px; }
.runner-edition .overlay-card { padding:12px; max-height:100%; overflow:auto; }
.runner-edition .overlay-card h2 { font-size:clamp(16px,3dvh,26px); margin:6px 0; }
.runner-edition .overlay-card p:not(.eyebrow) { font-size:clamp(11px,1.8dvh,16px); line-height:1.35; margin-bottom:10px; }
.runner-edition .overlay-card .eyebrow { font-size:9px; margin-bottom:4px; }
.runner-edition .primary-button { padding:9px 14px; font-size:13px; }
.game-help { position:relative; margin-top:6px; color:#9aa9c3; font-size:11px; }
.game-help summary { cursor:pointer; }
.game-help[open] .note { position:absolute; bottom:100%; left:0; right:0; margin:0; padding:14px; background:#102e4b; border:1px solid #7da6b8; border-radius:8px; z-index:10; font-size:13px; }
.restart-button { margin:10px auto 0; padding:8px 12px; border:1px solid #91b9cb; border-radius:8px; background:#173e58; color:#e2f3ff; font:600 13px 'Segoe UI',sans-serif; }
.restart-button:not([hidden]) { display:block; }
.level-test-controls:not([hidden]) { display:grid; gap:6px; margin-top:12px; text-align:left; font:12px 'Segoe UI',sans-serif; }
.level-test-controls select { width:100%; min-width:0; padding:7px; color:#e2f3ff; background:#173e58; border:1px solid #91b9cb; border-radius:6px; }
.level-test-controls .restart-button { margin:0 auto; }
.runner-edition .overlay[data-result="victory"] .overlay-card { border:2px solid #ffd477; background:#253a43f2; box-shadow:0 0 32px #e9b94d30; }
.runner-edition .overlay[data-result="victory"] .final-score { color:#ffe3a0; font-size:clamp(20px,4dvh,32px); font-weight:900; margin:10px 0; }
