:root {
    --immersive-bg:
        radial-gradient(circle at 78% 12%, rgba(255, 184, 77, 0.2), transparent 23%),
        radial-gradient(circle at top left, rgba(255, 79, 163, 0.2), transparent 30%),
        linear-gradient(145deg, #090611 0%, #1b0c2b 45%, #091321 100%);
    --immersive-panel: rgba(7, 14, 27, 0.84);
    --immersive-panel-strong: rgba(11, 21, 38, 0.92);
    --immersive-border: rgba(103, 232, 249, 0.16);
    --immersive-text: #ecf7ff;
    --immersive-muted: #97a9bf;
    --immersive-accent: #ff69b4;
    --immersive-accent-2: #ffbf69;
    --immersive-accent-strong: #ff4fa3;
    --immersive-button-text: #082032;
    --immersive-field-bg: rgba(241, 245, 249, 0.96);
    --immersive-field-text: #0f172a;
    --immersive-field-border: rgba(103, 232, 249, 0.42);
}

.immersive-page {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    padding: 0;
    overflow: hidden;
}

.immersive-root {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    background: var(--immersive-bg);
    color: var(--immersive-text);
    overscroll-behavior: none;
    touch-action: manipulation;
}

.immersive-canvas {
    position: absolute;
    inset: 0;
}

.immersive-start-shell {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.18), rgba(2, 6, 23, 0.48));
    pointer-events: none;
}

.immersive-root.showing-overlay .immersive-canvas {
    pointer-events: none;
}

.immersive-start-card {
    position: relative;
    z-index: 1;
    width: min(58rem, 100%);
    padding: 1.5rem;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(7, 14, 27, 0.88), rgba(11, 21, 38, 0.94));
    pointer-events: auto;
}

.start-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.start-home-button {
    display: grid;
    width: 2.7rem;
    height: 2.7rem;
    flex: 0 0 2.7rem;
    place-items: center;
    border: 1px solid var(--immersive-border);
    border-radius: 10px;
    color: var(--immersive-text);
    background: rgba(11, 21, 38, 0.66);
    cursor: pointer;
}

.start-layout {
    display: grid;
    grid-template-columns: minmax(14rem, 0.72fr) minmax(0, 1.55fr);
    gap: 1rem;
    margin-top: 1rem;
}

.start-player-panel,
.start-course-panel {
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid rgba(103, 232, 249, 0.12);
    border-radius: 12px;
    background: rgba(4, 10, 22, 0.46);
}

.start-player-panel {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.start-panel-title {
    color: var(--immersive-muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.start-name-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--immersive-field-border);
    border-radius: 10px;
    background: var(--immersive-field-bg);
}

.start-name-field input {
    width: 100%;
    min-width: 0;
    height: 2.35rem;
    padding: 0;
    border: 0;
    outline: none;
    color: var(--immersive-field-text);
    background: transparent;
    font: inherit;
    font-weight: 700;
}

/* MudTextField keeps its accessibility and validation; these overrides make it
   match the glass fields instead of the default MudBlazor underline. */
.start-name-field .mud-input-control,
.start-name-field .mud-input,
.settings-field .mud-input-control,
.settings-field .mud-input {
    margin: 0;
    min-height: 0;
}

.start-name-field .mud-input-control-input-container,
.settings-field .mud-input-control-input-container {
    margin: 0;
}

.start-name-field:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.22);
}

.start-profile-meta,
.selected-level-meta span,
.start-controls-hint {
    display: flex;
    align-items: center;
}

.start-profile-meta {
    gap: 0.45rem;
    color: var(--immersive-muted);
    font-size: 0.74rem;
}

.online-status-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 10px #4ade80;
}

.selected-level-card {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.2rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 79, 163, 0.13), rgba(255, 191, 105, 0.07));
}

.selected-level-card > strong {
    overflow: hidden;
    font-size: 1.1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-level-meta {
    display: grid;
    gap: 0.35rem;
}

.selected-level-meta span {
    gap: 0.4rem;
    color: var(--immersive-muted);
    font-size: 0.72rem;
}

.selected-level-meta .mud-icon-root {
    color: var(--immersive-accent-2) !important;
    font-size: 0.95rem !important;
}

.run-result-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
}

.run-result-grid div {
    display: grid;
    gap: 0.15rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(11, 21, 38, 0.72);
}

.run-result-grid span {
    color: var(--immersive-muted);
    font-size: 0.62rem;
}

.run-result-grid strong {
    font-size: 0.92rem;
}

.start-controls-hint {
    gap: 0.55rem;
    margin-top: auto;
    color: var(--immersive-muted);
    font-size: 0.7rem;
}

.start-controls-hint kbd {
    padding: 0.28rem 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom-width: 3px;
    border-radius: 6px;
    color: var(--immersive-text);
    background: rgba(255, 255, 255, 0.08);
    font: inherit;
    font-weight: 800;
}

.immersive-start-card h1 {
    margin: 0.35rem 0 0.5rem;
    font-size: clamp(2rem, 5vw, 3rem);
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.start-copy {
    margin: 0;
    color: var(--immersive-text);
    opacity: 0.88;
    line-height: 1.6;
}

.stack-row.start-actions {
    margin-top: 1.1rem;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(9rem, 0.65fr);
    gap: 0.65rem;
    align-items: stretch;
}

.start-action-button {
    width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.65rem 0.8rem;
    font: inherit;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.15;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.start-action-button:disabled {
    cursor: wait;
    opacity: 0.58;
    filter: saturate(0.5);
}

.start-action-button .mud-icon-root {
    margin-right: 0.35rem;
    vertical-align: middle;
}

.start-level-picker {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0;
    overflow: visible;
}

.world-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.world-choice {
    --world-primary: var(--immersive-accent);
    --world-secondary: var(--immersive-accent-2);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    min-height: 3rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid color-mix(in srgb, var(--world-primary) 38%, rgba(148, 163, 184, 0.34));
    border-radius: 8px;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--world-primary) 18%, rgba(15, 23, 42, 0.92)),
        color-mix(in srgb, var(--world-secondary) 12%, rgba(2, 6, 23, 0.88))
    );
    color: var(--immersive-text);
    font: inherit;
    line-height: 1.1;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 22px rgba(2, 6, 23, 0.22);
}

.world-choice-mark {
    width: 0.62rem;
    height: 2rem;
    border-radius: 99px;
    background: linear-gradient(180deg, var(--world-primary), var(--world-secondary));
    box-shadow: 0 0 18px color-mix(in srgb, var(--world-primary) 55%, transparent);
}

.world-choice-main {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.world-choice-main > span,
.world-choice-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.world-choice-main > span {
    font-weight: 900;
}

.world-choice-meta {
    display: flex;
    gap: 0.45rem;
    min-width: 0;
}

.world-choice-meta strong {
    color: color-mix(in srgb, var(--world-primary) 82%, #ffffff);
    font-size: 0.72rem;
}

.world-choice:hover,
.world-choice:focus-visible {
    border-color: color-mix(in srgb, var(--world-primary) 70%, #ffffff);
    filter: brightness(1.08);
    outline: none;
}

.world-choice.selected {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--world-primary) 42%, #0f172a),
        color-mix(in srgb, var(--world-secondary) 32%, #020617)
    );
    border-color: color-mix(in srgb, var(--world-primary) 86%, #ffffff);
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--world-primary) 24%, transparent),
        0 14px 28px rgba(2, 6, 23, 0.34);
}

.level-category {
    display: grid;
    gap: 0.45rem;
}

.level-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--immersive-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.level-category-header strong {
    color: var(--immersive-accent);
    font-size: 0.72rem;
    letter-spacing: 0;
    text-transform: none;
}

.level-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.start-level-choice {
    display: grid;
    gap: 0.2rem;
    align-content: center;
    min-height: 3.35rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.48);
    color: var(--immersive-text);
    font: inherit;
    line-height: 1.1;
    cursor: pointer;
    transition:
        background 140ms ease,
        border-color 140ms ease,
        transform 140ms ease;
}

.start-level-choice:hover,
.start-level-choice:focus-visible {
    background: rgba(30, 41, 59, 0.74);
    border-color: rgba(94, 234, 212, 0.58);
    outline: none;
}

.start-level-choice.selected {
    background: linear-gradient(135deg, #0f766e, #2563eb);
    border-color: rgba(94, 234, 212, 0.82);
    box-shadow: 0 10px 24px rgba(14, 116, 144, 0.24);
}

.start-level-picker.loading {
    pointer-events: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    min-height: 246px;
}

@media (min-width: 700px) {
    .start-level-picker.loading {
        min-height: 198px;
    }
}

.start-level-choice.placeholder {
    display: block;
    opacity: 0.28;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.35), rgba(103, 232, 249, 0.18), rgba(15, 23, 42, 0.35));
}

.level-choice-name,
.level-choice-count {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.level-choice-name {
    font-weight: 800;
}

.level-choice-count {
    color: var(--immersive-accent);
    font-size: 0.74rem;
    font-weight: 700;
    opacity: 0.88;
}

.settings-display-section .mud-button-root {
    width: 100%;
    color: var(--immersive-text) !important;
    border-color: var(--immersive-field-border) !important;
}

.stack-row.start-actions .mud-button-root {
    width: 100%;
    min-width: 0 !important;
}

.stack-row.start-actions .mud-button-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.glass-panel {
    backdrop-filter: blur(18px);
    background: var(--immersive-panel);
    border: 1px solid var(--immersive-border);
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

.immersive-topbar {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(15rem, 1.15fr) auto auto;
    gap: 0.85rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(7, 14, 27, 0.84), rgba(8, 15, 31, 0.72));
}

.immersive-root.showing-overlay .immersive-topbar {
    opacity: 0;
    pointer-events: none;
}

.hud-progress {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.hud-progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--immersive-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hud-progress-label strong {
    color: var(--immersive-text);
    font-size: 0.8rem;
}

.hud-progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.1);
}

.hud-progress-track span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--immersive-accent), var(--immersive-accent-2));
    box-shadow: 0 0 14px rgba(255, 105, 180, 0.55);
    transition: width 160ms linear;
}

.immersive-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--immersive-accent-2);
}

.headline {
    font-size: clamp(1.1rem, 1.6vw, 1.55rem);
    font-weight: 800;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.race-tracker {
    position: absolute;
    top: 7rem;
    left: 1rem;
    z-index: 18;
    width: min(18rem, calc(100vw - 2rem));
    padding: 0.75rem;
    border-radius: 14px;
}

.race-tracker-header,
.race-player-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.race-tracker-header {
    margin-bottom: 0.6rem;
    color: var(--immersive-muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.race-tracker-header strong {
    color: var(--immersive-accent-2);
}

.race-tracker-list {
    display: grid;
    gap: 0.5rem;
}

.race-player {
    display: grid;
    gap: 0.28rem;
    opacity: 0.72;
}

.race-player.local {
    opacity: 1;
}

.race-player-label {
    justify-content: flex-start;
    gap: 0.4rem;
    min-width: 0;
    font-size: 0.7rem;
}

.race-player-label strong {
    overflow: hidden;
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.race-progress span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
    box-shadow: 0 0 8px currentColor;
    transition: width 180ms linear;
}

.race-progress {
    height: 3px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.12);
}

.immersive-secondary-button,
.immersive-cta-button {
    border-radius: 8px !important;
}

.immersive-nav-button {
    color: var(--immersive-text) !important;
    background: rgba(103, 232, 249, 0.1) !important;
    border: 1px solid rgba(103, 232, 249, 0.2) !important;
    border-radius: 8px !important;
    width: 2.6rem !important;
    height: 2.6rem !important;
    min-width: 2.6rem !important;
}

.immersive-nav-button:hover {
    background: rgba(103, 232, 249, 0.18) !important;
}

.immersive-cta-button {
    color: var(--immersive-button-text) !important;
    background: linear-gradient(135deg, var(--immersive-accent) 0%, var(--immersive-accent-2) 100%) !important;
    border: none !important;
    box-shadow: 0 16px 34px rgba(34, 211, 238, 0.22) !important;
}

.immersive-cta-button:hover {
    filter: brightness(1.04);
}

.immersive-secondary-button {
    color: var(--immersive-text) !important;
    border: 1px solid rgba(103, 232, 249, 0.24) !important;
    background: rgba(11, 21, 38, 0.68) !important;
}

.immersive-secondary-button:hover {
    background: rgba(20, 37, 63, 0.88) !important;
}

.immersive-tool-button {
    width: 2.6rem !important;
    height: 2.6rem !important;
    min-width: 2.6rem !important;
    border-radius: 8px !important;
    color: var(--immersive-text) !important;
    background: rgba(11, 21, 38, 0.68) !important;
    border: 1px solid rgba(103, 232, 249, 0.2) !important;
}

.immersive-tool-button:hover {
    background: rgba(20, 37, 63, 0.9) !important;
}

.hud-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
}

.hud-stats div,
.leaderboard-meta,
.online-player-stats,
.status-text {
    display: flex;
    flex-direction: column;
}

.hud-stats span,
.leaderboard-item span,
.online-player-item span,
.status-text {
    color: var(--immersive-muted);
    font-size: 0.86rem;
}

.settings-field span {
    color: var(--immersive-muted);
    font-size: 0.78rem;
    line-height: 1;
}

.coin-wallet span,
.coin-wallet small {
    color: var(--immersive-muted);
    font-size: 0.78rem;
}

.race-player-label > span:last-child {
    color: var(--immersive-muted);
}

.hud-stats div {
    min-width: 0;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    background: rgba(11, 21, 38, 0.56);
    border: 1px solid rgba(103, 232, 249, 0.1);
}

.hud-stats strong {
    font-size: 1rem;
    line-height: 1.1;
}

.topbar-actions,
.stack-row {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.topbar-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.immersive-sidebar {
    position: fixed;
    top: 7rem;
    right: 1rem;
    bottom: 1rem;
    width: min(28rem, calc(100vw - 2rem));
    z-index: 20;
    padding: 1rem;
    border-radius: 12px;
    transform: translateX(calc(100% + 1rem));
    transition: transform 220ms ease;
    overflow-y: auto;
    max-height: calc(100dvh - 8rem);
    overscroll-behavior: contain;
}

.immersive-sidebar.open {
    transform: translateX(0);
}

.sidebar-header,
.leaderboard-item,
.online-player-main,
.online-player-stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding-top: 0.85rem;
    margin-top: 0.85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--immersive-accent);
}

.session-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

.settings-toggle,
.settings-range,
.settings-field {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    background: rgba(11, 21, 38, 0.72);
    border: 1px solid rgba(103, 232, 249, 0.12);
    color: var(--immersive-text);
}

.settings-field input,
.settings-field select {
    width: 100%;
    min-width: 0;
    height: 2.7rem;
    padding: 0 0.75rem;
    border: 1px solid var(--immersive-field-border);
    border-radius: 8px;
    background: var(--immersive-field-bg);
    color: var(--immersive-field-text);
    font: inherit;
    outline: none;
}

.settings-toggle input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--immersive-accent);
}

.settings-range input {
    width: 100%;
    accent-color: var(--immersive-accent);
}

.settings-field input:focus,
.settings-field select:focus {
    border-color: var(--immersive-accent);
    box-shadow: 0 0 0 2px rgba(103, 232, 249, 0.24);
}

.settings-toggle {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
}

.settings-range {
    grid-template-columns: auto minmax(0, 1fr) 3.1rem;
    align-items: center;
}

.settings-range strong {
    text-align: right;
}

.settings-hint {
    color: var(--immersive-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.coin-wallet {
    display: grid;
    gap: 0.22rem;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.16), rgba(103, 232, 249, 0.08));
    border: 1px solid rgba(251, 191, 36, 0.28);
}

.coin-wallet strong {
    color: var(--immersive-accent-2);
    font-size: 1.05rem;
}

.color-shop-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.color-shop-item {
    display: grid;
    gap: 0.34rem;
    min-width: 0;
    padding: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(11, 21, 38, 0.62);
    color: var(--immersive-text);
    font: inherit;
    cursor: pointer;
}

.color-shop-item .color-swatch {
    width: 100%;
    aspect-ratio: 1.8;
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: var(--shop-color);
    box-shadow:
        inset 0 0 0 1px rgba(2, 6, 23, 0.45),
        0 10px 20px rgba(2, 6, 23, 0.2);
}

.color-shop-item span:not(.color-swatch),
.color-shop-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
    line-height: 1.1;
}

.color-shop-item strong {
    color: var(--immersive-accent-2);
}

.color-shop-item.selected,
.color-shop-item:focus-visible {
    border-color: #ffffff;
    outline: 2px solid rgba(94, 234, 212, 0.7);
    outline-offset: 2px;
}

.color-shop-item.locked {
    opacity: 0.54;
}

.leaderboard-item,
.online-player-item,
.leaderboard-empty {
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    background: rgba(11, 21, 38, 0.72);
    border: 1px solid rgba(103, 232, 249, 0.12);
}

.immersive-root .mud-input-control,
.immersive-root .mud-input,
.immersive-root .mud-input-slot,
.immersive-root .mud-select,
.immersive-root .mud-select-input,
.immersive-root .mud-input > input,
.immersive-root .mud-input-slot input,
.immersive-root .mud-input-slot textarea {
    color: var(--immersive-field-text) !important;
}

.online-player-stats div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.immersive-root .mud-input-label,
.immersive-root .mud-input-helper-text,
.immersive-root .mud-select-input + div,
.immersive-root .mud-icon-root {
    color: var(--immersive-text) !important;
}

.immersive-root .mud-input-outlined-border {
    border-color: var(--immersive-field-border) !important;
}

.immersive-root .mud-input-slot {
    background: var(--immersive-field-bg) !important;
    border-radius: 8px;
    padding-inline: 0.25rem;
}

/* The start panel already paints the field background: keep the input itself
   transparent so MudTextField blends into the existing glass field. */
.immersive-root .start-name-field .mud-input-slot {
    background: transparent !important;
    height: 2.35rem !important;
    padding: 0 !important;
    border-radius: 0;
}

.immersive-root .start-name-field .mud-input {
    height: auto;
    min-height: 0;
}

.immersive-root .settings-field .mud-input-slot {
    height: 2.7rem !important;
    padding: 0 0.75rem !important;
}

.immersive-root .settings-field .mud-input {
    height: auto;
    min-height: 0;
}

.start-name-field .mud-input-underline::before,
.start-name-field .mud-input-underline::after,
.settings-field .mud-input-underline::before,
.settings-field .mud-input-underline::after {
    display: none;
}

.immersive-root .mud-input-adornment,
.immersive-root .mud-select-input {
    color: var(--immersive-field-text) !important;
}

.immersive-root .mud-button-root.mud-button-filled {
    box-shadow: 0 12px 28px rgba(34, 211, 238, 0.2);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.online-player-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.online-player-item {
    display: grid;
    gap: 0.75rem;
}

.online-player-main {
    align-items: center;
    justify-content: flex-start;
}

.player-color-dot {
    width: 0.75rem;
    height: 0.75rem;
    flex: 0 0 0.75rem;
    border-radius: 999px;
    box-shadow: 0 0 16px currentColor;
}

.online-player-stats {
    flex-direction: row;
}

.online-player-stats strong {
    font-size: 1rem;
}

.immersive-mobile-controls {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 15;
    display: none;
    grid-template-columns: minmax(0, 1fr) repeat(3, 2.75rem);
    gap: 0.45rem;
    padding: 0.5rem;
    border-radius: 12px;
}

.mobile-jump-button {
    min-height: 2.75rem !important;
}

@media (max-width: 1100px) {
    .immersive-topbar {
        grid-template-columns: minmax(10rem, 1fr) minmax(12rem, 1fr) auto auto;
    }

    .hud-stats {
        justify-content: flex-start;
    }

    .immersive-brand {
        justify-content: space-between;
    }
}

@media (max-width: 720px) {
    .immersive-start-shell {
        place-items: center;
        padding: 0.75rem;
    }

    .immersive-start-card {
        padding: 0.9rem;
        max-height: calc(100vh - 1.5rem);
        max-height: calc(100dvh - 1.5rem);
        overflow-y: auto;
    }

    .start-layout {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        margin-top: 0.75rem;
    }

    .start-player-panel,
    .start-course-panel {
        padding: 0.7rem;
    }

    .selected-level-card,
    .start-controls-hint {
        display: none;
    }

    .immersive-start-card h1 {
        font-size: clamp(1.65rem, 8vw, 2.2rem);
        margin: 0.2rem 0 0.35rem;
    }

    .start-copy {
        line-height: 1.45;
    }

    .stack-row.start-actions {
        margin-top: 0.75rem;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .start-level-picker {
        gap: 0.45rem;
        margin-top: 0.75rem;
    }

    .world-selector {
        gap: 0.45rem;
    }

    .world-choice {
        min-height: 2.65rem;
        padding: 0.38rem 0.45rem;
        font-size: 0.84rem;
    }

    .world-choice-mark {
        height: 1.55rem;
    }

    .level-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .start-level-choice {
        min-height: 3.15rem;
    }

    .stack-row.start-actions .mud-button-root {
        width: 100%;
    }

    .immersive-topbar {
        top: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        padding: 0.65rem;
        grid-template-columns: minmax(0, 1fr);
    }

    .hud-stats {
        grid-column: 1 / -1;
    }

    .hud-progress {
        grid-column: 1 / -1;
    }

    .immersive-brand {
        align-items: center;
        flex-direction: row;
        gap: 0.5rem;
    }

    .immersive-brand .eyebrow {
        display: none;
    }

    .topbar-actions {
        display: none;
    }

    .immersive-root.playing .immersive-topbar {
        gap: 0.5rem;
        padding: 0.55rem;
        border-radius: 10px;
    }

    .immersive-root.playing .headline {
        font-size: clamp(0.95rem, 4vw, 1.1rem);
    }

    .immersive-root.playing .hud-stats {
        grid-template-columns: repeat(3, minmax(4.25rem, 1fr));
        gap: 0.35rem;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .immersive-root.playing .hud-stats::-webkit-scrollbar {
        display: none;
    }

    .immersive-root.playing .hud-stats div {
        padding: 0.35rem 0.45rem;
        border-radius: 8px;
        background: rgba(11, 21, 38, 0.72);
    }

    .immersive-root.playing .hud-stats strong {
        font-size: 0.9rem;
    }

    .immersive-root.playing .hud-stats span {
        font-size: 0.65rem;
    }

    .immersive-sidebar {
        top: 6rem;
        right: 0.75rem;
        bottom: 5.25rem;
        width: calc(100vw - 1.5rem);
        padding: 0.75rem;
    }

    .race-tracker {
        top: 8.9rem;
        left: 0.75rem;
        width: min(13rem, calc(100vw - 1.5rem));
        padding: 0.55rem;
    }

    .race-player:nth-child(n + 4) {
        display: none;
    }

    .session-grid {
        grid-template-columns: 1fr;
    }

    .immersive-mobile-controls {
        display: none;
    }

    .immersive-root.playing .immersive-mobile-controls {
        display: grid;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .immersive-root.playing .immersive-mobile-controls .mud-icon-button-root,
    .immersive-root.playing .immersive-mobile-controls .immersive-tool-button {
        width: 2.75rem !important;
        height: 2.75rem !important;
        min-width: 2.75rem !important;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .immersive-start-shell {
        place-items: center;
        overflow: hidden;
        padding: 0.5rem;
    }

    .immersive-start-card {
        width: min(60rem, calc(100vw - 1rem));
        max-height: calc(100dvh - 1rem);
        margin-top: 0;
        padding: 0.65rem;
        overflow: hidden;
    }

    .immersive-start-card h1 {
        font-size: 1.3rem;
        margin: 0.12rem 0 0.2rem;
    }

    .immersive-start-card .eyebrow {
        font-size: 0.58rem;
        letter-spacing: 0.18em;
    }

    .start-copy {
        display: none;
    }

    .start-header {
        align-items: center;
    }

    .start-home-button {
        width: 2.15rem;
        height: 2.15rem;
        flex-basis: 2.15rem;
    }

    .start-layout {
        grid-template-columns: minmax(11rem, 0.7fr) minmax(0, 1.65fr);
        gap: 0.5rem;
        margin-top: 0.4rem;
    }

    .start-player-panel,
    .start-course-panel {
        padding: 0.5rem;
        border-radius: 9px;
    }

    .start-player-panel {
        gap: 0.38rem;
    }

    .start-name-field {
        padding: 0.16rem 0.5rem;
    }

    .start-name-field input {
        height: 1.75rem;
        font-size: 0.78rem;
    }

    .start-profile-meta {
        font-size: 0.6rem;
    }

    .selected-level-card {
        gap: 0.25rem;
        margin: 0;
        padding: 0.4rem;
    }

    .selected-level-card > strong {
        font-size: 0.82rem;
    }

    .selected-level-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.2rem;
    }

    .selected-level-meta span {
        gap: 0.2rem;
        font-size: 0.56rem;
        white-space: nowrap;
    }

    .selected-level-meta .mud-icon-root {
        display: none;
    }

    .start-controls-hint {
        display: none;
    }

    .run-result-grid {
        gap: 0.25rem;
    }

    .run-result-grid div {
        padding: 0.3rem;
    }

    .start-level-picker {
        gap: 0.35rem;
        margin-top: 0;
    }

    .world-selector {
        gap: 0.3rem;
    }

    .world-choice {
        min-height: 2.05rem;
        padding: 0.24rem 0.32rem;
        font-size: 0.72rem;
        gap: 0.35rem;
    }

    .world-choice-mark {
        width: 0.42rem;
        height: 1.35rem;
    }

    .world-choice-meta {
        gap: 0.28rem;
    }

    .world-choice-meta strong {
        font-size: 0.58rem;
    }

    .level-category-header {
        display: none;
    }

    .level-choice-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 0.35rem;
    }

    .start-level-choice {
        min-height: 2.05rem;
        padding: 0.25rem 0.35rem;
        font-size: 0.72rem;
    }

    .level-choice-count {
        font-size: 0.58rem;
    }

    .stack-row.start-actions {
        grid-template-columns: minmax(0, 2fr) minmax(8rem, 0.6fr);
        gap: 0.35rem;
        margin-top: 0.5rem;
    }

    .start-action-button {
        min-height: 2rem;
        padding: 0.42rem 0.45rem;
        font-size: 0.72rem;
    }

    .immersive-topbar {
        top: 0.5rem;
        left: 0.5rem;
        right: auto;
        width: min(29rem, calc(100vw - 1rem));
        gap: 0.45rem;
        padding: 0.35rem;
        border-radius: 12px;
    }

    .immersive-root.playing .immersive-topbar {
        grid-template-columns: 2.25rem minmax(8rem, 1.2fr) minmax(10rem, 1.6fr) auto;
        align-items: stretch;
    }

    .immersive-root.playing .immersive-brand {
        display: contents;
        min-width: 0;
    }

    .immersive-root.playing .headline {
        font-size: 0.88rem;
        line-height: 1.1;
    }

    .immersive-root.playing .immersive-brand > div {
        display: block;
        align-self: center;
    }

    .immersive-root.playing .topbar-actions {
        display: none;
    }

    .immersive-root.playing .hud-progress {
        grid-column: auto;
        align-self: center;
    }

    .immersive-root.playing .hud-stats {
        grid-column: auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.25rem;
        justify-content: flex-start;
        overflow: hidden;
    }

    .immersive-root.playing .hud-coins {
        display: none;
    }

    .immersive-root.playing .hud-stats div {
        min-width: 0;
        padding: 0.22rem 0.32rem;
        border-radius: 8px;
        background: rgba(11, 21, 38, 0.52);
    }

    .immersive-root.playing .hud-stats strong {
        font-size: 0.78rem;
        line-height: 1;
    }

    .immersive-root.playing .hud-stats span {
        font-size: 0.58rem;
        line-height: 1;
    }

    .immersive-root.playing .immersive-nav-button {
        width: 2.25rem !important;
        height: 100% !important;
        min-width: 2.25rem !important;
        min-height: 2.25rem !important;
        border-radius: 8px !important;
    }

    .immersive-root.playing .immersive-nav-button .mud-icon-root {
        font-size: 1rem !important;
    }

    .immersive-sidebar {
        top: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        width: min(23rem, calc(55vw - 0.75rem));
        z-index: 40;
        max-height: calc(100dvh - 1rem);
        padding: 0.65rem;
        border-radius: 10px;
        overflow-y: auto;
    }

    .race-tracker {
        top: 3.5rem;
        left: 0.5rem;
        width: min(12rem, 38vw);
        padding: 0.45rem;
    }

    .race-player:nth-child(n + 3) {
        display: none;
    }

    .sidebar-header {
        align-items: center;
    }

    .sidebar-header .eyebrow {
        display: none;
    }

    .immersive-root.playing .eyebrow {
        display: none;
    }

    .sidebar-header h2 {
        margin: 0;
        font-size: 1.15rem;
        line-height: 1.1;
    }

    .sidebar-section {
        gap: 0.34rem;
        padding-top: 0.45rem;
        margin-top: 0.45rem;
    }

    .settings-online-section,
    .settings-leaderboard-section {
        display: none;
    }

    .section-title {
        font-size: 0.68rem;
        letter-spacing: 0.18em;
    }

    .status-text {
        display: none;
    }

    .settings-toggle,
    .settings-range,
    .settings-field {
        gap: 0.3rem;
        padding: 0.45rem 0.55rem;
    }

    .settings-field input,
    .settings-field select {
        height: 2rem;
        padding-inline: 0.55rem;
    }

    .settings-range {
        grid-template-columns: auto minmax(0, 1fr) 2.35rem;
    }

    .color-swatch {
        min-height: 1.55rem;
    }

    .immersive-mobile-controls {
        display: none;
        left: auto;
        right: 0.5rem;
        bottom: 0.5rem;
        width: min(20rem, 42vw);
        padding: 0.35rem;
        z-index: 18;
    }

    .immersive-root.playing .immersive-mobile-controls {
        display: grid;
    }

    .immersive-root.settings-open .immersive-mobile-controls {
        display: none;
    }

    .immersive-root.playing .immersive-mobile-controls .mobile-jump-button {
        min-height: 48px !important;
    }

    .immersive-root.playing .immersive-mobile-controls .immersive-tool-button {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
    }
}
