:root {
  --bg: #050b14;
  --bg-2: #071624;
  --panel: rgba(12, 27, 43, 0.86);
  --panel-strong: rgba(8, 20, 34, 0.96);
  --text: #f6fbff;
  --muted: #a9bdd0;
  --line: rgba(255, 255, 255, 0.12);
  --cyan: #47d9ff;
  --blue: #3388ff;
  --lime: #b8ff59;
  --yellow: #ffd44d;
  --orange: #ff8a3d;
  --red: #ff4d5f;
  --purple: #b782ff;
  --green: #62d996;
  --radius: 22px;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow-x: hidden; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 10%, rgba(54, 139, 255, 0.22), transparent 30%),
    radial-gradient(circle at 87% 5%, rgba(183, 130, 255, 0.16), transparent 25%),
    linear-gradient(180deg, #07111f 0%, #030810 100%);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .15;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
  z-index: -1;
}

.app-shell { min-height: 100dvh; padding: calc(12px + env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom)); max-width: 1440px; margin: 0 auto; }
.glass-panel { background: rgba(8, 20, 34, .78); border: 1px solid var(--line); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: var(--shadow); }
.topbar { position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 40; min-height: 64px; border-radius: 20px; display: grid; grid-template-columns: 48px minmax(120px, 1fr) auto 48px; gap: 10px; align-items: center; padding: 8px 10px; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: rgba(255,255,255,.06); cursor: pointer; font-size: 1.35rem; display: grid; place-items: center; }
.icon-button:hover { background: rgba(255,255,255,.12); transform: translateY(-1px); }
.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-lockup strong, .brand-lockup small { display: block; white-space: nowrap; }
.brand-lockup strong { letter-spacing: .02em; }
.brand-lockup small { color: var(--muted); font-size: .75rem; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; font-weight: 900; letter-spacing: -.08em; background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #00101d; box-shadow: 0 8px 24px rgba(51,136,255,.35); }
.status-strip { display: flex; gap: 8px; align-items: center; }
.status-strip span { min-width: 53px; padding: 7px 9px; border-radius: 12px; background: rgba(255,255,255,.055); color: var(--muted); font-size: .83rem; text-align: center; }
.status-strip b { color: var(--text); }
.screen { min-height: calc(100dvh - 170px); padding: 22px 0 34px; }

.bottom-nav { position: fixed; z-index: 50; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 24px), 700px); border-radius: 23px; padding: 7px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.nav-button { color: var(--muted); background: transparent; border: 0; border-radius: 16px; padding: 7px 4px; cursor: pointer; display: grid; gap: 2px; place-items: center; }
.nav-button span { font-size: 1.25rem; }
.nav-button small { font-size: .69rem; font-weight: 750; }
.nav-button.active { color: #06111e; background: linear-gradient(135deg, var(--cyan), #77ffa9); box-shadow: 0 8px 22px rgba(71,217,255,.24); }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 18px; align-items: stretch; }
.hero-card, .panel, .game-card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(16,35,55,.92), rgba(7,20,34,.92)); box-shadow: var(--shadow); }
.hero-card { min-height: 430px; padding: clamp(22px, 5vw, 54px); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; }
.hero-card::after { content: ""; position: absolute; width: 420px; aspect-ratio: 1; border-radius: 50%; right: -170px; top: -190px; background: radial-gradient(circle, rgba(71,217,255,.24), transparent 65%); }
.eyebrow { color: var(--cyan); font-size: .78rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; margin: 0 0 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.45rem, 7vw, 5.9rem); line-height: .93; letter-spacing: -.065em; margin-bottom: 18px; max-width: 820px; }
h2 { font-size: clamp(1.55rem, 4vw, 2.5rem); letter-spacing: -.035em; }
h3 { letter-spacing: -.02em; }
.lead { color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.6; max-width: 700px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.primary-button, .secondary-button, .danger-button, .choice-button { border-radius: 15px; min-height: 48px; padding: 12px 17px; border: 1px solid transparent; cursor: pointer; font-weight: 850; }
.primary-button { color: #03111b; background: linear-gradient(135deg, var(--cyan), #8cffbc); box-shadow: 0 12px 30px rgba(71,217,255,.2); }
.secondary-button { color: var(--text); background: rgba(255,255,255,.065); border-color: var(--line); }
.danger-button { color: white; background: rgba(255,77,95,.14); border-color: rgba(255,77,95,.35); width: 100%; }
.primary-button:hover, .secondary-button:hover, .choice-button:hover { transform: translateY(-2px); filter: brightness(1.06); }

.car-showcase { padding: 18px; display: grid; grid-template-rows: minmax(265px, 1fr) auto; gap: 13px; }
.car-stage { border-radius: 18px; min-height: 280px; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 70%, rgba(71,217,255,.18), transparent 35%), linear-gradient(180deg, #13273b, #07111d 67%); perspective: 900px; }
.car-stage::before { content: ""; position: absolute; inset: 60% -10% -20%; background: repeating-linear-gradient(90deg, rgba(255,255,255,.14) 0 2px, transparent 2px 80px), linear-gradient(180deg, #203346, #0b1723); transform: rotateX(58deg); transform-origin: top; }
.car-model { --car: #ab1627; --stripe: #d4d8dc; position: absolute; left: 50%; top: 53%; width: min(80%, 410px); aspect-ratio: 2.2 / 1; transform: translate(-50%, -50%) rotateY(-12deg) rotateX(3deg); filter: drop-shadow(0 28px 24px rgba(0,0,0,.55)); transition: transform .35s ease; }
.car-stage:hover .car-model { transform: translate(-50%, -53%) rotateY(-5deg) rotateX(1deg) scale(1.025); }
.car-body { position: absolute; left: 5%; top: 34%; width: 90%; height: 39%; border-radius: 28% 17% 16% 22% / 42% 38% 35% 28%; background: linear-gradient(180deg, color-mix(in srgb, var(--car) 70%, white), var(--car) 45%, color-mix(in srgb, var(--car) 70%, black)); border: 2px solid rgba(255,255,255,.16); overflow: hidden; }
.car-body::before { content: ""; position: absolute; width: 46%; height: 70%; left: 25%; top: -38%; border-radius: 45% 45% 20% 20%; background: linear-gradient(160deg, #bfe9ff, #20374a 55%, #07111d); border: 5px solid color-mix(in srgb, var(--car) 65%, black); transform: skewX(-8deg); }
.car-body::after { content: ""; position: absolute; width: 54%; height: 100%; left: 23%; top: 0; background: linear-gradient(90deg, transparent 0 39%, var(--stripe) 39% 45%, transparent 45% 53%, var(--stripe) 53% 59%, transparent 59%); opacity: var(--stripeOpacity, .9); }
.car-nose { position: absolute; right: 0; top: 42%; width: 22%; height: 20%; border-radius: 8px 24px 9px 4px; background: color-mix(in srgb, var(--car) 68%, black); border-right: 7px solid rgba(210,245,255,.75); }
.wheel { position: absolute; top: 61%; width: 20%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #111 0 22%, #404a55 23% 33%, #060708 34% 64%, #161a1e 65% 72%, #050506 73%); box-shadow: inset 0 0 0 2px rgba(255,255,255,.1); }
.wheel.left { left: 16%; } .wheel.right { right: 14%; }
.car-glow { position: absolute; left: 12%; right: 12%; bottom: 10%; height: 15%; border-radius: 50%; background: rgba(71,217,255,.28); filter: blur(18px); }
.car-info-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.car-info-row p { margin: 0; color: var(--muted); }
.car-swatch-list { display: flex; flex-wrap: wrap; gap: 8px; }
.car-swatch { width: 44px; height: 44px; border-radius: 14px; border: 2px solid transparent; background: var(--swatch); cursor: pointer; position: relative; }
.car-swatch.locked::after { content: "🔒"; position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: rgba(0,0,0,.58); font-size: .85rem; }
.car-swatch.selected { border-color: white; box-shadow: 0 0 0 3px rgba(71,217,255,.35); }

.section-header { display: flex; justify-content: space-between; gap: 14px; align-items: end; margin: 4px 0 17px; }
.section-header p { color: var(--muted); margin-bottom: 0; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.game-card { min-height: 240px; padding: 20px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.game-card::before { content: ""; position: absolute; inset: 0; opacity: .19; background: radial-gradient(circle at 85% 15%, var(--accent), transparent 30%); }
.game-card > * { position: relative; z-index: 1; }
.game-icon { font-size: 2.4rem; margin-bottom: auto; }
.game-card p { color: var(--muted); line-height: 1.45; }
.game-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.difficulty-badge { color: var(--muted); font-size: .76rem; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; }

.panel { padding: clamp(18px, 3vw, 30px); }
.game-shell { display: grid; gap: 16px; max-width: 1050px; margin: 0 auto; }
.game-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-track { flex: 1; height: 13px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: var(--progress, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--lime)); transition: width .35s ease; }
.prompt-card { text-align: center; padding: clamp(22px,5vw,48px); border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.045); }
.prompt-card h2 { font-size: clamp(1.7rem, 5vw, 3rem); }
.prompt-card p { color: var(--muted); }
.answer-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.choice-button { min-height: 84px; color: var(--text); background: rgba(255,255,255,.07); border-color: var(--line); font-size: clamp(1.15rem,3vw,1.5rem); }
.choice-button.correct { background: rgba(98,217,150,.22); border-color: var(--green); }
.choice-button.wrong { background: rgba(255,77,95,.16); border-color: var(--red); animation: shake .3s ease; }
.feedback-box { min-height: 68px; padding: 13px 15px; border-radius: 15px; background: rgba(255,255,255,.05); color: var(--muted); display: flex; align-items: center; gap: 10px; }
.feedback-box strong { color: var(--text); }

.race-lane { position: relative; height: 190px; overflow: hidden; border-radius: 20px; background: linear-gradient(#12263a 0 42%, #34434d 42% 100%); border: 1px solid var(--line); }
.race-lane::before { content: ""; position: absolute; inset: 60% 0 auto; height: 7px; background: repeating-linear-gradient(90deg, white 0 50px, transparent 50px 95px); opacity: .72; }
.race-scenery { position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0 80%, rgba(255,255,255,.1) 80% 81%, transparent 81%); background-size: 180px 100%; animation: roadMove 1.1s linear infinite; opacity: .6; }
.racer { --x: 5%; position: absolute; left: var(--x); bottom: 25px; width: 142px; height: 58px; border-radius: 30px 35px 15px 16px; background: linear-gradient(180deg, color-mix(in srgb,var(--raceCar) 70%,white), var(--raceCar)); transition: left .65s cubic-bezier(.2,.8,.2,1); box-shadow: 0 18px 20px rgba(0,0,0,.38); }
.racer::before { content: ""; position: absolute; left: 38px; top: -18px; width: 66px; height: 30px; border-radius: 25px 35px 5px 5px; background: #173246; border: 4px solid var(--raceCar); }
.racer::after { content: ""; position: absolute; inset: 15px 14px auto auto; width: 22px; height: 8px; border-radius: 50%; background: #d7f8ff; box-shadow: -112px 0 0 #ff3f44; }
.racer-wheel { position: absolute; bottom: -9px; width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle,#65717c 0 24%,#08090a 25% 68%,#20252b 69%); animation: spin .4s linear infinite; }
.racer-wheel.one { left: 20px; } .racer-wheel.two { right: 19px; }
.finish-line { position: absolute; right: 22px; top: 42%; bottom: 0; width: 22px; background: conic-gradient(#fff 25%, #111 0 50%, #fff 0 75%, #111 0); background-size: 22px 22px; }

.simon-board { display: grid; grid-template-columns: repeat(2, minmax(110px, 230px)); gap: 13px; justify-content: center; }
.simon-pad { aspect-ratio: 1; border-radius: 30px; border: 4px solid rgba(255,255,255,.14); cursor: pointer; opacity: .72; box-shadow: inset 0 -14px 0 rgba(0,0,0,.2), 0 12px 30px rgba(0,0,0,.25); }
.simon-pad[data-pad="0"] { background: #00c76f; border-radius: 100% 28px 28px 28px; }
.simon-pad[data-pad="1"] { background: #ff4f55; border-radius: 28px 100% 28px 28px; }
.simon-pad[data-pad="2"] { background: #ffd53e; border-radius: 28px 28px 28px 100%; }
.simon-pad[data-pad="3"] { background: #3b8cff; border-radius: 28px 28px 100% 28px; }
.simon-pad.active { opacity: 1; transform: scale(1.04); filter: brightness(1.45); box-shadow: 0 0 35px currentColor, inset 0 -7px 0 rgba(0,0,0,.12); }

.memory-grid { display: grid; grid-template-columns: repeat(4, minmax(65px, 1fr)); gap: 10px; }
.memory-card { aspect-ratio: 1; perspective: 700px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.memory-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .42s ease; }
.memory-card.flipped .memory-inner, .memory-card.matched .memory-inner { transform: rotateY(180deg); }
.memory-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px; backface-visibility: hidden; border: 1px solid var(--line); font-size: clamp(1.5rem,5vw,2.8rem); }
.memory-front { background: linear-gradient(145deg,#142d45,#091828); }
.memory-front::after { content: "TT"; color: var(--cyan); font-weight: 950; letter-spacing: -.08em; }
.memory-back { transform: rotateY(180deg); background: rgba(255,255,255,.08); }
.memory-card.matched .memory-back { border-color: var(--green); box-shadow: inset 0 0 0 3px rgba(98,217,150,.15); }

.route-map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; background: #0b1826; border-radius: 20px; padding: 12px; border: 1px solid var(--line); }
.route-cell { min-height: 62px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.07); font-size: 1.5rem; }
.route-cell.road { background: #34424d; }
.route-cell.start { background: rgba(71,217,255,.22); }
.route-cell.goal { background: rgba(184,255,89,.2); }
.route-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }

.rhythm-pads { display: grid; grid-template-columns: repeat(4,minmax(70px,1fr)); gap: 10px; }
.rhythm-pad { min-height: 110px; border: 0; border-radius: 17px; color: #02111b; font-weight: 950; font-size: 1.25rem; cursor: pointer; background: var(--pad); box-shadow: inset 0 -11px 0 rgba(0,0,0,.18); }
.rhythm-pad.hit { transform: translateY(7px) scale(.98); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 0 26px var(--pad); }
.beat-strip { display: grid; grid-template-columns: repeat(8,1fr); gap: 5px; }
.beat-dot { aspect-ratio: 1; border-radius: 7px; background: rgba(255,255,255,.07); }
.beat-dot.on { background: var(--yellow); box-shadow: 0 0 13px rgba(255,212,77,.5); }

.town-wrap { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 16px; }
.town-canvas-wrap { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: #79c9ea; min-height: 520px; }
#townCanvas { width: 100%; height: 100%; min-height: 520px; display: block; touch-action: none; }
.town-hud { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.town-hud > * { pointer-events: auto; }
.town-tip { max-width: 420px; padding: 10px 12px; border-radius: 13px; background: rgba(5,11,20,.76); backdrop-filter: blur(12px); color: white; font-size: .85rem; }
.joystick { width: 130px; height: 130px; border-radius: 50%; position: absolute; left: 18px; bottom: 18px; background: rgba(5,11,20,.34); border: 2px solid rgba(255,255,255,.28); touch-action: none; }
.joystick-knob { width: 58px; height: 58px; border-radius: 50%; position: absolute; left: 35px; top: 35px; background: rgba(255,255,255,.76); box-shadow: 0 7px 22px rgba(0,0,0,.35); }
.action-button { width: 82px; height: 82px; position: absolute; right: 23px; bottom: 30px; border-radius: 50%; border: 3px solid rgba(255,255,255,.42); color: white; background: rgba(51,136,255,.72); font-weight: 900; cursor: pointer; }
.town-sidebar { display: grid; align-content: start; gap: 12px; }
.quest-card { padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.05); }
.quest-card p, .quest-card small { color: var(--muted); }
.quest-card.complete { border-color: var(--green); }

.studio-room { min-height: 510px; position: relative; overflow: hidden; border-radius: 22px; border: 1px solid var(--line); background: linear-gradient(#233852 0 63%, #775b42 63% 100%); perspective: 900px; }
.studio-desk { position: absolute; left: 50%; bottom: 90px; width: min(80%,650px); height: 125px; transform: translateX(-50%) rotateX(10deg); border-radius: 10px; background: linear-gradient(#8a674a,#3a281b); box-shadow: 0 25px 35px rgba(0,0,0,.4); }
.monitor-speaker { position: absolute; bottom: 170px; width: 115px; height: 175px; border-radius: 10px; background: linear-gradient(145deg,#fff,#cfd4d9); border: 3px solid #e8edf1; box-shadow: 0 20px 35px rgba(0,0,0,.35); }
.monitor-speaker.left { left: 12%; } .monitor-speaker.right { right: 12%; }
.monitor-speaker::before, .monitor-speaker::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle,#151a1e 0 23%,#f2f5f7 24% 34%,#111820 35% 65%,#242b31 66%); }
.monitor-speaker::before { width: 78px; height: 78px; bottom: 25px; }
.monitor-speaker::after { width: 34px; height: 34px; top: 22px; }
.monitor-speaker.pumping::before { animation: speakerPump .23s infinite alternate ease-in-out; }
.mpc { position: absolute; left: 50%; bottom: 165px; width: 230px; height: 140px; transform: translateX(-50%) rotateX(48deg); transform-origin: bottom; border-radius: 14px; background: #2a3138; border: 3px solid #59636d; display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; padding: 18px; }
.mpc button { border: 0; border-radius: 7px; background: var(--pad); cursor: pointer; box-shadow: inset 0 -5px 0 rgba(0,0,0,.22); }
.mpc button:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.22); }
.keyboard { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); width: min(82%,660px); height: 86px; background: #0a0c0f; display: flex; gap: 2px; padding: 6px; border-radius: 11px; }
.key { flex: 1; border: 0; border-radius: 3px 3px 7px 7px; background: #f1f3f5; cursor: pointer; position: relative; }
.key.black { background: #15191e; height: 58%; margin-left: -3%; margin-right: -3%; z-index: 2; flex: .65; border: 1px solid #333; }
.studio-title { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); text-align: center; }
.studio-title p { color: #c7d3df; }

.music-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(300px,.65fr); gap: 15px; }
.upload-zone { border: 2px dashed rgba(71,217,255,.36); border-radius: 20px; min-height: 230px; padding: 24px; display: grid; place-items: center; text-align: center; background: rgba(71,217,255,.04); }
.upload-zone input { max-width: 100%; }
.now-playing { display: grid; gap: 14px; }
.visualizer { height: 160px; display: flex; align-items: end; justify-content: center; gap: 5px; padding: 20px; background: #07111c; border-radius: 17px; overflow: hidden; }
.visualizer span { width: 9px; height: var(--h); min-height: 6px; border-radius: 999px; background: linear-gradient(var(--cyan),var(--purple)); animation: visualizer 1s ease-in-out infinite alternate; animation-delay: var(--delay); transform-origin: bottom; }

.trophy-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; }
.trophy { min-height: 160px; border-radius: 18px; padding: 15px; display: grid; align-content: space-between; border: 1px solid var(--line); background: rgba(255,255,255,.045); }
.trophy.locked { opacity: .48; filter: grayscale(.7); }
.trophy .badge { font-size: 2.2rem; }
.trophy p { color: var(--muted); font-size: .82rem; margin-bottom: 0; }

.settings-dialog { border: 0; padding: 0; color: var(--text); background: transparent; width: min(680px, calc(100% - 24px)); }
.settings-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.dialog-card { padding: 22px; border-radius: 24px; border: 1px solid var(--line); background: var(--panel-strong); box-shadow: var(--shadow); }
.dialog-title-row { display: flex; align-items: start; justify-content: space-between; }
.setting-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); }
.setting-row span small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.setting-row input[type="checkbox"] { width: 27px; height: 27px; accent-color: var(--cyan); }
.setting-row input[type="range"] { width: min(220px,34vw); accent-color: var(--cyan); }
.setting-row select { color: var(--text); background: #10253a; border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.privacy-note { color: var(--muted); font-size: .78rem; line-height: 1.45; margin: 14px 0 0; }
.toast { position: fixed; left: 50%; bottom: calc(98px + env(safe-area-inset-bottom)); transform: translate(-50%,20px); background: #f4fbff; color: #06111c; border-radius: 14px; padding: 12px 16px; font-weight: 800; z-index: 80; opacity: 0; pointer-events: none; transition: .3s ease; box-shadow: 0 15px 35px rgba(0,0,0,.35); text-align: center; max-width: calc(100% - 36px); }
.toast.show { opacity: 1; transform: translate(-50%,0); }

.calm * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .12s !important; }
.calm .race-scenery, .calm .visualizer span { animation: none !important; }

@keyframes roadMove { to { background-position: -180px 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 25%{transform:translateX(-7px)} 50%{transform:translateX(7px)} 75%{transform:translateX(-4px)} }
@keyframes speakerPump { to { transform: translateX(-50%) scale(1.12); filter: drop-shadow(0 0 15px rgba(71,217,255,.5)); } }
@keyframes visualizer { from{transform:scaleY(.35)} to{transform:scaleY(1)} }

@media (max-width: 980px) {
  .hero-grid, .music-layout, .town-wrap { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .town-sidebar { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 680px) {
  .app-shell { padding-left: 9px; padding-right: 9px; }
  .topbar { grid-template-columns: 42px minmax(0,1fr) 42px; }
  .topbar .status-strip { position: absolute; top: 72px; left: 8px; right: 8px; justify-content: center; pointer-events: none; }
  .topbar .status-strip span { background: rgba(5,11,20,.78); backdrop-filter: blur(10px); }
  .screen { padding-top: 58px; }
  .brand-mark { display: none; }
  .game-grid, .trophy-grid { grid-template-columns: 1fr; }
  .game-card { min-height: 200px; }
  .hero-card { min-height: 390px; }
  .car-showcase { min-height: 410px; }
  .answer-grid, .route-options { grid-template-columns: 1fr; }
  .memory-grid { grid-template-columns: repeat(4,1fr); gap: 7px; }
  .rhythm-pads { grid-template-columns: repeat(2,1fr); }
  .town-sidebar { grid-template-columns: 1fr; }
  .bottom-nav { width: calc(100% - 14px); bottom: calc(6px + env(safe-area-inset-bottom)); }
  .nav-button small { font-size: .62rem; }
  .monitor-speaker { transform: scale(.72); transform-origin: bottom; }
  .monitor-speaker.left { left: 1%; } .monitor-speaker.right { right: 1%; }
  .mpc { width: 200px; }
}

@media (max-width: 430px) {
  h1 { font-size: 2.65rem; }
  .car-stage { min-height: 245px; }
  .simon-board { grid-template-columns: repeat(2,minmax(105px,1fr)); }
  .memory-grid { grid-template-columns: repeat(3,1fr); }
  .status-strip span { min-width: 48px; }
}
