/* Sol Kart: full-screen 3D kart racer. Brand tokens shared with Sol Sprint / Sol Leap; HUD is bold and outlined so it
   reads over bright and dark districts alike. */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-latin-wght-v6.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #0B0420; --panel: rgba(16, 8, 36, .82); --line: rgba(255, 255, 255, .16); --text: #F4F0FF; --muted: #B9AEDB;
  --purple: #9945FF; --green: #14F195; --pink: #FF3EA5; --cyan: #2EE6FF; --gold: #FFC93A;
  --grad: linear-gradient(90deg, #9945FF, #14F195);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --outline: 0 2px 0 rgba(11, 4, 32, .9), 0 0 2px rgba(11, 4, 32, .9), 2px 0 0 rgba(11, 4, 32, .9), -2px 0 0 rgba(11, 4, 32, .9), 0 -2px 0 rgba(11, 4, 32, .9);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- shared ---------- */
.screen { position: absolute; inset: 0; z-index: 10; padding: calc(14px + var(--sat)) calc(14px + var(--sar)) calc(14px + var(--sab)) calc(14px + var(--sal)); }
.screen.dim { display: grid; place-items: center; background: rgba(5, 2, 15, .55); z-index: 40; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.card { width: min(440px, 100%); max-height: calc(100dvh - 28px - var(--sat) - var(--sab)); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.card.wide { width: min(520px, 100%); }
.card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.menu { display: grid; gap: 10px; text-align: center; }
.btn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .07); font-weight: 800; font-size: 16px; color: var(--text); text-decoration: none; transition: transform .08s, background .15s; }
.btn:hover { background: rgba(255, 255, 255, .12); }
.btn:active { transform: scale(.97); }
.btn.big, #btn-resume, #btn-again, #btn-help-close { background: var(--grad); border: 0; color: #0B0420; font-weight: 900; font-size: 18px; letter-spacing: .04em; box-shadow: 0 8px 30px rgba(153, 69, 255, .35); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 40px; font-size: 14px; }
.icon { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; font-size: 18px; font-weight: 800; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.icon[aria-pressed="false"] { opacity: .5; }
.chip { display: inline-flex; align-items: center; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 700; text-decoration: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tools { display: flex; gap: 8px; }
.row-opt { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); font-size: 15px; }
.row-opt input { width: 20px; height: 20px; accent-color: var(--green); }

/* ---------- loading ---------- */
#loading { display: grid; place-content: center; justify-items: center; gap: 18px; background: radial-gradient(circle at 50% 40%, #2A0F5A, var(--bg) 70%); z-index: 60; }
.logo, .title-block h1 { font-weight: 900; font-size: clamp(44px, 10vw, 84px); letter-spacing: .02em; line-height: .95; margin: 0; text-shadow: 0 6px 30px rgba(153, 69, 255, .6); font-style: italic; }
.logo b, .title-block h1 b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar { width: min(280px, 70vw); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
#load-msg { color: var(--muted); margin: 0; }

/* ---------- title ---------- */
#title { display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
#title > * { pointer-events: auto; }
.title-block { text-align: center; margin-top: 2vh; pointer-events: none !important; }
.tag { margin: 8px 0 0; color: var(--text); font-weight: 600; text-shadow: var(--outline); font-size: clamp(13px, 2.4vw, 16px); }
.bottom-panel { width: min(460px, 100%); margin: 0 auto; display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.picker { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 8px; }
.arrow { height: 52px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); font-size: 30px; font-weight: 700; line-height: 1; }
.who { text-align: center; }
.who h2 { margin: 2px 0; font-size: 26px; font-weight: 900; }
.who span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); align-items: center; }
.stats dd { margin: 0; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.stats dd i { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .25s; }

body.wide #title { justify-content: center; align-items: flex-start; }
body.wide #title .top-row { position: absolute; top: calc(14px + var(--sat)); left: calc(14px + var(--sal)); right: calc(14px + var(--sar)); }
body.wide .title-block { text-align: left; margin: 0 0 18px 2vw; }
body.wide .bottom-panel { margin: 0 0 0 2vw; width: min(400px, 44vw); }

/* ---------- tracks ---------- */
:is(#tracks, #challenges) .track-wrap { width: min(760px, 100%); min-height: 0; max-height: 100%; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; display: grid; gap: 14px; padding: 18px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
:is(#tracks, #challenges) { align-content: start; justify-items: center; grid-template-rows: auto minmax(0, 1fr); place-items: start center; }
:is(#tracks, #challenges) .top-row { width: 100%; margin-bottom: 10px; }
.sec { margin: 0; font-size: 20px; font-weight: 900; }
.track-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.tcard { display: grid; gap: 6px; text-align: left; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: rgba(255, 255, 255, .04); }
.tcard[aria-pressed="true"] { border-color: var(--green); background: rgba(20, 241, 149, .08); box-shadow: 0 0 0 3px rgba(20, 241, 149, .15); }
.tcard canvas { width: 100%; height: 90px; border-radius: 10px; background: rgba(0, 0, 0, .25); }
.tcard b { font-size: 17px; font-weight: 900; }
.tcard span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.tcard em { font-style: normal; font-size: 12px; color: var(--gold); font-weight: 700; }
.opts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.seg { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); }
.seg-label { font-size: 12px; font-weight: 800; color: var(--muted); padding: 0 6px 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--grad); color: #0B0420; }
.seg.small { justify-self: center; }
body:not(.touch) .touch-only { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; font-weight: 900; }
#hud > * { position: absolute; }
.h-place { top: calc(10px + var(--sat)); left: calc(14px + var(--sal)); text-shadow: var(--outline); line-height: 1; }
.h-place b { font-size: clamp(46px, 9vw, 72px); font-style: italic; }
.h-place sup { font-size: clamp(18px, 3.4vw, 26px); vertical-align: top; margin-left: 2px; }
.h-place span { display: block; font-size: 15px; color: var(--muted); margin-top: -2px; }
.h-place.p1 b, .h-place.p1 sup { color: var(--gold); }
.h-item { top: calc(10px + var(--sat)); left: 50%; transform: translateX(-50%); width: 74px; height: 74px; border-radius: 18px; border: 3px solid rgba(255, 255, 255, .85); background: rgba(16, 8, 36, .6); padding: 0; pointer-events: auto; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.h-item canvas { width: 100%; height: 100%; display: block; }
.h-item em { position: absolute; right: -6px; bottom: -6px; min-width: 24px; height: 24px; border-radius: 99px; background: var(--gold); color: #0B0420; font-style: normal; font-size: 14px; display: grid; place-items: center; }
.h-item em:empty { display: none; }
.h-item.ready { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 241, 149, .35), 0 6px 18px rgba(0, 0, 0, .35); }
.h-right { top: calc(10px + var(--sat)); right: calc(68px + var(--sar)); text-align: right; text-shadow: var(--outline); }
.h-lap { font-size: clamp(20px, 3.6vw, 28px); font-style: italic; }
.h-lap b { color: var(--green); }
.h-time { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--text); }
.pause-btn { top: calc(10px + var(--sat)); right: calc(12px + var(--sar)); pointer-events: auto; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(16, 8, 36, .7); }   /* no blur over the live 3D view: it forces a full re-composite every frame */
#minimap { right: calc(12px + var(--sar)); bottom: calc(12px + var(--sab)); width: 132px; height: 132px; opacity: .92; }
body.touch #minimap { top: calc(84px + var(--sat)); bottom: auto; width: 104px; height: 104px; }
#count { top: 30%; left: 0; right: 0; text-align: center; font-size: clamp(80px, 18vw, 160px); font-style: italic; text-shadow: var(--outline), 0 10px 40px rgba(153, 69, 255, .7); opacity: 0; transform: scale(.6); transition: opacity .12s, transform .25s cubic-bezier(.2, 1.6, .4, 1); }
#count.show { opacity: 1; transform: scale(1); }
#count.go { color: var(--green); }
#banner { top: 22%; left: 0; right: 0; text-align: center; font-size: clamp(34px, 7vw, 64px); font-style: italic; text-shadow: var(--outline); opacity: 0; transition: opacity .2s, transform .3s; transform: translateY(10px); }
#banner.show { opacity: 1; transform: none; }
#banner.gold { color: var(--gold); }
#toast { bottom: calc(26% + var(--sab)); left: 0; right: 0; text-align: center; font-size: clamp(16px, 3vw, 22px); text-shadow: var(--outline); opacity: 0; z-index: 2; transition: opacity .2s; }
#toast.show { opacity: 1; }
#wrong { top: 40%; left: 0; right: 0; text-align: center; font-size: clamp(30px, 6vw, 52px); color: #FF3B4E; font-style: italic; text-shadow: var(--outline); display: none; }
#wrong.show { display: block; animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
#drift-meter { left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--sab)); width: 150px; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .35); overflow: hidden; opacity: 0; transition: opacity .15s; }
#drift-meter.show { opacity: 1; }
#drift-meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: #5AB8FF; }
body.touch #drift-meter { bottom: calc(150px + var(--sab)); }

/* ---------- touch controls ---------- */
#zone { position: absolute; inset: 0; z-index: 15; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#fx-touch { position: absolute; inset: 0; z-index: 16; pointer-events: none; }
.ripple { position: absolute; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; border: 3px solid var(--green); animation: ripple .45s ease-out forwards; }
.ripple.jump { border-color: var(--cyan); }
@keyframes ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* ---------- results / help ---------- */
.res-sub { margin-bottom: 4px !important; }
.podium { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; text-align: left; }
.podium li { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-weight: 700; font-size: 15px; }
.podium li b { font-style: italic; font-size: 18px; }
.podium li.me { background: rgba(20, 241, 149, .16); outline: 1px solid rgba(20, 241, 149, .5); }
.podium li span.t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13.5px; }
.podium li:nth-child(1) b { color: var(--gold); }
.res-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 6px; }
.help table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.help th { padding: 6px 8px 6px 0; color: var(--green); white-space: nowrap; vertical-align: top; }
.help td { padding: 6px 0; color: var(--text); }
.help p { text-align: left; font-size: 14px; }
.items-help { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: left; font-size: 12.5px; color: var(--muted); }
.items-help li { display: flex; gap: 8px; align-items: center; }
.items-help img { width: 30px; height: 30px; flex: none; }
.items-help b { color: var(--text); display: block; font-size: 13px; }
@media (max-width: 520px) { .res-btns { grid-template-columns: 1fr; } .items-help { grid-template-columns: 1fr; } }
@media (max-height: 520px) { .title-block { margin-top: 0; } .title-block h1 { font-size: 40px; } .tag { display: none; } .bottom-panel { padding: 10px; gap: 6px; } .stats { display: none; } }

.seg button.locked { opacity: .5; }
.seg button.locked::after { content: ' \1F512'; font-size: 9px; }
.track-list.gp .tcard { opacity: 1; }
.mtoast { position: absolute; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); z-index: 60; max-width: 86vw; padding: 10px 16px; border-radius: 12px; background: rgba(16, 8, 36, .94); border: 1px solid var(--gold); font-weight: 800; font-size: 14px; text-align: center; }

body.shotmode .screen { display: none !important; }

.cup-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.cup-head b { font-size: 16px; font-weight: 900; }
.cup-head span { font-size: 12px; color: var(--muted); font-weight: 700; }
.cup-head.soon { opacity: .55; }
#ink { inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s; }
#ink.show { opacity: .86; transition: opacity .1s; }
#ink { z-index: 1; }
#ink i { position: absolute; width: var(--sz); height: var(--sz); margin: calc(var(--sz) / -2) 0 0 calc(var(--sz) / -2); border-radius: 46% 54% 42% 58% / 55% 45% 55% 45%; background: radial-gradient(circle at 40% 40%, #3A2A66, #120A26 70%); box-shadow: 0 0 0 10px rgba(18, 10, 38, .55), 22px 18px 0 -12px #120A26, -26px -14px 0 -16px #120A26; }

.seg.dim { opacity: .45; }

/* ---- phase 3: coins, challenges, garage, goal HUD */
.chip.coins { color: #FFE066; font-weight: 900; }
.title-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.title-row .btn em { font-style: normal; color: #FFE066; font-size: 12px; margin-left: 4px; }
.sec-sub { margin: -4px 0 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.chal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.chal-list .cup-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.chal-card { text-align: left; padding: 10px 12px; border-radius: 14px; background: rgba(22, 10, 46, .82); border: 1px solid rgba(255, 255, 255, .14); color: #fff; display: grid; gap: 3px; cursor: pointer; font: inherit; }
.chal-card b { font-size: 15px; font-weight: 900; }
.chal-card span { font-size: 12px; color: var(--muted); }
.chal-card .st { color: #FFE066; font-size: 16px; letter-spacing: 2px; }
.chal-card.boss { border-color: #FFC93A; background: linear-gradient(135deg, rgba(90, 40, 10, .9), rgba(40, 14, 60, .9)); }
.chal-card.locked { opacity: .45; }
.chal-card:hover:not(.locked) { border-color: #14F195; }
#garage { pointer-events: none; }
#garage > * { pointer-events: auto; }
.garage-panel { position: absolute; left: 16px; top: 64px; bottom: 16px; width: min(420px, calc(100% - 32px)); overflow: auto; padding: 14px; border-radius: 18px; background: rgba(16, 8, 36, .9); border: 1px solid rgba(255, 255, 255, .14); }
.garage-panel small { font-size: 13px; color: var(--muted); font-weight: 700; }
.g-tabs { display: flex; gap: 6px; margin: 6px 0 10px; }
.g-tabs button { flex: 1; padding: 8px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.g-tabs button[aria-pressed="true"] { background: var(--grad); color: #0B0420; border: 0; }
.g-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.g-item { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; border: 2px solid transparent; background: rgba(255, 255, 255, .06); color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.g-item i { width: 42px; height: 42px; border-radius: 50%; display: block; border: 2px solid rgba(255, 255, 255, .5); background-size: cover; }
.g-item em { font-style: normal; font-size: 11px; color: #FFE066; }
.g-item.on { border-color: #14F195; }
.g-item.sel { border-color: #FFE066; }
.g-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; min-height: 44px; font-weight: 800; }
.g-note { font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.h-goal { margin-top: 4px; padding: 3px 9px; border-radius: 10px; background: rgba(16, 8, 36, .72); font-weight: 900; font-size: clamp(13px, 2.4vw, 17px); text-shadow: var(--outline); white-space: nowrap; }
.h-goal.warn { color: #FF6A6A; }
.h-goal.good { color: #14F195; }
@media (max-width: 760px) { .garage-panel { top: auto; height: 52%; right: 16px; left: 16px; width: auto; } }

.st-off { opacity: .28; }
.selection-row { margin-top: 0; }
.vehicle-choice { margin: 0; text-align: center; color: var(--muted); font-size: 12px; }
.driver-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
#drivers { pointer-events: none; }
#drivers > * { pointer-events: auto; }
.driver-panel { position: absolute; left: calc(16px + var(--sal)); top: calc(64px + var(--sat)); bottom: calc(16px + var(--sab)); width: min(420px, 40vw); overflow: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: rgba(16,8,36,.94); }
.driver-panel h2 { margin-bottom: 12px; }
.driver-panel .driver-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
#driver-preview-name { max-width: calc(100% - 110px); height: auto; min-height: 44px; font-size: 13px; text-align: right; }
body:not(.wide) .driver-panel { top: auto; height: 52%; right: calc(16px + var(--sar)); width: auto; }
.driver-card { display: grid; gap: 5px; padding: 10px; text-align: left; border: 2px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.04); }
.driver-card[aria-pressed="true"] { border-color: var(--green); background: rgba(20,241,149,.08); }
.driver-card img, .car-grid img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; }
.driver-card span { color: var(--muted); font-size: 12px; }
.driver-card em { color: var(--green); font-size: 12px; font-style: normal; }
.car-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.car-grid .g-item { padding: 8px; justify-items: stretch; text-align: left; }
.car-grid .g-item span { color: var(--muted); font-size: 11px; }
.g-foot { position: sticky; bottom: -14px; z-index: 1; padding: 10px 0; background: #100824; }
.g-foot .btn { flex-shrink: 0; }
.g-item:disabled, .g-foot .btn:disabled { opacity: .45; cursor: default; }
@media (max-height: 650px) { #title .bottom-panel { gap: 5px; padding: 9px; } #title .stats { display: none; } }
@media (max-width: 360px) { .driver-list { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-foot { flex-wrap: wrap; } }
@media (max-height: 520px) and (min-aspect-ratio: 5/4) { #title .title-block { display: none; } }

.journey-status{font-size:12px;color:#d9cdf2;text-align:center;margin:0 0 8px;max-width:100%;line-height:1.4}
.effects-hud{position:absolute;top:135px;left:18px;color:#a5f5ef;font-size:11px;max-width:145px;pointer-events:none}
@media(max-width:600px){.journey-status{font-size:10px}.effects-hud{top:115px;left:12px;font-size:10px}}

.energy-hud{position:absolute;top:100px;left:50%;transform:translateX(-50%);width:112px;height:22px;border:1px solid #70f8bf;border-radius:7px;background:#111a30;overflow:hidden;pointer-events:none}.energy-hud i{position:absolute;inset:0 auto 0 0;background:#256a59}.energy-hud b{position:relative;display:block;text-align:center;line-height:20px;color:#edfff8;font-size:10px}

.effects-hud{width:145px;max-width:calc(50vw - 80px);line-height:1.4}

.effects-hud:not(:empty){background:rgba(16,8,36,.8);padding:5px 7px;border-radius:7px}

/* Reserve a real preview region instead of placing the kart behind the menu. */
body:not(.wide) #title { justify-content: flex-start; gap: 8px; }
body:not(.wide) #title .title-block { margin: 2px 0 0; }
body:not(.wide) #title .title-block h1 { font-size: clamp(30px,8vw,44px); }
body:not(.wide) #title .tag { display: none; }
#title-preview { flex: 1; min-height: 0; pointer-events: none; }
body.wide #title-preview { display: none; }
body:not(.wide) #title .top-row, body:not(.wide) #title .bottom-panel { flex-shrink: 0; }
body:not(.wide) #title .bottom-panel { gap: 7px; padding: 10px; }
body.touch:not(.wide) #title .journey-status { display: none; }
body:not(.wide) .garage-panel { top: auto; height: 52%; right: calc(16px + var(--sar)); left: calc(16px + var(--sal)); bottom: calc(16px + var(--sab)); width: auto; }
body.wide .garage-panel { width: min(420px,40vw); }
@media (max-height:650px) and (max-aspect-ratio:5/4) {
  #title .bottom-panel { gap:4px; padding:8px; }
  #title .who h2 { font-size:21px; }
  #title .picker { grid-template-columns:44px 1fr 44px; }
  #title .arrow { height:44px; }
  #title .btn { min-height:40px; padding:7px 10px; font-size:14px; }
}
@media (max-height:520px) and (min-aspect-ratio:5/4) {
  body.touch #title .bottom-panel { max-height:calc(100dvh - 78px - var(--sat) - var(--sab)); overflow:auto; overscroll-behavior:contain; touch-action:pan-y; }
  body.touch #title .journey-status { display:none; }
}
/* Compact edge HUD; the item slot is an indicator on touch devices. */
body.touch .h-place b { font-size:40px; }
body.touch .h-place sup { font-size:15px; }
body.touch .h-place span { font-size:12px; }
body.touch .h-item { width:48px; height:48px; border-width:2px; border-radius:12px; pointer-events:none; }
body.touch .h-item em { min-width:18px; height:18px; font-size:11px; }
body.touch .h-right { right:calc(66px + var(--sar)); }
body.touch .h-lap { font-size:18px; }
body.touch .h-time { font-size:12px; }
body.touch #minimap { top:calc(68px + var(--sat)); right:calc(10px + var(--sar)); width:76px; height:76px; }
body.touch #drift-meter { bottom:calc(14px + var(--sab)); width:110px; height:5px; }
body.touch .energy-hud { top:calc(66px + var(--sat)); width:80px; height:17px; }
body.touch .energy-hud b { font-size:9px; line-height:15px; }
body.touch .effects-hud { top:calc(80px + var(--sat)); left:calc(12px + var(--sal)); max-width:100px; font-size:9px; }
body.touch #toast { top:calc(150px + var(--sat)); bottom:auto; padding:0 12px; font-size:13px; }
body.touch .h-goal { white-space:normal; max-width:100px; font-size:11px; }
#tutorial { z-index:50; }
.tutorial-card { display:grid; gap:14px; text-align:left; background:rgba(16,8,36,.97); }
.tutorial-eyebrow { color:var(--green); font-size:11px; font-weight:800; letter-spacing:.12em; }
.tutorial-controls { display:grid; gap:0; margin:0; }
.tutorial-controls > div { display:flex; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.tutorial-controls dt { font-size:14px; font-weight:750; }
.tutorial-controls dd { margin:0; font-size:13px; color:var(--muted); text-align:right; }
.tutorial-countdown { font-size:12px!important; }
@media(max-height:520px) { .tutorial-card { gap:8px; padding:14px; }.tutorial-controls { grid-template-columns:1fr 1fr; column-gap:18px; }.tutorial-controls > div { padding:7px 0; }.tutorial-controls dt,.tutorial-controls dd { font-size:12px; } }

/* Collected items stay legible against every district, including dark icons. */
.h-item { background:#f0f3ff; }
.h-item.collecting { border-color:var(--gold); }
#h-item-label { position:absolute;top:calc(100% + 7px);left:50%;transform:translateX(-50%);width:104px;text-align:center;font-size:10px;line-height:1.2;color:#fff;text-shadow:var(--outline);font-weight:850; }
.sr-only { position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
body.touch .h-item { width:56px;height:56px;background:#f0f3ff; }
body.touch #h-item-label { width:100px;font-size:10px; }
body.touch .energy-hud { top:calc(100px + var(--sat)); }

body:not(.touch) .energy-hud { top:calc(118px + var(--sat)); }

/* Track selection scrolls across one strip; the settings and race action stay in view. */
#tracks .track-wrap { width:min(1000px,100%); overflow:hidden; touch-action:auto; grid-template-rows:auto minmax(0,1fr) auto auto; gap:10px; padding:14px; }
.track-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.track-arrows { display:flex; gap:6px; }
.track-arrows .chip { min-width:38px; min-height:36px; padding:2px 10px; font-size:24px; }
#tracks .track-list { display:grid; grid-auto-flow:column; grid-auto-columns:230px; grid-template-columns:none; gap:12px; overflow-x:auto; overflow-y:hidden; min-width:0; min-height:0; padding:4px 4px 10px; scroll-snap-type:x proximity; scroll-padding:4px; overscroll-behavior-x:contain; touch-action:pan-x; scrollbar-width:thin; scrollbar-color:var(--purple) transparent; }
#tracks .tcard { align-content:start; min-width:0; scroll-snap-align:start; gap:5px; }
#tracks .tcard .track-cup { color:var(--cyan); font-size:11px; font-weight:800; }
#tracks .tcard span:not(.track-cup) { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
#tracks .tcard small { color:var(--muted); font-size:10px; }
#tracks .opts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
#tracks .seg { min-width:0; display:flex; flex-wrap:wrap; justify-content:center; gap:2px; padding:4px; }
#tracks #seg-mode { grid-column:1/-1; }
#tracks .seg-label { flex-basis:100%; text-align:center; padding:0 2px; font-size:10px; }
#tracks .seg button { flex:1; min-width:0; min-height:36px; padding:0 5px; font-size:12px; white-space:nowrap; }
.race-start { display:grid; gap:5px; text-align:center; }
#track-selected { font-size:12px; color:var(--cyan); font-weight:800; }
@media(max-height:700px) {
 #tracks .track-wrap { gap:7px; padding:10px; }
 #tracks .tcard { padding:8px; gap:4px; }
 #tracks .tcard canvas { height:54px; }
 #tracks .tcard b { font-size:15px; }
 #tracks .tcard span,#tracks .tcard em { font-size:11px; }
 #tracks .seg button { min-height:30px; font-size:10px; padding:0 2px; }
 #tracks .seg { padding:3px; }
 #tracks .opts { gap:4px; }
 #tracks .race-start .btn { min-height:40px; padding:7px 10px; font-size:16px; }
}
@media(max-height:520px) and (min-width:600px) {
 #tracks .track-wrap { grid-template-columns:minmax(0,1fr) minmax(0,1.2fr); grid-template-rows:auto minmax(0,1fr) auto; width:100%; height:100%; }
 #tracks .track-heading { grid-column:1; grid-row:1; }
 #tracks .track-list { grid-column:1; grid-row:2/4; grid-auto-columns:min(230px,90%); }
 #tracks .opts { grid-column:2; grid-row:1/3; align-content:start; }
 #tracks .race-start { grid-column:2; grid-row:3; }
 #tracks .tcard canvas { height:72px; }
}

/* Audio settings are in temporary menus, never over the racing surface. */
.audio-controls { min-width:0; margin:0; padding:12px; display:grid; gap:8px; border:1px solid var(--line); border-radius:12px; text-align:left; }
.audio-controls legend { font-size:13px; font-weight:800; color:var(--cyan); padding:0 5px; }
.audio-toggles { display:flex; flex-wrap:wrap; gap:12px; font-size:12px; }
.audio-toggles label { display:flex; align-items:center; min-height:28px; gap:5px; }
.audio-level { display:grid; grid-template-columns:48px minmax(0,1fr) 36px; align-items:center; gap:8px; font-size:12px; font-weight:700; }
.audio-level input { width:100%; min-width:0; height:32px; margin:0; accent-color:var(--green); }
.audio-level output { text-align:right; font-variant-numeric:tabular-nums; color:var(--muted); }
.audio-controls .btn { min-height:32px; padding:4px 8px; font-size:12px; }
.audio-controls .btn:disabled { opacity:.45; cursor:default; }
