@font-face { font-family: 'Orbitron'; font-weight: 400; font-style: normal; font-display: swap; src: url('./assets/side-b/fonts/orbitron-latin-400.woff2') format('woff2'); }
@font-face { font-family: 'Orbitron'; font-weight: 600 700; font-style: normal; font-display: swap; src: url('./assets/side-b/fonts/orbitron-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 100 900; font-style: normal; font-display: swap; src: url('./assets/side-b/fonts/inter-latin-variable.woff2') format('woff2'); }

:root {
  --bg: #0b0911;
  --bg-2: #120f1b;
  --panel: #181422;
  --panel-2: #211b2f;
  --panel-3: #2a2339;
  --line: #3a3149;
  --line-2: #51455f;
  --ink: #f2ebdb;
  --ink-dim: #cfc6b8;
  --muted: #a89eb9;
  --faint: #6f6684;
  --orange: #ff8a3d;
  --orange-deep: #c9561c;
  --amber: #ffc15a;
  --pink: #ff5b97;
  --cyan: #4fe3d3;
  --lime: #a5e665;
  --violet: #8b78ff;
  --red: #ff6464;
  --lane-a: var(--pink);
  --lane-b: var(--cyan);
  --lane-c: var(--lime);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 44px rgba(0, 0, 0, .5);
  --glow-orange: 0 0 0 1px rgba(255, 138, 61, .55), 0 0 22px rgba(255, 138, 61, .28);
  --display: 'Orbitron', 'Eurostile', 'Segoe UI', system-ui, sans-serif;
  --text: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;

  /* Fire Dragon shell kit theming (credits roll), see site/assets/fire-dragon/README.md */
  --fd-bg: #0b0911;
  --fd-accent: #ffc15a;
  --fd-accent-2: #4fe3d3;
  --fd-text: #f2ebdb;
  --fd-font: 'Inter', system-ui, sans-serif;
  --fd-title-font: 'Orbitron', system-ui, sans-serif;
  --fd-focus: #ffc15a;
  --fd-glow-hue: 10deg;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  min-width: 320px;
  overflow: hidden;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 12% -10%, rgba(255, 138, 61, .10), transparent 60%), radial-gradient(900px 600px at 100% 110%, rgba(79, 227, 211, .08), transparent 60%), var(--bg);
  font: 400 14px/1.5 var(--text);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: currentColor; color: inherit; }
[hidden] { display: none !important; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 0 rgba(0, 0, 0, .35);
  font: 600 11px/1 var(--display); letter-spacing: .09em; text-transform: uppercase; white-space: nowrap;
  cursor: pointer; transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--orange); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .45); }
button:disabled { opacity: .38; cursor: not-allowed; }
button.primary { border-color: #ffb066; background: linear-gradient(180deg, #ffa14f, var(--orange-deep)); color: #1b0e06; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 0 #7c320e, var(--glow-orange); }
button.primary:hover:not(:disabled) { border-color: #fff0d8; }
button.selected { border-color: var(--cyan); color: var(--cyan); background: rgba(79, 227, 211, .12); }
button.danger { border-color: #7a3a46; color: #ff9aa6; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
#game-canvas:focus-visible { outline: none; }
#game-canvas:focus-visible::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: 10px; box-shadow: inset 0 0 0 2px rgba(255, 193, 90, .55); pointer-events: none; }

kbd {
  display: inline-block; min-width: 22px; padding: 2px 6px; margin-inline: 1px; text-align: center;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--panel-2);
  color: var(--ink); font: 600 10px/1.4 var(--display);
}

#app { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; height: 100dvh; min-height: 0; }

.topbar {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 8px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1d1729, #130f1c);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.exit-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px 0 8px;
  border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); text-decoration: none;
  font: 600 10px/1 var(--display); letter-spacing: .1em; text-transform: uppercase;
}
.exit-link:hover { color: var(--ink); border-color: var(--orange); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { display: block; width: 46px; height: 34px; object-fit: contain; }
.brand strong { display: block; font: 700 17px/1 var(--display); letter-spacing: .1em; white-space: nowrap; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font: 400 10px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; }
.chapter-readout { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.chapter-readout span { color: var(--muted); font: 400 10px/1 var(--display); letter-spacing: .22em; }
.chapter-readout b { color: var(--amber); font: 700 18px/1.1 var(--display); letter-spacing: .08em; }
.top-actions { display: flex; gap: 8px; }
.chip-button { min-height: 38px; padding: 0 12px; border-radius: 999px; }
.chip-accent { border-color: rgba(255, 138, 61, .6); color: var(--amber); }
.chip-accent.ready::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(330px, 29vw, 410px); gap: 14px;
  min-height: 0; padding: 14px 16px;
}

.stage {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .045), transparent 38%), linear-gradient(180deg, #1b1626, #130f1c);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.stage::before, .stage::after {
  content: ''; position: absolute; top: 12px; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6d6178, #241d2e 70%); box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .6);
}
.stage::before { left: 14px; }
.stage::after { right: 14px; }

.cassette-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: 'label tabs reels'; align-items: center; gap: 6px 14px; padding: 2px 22px 0; }
.cassette-label { grid-area: label; min-width: 0; }
.cassette-label span { display: block; color: var(--orange); font: 600 9px/1 var(--display); letter-spacing: .26em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cassette-label strong { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 clamp(20px, 2.4vw, 30px)/1.1 var(--display); letter-spacing: .02em; }
.cassette-label strong.long { font-size: clamp(16px, 1.55vw, 24px); letter-spacing: .01em; }
.cassette-label em { display: block; margin-top: 3px; color: var(--muted); font: italic 400 13px/1.3 var(--text); }
.reel-row { grid-area: reels; display: flex; align-items: center; gap: 8px; }
.reel { width: 46px; height: 46px; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }
.tape-window { position: relative; width: clamp(84px, 9vw, 190px); height: 26px; overflow: hidden; border: 1px solid var(--line-2); border-radius: 8px; background: #0b0911; }
#tape-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--orange-deep), var(--orange)); transition: width .2s ease; }
#tape-readout { position: relative; display: grid; place-items: center; height: 100%; font: 600 11px/1 var(--display); letter-spacing: .12em; text-shadow: 0 1px 2px #000; }
.pass-tabs { grid-area: tabs; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pass-tab { min-height: 30px; padding: 0 12px; border-radius: 999px; font-size: 10px; }
.pass-tab[data-lane='a'] { --lane: var(--lane-a); }
.pass-tab[data-lane='b'] { --lane: var(--lane-b); }
.pass-tab[data-lane='c'] { --lane: var(--lane-c); }
.pass-tab::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--lane); box-shadow: 0 0 8px var(--lane); opacity: .45; }
.pass-tab.recorded::before { opacity: 1; }
.pass-tab.live { border-color: var(--lane); color: var(--lane); background: color-mix(in srgb, var(--lane) 14%, transparent); }
.pass-tab.live::before { opacity: 1; animation: pulse 1.2s ease-in-out infinite; }
.pass-tab:disabled { opacity: .3; }

.screen-bezel {
  position: relative; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; padding: 8px; border-radius: 16px;
  border: 1px solid #000; background: linear-gradient(145deg, #1e1829, #0b0911);
  box-shadow: inset 0 0 0 2px #2f2740, inset 0 0 40px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 138, 61, .35), 0 0 34px rgba(255, 138, 61, .14);
}
#game-canvas { position: relative; flex: 1; min-height: 120px; overflow: hidden; border-radius: 10px; background: #0a0810; touch-action: none; }
#game-canvas canvas { position: absolute; left: 0; top: 0; display: block; }
.mode-banner {
  align-self: center; max-width: 100%; padding: 7px 14px; border: 1px solid rgba(255, 91, 151, .7); border-radius: 999px; background: rgba(12, 8, 18, .86);
  color: var(--pink); font: 600 10px/1 var(--display); letter-spacing: .14em; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 0 18px rgba(255, 91, 151, .25);
}
.mode-banner.playback { border-color: rgba(79, 227, 211, .7); color: var(--cyan); box-shadow: 0 0 18px rgba(79, 227, 211, .25); }
.mode-banner.lane-c { border-color: rgba(165, 230, 101, .7); color: var(--lime); box-shadow: 0 0 18px rgba(165, 230, 101, .25); }
.mode-banner.complete { border-color: rgba(255, 193, 90, .8); color: var(--amber); }
.tape-note { padding: 7px 12px; border: 1px solid rgba(139, 120, 255, .7); border-radius: 12px; background: rgba(12, 8, 18, .88); color: #c9c0ff; font: 500 11px/1.35 var(--text); }
.tape-note b { display: block; margin-bottom: 3px; color: var(--violet); font: 600 9px/1 var(--display); letter-spacing: .16em; }

.teach-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--orange); border-radius: 14px; background: rgba(18, 12, 10, .94); box-shadow: var(--glow-orange);
  animation: rise .35s ease;
}
.teach-card b { padding: 5px 8px; border-radius: 6px; background: var(--orange); color: #1b0e06; font: 700 10px/1 var(--display); letter-spacing: .12em; }
.teach-card p { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.4; }
.teach-card button { min-height: 34px; padding: 0 12px; }

.deck { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.statusbar {
  display: flex; align-items: center; gap: 16px; padding: 7px 16px; border-top: 1px solid var(--line);
  background: #100c18; color: var(--muted); font: 400 10px/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase;
}
.statusbar b { margin-left: auto; max-width: 52%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--amber); font-weight: 600; letter-spacing: .06em; }

@keyframes pulse { 50% { transform: scale(1.35); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

@media (max-height: 820px) { .cassette-label em { display: none; } .cassette-label strong { margin-top: 3px; } .stage { padding: 10px; gap: 6px; } .layout { padding: 10px 14px; } }
@media (max-width: 1180px) { .cassette-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'label reels' 'tabs tabs'; } .pass-tabs { justify-content: flex-start; } }
/* The teach card already says what the tape does; the permanent tape note returns once the card is dismissed. */
.screen-bezel:has(#teach-card:not([hidden])) .tape-note { display: none; }

.panel {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 30%), var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font: 600 10px/1 var(--display); letter-spacing: .2em; }
.panel-title b { color: var(--amber); font-weight: 700; letter-spacing: .1em; }
.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.stars .icon { width: 17px; height: 17px; color: var(--amber); filter: drop-shadow(0 0 4px rgba(255, 193, 90, .45)); }
.stars .icon.empty { color: var(--faint); filter: none; }

.objective-panel p { margin: 0; font-size: 14px; line-height: 1.45; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; color: var(--muted); font: 400 10px/1 var(--display); letter-spacing: .08em; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.legend i.diamond { border-radius: 2px; transform: rotate(45deg); }
.legend i.triangle { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.transport-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.dpad { display: grid; grid-template-columns: 50px 50px 50px; grid-template-areas: '. up .' 'left wait right' '. down .'; gap: 6px; }
.dpad button { min-height: 0; width: 50px; height: 50px; padding: 0; border-radius: 12px; font-size: 18px; }
.dpad .pad-up { grid-area: up; }
.dpad .pad-left { grid-area: left; }
.dpad .pad-right { grid-area: right; }
.dpad .pad-down { grid-area: down; }
.dpad .pad-wait { grid-area: wait; flex-direction: column; gap: 2px; font-size: 14px; }
.dpad .pad-wait small { font: 600 7px/1 var(--display); letter-spacing: .12em; }
.transport-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.transport-buttons button { min-height: 38px; padding: 0 8px; font-size: 12px; letter-spacing: .05em; }
.transport-buttons #rewind-button { grid-column: 1 / -1; min-height: 44px; font-size: 12px; }
.transport-buttons #auto-button { grid-column: 1 / -1; }

#timeline { width: 100%; height: 22px; margin: 2px 0 8px; appearance: none; background: transparent; cursor: pointer; }
#timeline::-webkit-slider-runnable-track { height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--orange) var(--fill, 0%), #0d0a14 var(--fill, 0%)); border: 1px solid var(--line-2); }
#timeline::-webkit-slider-thumb { appearance: none; width: 16px; height: 22px; margin-top: -9px; border: 1px solid #ffd7a8; border-radius: 4px; background: linear-gradient(180deg, #ffb066, var(--orange-deep)); box-shadow: 0 0 10px rgba(255, 138, 61, .5); }
#timeline::-moz-range-track { height: 6px; border-radius: 4px; background: #0d0a14; border: 1px solid var(--line-2); }
#timeline::-moz-range-progress { height: 6px; border-radius: 4px; background: var(--orange); }
#timeline::-moz-range-thumb { width: 14px; height: 20px; border: 1px solid #ffd7a8; border-radius: 4px; background: var(--orange); }
#timeline:disabled { opacity: .35; cursor: not-allowed; }

.command-strip { display: grid; gap: 5px; }
.lane { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.lane-tag { width: 16px; flex: none; color: var(--lane); font: 700 10px/1 var(--display); }
.lane[data-lane='a'] { --lane: var(--lane-a); }
.lane[data-lane='b'] { --lane: var(--lane-b); }
.lane[data-lane='c'] { --lane: var(--lane-c); }
.command-chip {
  position: relative; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 6px;
  background: #0d0a14; color: var(--faint);
}
.command-chip .icon { width: 14px; height: 14px; }
.command-chip.used { border-color: color-mix(in srgb, var(--lane) 70%, transparent); background: color-mix(in srgb, var(--lane) 16%, #0d0a14); color: var(--lane); }
.command-chip.played { opacity: .5; }
.command-chip.playing { opacity: 1; box-shadow: 0 0 0 2px var(--amber), 0 0 12px rgba(255, 193, 90, .6); }
.command-chip.flagged { box-shadow: 0 0 0 2px var(--red), 0 0 12px rgba(255, 100, 100, .6); }
.command-chip.empty::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.speed-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; color: var(--muted); font: 400 9px/1 var(--display); letter-spacing: .18em; }
.speed-row div { display: flex; gap: 5px; }
.speed-row button { min-height: 28px; padding: 0 10px; font-size: 11px; letter-spacing: 0; }

.hint-panel p { margin: 0 0 10px; color: var(--ink-dim); font-size: 13px; line-height: 1.45; }
.hint-panel p.revealed { color: var(--ink); }
.hint-panel p.long { max-height: 8.4em; overflow-y: auto; font-size: 12px; line-height: 1.4; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.check-notes { display: grid; gap: 5px; margin: 0 0 10px; padding: 0; list-style: none; }
.check-notes li { padding: 6px 9px; border-left: 3px solid var(--red); border-radius: 4px; background: rgba(255, 100, 100, .08); color: var(--ink-dim); font-size: 12px; line-height: 1.35; }
.hint-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.hint-actions button { min-height: 36px; padding: 2px 6px; font-size: 12px; letter-spacing: .03em; gap: 5px; white-space: normal; line-height: 1.15; text-align: center; }
.hint-actions #skip-button { grid-column: span 3; }
.hint-panel p.hint-rule { margin: -4px 0 10px; color: var(--ink-dim); font-size: 12px; line-height: 1.35; }
.hint-panel p.hint-rule.assisted { color: var(--amber); }
.hint-panel p.armed { color: var(--ink); border-left: 3px solid var(--amber); padding-left: 8px; }
.hint-actions button.armed { border-color: var(--amber); color: var(--amber); }
.hint-actions .icon { width: 1.15em; height: 1.15em; }

dialog { max-width: 100vw; max-height: 100dvh; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; }
dialog::backdrop { background: rgba(5, 3, 10, .8); backdrop-filter: blur(3px); }
.dialog-card {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: 0; padding: 20px 22px; overflow: auto;
  border: 1px solid var(--line-2); border-radius: 18px; background: linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 30%), var(--panel);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 138, 61, .18);
}
.wide-dialog .dialog-card { width: min(1040px, calc(100vw - 24px)); }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-title strong { font: 700 13px/1.2 var(--display); letter-spacing: .16em; }
.dialog-title button, .icon-only { min-height: 38px; width: 38px; padding: 0; border-radius: 50%; flex: none; }
.dialog-card h2 { margin: 6px 0 10px; font: 700 clamp(22px, 3vw, 30px)/1.15 var(--display); letter-spacing: .02em; }
.dialog-card ol { display: grid; gap: 10px; margin: 0 0 12px; padding-left: 22px; color: var(--ink-dim); line-height: 1.45; }
.dialog-card ol b { color: var(--ink); }
.help-note, .complete-note, .program-restored { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.program-restored { color: var(--ink-dim); font-size: 14px; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; color: var(--ink-dim); font-size: 13px; }
.help-grid dt { color: var(--amber); font: 600 10px/1.6 var(--display); letter-spacing: .12em; }
.help-grid dd { margin: 0; }

.settings-card { gap: 12px; }
.setting-row { display: grid; grid-template-columns: 1fr minmax(120px, 55%); align-items: center; gap: 12px; margin-bottom: 10px; color: var(--ink-dim); }
.setting-row input[type='range'] { width: 100%; accent-color: var(--orange); }
.assist-box { margin: 14px 0 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.assist-box legend { padding: 0 6px; color: var(--muted); font: 600 9px/1 var(--display); letter-spacing: .2em; }
.check-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 7px 0; color: var(--ink-dim); font-size: 13px; line-height: 1.4; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--orange); }
.check-row b { color: var(--ink); }
.save-status { margin: 8px 0 0; color: var(--amber); font-size: 12px; }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

.complete-card { text-align: center; }
.success-badge {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--cyan); border-radius: 999px; background: rgba(79, 227, 211, .1);
  color: var(--cyan); font: 700 10px/1 var(--display); letter-spacing: .2em;
}
.complete-stars { display: flex; justify-content: center; margin: 4px 0 10px; }
.complete-stars .stars { gap: 8px; }
.complete-stars .icon { width: 44px; height: 44px; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.complete-stars .icon:nth-child(2) { animation-delay: .12s; }
.complete-stars .icon:nth-child(3) { animation-delay: .24s; }
.complete-file { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 10px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--ink-dim); font-size: 13px; }
.complete-file .icon { color: var(--amber); width: 22px; height: 22px; }
.complete-file b { display: block; color: var(--amber); font: 600 9px/1.4 var(--display); letter-spacing: .16em; }
.complete-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
/* In a card that scrolls (short screens), the buttons stay in reach. */
.dialog-card .complete-actions { position: sticky; bottom: -20px; z-index: 1; padding: 10px 0 20px; margin-bottom: -20px; background: linear-gradient(180deg, transparent, var(--panel) 38%); }
.complete-actions > * { flex: 1 1 150px; }
/* Touch floor: 44 px targets and 12 px labels on every card button (TRY FOR 3 STARS included). */
.complete-actions button, .complete-actions a.button { min-height: 44px; font-size: 12px; }
a.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2)); color: var(--ink); font: 600 11px/1 var(--display); letter-spacing: .09em; text-transform: uppercase; text-decoration: none;
}
a.button.primary { border-color: #ffb066; background: linear-gradient(180deg, #ffa14f, var(--orange-deep)); color: #1b0e06; box-shadow: var(--glow-orange); }
.demo-features { margin: 0 0 6px; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; }
.demo-features li { padding: 9px 12px 9px 34px; position: relative; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .03); color: var(--ink-dim); font-size: 13px; line-height: 1.4; }
.demo-programs li { display: grid; gap: 2px; }
.demo-program { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--ink); }
.demo-program b { font: 600 12px/1.3 var(--display); letter-spacing: .08em; }
.demo-program small { color: var(--orange); font: 500 11px/1.3 var(--display); letter-spacing: .06em; white-space: nowrap; }
.demo-programs em { font-style: normal; color: var(--ink-dim); font-size: 12px; }
.demo-features li::before { content: ''; position: absolute; left: 13px; top: 15px; width: 9px; height: 9px; border-radius: 2px; background: var(--orange); transform: rotate(45deg); }
.eyebrow { margin: 0; color: var(--amber); font: 700 10px/1 var(--display); letter-spacing: .2em; }

.library-card { padding: 0; }
.library-hero { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px 12px; background: linear-gradient(180deg, #241d33, var(--panel)); border-bottom: 1px solid var(--line); }
.library-hero h2 { margin: 6px 0 4px; }
.library-hero p:last-child { margin: 0; color: var(--muted); font-size: 13px; max-width: 62ch; }
.library-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 22px 0; }
.library-stats div { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 9, 19, .5); }
.library-stats span { display: block; color: var(--muted); font: 600 9px/1 var(--display); letter-spacing: .16em; }
.library-stats b { display: block; margin-top: 5px; font: 700 18px/1 var(--display); white-space: nowrap; }
.library-body { display: grid; gap: 14px; padding: 14px 22px 22px; }
.program-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(255, 255, 255, .02); }
.program-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.program-card small { display: block; color: var(--muted); font: 600 9px/1 var(--display); letter-spacing: .16em; }
.program-card strong { display: block; margin-top: 4px; font: 700 16px/1.1 var(--display); letter-spacing: .06em; }
.program-card em { display: block; margin-top: 3px; color: var(--muted); font: italic 400 12px/1.3 var(--text); }
.program-card header b { color: var(--amber); font: 700 13px/1 var(--display); }
.program-card .perfect { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid var(--amber); border-radius: 999px; background: rgba(255, 193, 90, .12); font-size: 10px; letter-spacing: .14em; }
.program-card .perfect .icon { width: 14px; height: 14px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; padding: 10px; }
.room-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 6px; min-height: 92px; padding: 10px 11px; text-align: left; letter-spacing: .02em; white-space: normal; }
.room-card .room-no { color: var(--muted); font: 600 9px/1 var(--display); letter-spacing: .14em; }
.room-card strong { font: 600 12px/1.25 var(--text); text-transform: none; letter-spacing: 0; }
.room-card .room-state { display: inline-flex; align-items: center; gap: 5px; margin-top: auto; color: var(--amber); font: 600 9px/1 var(--display); letter-spacing: .1em; }
.room-card .room-state .icon { width: 12px; height: 12px; }
.room-card .room-state em { color: var(--muted); font-style: normal; }
.room-card .stars .icon { width: 13px; height: 13px; }
.room-card.done { border-color: rgba(79, 227, 211, .45); background: linear-gradient(145deg, rgba(79, 227, 211, .1), var(--panel-2)); }
.room-card.current { border-color: var(--orange); box-shadow: var(--glow-orange); }
.room-card.bonus .room-no::after { content: ' \00b7  B-SIDE'; color: var(--pink); }
.room-card.withheld { opacity: .55; border-style: dashed; }

.desktop-card { padding: 0; }
.desktop-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #241d33, var(--panel)); }
.desktop-bar strong { display: inline-flex; align-items: center; gap: 8px; font: 700 13px/1 var(--display); letter-spacing: .16em; }
.desktop-bar span { margin-left: auto; color: var(--muted); font: 600 10px/1 var(--display); letter-spacing: .12em; }
.desktop-screen { position: relative; min-height: min(56vh, 520px); padding: 16px; background: #0c0912 url('./assets/side-b/painted/desktop.webp') center / cover; }
.desktop-screen::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 5, 14, .35), rgba(8, 5, 14, .72)); }
.desktop-icons { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 6px; }
.desk-file { flex-direction: column; gap: 6px; min-height: 84px; padding: 8px 4px; border-color: transparent; background: transparent; box-shadow: none; letter-spacing: .02em; white-space: normal; text-align: center; text-transform: none; }
.desk-file .icon { width: 32px; height: 32px; color: var(--amber); }
.desk-file span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font: 500 11px/1.25 var(--text); }
.desk-file:hover:not(:disabled) { background: rgba(255, 193, 90, .12); border-color: var(--amber); }
.desk-file.corrupted .icon { color: var(--faint); }
.desk-file.corrupted span { color: var(--faint); font-family: var(--display); font-size: 9px; letter-spacing: .12em; }
.notepad { position: absolute; z-index: 3; right: 16px; bottom: 16px; width: min(380px, calc(100% - 32px)); border: 1px solid var(--amber); border-radius: 12px; background: #17121f; box-shadow: var(--shadow); }
.notepad header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line-2); }
.notepad header b { color: var(--amber); font: 600 11px/1 var(--display); letter-spacing: .1em; }
.notepad header button { min-height: 30px; width: 30px; padding: 0; border-radius: 50%; }
.notepad p { margin: 0; padding: 12px 14px 14px; color: var(--ink); font: 400 13px/1.55 var(--text); white-space: pre-line; }
.services { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 12px 18px 16px; list-style: none; }
.services li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 600 9px/1 var(--display); letter-spacing: .1em; }
.services li i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.services li.online { border-color: rgba(79, 227, 211, .5); color: var(--cyan); }
.services li.online i { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

.credits-card { width: min(560px, calc(100vw - 24px)); }
.credits-roll { text-align: center; }
.credits-roll .studio { margin: 0; font: 700 22px/1.2 var(--display); letter-spacing: .08em; }
.credits-roll .publisher { margin: 4px 0 18px; color: var(--muted); font-size: 13px; }
.credits-roll section { margin-bottom: 14px; }
.credits-roll h3 { margin: 0 0 4px; color: var(--amber); font: 600 10px/1 var(--display); letter-spacing: .22em; text-transform: uppercase; }
.credits-roll section p { margin: 0 0 2px; color: var(--ink); font-size: 15px; }
.credits-roll .notice { margin-top: 18px; color: var(--faint); font-size: 12px; }

@keyframes pop { from { transform: scale(0); opacity: 0; } }
.dialog-card:focus, .dialog-card:focus-visible { outline: none; }

/* The ending opens on the painted desktop, now lit. */
.ending-art { height: clamp(90px, 22vh, 190px); margin: -20px -22px 12px; border-radius: 17px 17px 0 0; background: linear-gradient(180deg, rgba(12, 9, 18, 0) 45%, var(--panel) 100%), url('./assets/side-b/painted/desktop.webp') center 38% / cover; }

.title-screen { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: flex-start; padding: clamp(18px, 5vw, 80px); overflow: hidden; background: #0b0911; }
#app[data-screen='title'] .title-screen { display: flex; }
#app[data-screen='title'] .topbar, #app[data-screen='title'] .layout, #app[data-screen='title'] .statusbar { visibility: hidden; }
#app[data-screen='title'] { height: 100dvh; min-height: 0; overflow: hidden; }
.title-art { position: absolute; inset: 0; background: url('./assets/side-b/painted/key-art.webp') center / cover no-repeat; transform: scale(1.04); animation: drift 24s ease-in-out infinite alternate; }
.title-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8, 5, 14, .94) 0%, rgba(8, 5, 14, .72) 34%, rgba(8, 5, 14, .1) 70%), linear-gradient(0deg, rgba(8, 5, 14, .7), transparent 38%); }
.title-card { position: relative; display: flex; flex-direction: column; gap: 6px; width: min(420px, 100%); }
.title-mark { width: 84px; height: auto; margin-bottom: 4px; filter: drop-shadow(0 0 18px rgba(255, 138, 61, .5)); }
.title-word { margin: 0; font: 800 clamp(56px, 9vw, 104px)/.95 var(--display); letter-spacing: .02em; text-shadow: 0 4px 0 #000, 0 0 40px rgba(255, 91, 151, .35); }
.title-word span { color: var(--pink); }
.title-tag { margin: 6px 0 4px; color: var(--amber); font: 600 clamp(12px, 1.4vw, 15px)/1.3 var(--display); letter-spacing: .26em; text-transform: uppercase; }
.title-progress { margin: 0 0 14px; color: var(--ink-dim); font-size: 13px; }
.title-menu { display: grid; gap: 8px; }
.title-menu button { justify-content: flex-start; min-width: 0; min-height: 48px; padding: 2px 18px; border-radius: 12px; font-size: 12px; line-height: 1.15; text-align: left; white-space: normal; background: rgba(24, 20, 34, .84); }
.title-menu button.primary { min-height: 56px; font-size: 13px; background: linear-gradient(180deg, #ffa14f, var(--orange-deep)); }
.copyright { margin: 18px 0 0; color: var(--muted); font: 500 11px/1.2 var(--text); letter-spacing: .04em; }
@keyframes drift { to { transform: scale(1.1) translateX(-1.5%); } }

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .top-actions .chip-button span { display: none; }
  .top-actions .chip-button { padding: 0 11px; }
  .chapter-readout span { display: none; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 6px 10px; position: sticky; top: 0; z-index: 20; }
  .brand small, .chapter-readout { display: none; }
  .brand-mark { width: 34px; height: 26px; }
  .exit-link span { display: none; }
  @media (max-width: 480px) { .brand strong { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
  .exit-link { padding: 0 10px; min-height: 40px; }
  .layout { display: flex; flex-direction: column; padding: 8px; gap: 8px; }
  .stage { padding: 8px; }
  .stage::before, .stage::after { display: none; }
  .cassette-head { padding: 0 4px; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'label' 'reels' 'tabs'; }
  .reel-row { justify-content: space-between; }
  .reel { width: 34px; height: 34px; }
  .tape-window { flex: 1; width: auto; height: 22px; }
  .cassette-label em { display: none; }
  .screen-bezel { flex: none; height: clamp(210px, calc((100vw - 64px) * var(--board-ratio, 1) + 72px), 470px); }
  #game-canvas { min-height: 0; }
  .deck { overflow: visible; }
  .statusbar { display: none; }
  /* The deck reads in play order: transport first (thumbs), then the tape, the objective and the diagnostics. */
  .transport-panel { order: 1; }
  .timeline-panel { order: 2; }
  .objective-panel { order: 3; }
  .hint-panel { order: 4; }
  /* A teach card is a one-time bottom sheet on phones, so it never squeezes the board. */
  .teach-card { position: fixed; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 30; grid-template-columns: 1fr auto; }
  .teach-card b { grid-column: 1 / -1; justify-self: start; }
  .teach-card p { grid-column: 1; }
  .teach-card button { grid-column: 2; }
  .title-screen { align-items: flex-end; padding: 20px 20px 28px; }
  .title-art::after { background: linear-gradient(0deg, rgba(8, 5, 14, .96) 0%, rgba(8, 5, 14, .7) 55%, rgba(8, 5, 14, .15) 100%); }
  .title-card { width: 100%; }
  .title-word { font-size: 64px; }
  .library-stats { grid-template-columns: repeat(3, 1fr); padding-inline: 14px; gap: 6px; }
  .library-stats div { padding: 8px; }
  .library-stats b { font-size: 14px; }
  .library-hero, .library-body { padding-inline: 14px; }
  .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desktop-icons { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  /* Touch floor on phones: 44 px targets in the transport and diagnostics rows. */
  .hint-actions button, .transport-buttons button { min-height: 44px; }
  .notepad { position: relative; right: auto; bottom: auto; width: 100%; margin-top: 12px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .demo-programs em { display: none; }
  .dialog-card h2 { font-size: 20px; margin: 4px 0 6px; }
  .demo-programs li { padding-top: 6px; padding-bottom: 6px; }
  body { overflow: hidden; }
  #app { height: 100dvh; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
  .topbar { position: static; grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .layout { display: grid; }
  .exit-link span { display: none; }
  .brand-mark { width: 30px; height: 22px; }
  .stage::before, .stage::after { display: none; }
  .screen-bezel { flex: 1; height: auto; padding: 4px; gap: 0; }
  #game-canvas { min-height: 0; }
  /* The mode banner and the tape note float over the board's border rows instead of eating its height. */
  .mode-banner { position: absolute; top: 8px; left: 50%; z-index: 2; transform: translateX(-50%); padding: 4px 10px; font-size: 8px; }
  .tape-note { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2; padding: 4px 8px; font-size: 10px; }
  .tape-note b { display: inline; margin: 0 6px 0 0; }
  /* The teach card is a one-time card over the deck column, so the board stays whole. */
  .teach-card { position: fixed; top: 52px; right: 8px; z-index: 30; width: 330px; max-width: calc(100vw - 16px); grid-template-columns: 1fr auto; }
  .teach-card b { grid-column: 1 / -1; justify-self: start; }
  .teach-card button { grid-column: 2; }
  .statusbar { display: none; }
  .topbar { padding: 4px 10px; gap: 8px; }
  .brand strong { font-size: 13px; }
  .chapter-readout { display: none; }
  .brand small, .chapter-readout span { display: none; }
  .brand-mark { width: 30px; height: 22px; }
  .chip-button, .exit-link { min-height: 34px; }
  .top-actions .chip-button span { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr) 340px; padding: 6px 8px; gap: 8px; }
  .transport-grid { gap: 8px; }
  /* Touch floor in landscape: 44 px targets and 12 px labels for the transport and diagnostics buttons. */
  .transport-buttons button, .hint-actions button { min-width: 0; min-height: 44px; padding: 2px 5px; font-size: 12px; letter-spacing: .03em; }
  .stage { padding: 6px; gap: 4px; }
  .cassette-head { padding: 0 4px; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'label' 'tabs'; }
  .reel-row, .cassette-label em, .cassette-label span { display: none; }
  .cassette-label strong { font-size: 16px; margin: 0; }
  .pass-tab { min-height: 26px; }
  .deck { gap: 6px; }
  .panel { padding: 8px 10px; }
  .panel-title { margin-bottom: 4px; }
  .objective-panel p { font-size: 12px; line-height: 1.3; }
  .legend { display: none; }
  .dpad { grid-template-columns: 44px 44px 44px; gap: 4px; }
  .dpad button { width: 44px; height: 44px; }
  .hint-panel p { font-size: 12px; margin-bottom: 6px; }
  .title-card { width: min(560px, 100%); gap: 4px; }
  .title-mark { display: none; }
  .title-word { font-size: 44px; }
  .title-tag { margin: 2px 0; }
  .title-progress { margin: 0 0 6px; }
  .copyright { margin-top: 8px; }
  /* Three columns keep every target 44 px tall and the whole card on a 390 px high screen. */
  .title-menu { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .title-menu button { min-height: 44px; padding: 2px 12px; white-space: normal; line-height: 1.15; }
  .title-menu button.primary { grid-column: 1 / -1; min-height: 44px; }
  .title-menu #title-daily { grid-column: span 2; }
}

/* Short desktop windows (1280x720 and friends): compact the deck so every panel stays reachable without clipping. */
@media (max-height: 800px) and (min-width: 761px) and (min-height: 521px) {
  .deck { gap: 8px; }
  .panel { padding: 9px 12px; }
  .panel-title { margin-bottom: 6px; }
  .objective-panel p { font-size: 13px; line-height: 1.35; }
  .legend { margin-top: 5px; }
  .dpad { grid-template-columns: repeat(3, 44px); gap: 5px; }
  .dpad button { width: 44px; height: 44px; }
  .transport-buttons { gap: 5px; }
  .transport-buttons button { min-height: 32px; }
  .transport-buttons #rewind-button { min-height: 38px; }
  #timeline { margin: 0 0 4px; }
  .speed-row { margin-top: 5px; }
  .speed-row button { min-height: 24px; }
  .hint-panel p { margin-bottom: 6px; font-size: 12px; line-height: 1.35; }
  .hint-actions button { min-height: 32px; }
  .teach-card { padding: 7px 10px; gap: 10px; }
  .teach-card p { font-size: 12px; line-height: 1.35; }
  .teach-card button { min-height: 30px; }
}
