:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel: rgba(13, 18, 30, .84);
  --panel-strong: #0e1422;
  --line: rgba(175, 197, 226, .16);
  --line-strong: rgba(111, 247, 216, .42);
  --text: #f7f9fc;
  --muted: #8f9bad;
  --soft: #c8d0db;
  --mint: #64f4d2;
  --violet: #8d72ff;
  --hot: #ff6384;
  --gold: #ffc96b;
  --radius: 18px;
  --shadow: 0 28px 90px rgba(0, 0, 0, .48);
  --font-display: "Arial Narrow", "Segoe UI", sans-serif;
  --font-body: Inter, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 80% -10%, rgba(83, 63, 196, .22), transparent 34rem),
    radial-gradient(circle at -8% 35%, rgba(39, 185, 166, .12), transparent 28rem),
    var(--bg);
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}
.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; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 1000; padding: .75rem 1rem; border-radius: 8px; background: var(--mint); color: #05110f; font-weight: 800; }
.skip-link:focus { top: 1rem; }

.page-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .28;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, #000 0, transparent 82%);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: .7rem clamp(1rem, 2.7vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 15, .82);
  backdrop-filter: blur(22px) saturate(1.2);
}
.brand { display: inline-flex; align-items: center; gap: .72rem; min-width: max-content; color: var(--text); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(100,244,210,.38); border-radius: 13px; background: rgba(100,244,210,.08); box-shadow: inset 0 0 24px rgba(100,244,210,.05); }
.brand-mark img { width: 30px; height: 30px; object-fit: contain; }
.brand strong { display: block; font-size: .92rem; letter-spacing: .04em; }
.brand small { display: block; margin-top: .16rem; color: var(--mint); font-size: .58rem; font-weight: 800; letter-spacing: .24em; }
.header-track { justify-self: center; min-width: 0; display: flex; align-items: center; gap: .7rem; padding: .38rem .8rem .38rem .42rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); }
.header-track img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #111; }
.header-track span { min-width: 0; }
.header-track small { display: block; color: var(--muted); font-size: .53rem; font-weight: 800; letter-spacing: .14em; }
.header-track strong { display: block; max-width: 28vw; overflow: hidden; color: var(--soft); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.app-header nav { display: flex; align-items: center; gap: .42rem; }
.app-header nav a, .app-header nav button { border: 0; border-radius: 9px; padding: .62rem .78rem; color: var(--muted); background: transparent; font-size: .76rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.app-header nav a:hover, .app-header nav button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.engine-chip { display: flex; align-items: center; gap: .45rem; min-width: max-content; padding: .52rem .68rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .58rem; font-weight: 900; letter-spacing: .12em; }
.engine-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px var(--mint); animation: breathe 2.4s ease-in-out infinite; }
.engine-chip.error i { background: var(--hot); box-shadow: 0 0 12px var(--hot); }

main { width: min(1880px, 100%); margin: 0 auto; padding: 0 clamp(.8rem, 1.6vw, 1.8rem) 3rem; }
.intro { min-height: 112px; display: grid; grid-template-columns: minmax(340px, 1.35fr) minmax(280px, .85fr) auto; align-items: center; gap: 2rem; padding: 1.35rem .2rem 1.15rem; }
.eyebrow, .intro .eyebrow { margin: 0 0 .45rem; color: var(--mint); font-size: .63rem; font-weight: 900; letter-spacing: .18em; }
.intro h1 { margin: 0; font-family: var(--font-display); font-size: clamp(2rem, 3.2vw, 3.65rem); font-stretch: condensed; line-height: .98; letter-spacing: -.045em; }
.intro h1 em { color: var(--mint); font-style: normal; }
.intro > p { max-width: 34rem; margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.feature-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .38rem; }
.feature-chips span { padding: .52rem .68rem; border: 1px solid var(--line); border-radius: 999px; color: var(--soft); background: rgba(255,255,255,.025); font-size: .64rem; font-weight: 800; letter-spacing: .04em; }

.game-shell {
  display: grid;
  grid-template-columns: minmax(216px, 264px) minmax(0, 1fr) minmax(216px, 264px);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 9, 16, .72);
  box-shadow: var(--shadow);
}
.track-panel, .director-panel { position: relative; z-index: 3; display: flex; flex-direction: column; gap: 1rem; padding: 1.05rem; background: var(--panel); backdrop-filter: blur(18px); }
.track-panel { border-right: 1px solid var(--line); }
.director-panel { border-left: 1px solid var(--line); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .58rem; font-weight: 900; letter-spacing: .17em; }
.panel-heading b { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--mint); font-size: .58rem; }

.track-picker { width: 100%; display: grid; grid-template-columns: 58px minmax(0,1fr) 18px; align-items: center; gap: .72rem; padding: .5rem; border: 1px solid var(--line); border-radius: 13px; text-align: left; background: rgba(255,255,255,.035); cursor: pointer; transition: border-color .2s ease, transform .2s ease, background .2s ease; }
.track-picker:hover { transform: translateY(-1px); border-color: var(--line-strong); background: rgba(100,244,210,.055); }
.track-picker img { width: 58px; height: 58px; border-radius: 9px; object-fit: cover; background: #0a0c12; }
.track-picker span { min-width: 0; }
.track-picker strong, .track-picker small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-picker strong { font-size: .79rem; }
.track-picker small { margin-top: .25rem; color: var(--muted); font-size: .65rem; }
.track-picker svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sync-card { padding: .78rem; border: 1px solid rgba(100,244,210,.2); border-radius: 12px; background: linear-gradient(135deg, rgba(100,244,210,.07), rgba(141,114,255,.035)); }
.sync-card span, .sync-card strong, .sync-card small { display: block; }
.sync-card span { color: var(--muted); font-size: .53rem; font-weight: 900; letter-spacing: .13em; }
.sync-card strong { margin-top: .28rem; color: var(--mint); font-size: .77rem; letter-spacing: .04em; }
.sync-card small { margin-top: .22rem; color: var(--muted); font-size: .61rem; line-height: 1.35; }
.dna-meter { display: grid; gap: .38rem; padding: .2rem 0; }
.dna-meter div { display: flex; justify-content: space-between; color: var(--muted); font-size: .54rem; font-weight: 800; letter-spacing: .1em; }
.dna-meter b { color: var(--soft); }
.dna-meter i { height: 3px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.dna-meter u { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--violet)); transition: width .5s ease; }
.session-score { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.session-score div { padding: .62rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.022); }
.session-score div:first-child { grid-column: 1 / -1; }
.session-score span { display: block; color: var(--muted); font-size: .5rem; font-weight: 900; letter-spacing: .14em; }
.session-score strong { display: block; margin-top: .16rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1rem; letter-spacing: .05em; }
.session-score div:first-child strong { color: var(--mint); font-size: 1.35rem; }
.control-legend { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.control-legend > span { display: flex; gap: .3rem; }
kbd { min-width: 28px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); border-bottom-width: 3px; border-radius: 6px; color: var(--soft); background: rgba(255,255,255,.04); font: 700 .65rem var(--font-body); }
.control-legend p { margin: .55rem 0 0; color: var(--muted); font-size: .64rem; line-height: 1.45; }

.stage-column { min-width: 0; display: flex; flex-direction: column; padding: .75rem; background: radial-gradient(circle at 50% 40%, rgba(57, 79, 123, .1), transparent 50%); }
.stage-toolbar { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: 0 .1rem .65rem; }
.ratio-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.ratio-switch button { min-width: 52px; border: 0; border-radius: 6px; padding: .48rem .58rem; color: var(--muted); background: transparent; font-size: .62rem; font-weight: 800; cursor: pointer; }
.ratio-switch button.active { color: #06130f; background: var(--mint); }
.stage-actions { display: flex; gap: .4rem; }
.stage-actions button { display: inline-flex; align-items: center; gap: .4rem; min-height: 35px; padding: .48rem .65rem; border: 1px solid var(--line); border-radius: 8px; color: var(--soft); background: rgba(255,255,255,.025); font-size: .64rem; font-weight: 800; cursor: pointer; }
.stage-actions svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.stage-actions .record span { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 10px rgba(255,99,132,.7); }
.stage-actions .record.active { border-color: rgba(255,99,132,.55); color: #fff; background: rgba(255,99,132,.12); }

.stage-wrap { position: relative; width: 100%; max-height: calc(100vh - 220px); min-height: 410px; margin: auto; overflow: hidden; border: 1px solid rgba(188, 214, 244, .2); border-radius: 14px; background: #02040a; isolation: isolate; transition: width .35s ease, aspect-ratio .35s ease; }
.stage-wrap.aspect-wide { aspect-ratio: 16 / 9; }
.stage-wrap.aspect-vertical { width: min(100%, calc((100vh - 235px) * .5625)); aspect-ratio: 9 / 16; min-height: 560px; }
.portfolio-backdrops { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #050811; }
.portfolio-backdrop-layer { position: absolute; inset: -5%; background-color: #070a12; background-position: center; background-size: cover; filter: saturate(1.16) brightness(.48); opacity: 0; transform: scale(1.055); transition: opacity 1.25s ease-in-out, transform 7s ease-out, filter 1.25s ease-in-out; will-change: opacity, transform; }
.portfolio-backdrop-layer::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(2,5,10,.18), rgba(2,5,10,.38)), radial-gradient(ellipse at center, transparent 30%, rgba(2,4,10,.45) 100%); }
.portfolio-backdrop-layer.active { opacity: .94; transform: scale(1.01); filter: saturate(1.2) brightness(.5); }
#runner-canvas { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; mix-blend-mode: screen; touch-action: none; }
.stage-vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, transparent 38%, rgba(2,4,10,.28) 72%, rgba(2,4,10,.72) 100%), linear-gradient(to bottom, rgba(2,4,10,.12), transparent 35%, rgba(2,4,10,.24)); }
.hit-flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 68%, color-mix(in srgb, var(--impact-color, var(--mint)) 58%, transparent), transparent 38%), linear-gradient(90deg, transparent, color-mix(in srgb, var(--impact-color, var(--mint)) 28%, transparent), transparent); mix-blend-mode: screen; }
.stage-wrap.hit-confirm .hit-flash { animation: hit-confirm .42s ease-out; }
.stage-wrap.hazard-hit { animation: hazard-shake .38s ease-out; }
.game-hud { position: absolute; inset: 0; z-index: 3; padding: clamp(.75rem, 2vw, 1.25rem); pointer-events: none; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.hud-brand, .hud-progress { position: absolute; top: 1rem; color: rgba(255,255,255,.58); font-size: clamp(.48rem, .8vw, .65rem); font-weight: 800; letter-spacing: .15em; }
.hud-brand { left: 1rem; }
.hud-progress { right: 1rem; }
.hud-score { position: absolute; top: 2rem; right: 1rem; text-align: right; }
.hud-score b { display: block; color: #fff; font-size: clamp(.9rem, 2vw, 1.35rem); letter-spacing: .08em; text-shadow: 0 0 18px rgba(100,244,210,.4); }
.hud-score small { color: var(--mint); font-size: clamp(.45rem, .75vw, .58rem); font-weight: 800; letter-spacing: .1em; }
.stage-overlay { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center; padding: 2rem; text-align: center; background: linear-gradient(180deg, rgba(4,7,14,.38), rgba(4,7,14,.78)); backdrop-filter: blur(4px); transition: opacity .28s ease, visibility .28s ease; }
.stage-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.stage-overlay p { margin: 0 0 .8rem; color: var(--mint); font-size: .58rem; font-weight: 900; letter-spacing: .2em; }
.stage-overlay h2 { max-width: 14ch; margin: 0; font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 5.4rem); line-height: .94; letter-spacing: -.05em; text-wrap: balance; }
.aspect-vertical .stage-overlay { padding: 1.15rem; }
.aspect-vertical .stage-overlay h2 { width: 100%; max-width: 10ch; font-size: clamp(1.45rem, 2.8vw, 2.65rem); line-height: 1; letter-spacing: -.035em; overflow-wrap: anywhere; }
.stage-overlay > span { max-width: 34rem; margin-top: 1rem; color: var(--soft); font-size: clamp(.75rem, 1.2vw, .95rem); line-height: 1.5; }
.stage-overlay button { display: inline-flex; align-items: center; gap: .55rem; margin-top: 1.35rem; padding: .82rem 1.2rem; border: 0; border-radius: 999px; color: #05110e; background: var(--mint); box-shadow: 0 12px 40px rgba(100,244,210,.22); font-size: .72rem; font-weight: 900; letter-spacing: .08em; cursor: pointer; }
.stage-overlay button:hover { transform: translateY(-2px); box-shadow: 0 16px 50px rgba(100,244,210,.32); }
.stage-overlay svg { width: 17px; fill: currentColor; }
.rating-pop { position: absolute; left: 50%; top: 34%; z-index: 6; transform: translate(-50%, 12px) scale(.9); opacity: 0; color: #fff; font-family: var(--font-display); font-size: clamp(1.25rem, 3.5vw, 3rem); font-weight: 900; letter-spacing: -.03em; text-shadow: 0 0 30px currentColor; pointer-events: none; }
.rating-pop.show { animation: rating .68s cubic-bezier(.2,.9,.2,1); }
.combo-banner { position: absolute; left: 50%; top: 19%; z-index: 6; transform: translate(-50%, 10px) scale(.88); opacity: 0; color: #fff; font: 900 clamp(.85rem, 2.4vw, 1.7rem) var(--font-display); letter-spacing: .08em; text-transform: uppercase; text-shadow: 0 0 12px var(--mint), 0 0 34px var(--violet); pointer-events: none; }
.combo-banner.show { animation: combo-confirm .9s cubic-bezier(.16,.9,.2,1); }
.hud-score.combo-hot b { color: var(--mint); text-shadow: 0 0 15px var(--mint), 0 0 42px var(--violet); }
.hud-score.combo-hot small { animation: combo-breathe .72s ease-in-out infinite alternate; }
.route-cue { position: absolute; left: 50%; bottom: 11%; z-index: 4; transform: translateX(-50%); padding: .35rem .58rem; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: rgba(255,255,255,.55); background: rgba(4,7,12,.48); backdrop-filter: blur(8px); font-size: .5rem; font-weight: 900; letter-spacing: .15em; pointer-events: none; }
.recording-indicator { position: absolute; left: 1rem; top: 2.2rem; z-index: 5; display: none; align-items: center; gap: .35rem; color: #fff; font: 800 .58rem ui-monospace, monospace; }
.recording-indicator.on { display: flex; }
.recording-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); animation: blink 1s steps(1) infinite; }
.touch-controls { position: absolute; inset: auto .75rem .75rem; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; pointer-events: none; }
.touch-controls button { width: 52px; height: 52px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; color: #fff; background: rgba(5,8,14,.4); backdrop-filter: blur(10px); font-size: 1.25rem; cursor: pointer; opacity: .62; pointer-events: auto; touch-action: manipulation; }
.touch-controls #move-left { justify-self: start; }
.touch-controls #move-right { justify-self: end; }
.touch-controls .jump-control { width: 62px; height: 62px; justify-self: center; border-color: color-mix(in srgb, var(--mint) 55%, transparent); color: var(--mint); background: rgba(4,12,16,.58); box-shadow: 0 0 28px color-mix(in srgb, var(--mint) 18%, transparent); font-size: 1.55rem; }
.touch-controls button:active { transform: scale(.94); opacity: 1; border-color: var(--mint); background: rgba(100,244,210,.14); }
.webgl-fallback { position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; gap: .5rem; padding: 2rem; text-align: center; background: #070a12; }
.webgl-fallback[hidden] { display: none; }
.webgl-fallback span { color: var(--muted); }

.transport { min-height: 54px; display: flex; align-items: center; gap: .7rem; padding: .7rem .15rem 0; color: var(--muted); font: 700 .61rem ui-monospace, monospace; }
#play-toggle { width: 37px; height: 37px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(100,244,210,.42); border-radius: 50%; color: #07110f; background: var(--mint); cursor: pointer; }
#play-toggle svg { width: 16px; fill: currentColor; stroke: currentColor; }
#play-toggle .pause-icon { display: none; }
#play-toggle.playing .play-icon { display: none; }
#play-toggle.playing .pause-icon { display: block; }
.progress { flex: 1; display: flex; }
.progress input, .volume input, .range-control input { width: 100%; accent-color: var(--mint); cursor: pointer; }
.volume { width: 108px; display: flex; align-items: center; gap: .42rem; }
.volume svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset legend { margin-bottom: .55rem; color: var(--muted); font-size: .55rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.difficulty-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.difficulty-picker legend { grid-column: 1 / -1; }
.difficulty-picker label { position: relative; min-width: 0; }
.difficulty-picker input, .theme-picker input, .toggle-control input { position: absolute; opacity: 0; pointer-events: none; }
.difficulty-picker label > span { min-height: 43px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.025); font-size: .55rem; font-weight: 900; cursor: pointer; }
.difficulty-picker label > small { display: none; }
.difficulty-picker input:checked + span { border-color: var(--line-strong); color: var(--mint); background: rgba(100,244,210,.075); }
.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.theme-picker legend { grid-column: 1 / -1; }
.theme-picker label { display: grid; justify-items: center; gap: .3rem; padding: .5rem .2rem; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.02); font-size: .55rem; cursor: pointer; }
.theme-picker label:has(input:checked) { border-color: var(--line-strong); color: var(--text); background: rgba(100,244,210,.055); }
.theme-swatch { width: 100%; height: 16px; border-radius: 5px; }
.theme-swatch.album { background: linear-gradient(90deg, #64f4d2, #8d72ff, #ff6384); }
.theme-swatch.aurora { background: linear-gradient(90deg, #3fe3e0, #56c8ff, #8d72ff); }
.theme-swatch.solar { background: linear-gradient(90deg, #ffcc67, #ff765c, #ff4d9c); }
.range-control { display: grid; gap: .38rem; }
.range-control > span { display: flex; justify-content: space-between; color: var(--soft); font-size: .64rem; }
.range-control output { color: var(--mint); font: 700 .59rem ui-monospace, monospace; }
.toggle-control { display: flex; align-items: center; gap: .55rem; color: var(--soft); font-size: .65rem; cursor: pointer; }
.toggle-control > span { position: relative; width: 34px; height: 19px; border-radius: 999px; background: rgba(255,255,255,.12); transition: background .2s ease; }
.toggle-control > span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 13px; height: 13px; border-radius: 50%; background: #8b95a4; transition: transform .2s ease, background .2s ease; }
.toggle-control input:checked + span { background: rgba(100,244,210,.22); }
.toggle-control input:checked + span::after { transform: translateX(15px); background: var(--mint); box-shadow: 0 0 10px rgba(100,244,210,.55); }
.capture-card { margin-top: auto; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.capture-card svg { width: 22px; fill: none; stroke: var(--mint); stroke-width: 1.5; }
.capture-card strong { display: block; margin-top: .42rem; font-size: .72rem; }
.capture-card p { margin: .35rem 0; color: var(--muted); font-size: .61rem; line-height: 1.45; }
.capture-card small { display: block; color: rgba(255,255,255,.42); font-size: .54rem; line-height: 1.35; }
#capture-result a { display: block; margin-top: .55rem; color: var(--mint); font-size: .58rem; font-weight: 800; }
.share-result { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; color: var(--soft); background: transparent; font-size: .62rem; font-weight: 900; cursor: pointer; }
.share-result:hover { border-color: var(--line-strong); color: var(--mint); background: rgba(100,244,210,.05); }

.system-note { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(320px, 1.2fr); align-items: center; gap: 3rem; margin-top: 1rem; padding: 1.2rem 1.4rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.018); }
.system-note span { color: var(--mint); font-size: .57rem; font-weight: 900; letter-spacing: .16em; }
.system-note h2 { margin: .25rem 0 0; font-family: var(--font-display); font-size: clamp(1.4rem, 2vw, 2rem); letter-spacing: -.025em; }
.system-note p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.58; }
.system-note b { color: var(--soft); }

dialog { color: var(--text); }
dialog::backdrop { background: rgba(2,4,9,.72); backdrop-filter: blur(12px); }
.track-dialog { width: min(900px, calc(100vw - 1.5rem)); max-height: min(820px, calc(100vh - 1.5rem)); padding: 1.2rem; border: 1px solid rgba(175,197,226,.24); border-radius: 20px; background: #0e1421; box-shadow: 0 38px 100px rgba(0,0,0,.7); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dialog-head span { color: var(--mint); font-size: .58rem; font-weight: 900; letter-spacing: .15em; }
.dialog-head h2 { margin: .28rem 0 0; font-family: var(--font-display); font-size: 1.9rem; letter-spacing: -.035em; }
.dialog-head button, .help-dialog form button { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.03); cursor: pointer; }
.dialog-head svg, .help-dialog svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.catalog-search { display: flex; align-items: center; gap: .65rem; margin-top: 1.1rem; padding: 0 .85rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.catalog-search:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(100,244,210,.06); }
.catalog-search svg { width: 18px; flex: 0 0 auto; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.catalog-search input { width: 100%; min-height: 50px; border: 0; outline: 0; color: var(--text); background: transparent; }
.catalog-search input::placeholder { color: #667184; }
.search-feedback { min-height: 1.1rem; margin: .45rem .1rem 0; color: var(--muted); font-size: .61rem; }
.catalog-meta { display: flex; justify-content: space-between; margin: .75rem .1rem .6rem; color: var(--muted); font-size: .56rem; }
.track-grid { max-height: 52vh; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .5rem; overflow-y: auto; overscroll-behavior: contain; padding-right: .2rem; }
.track-option { display: grid; grid-template-columns: 52px minmax(0,1fr); align-items: center; gap: .65rem; padding: .46rem; border: 1px solid var(--line); border-radius: 11px; text-align: left; background: rgba(255,255,255,.025); cursor: pointer; }
.track-option:hover, .track-option.selected { border-color: var(--line-strong); background: rgba(100,244,210,.055); }
.track-option img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #090b11; }
.track-option span { min-width: 0; }
.track-option strong, .track-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-option strong { font-size: .69rem; }
.track-option small { margin-top: .22rem; color: var(--muted); font-size: .58rem; }
.empty-state { grid-column: 1 / -1; min-height: 150px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: .75rem; }
.help-dialog { width: min(580px, calc(100vw - 1.5rem)); padding: 1.5rem; border: 1px solid rgba(175,197,226,.24); border-radius: 20px; background: #0e1421; box-shadow: 0 38px 100px rgba(0,0,0,.7); }
.help-dialog form { display: flex; justify-content: flex-end; }
.help-dialog h2 { margin: .25rem 0 1.2rem; font-family: var(--font-display); font-size: 2.2rem; letter-spacing: -.045em; }
.help-dialog ol { display: grid; gap: .75rem; margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.help-dialog li { display: grid; grid-template-columns: 28px 1fr; column-gap: .75rem; counter-increment: steps; }
.help-dialog li::before { content: counter(steps, decimal-leading-zero); grid-row: 1 / span 2; color: var(--mint); font: 800 .64rem ui-monospace, monospace; }
.help-dialog li b { font-size: .76rem; }
.help-dialog li span { margin-top: .2rem; color: var(--muted); font-size: .69rem; line-height: 1.45; }
.help-note { margin: 1.1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .64rem; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; z-index: 500; max-width: min(520px, calc(100vw - 2rem)); transform: translate(-50%, 25px); padding: .75rem 1rem; border: 1px solid rgba(100,244,210,.28); border-radius: 10px; color: var(--text); background: rgba(9,14,23,.94); box-shadow: 0 16px 50px rgba(0,0,0,.45); opacity: 0; visibility: hidden; font-size: .69rem; transition: opacity .2s ease, transform .2s ease, visibility .2s ease; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

@keyframes breathe { 0%,100% { opacity: .45; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes rating { 0% { opacity: 0; transform: translate(-50%, 14px) scale(.82); } 22% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 72% { opacity: 1; transform: translate(-50%, -4px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -24px) scale(.94); } }
@keyframes hit-confirm { 0% { opacity: 0; } 18% { opacity: .82; } 100% { opacity: 0; } }
@keyframes hazard-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 42% { transform: translateX(6px); } 66% { transform: translateX(-3px); } }
@keyframes combo-confirm { 0% { opacity: 0; transform: translate(-50%, 12px) scale(.76); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 72% { opacity: 1; transform: translate(-50%, -5px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -18px) scale(.92); } }
@keyframes combo-breathe { from { opacity: .65; transform: scale(.98); } to { opacity: 1; transform: scale(1.04); } }

.stage-wrap:fullscreen { width: 100vw !important; height: 100vh !important; max-height: none !important; min-height: 0 !important; aspect-ratio: auto !important; border: 0; border-radius: 0; background: #02040a; }
.stage-wrap:fullscreen .touch-controls { inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)); }
.stage-wrap:fullscreen .game-hud { padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }

@media (max-width: 1180px) {
  .game-shell { grid-template-columns: 218px minmax(0,1fr); }
  .director-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); align-items: end; border-top: 1px solid var(--line); border-left: 0; }
  .director-panel .panel-heading { grid-column: 1 / -1; }
  .capture-card { margin-top: 0; }
  .share-result { align-self: end; }
  .stage-wrap { max-height: none; }
  .stage-wrap.aspect-vertical { width: min(100%, 520px); }
}

@media (max-width: 820px) {
  .app-header { grid-template-columns: auto 1fr auto; gap: .55rem; min-height: 62px; padding: .55rem .75rem; }
  .brand span:last-child, .app-header nav, .header-track small { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .header-track { justify-self: stretch; }
  .header-track strong { max-width: 46vw; }
  .engine-chip { padding: .46rem; }
  .engine-chip span { display: none; }
  main { padding-inline: .55rem; }
  .intro { min-height: 0; grid-template-columns: 1fr; gap: .65rem; padding: 1rem .2rem; }
  .intro h1 { font-size: 2.45rem; }
  .intro > p { font-size: .76rem; }
  .feature-chips { justify-content: flex-start; }
  .game-shell { grid-template-columns: 1fr; }
  .track-panel { display: grid; grid-template-columns: 1fr 1fr; border-right: 0; border-bottom: 1px solid var(--line); }
  .track-panel .panel-heading, .track-panel .track-picker { grid-column: 1 / -1; }
  .track-panel .control-legend { display: none; }
  .session-score { align-self: stretch; }
  .stage-column { padding: .55rem; }
  .stage-wrap { min-height: 52vw; }
  .stage-wrap.aspect-vertical { min-height: min(126vw, 720px); }
  .director-panel { grid-template-columns: 1fr 1fr; }
  .director-panel .capture-card, .director-panel .share-result { display: none; }
  .system-note { grid-template-columns: 1fr; gap: .6rem; }
  .track-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 520px) {
  .intro > p, .feature-chips { display: none; }
  .intro h1 { font-size: 2rem; }
  .game-shell { border-radius: 13px; }
  .track-panel { grid-template-columns: 1fr; gap: .7rem; padding: .75rem; }
  .track-panel .sync-card, .track-panel .dna-meter, .track-panel .session-score { display: none; }
  .stage-toolbar { min-height: 38px; }
  .stage-actions button { min-height: 32px; padding: .42rem .5rem; }
  .stage-actions #snapshot { display: none; }
  .stage-actions #fullscreen b { display: none; }
  .stage-wrap.aspect-wide { min-height: min(67vw, 68svh); border-radius: 10px; }
  .stage-wrap.aspect-vertical { width: 100%; min-height: min(162vw, 78svh); max-height: 82svh; }
  .route-cue { bottom: 8%; }
  .touch-controls { inset: auto .65rem max(.65rem, env(safe-area-inset-bottom)); }
  .touch-controls button { width: 58px; height: 58px; opacity: .82; }
  .touch-controls .jump-control { width: 68px; height: 68px; }
  .transport { gap: .45rem; }
  .volume { display: none; }
  .director-panel { grid-template-columns: 1fr; padding: .8rem; }
  .director-panel .panel-heading, .theme-picker, .range-control, .toggle-control { display: none; }
  .difficulty-picker { grid-template-columns: repeat(3,1fr); }
  .system-note { display: none; }
  .track-dialog { padding: .9rem; }
  .track-grid { grid-template-columns: 1fr; }
  .track-option { grid-template-columns: 46px minmax(0,1fr); }
  .track-option img { width: 46px; height: 46px; }
}

@media (hover: hover) and (pointer: fine) {
  .touch-controls { opacity: .2; }
  .stage-wrap:hover .touch-controls { opacity: .75; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
