:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101a17;
  color: #f4f5ec;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #9eada3;
  --line: rgba(228, 241, 226, .11);
  --lime: #c6f279;
  --panel: rgba(16, 26, 23, .76);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; background: radial-gradient(ellipse at 78% 3%, #273b32 0, #101a17 42rem); }
body.is-prelaunch { background: #000; overflow: hidden; }
button, select { font: inherit; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.app-shell { width: min(1240px, calc(100% - 36px)); margin: 0 auto; padding: 14px 0 14px; overflow-anchor: none; transition: opacity .22s ease; }
body.is-prelaunch .app-shell { opacity: 0; visibility: hidden; pointer-events: none; }
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; padding-bottom: 12px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--lime); color: #152018; font-weight: 900; letter-spacing: -.08em; }
.eyebrow { margin: 0 0 4px; color: var(--lime); font-size: 11px; font-weight: 750; letter-spacing: .17em; }
h1 { margin: 0; font-size: 19px; letter-spacing: -.04em; }
h1 span { color: var(--muted); font-weight: 500; }

.topbar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hub-topbar-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border: 1px solid rgba(198, 242, 121, .32); border-radius: 10px; background: rgba(20, 32, 27, .85); color: #edf3e9; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease; }
.hub-topbar-btn:not(:disabled):hover { border-color: rgba(198, 242, 121, .6); background: rgba(28, 44, 37, .92); }
.hub-topbar-btn.is-active { border-color: rgba(198, 242, 121, .45); background: var(--lime); color: #152018; }
.hub-topbar-btn:disabled { opacity: .42; cursor: not-allowed; }
.theme-select { min-height: 40px; min-width: 140px; max-width: 210px; padding: 0 28px 0 12px; font-size: 12.5px; border-radius: 10px; border-color: rgba(198, 242, 121, .28); background: rgba(20, 32, 27, .85); }
.app-nav { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(20, 32, 27, .85); gap: 4px; }
.nav-tab { min-height: 36px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.nav-tab:hover { color: #f4f5ec; }
.nav-tab.is-active { border-color: rgba(198, 242, 121, .35); background: var(--lime); color: #152018; }
.settings-gear-icon { display: none; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 14px rgba(198, 242, 121, .65); }

.run-view[hidden], .settings-view[hidden] { display: none; }

.stage { position: relative; isolation: isolate; min-height: clamp(500px, calc(100vh - 92px), 900px); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: #172821; box-shadow: 0 24px 80px rgba(0, 0, 0, .28); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage-shade { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(90deg, rgba(14, 24, 20, .86) 0%, rgba(14, 24, 20, .58) 38%, rgba(14, 24, 20, .06) 100%), linear-gradient(0deg, rgba(12, 20, 17, .72) 0%, transparent 45%); transition: opacity .25s ease; }
.stage.is-running .stage-shade, .stage.is-session-active .stage-shade { opacity: .35; }
.stage-copy { position: absolute; z-index: 2; left: clamp(22px, 4vw, 48px); top: 38%; width: min(560px, 68%); transform: translateY(-50%); pointer-events: none; text-shadow: 0 2px 14px rgba(0, 0, 0, .55); transition: opacity .25s ease; }
.stage.is-running .stage-copy, .stage.is-session-active .stage-copy { opacity: 0; }
.stage-copy .eyebrow { font-size: 12.5px; letter-spacing: .16em; }
.stage-copy h2 { margin: 10px 0 12px; font-size: clamp(36px, 4.4vw, 54px); line-height: 1.06; letter-spacing: -.045em; }
.stage-copy h2 .hero-line-muted { color: #c8d7c6; }
.stage-description { max-width: 480px; margin: 0; color: #dce7de; font-size: 17px; line-height: 1.5; }
.stage-hint { max-width: 500px; margin: 12px 0 0; color: #eef5ee; font-size: 15.5px; font-weight: 500; line-height: 1.48; }

.webxr-pill { position: absolute; z-index: 2; left: 18px; top: 18px; display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 99px; background: rgba(12, 20, 17, .65); color: #d7e0d6; font-size: 12.5px; backdrop-filter: blur(12px); }
.mobile-compact-hud { position: absolute; z-index: 3; left: 50%; top: 10px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 7px; max-width: calc(100% - 20px); padding: 6px 12px; border: 1px solid rgba(198, 242, 121, .32); border-radius: 99px; background: rgba(12, 20, 17, .74); color: #edf3e9; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; backdrop-filter: blur(12px); pointer-events: none; }
.mch-hr { color: #f4f5ec; font-weight: 700; }
.mch-heart { color: #ff6b7a; }
.mch-sep { opacity: .45; }
.rhythm-banner { position: absolute; z-index: 3; left: 50%; top: 18px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid rgba(255, 179, 71, .55); border-radius: 99px; background: rgba(16, 26, 23, .82); color: #f4f5ec; font-size: 12px; backdrop-filter: blur(12px); pointer-events: none; transition: border-color .15s ease, background .15s ease; }
.rhythm-banner[hidden] { display: none; }
.rhythm-dot { width: 8px; height: 8px; border-radius: 50%; background: #ffb347; box-shadow: 0 0 10px rgba(255, 179, 71, .65); }
.rhythm-meta { color: #ffd494; font-variant-numeric: tabular-nums; }
.rhythm-banner.is-on-target { border-color: var(--lime); background: rgba(20, 36, 24, .88); }
.rhythm-banner.is-on-target .rhythm-dot { background: var(--lime); box-shadow: 0 0 12px rgba(198, 242, 121, .75); }
.rhythm-banner.is-on-target .rhythm-meta { color: var(--lime); }

.pause-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 16px 16px 96px; pointer-events: none; background: radial-gradient(circle at 50% 42%, rgba(12, 22, 18, .22) 0%, rgba(10, 18, 15, .58) 100%); backdrop-filter: blur(4px); }
.pause-card { pointer-events: auto; width: min(320px, 100%); padding: 20px 20px 16px; border: 1px solid rgba(198, 242, 121, .38); border-radius: 24px; background: rgba(14, 24, 20, .88); box-shadow: 0 22px 64px rgba(0, 0, 0, .48); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.pause-eyebrow { margin: 0; display: inline-flex; align-items: center; gap: 8px; color: #ffd494; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.pause-dot { width: 8px; height: 8px; border-radius: 50%; background: #ffb347; box-shadow: 0 0 12px rgba(255, 179, 71, .75); }
.pause-stats { margin: 0; color: #d7e3d9; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pause-resume-cta { width: 100%; min-height: 58px; padding: 8px 20px 8px 10px; border: 0; border-radius: 999px; background: var(--lime); color: #142016; font-size: 18px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; box-shadow: 0 10px 30px rgba(198, 242, 121, .34); animation: pausePulse 2.2s ease-in-out infinite; transition: transform .14s ease, box-shadow .14s ease; }
.pause-resume-cta:hover { transform: translateY(-2px) scale(1.015); box-shadow: 0 14px 36px rgba(198, 242, 121, .45); }
.pause-resume-cta:active { transform: scale(0.97); }
.pause-play-ring { width: 40px; height: 40px; border-radius: 50%; background: #142016; color: var(--lime); display: grid; place-items: center; flex: 0 0 auto; }
.pause-hint { margin: 0; font-size: 12px; color: #b7c8bc; line-height: 1.4; }
.pause-stop-btn { min-height: 36px; padding: 0 18px; border-radius: 999px; font-size: 12.5px; }
@keyframes pausePulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(198, 242, 121, .32); }
  50% { box-shadow: 0 12px 38px rgba(198, 242, 121, .52); }
}

.run-summary { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 42%, rgba(12, 22, 18, .22) 0%, rgba(10, 18, 15, .58) 100%); backdrop-filter: blur(4px); }
.run-summary[hidden] { display: none; }
.summary-card { width: min(640px, 100%); max-height: 100%; overflow-y: auto; padding: 22px; border: 1px solid rgba(198, 242, 121, .38); border-radius: 24px; background: rgba(14, 24, 20, .88); box-shadow: 0 22px 64px rgba(0, 0, 0, .48); }
.summary-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.summary-header h3 { margin: 2px 0 0; font-size: 21px; letter-spacing: -.03em; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.summary-item { padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(22, 35, 29, .78); display: flex; flex-direction: column; gap: 4px; }
.summary-item span { color: var(--muted); font-size: 11px; }
.summary-item strong { color: #f4f5ec; font-size: 15px; font-variant-numeric: tabular-nums; }
.minimap-dock { position: absolute; z-index: 2; right: 18px; top: 18px; width: 204px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.15); border-radius: 14px; background: rgba(12, 20, 17, .76); backdrop-filter: blur(12px); pointer-events: none; transition: opacity .2s ease; }
.minimap-header, .minimap-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; }
.sector-name { color: var(--lime); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lap-badge { color: #d6e1d5; font-variant-numeric: tabular-nums; white-space: nowrap; }
#minimap-canvas { display: block; width: 100%; height: auto; margin: 7px 0 6px; border-radius: 8px; background: rgba(16, 26, 23, .65); }
.minimap-footer { color: #b8c6bd; font-variant-numeric: tabular-nums; }
.ghost-delta.is-ahead { color: var(--lime); font-weight: 700; }
.ghost-delta.is-behind { color: #ffc2b8; font-weight: 700; }
.status-dot { width: 7px; height: 7px; }

.loading-error { position: absolute; z-index: 6; top: 64px; left: 18px; right: 240px; padding: 12px; border: 1px solid #c66b67; border-radius: 10px; background: #381d1c; color: #ffe3dd; font-size: 13px; }
.touch-run-button { position: relative; z-index: 3; align-self: flex-end; margin: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border: 2px solid var(--lime); border-radius: 999px; background: rgba(16, 26, 23, .88); color: #f4f5ec; font-size: 14px; font-weight: 730; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; backdrop-filter: blur(10px); transition: background .12s ease, color .12s ease, transform .12s ease; }
.touch-run-button[hidden] { display: none; }
.touch-run-button:disabled { opacity: .45; cursor: not-allowed; }
.touch-run-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px rgba(198, 242, 121, .65); transition: background .12s ease; }
.touch-run-button.is-active { background: var(--lime); color: #152018; transform: scale(0.98); }
.touch-run-button.is-active .touch-run-dot { background: #152018; box-shadow: none; }

.stage-bottom-bar { position: relative; z-index: 4; margin: 14px 16px 16px; display: grid; gap: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.metric-card { min-height: 86px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(16, 26, 23, .72); backdrop-filter: blur(12px); }
.metric-card[hidden] { display: none; }
.metric-card > span, .metric-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 11px; }
.metric-head > span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.est-tag { padding: 1px 6px; border: 1px solid rgba(193, 241, 29, .28); border-radius: 99px; color: var(--lime); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.heart-icon { display: inline-block; color: #ff6b7a; font-size: 13px; line-height: 1; transition: transform .12s ease, color .2s ease; }
.heart-icon.is-beating { transform: scale(1.32); color: #ff8f9b; }
.hr-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 6px; }
.hr-row strong { margin-top: 0; white-space: nowrap; }
#hr-sparkline { width: 88px; height: 28px; display: block; flex: 0 1 auto; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.metric-card strong { display: block; margin-top: 6px; font-size: 25px; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.metric-card strong em { margin-left: 5px; color: #a8b8aa; font-size: 11px; font-style: normal; font-weight: 550; letter-spacing: 0; }
.metric-card small { display: block; margin-top: 6px; color: #95a69b; font-size: 11px; }

.control-panel { padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); backdrop-filter: blur(12px); }
.run-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 730; transition: transform .15s ease, border-color .15s ease, opacity .15s ease; }
.button:not(:disabled):hover { transform: translateY(-1px); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button-primary { background: var(--lime); color: #162017; }
.button-secondary { border-color: rgba(229, 239, 227, .19); background: #23332c; color: #edf3e9; }
.button-secondary.is-active { border-color: var(--lime); color: var(--lime); }
.button-secondary.is-vr-ready { border-color: rgba(198, 242, 121, .6); color: var(--lime); }
.button-stop { border-color: rgba(253, 137, 121, .28); background: rgba(97, 45, 40, .62); color: #ffc2b8; }
#recenter-view-button { margin-left: auto; }
.speed-kmh-indicator { color: #d6e1d5; font-weight: 650; }
kbd { min-width: 20px; padding: 2px 5px; border: 1px solid rgba(255,255,255,.23); border-radius: 5px; color: #c7d0c8; font-size: 10px; }

/* Settings Page View */
.settings-view { min-height: clamp(500px, calc(100vh - 92px), 900px); padding: clamp(18px, 3vw, 30px); border: 1px solid var(--line); border-radius: 22px; background: rgba(20, 32, 27, .88); box-shadow: 0 24px 80px rgba(0, 0, 0, .24); }
.settings-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.settings-header h2 { margin: 4px 0 0; font-size: clamp(24px, 3vw, 30px); letter-spacing: -.04em; }
.settings-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.settings-lead { margin: 6px 0 0; max-width: 620px; color: #a8b8aa; font-size: 13px; line-height: 1.5; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.settings-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(16, 26, 23, .78); display: flex; flex-direction: column; gap: 14px; }
.settings-card-wide { grid-column: 1 / -1; }
.settings-card.is-solo-span { grid-column: 1 / -1; }
.settings-card-head { display: flex; align-items: flex-start; gap: 12px; }
.settings-card-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.settings-card h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; color: #f4f5ec; }
.settings-description { margin: 4px 0 0; color: #a8b8aa; font-size: 12.5px; line-height: 1.5; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid rgba(228, 241, 226, .09); border-radius: 13px; background: rgba(12, 20, 17, .48); }
.setting-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; }
.setting-title { color: #edf3e9; font-size: 13.5px; font-weight: 650; }
.setting-sub { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
select { min-height: 42px; min-width: 190px; max-width: 100%; padding: 0 30px 0 12px; border: 1px solid rgba(229,239,227,.18); border-radius: 9px; background: #192620; color: #edf3e9; cursor: pointer; }
select:disabled { opacity: .45; cursor: not-allowed; }
.setting-row .button { flex: 0 0 auto; min-height: 42px; min-width: 150px; }
.track-file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.track-file-actions .button { min-width: 120px; }
.setting-callout { margin-top: auto; padding: 11px 13px; border-radius: 11px; background: rgba(198, 242, 121, .06); border: 1px solid rgba(198, 242, 121, .16); color: #c4d2c6; font-size: 12px; line-height: 1.5; }
.callout-label { display: block; margin-bottom: 4px; color: var(--lime); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.callout-text { margin: 0; }
.desktop-hint { margin: 0; color: #c4d2c6; font-size: 12px; line-height: 1.5; }
.panel-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; }
.audio-toggles.is-master-muted { opacity: .55; }
.button-chip { display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 6px; min-height: 68px; padding: 12px 14px; border: 1px solid rgba(229, 239, 227, .16); border-radius: 13px; background: rgba(12, 20, 17, .55); color: #b7c4ba; text-align: left; }
.button-chip:hover { border-color: rgba(229, 239, 227, .3); }
.chip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.chip-title { font-size: 13px; font-weight: 700; color: #edf3e9; }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .2); transition: background .15s ease, box-shadow .15s ease; }
.chip-desc { font-size: 11px; font-weight: 450; color: var(--muted); line-height: 1.35; }
.button-chip.is-active { border-color: var(--lime); background: rgba(198, 242, 121, .11); }
.button-chip.is-active .chip-title { color: var(--lime); }
.button-chip.is-active .chip-dot { background: var(--lime); box-shadow: 0 0 10px rgba(198, 242, 121, .65); }

.safety-dialog { position: fixed; z-index: 10; inset: 0; width: min(500px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); margin: auto; padding: 0; overflow: auto; border: 1px solid rgba(226, 241, 222, .19); border-radius: 18px; background: #192720; color: #eff4ec; box-shadow: 0 26px 100px rgba(0,0,0,.55); }
.safety-dialog::backdrop { background: #000; }
.safety-dialog form { padding: clamp(23px, 5vw, 35px); }
.safety-dialog h2 { margin: 10px 0; font-size: 27px; letter-spacing: -.04em; }
.safety-dialog p:not(.eyebrow), .safety-dialog li { color: #b8c6bb; font-size: 14px; line-height: 1.6; }
.safety-dialog ul { padding-left: 20px; }
.dialog-button { width: 100%; margin-top: 21px; }
.confirm-dialog { width: min(440px, calc(100% - 32px)); }
.confirm-dialog::backdrop { background: rgba(6, 12, 9, .78); backdrop-filter: blur(4px); }
.confirm-dialog-content { padding: clamp(22px, 5vw, 30px); }
.confirm-dialog h2 { margin: 8px 0 10px; font-size: 22px; letter-spacing: -.035em; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-actions .button { flex: 1 1 140px; min-height: 44px; }

/* Mobile & Compact Viewport Layout */
.app-shell.is-mobile-ui { width: calc(100% - 12px); padding: calc(6px + env(safe-area-inset-top)) 0 calc(8px + env(safe-area-inset-bottom)); }
.app-shell.is-mobile-ui .topbar { flex-wrap: nowrap; gap: 4px; padding-bottom: 8px; }
.app-shell.is-mobile-ui .brand-lockup { gap: 4px; flex: 0 0 auto; min-width: 0; }
.app-shell.is-mobile-ui .brand-mark { width: 24px; height: 24px; border-radius: 7px; font-size: 10.5px; flex: 0 0 auto; }
.app-shell.is-mobile-ui h1 { font-size: 13px; white-space: nowrap; }
.app-shell.is-mobile-ui .topbar-tools { flex: 1 1 auto; min-width: 0; justify-content: flex-end; flex-wrap: nowrap; gap: 4px; }
.app-shell.is-mobile-ui .theme-select { appearance: none; -webkit-appearance: none; min-height: 34px; padding: 0 18px 0 7px; font-size: 11.5px; text-overflow: ellipsis; background-color: rgba(20, 32, 27, .85); background-image: linear-gradient(45deg, transparent 50%, #9eada3 50%), linear-gradient(135deg, #9eada3 50%, transparent 50%); background-position: right 10px center, right 6px center; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; }
.app-shell.is-mobile-ui .hub-topbar-btn { order: 1; flex: 0 0 auto; min-height: 34px; padding: 0 10px; font-size: 11.5px; white-space: nowrap; }
.app-shell.is-mobile-ui .theme-select { order: 2; flex: 1 1 0; min-width: 0; max-width: 150px; }
.app-shell.is-mobile-ui .app-nav { order: 3; flex: 0 0 auto; padding: 0; border: 0; background: transparent; gap: 0; }
.app-shell.is-mobile-ui .nav-tab-settings { display: inline-grid; place-items: center; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(20, 32, 27, .85); color: #edf3e9; }
.app-shell.is-mobile-ui .nav-tab-settings.is-active { border-color: rgba(198, 242, 121, .45); background: var(--lime); color: #152018; }
.app-shell.is-mobile-ui .nav-tab-settings .settings-gear-icon { display: block; }
.app-shell.is-mobile-ui .nav-tab-settings .nav-tab-label { display: none; }
.app-shell.is-mobile-ui .stage { min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); border-radius: 16px; }

.stage.is-mobile-ui .stage-shade { background: linear-gradient(180deg, rgba(10, 18, 15, .74) 0%, rgba(10, 18, 15, .44) 30%, transparent 56%, rgba(10, 18, 15, .74) 100%); }
.stage.is-mobile-ui .stage-copy { left: 16px; right: 16px; top: 52px; width: auto; transform: none; text-shadow: 0 2px 14px rgba(0, 0, 0, .72); }
.stage.is-mobile-ui .stage-copy .eyebrow, .stage.is-mobile-ui .stage-description { display: none; }
.stage.is-mobile-ui .stage-copy h2 { margin: 0; font-size: clamp(26px, 7.2vw, 34px); line-height: 1.12; letter-spacing: -.035em; }
.stage.is-mobile-ui .stage-hint { margin-top: 10px; max-width: 38ch; font-size: 14.5px; font-weight: 500; line-height: 1.45; color: #edf4ee; }
.stage.is-mobile-ui .webxr-pill { left: 10px; top: 10px; max-width: calc(100% - 20px); padding: 6px 11px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s ease; }
.stage.is-mobile-ui.is-session-active .webxr-pill { opacity: 0; pointer-events: none; }
.stage.is-mobile-ui .rhythm-banner { top: 48px; font-size: 11px; padding: 5px 11px; max-width: calc(100% - 20px); }
.stage.is-mobile-ui .minimap-dock { width: 146px; right: 10px; top: 10px; padding: 7px 9px; opacity: 1; }
.stage.is-mobile-ui kbd { display: none; }
.stage.is-mobile-ui .stage-bottom-bar { margin: 8px 10px 10px; gap: 8px; }
.stage.is-mobile-ui .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 44vh; overflow-y: auto; }
.stage.is-mobile-ui .metric-card { min-height: 64px; padding: 8px 10px; background: rgba(14, 24, 20, .82); }
.stage.is-mobile-ui .metric-card strong { font-size: 19px; margin-top: 4px; }
.stage.is-mobile-ui .metric-card small { margin-top: 4px; font-size: 10.5px; }
.stage.is-mobile-ui .control-panel { padding: 8px; border-radius: 15px; background: rgba(14, 24, 20, .74); }
.stage.is-mobile-ui .run-controls { gap: 7px; }
.stage.is-mobile-ui .run-controls .button { min-height: 38px; padding: 0 11px; font-size: 12.5px; gap: 6px; }
.stage.is-mobile-ui .touch-run-button { margin: 0; min-height: 48px; padding: 0 16px; flex: 1 1 170px; font-size: 13.5px; }
.stage.is-mobile-ui #enter-vr-button { min-height: 48px; padding: 0 14px; flex: 0 0 auto; }
.stage.is-mobile-ui #recenter-view-button { margin-left: 0; }
.stage.is-mobile-ui.is-session-active .run-controls .button { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 0 8px; font-size: 12px; }
.stage.is-mobile-ui.is-session-active .touch-run-button { order: 2; flex: 1 0 100%; min-height: 50px; }

@media (max-width: 860px) {
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .run-summary { padding: 14px; }
  .summary-card { padding: 16px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .settings-view { padding: 16px; }
  .settings-header-actions { width: 100%; }
  .settings-header-actions .button { flex: 1 1 140px; }
  .panel-toggles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-height: 540px) {
  .stage.is-mobile-ui .stage-copy { top: 46px; }
  .stage.is-mobile-ui .stage-copy h2 { font-size: 24px; }
  .stage.is-mobile-ui .stage-hint { margin-top: 6px; font-size: 13.5px; max-width: 52ch; }
  .pause-overlay { padding: 12px 12px 64px; }
  .pause-card { padding: 14px 16px; gap: 7px; }
  .pause-resume-cta { min-height: 46px; font-size: 16px; }
  .stage.is-mobile-ui.is-session-active .run-controls { flex-wrap: nowrap; }
  .stage.is-mobile-ui.is-session-active .touch-run-button { order: 0; flex: 1.6 1 160px; min-height: 42px; }
  .stage.is-mobile-ui.is-session-active .run-controls .button { min-height: 42px; flex: 0 1 auto; padding: 0 10px; }
  .stage.is-mobile-ui .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 40vh; }
}

@media (max-width: 560px) {
  .setting-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-row select, .setting-row .button { width: 100%; min-width: 0; }
  .panel-toggles { grid-template-columns: 1fr; }
}

html.is-mobile-run-view, body.is-mobile-run-view {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior-y: none;
}
.app-shell.is-mobile-ui.is-run-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app-shell.is-mobile-ui.is-run-view .topbar { flex: 0 0 auto; }
.app-shell.is-mobile-ui.is-run-view .run-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.app-shell.is-mobile-ui.is-run-view .stage { flex: 1 1 auto; min-height: 0; height: 100%; }

@media (max-width: 520px) {
  .app-shell.is-mobile-ui .brand-mark { display: none; }
}

@media (max-width: 360px) {
  .app-shell.is-mobile-ui h1 { font-size: 12px; }
  .summary-grid { grid-template-columns: 1fr; }
}

@media (pointer: coarse) {
  kbd { display: none; }
}

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

body.is-track-hub-open .stage-copy,
body.is-track-hub-open .stage-shade,
body.is-track-hub-open .stage-bottom-bar,
body.is-track-hub-open .minimap-dock,
body.is-track-hub-open .mobile-compact-hud,
body.is-track-hub-open .rhythm-banner,
body.is-summary-open .stage-copy,
body.is-summary-open .stage-shade,
body.is-summary-open .stage-bottom-bar,
body.is-summary-open .minimap-dock,
body.is-summary-open .mobile-compact-hud,
body.is-summary-open .rhythm-banner {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.track-hub-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.track-hub-close-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(12, 20, 18, 0.72);
  color: #f4faf6;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.track-hub-close-btn:hover {
  transform: scale(1.06);
  border-color: rgba(154, 240, 200, 0.65);
  background: rgba(20, 36, 30, 0.9);
}

.track-hub-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 24px 24px;
  background: linear-gradient(180deg, rgba(8, 14, 12, 0.12) 0%, rgba(8, 14, 12, 0.42) 48%, rgba(8, 14, 12, 0.84) 100%);
  overflow-y: auto;
}
.track-hub-overlay[hidden],
.hub-topbar-btn[hidden] {
  display: none;
}

.track-hub-header {
  max-width: 740px;
  margin: 0 auto 14px;
  width: 100%;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}
.track-hub-header h2 {
  margin: 2px 0 4px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.15;
  color: #f4faf6;
}
.track-hub-subtitle {
  margin: 0;
  font-size: 13px;
  color: rgba(226, 240, 232, 0.86);
}

.track-hub-grid {
  max-width: 740px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.track-hub-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 20, 18, 0.72);
  backdrop-filter: blur(10px);
  color: #eef6f1;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.track-hub-card:hover {
  transform: translateY(-2px);
  border-color: rgba(154, 240, 200, 0.45);
}
.track-hub-card.is-previewing {
  border-color: #7ee8b4;
  background: rgba(16, 30, 26, 0.82);
  box-shadow: 0 0 0 1px rgba(126, 232, 180, 0.35), 0 12px 28px rgba(0, 0, 0, 0.42);
}
.track-hub-card.is-locked {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(14, 18, 22, 0.68);
}

.track-hub-ribbon {
  position: absolute;
  top: 14px;
  right: -34px;
  width: 128px;
  padding: 4px 0;
  transform: rotate(35deg);
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1c1406;
  background: linear-gradient(135deg, #ffd46b, #f09e2c);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.track-hub-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.25;
  color: #ffffff;
  padding-right: 24px;
}
.track-hub-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(226, 238, 231, 0.82);
}
.track-hub-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.track-hub-card-actions .button {
  width: 100%;
  justify-content: center;
}

@media (max-width: 780px) {
  .track-hub-overlay {
    padding: 14px;
    justify-content: flex-end;
  }
  .track-hub-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .track-hub-card {
    padding: 13px;
  }
}
