:root {
  color-scheme: dark;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #fff4da;
  background: #0d1213;
  --gold: #f3b76e;
  --ink: #0d1c1c;
  --line: #b6d6c229;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid white; outline-offset: 4px; }
[hidden] { display: none !important; }
.cabinet { max-width: 1940px; margin: auto; padding: 0 clamp(12px, 2.2vw, 45px); }
.topbar { min-height: 70px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand, .utilities { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: block; width: 40px; height: 40px; flex: none; }
.brand strong, .brand small, .record span, .record strong { display: block; }
.brand strong { font-size: .98rem; line-height: 1.2; letter-spacing: .115em; font-weight: 900; }
.brand small, .record span, .console-label { color: #a3bdb4; font-size: .66rem; font-weight: 750; letter-spacing: .135em; }
.record { text-align: center; }
.record strong { font-size: 1.09rem; line-height: 1.1; letter-spacing: .16em; font-variant-numeric: tabular-nums; margin-top: 4px; color: var(--gold); }
.utilities { justify-content: flex-end; gap: 8px; }
.record[hidden] + .utilities { grid-column: 3; }
.utility, .secondary { background: #1a2a29; border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; font-size: .81rem; font-weight: 650; white-space: nowrap; }
.utility:hover, .secondary:hover { background: #2b403b; }
.screen-control { display: grid; place-items: center; min-width: 37px; padding: 5px 9px; font-size: 1.08rem; line-height: 1.2; }
.screen-control[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.stage { height: min(calc(100dvh - 136px), 1100px); min-height: 535px; isolation: isolate; overflow: hidden; position: relative; border: 1px solid #c9b49d48; border-radius: 14px; background: #1b2227; }
#scene, .vignette, .title-screen, .film, .overlay, .loading { position: absolute; inset: 0; width: 100%; height: 100%; }
#scene { display: block; touch-action: none; }
.vignette { pointer-events: none; box-shadow: inset 0 -24px 92px #100f12b3, inset 0 18px 55px #11101938; }
.title-screen { display: flex; align-items: center; padding: 18px clamp(24px, 5.35vw, 90px); background: linear-gradient(90deg,#0b1114fa 0%,#0b1114dd 23%,#0b11149d 38%,#0b111439 58%,transparent 76%), linear-gradient(0deg,#0b11147d,transparent 36%); pointer-events: none; }
.title-content { pointer-events: auto; width: clamp(330px, 39vw, 555px); max-width: 100%; max-height: 100%; overflow: auto; padding: 3px 5px 8px; scrollbar-width: thin; }
.game-title { width: clamp(345px, 38vw, 535px); max-width: 100%; margin: 0 0 11px; }
.game-title img { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 14px #08080cc7); }
.launch-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.launch-actions .secondary { min-height: 44px; background: #131c21ec; }
.route-picker .runner { padding: 9px 12px; }
.route-hint { margin: 8px 0 0; font-size: .8rem; color: #f8e9d3; line-height: 1.3; }
.crew { padding: 0; margin: 0 0 11px; border: 0; min-width: 0; }
.crew legend { margin-bottom: 6px; padding: 0; color: #e2e8df; font-size: .78rem; font-weight: 740; }
.crew-options { display: flex; gap: 7px; flex-wrap: wrap; }
.runner { display: inline-flex; gap: 6px; justify-content: center; align-items: center; border: 1px solid #c7dfcb43; border-radius: 8px; background: #142423c9; padding: 7px 9px 7px 6px; line-height: 1; font-size: .79rem; font-weight: 750; }
.runner:hover, .runner[aria-pressed="true"] { background: #3e3827; border-color: var(--gold); }
.pick-grid { display: grid; width: min(100%, 420px); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.pick { --accent: #f3b76e; display: grid; gap: 0; min-width: 0; padding: 0; text-align: left; border: 1px solid #c7dfcb58; border-radius: 8px; background: #122323f2; overflow: hidden; }
.pick.trail, .runner-preview[data-runner="0"] { --accent: #6fe8d7; }
.pick.bloom, .runner-preview[data-runner="1"] { --accent: #ff9c96; }
.pick.spark, .runner-preview[data-runner="2"] { --accent: #ffd47a; }
.pick.flint, .runner-preview[data-runner="3"] { --accent: #ff9567; }
.pick.nova, .runner-preview[data-runner="4"] { --accent: #cfaeff; }
.runner-picker .pick-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
.map-picker .pick-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.pick-grid { width: min(100%, 520px); }
.mode-stat strong { color: #c7ede2; }
.pick:hover, .pick[aria-pressed="true"] { border-color: var(--accent); background: #283634; }
.pick[aria-pressed="true"] span { color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
.pick img { width: 100%; height: 49px; object-fit: cover; object-position: center 39%; display: block; }
.pick span { padding: 5px 7px 6px; font-size: .75rem; font-weight: 780; line-height: 1.16; }
.map-picker .pick img { height: 44px; object-position: center 48%; }
.runner-preview { position: absolute; bottom: 22px; right: 22px; min-width: 137px; padding: 10px 15px; border: 1px solid #e6d0b34a; border-left: 3px solid var(--accent, #f3b76e); background: #0e181be8; }
.runner-preview span, .runner-preview strong { display: block; }
.runner-preview span { color: #cfddd5; font-size: .63rem; font-weight: 730; letter-spacing: .14em; }
.runner-preview strong { margin-top: 2px; color: var(--accent, #f3b76e); font-size: 1.25rem; }
.primary { color: #282015; font-weight: 900; font-size: 1rem; padding: 13px 24px; border: 1px solid #ffe3a2; background: var(--gold); border-radius: 9px; box-shadow: 0 4px 0 #a9652f, 0 9px 24px #080f116b; min-height: 46px; }
.primary:hover { background: #ffdb93; }
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #a9652f; }
.primary span { font-size: .86em; margin-right: 6px; }
.region { position: absolute; right: 18px; top: 17px; padding: 8px 11px; z-index: 2; border: 1px solid #e6d0b34a; border-radius: 6px; background: #101518cf; color: #fff0ce; font-size: .67rem; font-weight: 850; letter-spacing: .125em; text-transform: uppercase; pointer-events: none; }
.region span:first-child { color: var(--gold); margin-right: 4px; }
.console { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.film { z-index: 3; pointer-events: none; }
.film-top, .film-bottom { width: 100%; height: clamp(20px, 7%, 58px); position: absolute; background: #090b0e; pointer-events: none; animation: open-frame 1.24s both cubic-bezier(.52,.05,.74,.98); }
.film-top { top: 0; transform-origin: top; }
.film-bottom { bottom: 0; transform-origin: bottom; }
.film button { position: absolute; bottom: max(16px, 8.5%); right: 18px; pointer-events: auto; background: #101518e8; }
.stage.is-launching .region { opacity: 0; }
@keyframes open-frame {
  0%, 45% { transform: scaleY(1); }
  100% { transform: scaleY(0); }
}
.cabinet:fullscreen, .cabinet.is-theater { width: 100%; max-width: none; height: 100dvh; padding: 0 clamp(8px, 1vw, 16px); background: #0d1213; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.cabinet.is-theater { position: fixed; inset: 0; z-index: 20; }
.cabinet:fullscreen .stage, .cabinet.is-theater .stage { height: auto; min-height: 0; }
.challenge { display: flex; align-items: center; gap: 10px; }
.console-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.challenge-icon { color: var(--gold); font-size: 1.1rem; }
.console-label, .challenge strong { display: block; }
.challenge strong { font-size: .83rem; }
.progress-group { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: #bdcec6; font-variant-numeric: tabular-nums; }
progress { width: min(12vw, 110px); height: 6px; border: 0; border-radius: 8px; background: #2b3f3b; accent-color: var(--gold); }
progress::-webkit-progress-bar { background: #2b3f3b; border-radius: 8px; }
progress::-webkit-progress-value { background: var(--gold); border-radius: 8px; }
.key-guide { display: flex; gap: 14px; color: #b9cbc3; font-size: .78rem; }
kbd { display: inline-grid; min-width: 22px; padding: 2px 4px; place-items: center; border-radius: 5px; border: 1px solid #526860; background: #253633; color: #f7e9d0; font: inherit; }
.swipe-guide { display: none; font-size: .75rem; color: #b9cbc3; }
.hud { position: absolute; display: flex; gap: 6px; top: 17px; left: 17px; pointer-events: none; }
.stat { padding: 8px 13px; min-width: 75px; background: #142423e6; border: 1px solid #c4decd55; border-radius: 9px; }
.stat span, .stat strong { display: block; }
.stat span { font-size: .62rem; font-weight: 800; letter-spacing: .14em; color: #b9d4c9; }
.stat strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; color: var(--gold); line-height: 1.1; }
.stat.chain strong { color: #89f0da; }
.power, .toast { position: absolute; left: 50%; translate: -50% 0; text-align: center; max-width: 92%; pointer-events: none; background: #102624ed; border-radius: 10px; border: 1px solid #83e9c5; color: #b8ffed; padding: 8px 13px; font-weight: 800; }
.power { bottom: 20px; width: max-content; max-width: 90%; font-size: .86rem; }
.toast { top: 89px; font-size: .93rem; }
.touch-controls { display: none; position: absolute; inset: auto 12px 13px; gap: 7px; pointer-events: none; }
.touch-controls button { width: 46px; height: 46px; border-radius: 10px; border: 1px solid #aacdc39c; background: #132826dc; font-weight: 900; font-size: 1.25rem; pointer-events: auto; touch-action: manipulation; }
.touch-controls button:nth-child(3) { margin-left: auto; }
.overlay, .loading { display: grid; place-items: center; }
.overlay { z-index: 5; padding: 15px; background: #0b1a1bcc; }
.panel { width: min(500px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; padding: clamp(17px, 3vw, 29px); background: #172c2b; border: 1px solid #537a68; border-radius: 17px; box-shadow: 0 18px 75px #060f12a8; }
.panel > :not(#panelBody) { flex: none; }
#panelBody { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 5px; }
.panel-kicker { color: var(--gold); font-size: .72rem; font-weight: 850; letter-spacing: .15em; margin: 0 0 6px; }
.panel h2 { font-size: clamp(1.8rem, 5vw, 2.75rem); margin: 0 0 13px; line-height: 1.03; }
.panel p { line-height: 1.5; }
.panel ul { padding-left: 20px; line-height: 1.6; color: #e4eddb; }
.panel-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 15px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.result-stats div { background: #203a36; padding: 9px; border-radius: 7px; }
.result-stats dt { color: #bfd9cc; font-size: .75rem; }
.result-stats dd { margin: 3px 0 0; font-weight: 900; color: var(--gold); font-size: 1.18rem; }
.record-table { width: 100%; border-collapse: collapse; text-align: right; font-variant-numeric: tabular-nums; font-size: .9rem; }
.record-table caption { font-weight: 800; margin-bottom: 8px; text-align: left; }
.record-table + .record-table { margin-top: 17px; }
.record-table tr { border-bottom: 1px solid #bcdbca35; }
.record-table th, .record-table td { padding: 8px 4px; }
.record-table th:first-child { text-align: left; }
.record-note { font-size: .84rem; color: #c4d8cf; }
.challenge-list { display: grid; gap: 7px; }
.challenge-choice { text-align: left; padding: 9px 11px; background: #1c3633; border: 1px solid #b6d6c239; border-radius: 8px; color: #f3e8d2; font-size: .88rem; }
.challenge-choice[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.gallery-wallet { margin-block: 5px 12px; color: var(--gold); font-weight: 800; }
.gallery-grid { display: grid; gap: 7px; }
.gallery-filters, .gallery-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 8px 0 11px; font-size: .84rem; }
.gallery-filters select, .gallery-pages input { max-width: 100%; background: #223b36; border: 1px solid #779988; border-radius: 7px; color: inherit; padding: 7px; }
.gallery-pages button:disabled, .lesson-answers button:disabled { opacity: .6; cursor: default; }
.lesson-answers { display: flex; flex-wrap: wrap; gap: 7px; margin-block: 14px; }
.lesson-answers .correct-answer { opacity: 1; color: #b5ffca; border-color: #82db9b; }
.gallery-pages label { display: block; flex-basis: 100%; }
.gallery-pages input { display: block; margin-top: 6px; }
.gear { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid #b6d6c239; border-radius: 8px; background: #1c3633; }
.gear img { display: block; width: 44px; height: 44px; object-fit: cover; border-radius: 5px; }
.gear .secondary { padding-inline: 8px; }
.gear h3 { font-size: .92rem; margin: 0 0 3px; }
.gear p { font-size: .77rem; margin: 0; color: #c9ded7; }
.gear button:disabled { opacity: .57; cursor: default; }
.console-links [hidden] { display: none !important; }
.loading { z-index: 6; background: #172825; padding: 24px; text-align: center; font-weight: 760; }
@media (min-width: 681px) and (max-height: 820px) {
  .game-title { width: clamp(272px, 34vw, 459px); }
}
@media (pointer: coarse), (max-width: 680px) {
  .touch-controls { display: flex; }
  .power { bottom: 70px; }
  .key-guide { display: none; }
  .swipe-guide { display: block; text-align: right; }
}
@media (max-width: 680px) {
  .topbar { min-height: 63px; grid-template-columns: 1fr auto; gap: 8px; }
  .record { display: none; }
  .record[hidden] + .utilities { grid-column: auto; }
  .brand { gap: 8px; }
  .brand strong { font-size: .77rem; }
  .brand small { font-size: .53rem; }
  .brand-mark { width: 31px; height: 31px; }
  .utilities { gap: 4px; }
  .utility { padding: 7px; font-size: .70rem; }
  .stage { height: calc(100dvh - 121px); min-height: 492px; border-radius: 13px; }
  .title-screen { align-items: flex-end; padding: 9px 12px 14px; background: linear-gradient(0deg,#0b1114fa 0%,#0b1114ea 39%,#0b11147a 63%,transparent 87%); }
  .title-content { width: 100%; }
  .game-title { width: min(82%, 274px); margin-bottom: 8px; }
  .crew { margin-bottom: 8px; }
  .pick img { height: 40px; }
  .map-picker .pick img { height: 33px; }
  .pick span { padding-inline: 5px; font-size: .69rem; }
  .pick-grid { gap: 5px; }
  .map-picker .pick span { font-size: .63rem; }
  .route-picker .runner { padding: 8px 7px; font-size: .71rem; }
  .runner-preview { display: none; }
  .launch-actions { gap: 5px; }
  .launch-actions .secondary { padding-inline: 9px; }
  .launch-actions .primary { padding-inline: 13px; }
  .region { right: 9px; top: 9px; font-size: .56rem; padding: 6px; }
  .screen-control { min-width: 31px; padding: 5px 7px; font-size: 1rem; }
  .hud { top: 9px; left: 9px; gap: 4px; max-width: calc(100% - 18px); flex-wrap: wrap; }
  .stat { padding: 6px; min-width: 53px; }
  .stat strong { font-size: 1rem; }
  .stat span { font-size: .52rem; }
  .stage.is-running .region { top: 55px; }
  .toast { top: 75px; }
  .console { min-height: 58px; gap: 8px; }
  .challenge { gap: 5px; flex-wrap: wrap; }
  .challenge .utility { padding: 5px 7px; }
  .challenge strong { font-size: .71rem; }
  .console-label, .swipe-guide, .progress-group { font-size: .63rem; }
}
@media (max-width: 330px) {
  .brand-mark { display: none; }
  .brand strong { font-size: .69rem; letter-spacing: .055em; }
  .brand small { font-size: .48rem; }
  .utility { font-size: .65rem; padding-inline: 5px; }
  .screen-control { font-size: .95rem; min-width: 28px; }
  .gear { grid-template-columns: 1fr auto; }
  .gear img { display: none; }
  .stat { min-width: 48px; padding-inline: 5px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .topbar { min-height: 48px; }
  .console { min-height: 45px; }
  .stage { min-height: 282px; height: max(282px, calc(100dvh - 93px)); }
  .title-screen { padding: 10px clamp(16px, 6vw, 55px); }
  .title-content { position: relative; height: 100%; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); width: min(81vw, 605px); gap: 4px 9px; align-items: start; align-content: start; }
  .game-title { grid-column: 1 / -1; width: clamp(132px, 20vw, 166px); margin-bottom: 0; }
  .crew { margin-bottom: 3px; }
  .pick-grid { gap: 4px; }
  .pick img, .map-picker .pick img { height: 30px; }
  .pick span { font-size: .62rem; padding: 3px 3px 5px; }
  .route-hint { display: none; }
  .route-picker .runner { padding: 9px 7px; }
  .launch-actions { position: absolute; left: 48%; right: 0; bottom: 3px; gap: 4px; }
  .runner { padding-block: 4px; }
  .title-screen .primary, .launch-actions .secondary { min-height: 36px; padding: 7px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

