:root {
  color-scheme: dark;
  font-family: system-ui,sans-serif;
  background: #10182e;
  color: #f5f4ef;
  --amber: #ffcc83;
  --muted: #c6d1e4;
  --edge: #556681;
  --panel: #19243c;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 15% 4%,#24475d 0%,transparent 55%),#10182e; }
.shell { width: min(100%,1000px); margin: auto; padding: clamp(12px,3vw,30px); }
.head,.stageHead,.counters,.bar,.summary { display: flex; gap: .55rem; align-items: center; justify-content: space-between; }
.head { margin-bottom: 16px; }
h1,h2,h3,p { margin: 0; }
h1,h2,h3 { font-family: Georgia,serif; line-height: 1.08; }
h1 { font-size: clamp(1.6rem,7.5vw,4rem); }
h2 { font-size: clamp(1.4rem,4vw,2.2rem); }
.kicker { margin-bottom: .35rem; text-transform: uppercase; font-size: .76rem; letter-spacing: .145em; font-weight: 800; color: var(--amber); }
button,summary,input { touch-action: manipulation; }
button { min-height: 46px; padding: .52rem .75rem; border: 1px solid #7788a1; border-radius: 9px; background: #293751; color: #fff; font: inherit; font-weight: 690; cursor: pointer; }
button:disabled { opacity: .62; cursor: default; }
button:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid #ffe1a3; outline-offset: 3px; }
button:hover:enabled { background: #3a4f72; }
.primary { background: var(--amber); color: #242036; border-color: #fff0c8; }
.primary:hover:enabled { background: #ffe4b2; }
.welcome,.stage,.controls,details { border: 1px solid var(--edge); border-radius: 16px; background: var(--panel); }
.welcome { display: grid; grid-template-columns: 1.25fr 1fr; overflow: hidden; }
.welcome img { width: 100%; height: 100%; min-height: 290px; object-fit: cover; }
.intro { align-self: center; display: grid; gap: .7rem; justify-items: start; padding: clamp(14px,3vw,34px); }
.intro p:not(.kicker),#guide,details,footer,#levelNumber { color: var(--muted); }
.intro p,.controls,details { line-height: 1.48; }
.mode { display: flex; align-items: center; min-height: 44px; gap: .4rem; cursor: pointer; font-weight: 650; }
.mode input { width: 1.2em; height: 1.2em; accent-color: var(--amber); }
#sound { white-space: nowrap; }
.stage,.controls { padding: clamp(10px,2vw,17px); }
.stageHead { margin-bottom: .65rem; }
#levelNumber { font-size: .87rem; text-align: right; flex: none; }
canvas { width: 100%; height: auto; display: block; border: 1px solid #557394; border-radius: 12px; background: #081527; }
.stations { display: flex; gap: .35rem; flex-wrap: wrap; margin-block: .55rem; font-size: .8rem; }
.stations span { border: 1px solid #556781; border-radius: 20px; padding: .12rem .5rem; color: #e9edf5; }
.stations [data-station="N"] { color: #86efd0; }
.stations [data-station="T"] { color: #ffcb78; }
.stations [data-station="O"] { color: #b2caff; }
.counters { justify-content: flex-start; flex-wrap: wrap; gap: .35rem 1.2rem; font-size: .88rem; }
#delivered { color: #a8f3d7; }
#misses { color: #ffd3aa; }
.controls { margin-top: .55rem; }
.switches { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; margin-block: .65rem; }
.switch { display: grid; align-content: space-between; padding: .65rem; gap: .35rem; border-radius: 10px; border: 1px solid #61738b; background: #142039; }
.switch button { min-height: 52px; background: #324e69; width: 100%; }
.switch button:hover:enabled { background: #426384; }
.switch .kicker { margin: 0; }
.next { min-height: 2.5em; font-size: .88rem; font-variant-numeric: tabular-nums; }
.bar { justify-content: flex-start; flex-wrap: wrap; }
#resultStatus { min-height: 1.5em; margin-top: .45rem; color: var(--amber); }
.summary { flex-wrap: wrap; margin-top: .4rem; padding: .7rem; background: #273956; border: 1px solid #7792ab; border-radius: 10px; }
#stars { color: #ffd596; letter-spacing: .12em; }
details { margin-top: .65rem; padding: 0 .85rem; }
details[open] { padding-bottom: .8rem; }
details p + p { margin-top: .45rem; }
summary { cursor: pointer; display: list-item; min-height: 46px; line-height: 46px; color: #f5f4ef; font-weight: 750; }
summary span { margin-left: .3em; font-weight: 500; color: var(--muted); }
.levels { display: grid; grid-template-columns: repeat(auto-fill,minmax(86px,1fr)); gap: .35rem; }
.levels button { padding: .35rem; font-size: .85rem; }
.levels button[aria-current="true"] { border-color: #ffe0a9; }
kbd { font: inherit; font-weight: 750; color: var(--amber); }
footer { margin-top: .8rem; font-size: .87rem; }
@media (max-width: 620px) {
  .welcome { grid-template-columns: 1fr; }
  .welcome img { height: min(46vw,250px); min-height: 0; }
  .intro { gap: .5rem; }
  .head { margin-bottom: .65rem; }
  .controls { font-size: .93rem; }
  .switch { padding: .42rem; }
  .switch button { padding-inline: .2rem; }
}
