:root {
    color-scheme: dark;
    --ink: #fff9ec;
    --muted: #d5e5e0;
    --panel: rgba(18, 22, 28, 0.86);
    --edge: rgba(255, 255, 255, 0.18);
    --pink: #ff7eb6;
    --mint: #72f2c8;
    --gold: #ffd166;
    --road: #3f444d;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(255, 126, 182, 0.11), transparent 22%, transparent 78%, rgba(114, 242, 200, 0.1)),
        radial-gradient(circle at 50% 115%, rgba(255, 209, 102, 0.12), transparent 28rem),
        linear-gradient(135deg, #141820, #252231 48%, #102e30);
    overflow: hidden;
}

.shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.game-panel {
    width: min(1460px, 100%);
    display: grid;
    grid-template-rows: auto minmax(320px, 1fr) auto;
    gap: 10px;
}

.game-panel:fullscreen {
    width: 100vw;
    height: 100vh;
    padding: 12px;
    background:
        linear-gradient(135deg, #141820, #252231 48%, #102e30);
}

.game-panel:fullscreen canvas {
    max-height: calc(100vh - 132px);
}

.hud,
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 10px 12px;
    border: 1px solid var(--edge);
    border-radius: 8px;
    background: var(--panel);
    backdrop-filter: blur(12px);
}

.hud-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.hud > div {
    min-width: 104px;
}

.label,
label {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

strong {
    display: block;
    margin-top: 1px;
    font-size: clamp(1rem, 2vw, 1.35rem);
}

button,
select {
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.1);
    font: inherit;
}

button {
    padding: 0 14px;
    font-weight: 800;
    cursor: pointer;
}

button:hover,
select:hover {
    border-color: var(--gold);
}

select {
    position: absolute;
    width: 1px;
    min-width: 0;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.select-wrap strong {
    margin-top: 0;
    font-size: 1rem;
}

select {
    min-width: 190px;
    padding: 0 32px 0 10px;
}

canvas {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 144px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: #1d2324;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
    image-rendering: pixelated;
}

.stage {
    position: relative;
    overflow: hidden;
}

.stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
}

.game-panel.fx-scanlines .stage::after,
.game-panel.fx-crt .stage::after,
.game-panel.fx-green .stage::after,
.game-panel.fx-blood .stage::after,
.game-panel.fx-night .stage::after,
.game-panel.fx-arcade .stage::after {
    opacity: 1;
}

.game-panel.fx-scanlines .stage::after {
    background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0 2px, transparent 2px 5px);
    mix-blend-mode: multiply;
}

.game-panel.fx-crt canvas,
.game-panel.fx-crt .welcome-screen,
.game-panel.fx-crt .start-menu,
.game-panel.fx-crt .results-screen {
    filter: saturate(1.25) contrast(1.12) brightness(0.95);
}

.game-panel.fx-crt .stage::after {
    background:
        radial-gradient(circle at 50% 50%, transparent 54%, rgba(0, 0, 0, 0.36)),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0 1px, rgba(0, 0, 0, 0.18) 1px 4px);
}

.game-panel.fx-green canvas,
.game-panel.fx-green .welcome-screen,
.game-panel.fx-green .start-menu,
.game-panel.fx-green .results-screen {
    filter: grayscale(1) sepia(1) hue-rotate(64deg) saturate(2.1) contrast(1.1);
}

.game-panel.fx-green .stage::after {
    background: repeating-linear-gradient(180deg, rgba(166, 255, 121, 0.1) 0 2px, transparent 2px 6px);
}

.game-panel.fx-blood canvas,
.game-panel.fx-blood .welcome-screen,
.game-panel.fx-blood .start-menu,
.game-panel.fx-blood .results-screen {
    filter: sepia(0.35) saturate(1.55) hue-rotate(-18deg) contrast(1.1);
}

.game-panel.fx-blood .stage::after {
    background: radial-gradient(circle at 50% 45%, transparent 42%, rgba(120, 0, 0, 0.42));
}

.game-panel.fx-gray canvas,
.game-panel.fx-gray .welcome-screen,
.game-panel.fx-gray .start-menu,
.game-panel.fx-gray .results-screen {
    filter: grayscale(1) contrast(1.18);
}

.game-panel.fx-contrast canvas,
.game-panel.fx-contrast .welcome-screen,
.game-panel.fx-contrast .start-menu,
.game-panel.fx-contrast .results-screen {
    filter: contrast(1.45) saturate(1.35) brightness(1.04);
}

.game-panel.fx-night canvas,
.game-panel.fx-night .welcome-screen,
.game-panel.fx-night .start-menu,
.game-panel.fx-night .results-screen {
    filter: brightness(0.72) saturate(1.25) hue-rotate(12deg);
}

.game-panel.fx-night .stage::after {
    background: radial-gradient(circle at 50% 50%, transparent 34%, rgba(0, 0, 0, 0.58));
}

.game-panel.fx-dream canvas,
.game-panel.fx-dream .welcome-screen,
.game-panel.fx-dream .start-menu,
.game-panel.fx-dream .results-screen {
    filter: blur(0.7px) saturate(1.4) brightness(1.08);
}

.game-panel.fx-pixel canvas,
.game-panel.fx-pixel .welcome-screen,
.game-panel.fx-pixel .start-menu,
.game-panel.fx-pixel .results-screen {
    filter: contrast(1.22) saturate(1.18);
}

.game-panel.fx-pixel .stage {
    image-rendering: pixelated;
}

.game-panel.fx-arcade canvas,
.game-panel.fx-arcade .welcome-screen,
.game-panel.fx-arcade .start-menu,
.game-panel.fx-arcade .results-screen {
    filter: saturate(1.65) contrast(1.16) brightness(1.06);
}

.game-panel.fx-arcade .stage::after {
    background:
        linear-gradient(90deg, rgba(255, 126, 182, 0.16), transparent 28%, transparent 72%, rgba(114, 242, 200, 0.16)),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 5px);
    mix-blend-mode: screen;
}

.welcome-screen,
.start-menu {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    border-radius: 8px;
    text-align: center;
}

.welcome-screen {
    align-items: flex-end;
    background:
        linear-gradient(180deg, rgba(8, 9, 12, 0), rgba(8, 9, 12, 0.18) 55%, rgba(8, 9, 12, 0.65)),
        url("assets/ui/start-screen.png") center / cover no-repeat;
}

.start-menu {
    background:
        radial-gradient(circle at 24% 30%, rgba(255, 209, 102, 0.16), transparent 18rem),
        linear-gradient(180deg, rgba(8, 9, 12, 0.72), rgba(8, 9, 12, 0.9)),
        url("assets/ui/start-screen.png") center / cover no-repeat;
}

.welcome-screen.hidden,
.start-menu.hidden {
    display: none;
}

.menu-flow {
    width: min(1220px, 98%);
    max-height: calc(100% - 20px);
    overflow: hidden;
}

.menu-step {
    width: 100%;
}

.menu-step.hidden,
#modeStep.hidden,
#roomStep.hidden,
#cupStep.hidden,
#kartStep.hidden,
.multiplayer-panel.hidden,
.race-grid.hidden {
    display: none !important;
}

.multiplayer-disabled .multiplayer-only {
    display: none !important;
}

.multiplayer-disabled #cupStep .menu-actions {
    grid-template-columns: 1fr;
}

.multiplayer-disabled #kartStep {
    width: min(1040px, 96%);
    margin: 0 auto;
    grid-template-columns: 1fr;
    gap: 12px;
}

.multiplayer-disabled #kartStep .selected-driver {
    min-height: 0;
    grid-template-columns: auto 1fr auto;
    justify-content: center;
    align-items: center;
    text-align: left;
    padding: 12px 18px;
}

.multiplayer-disabled #kartStep .selected-driver .menu-actions {
    width: min(380px, 100%);
}

.multiplayer-disabled #kartStep .menu-art {
    width: 112px;
    height: 86px;
}

.multiplayer-disabled #kartStep .kart-grid {
    width: 100%;
}

#kartStep {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(620px, 1.28fr);
    gap: 16px;
    align-items: stretch;
}

.selected-driver,
.kart-grid,
#modeStep,
#roomStep,
#cupStep,
.multiplayer-panel {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(13, 16, 21, 0.72);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(8px);
}

#modeStep,
#roomStep,
#cupStep {
    width: min(620px, 94%);
    margin: 0 auto;
    display: grid;
    place-items: center;
    gap: 14px;
    padding: 22px;
    max-height: min(720px, calc(100vh - 190px));
    overflow-y: auto;
    text-align: center;
}

#modeStep h1,
#roomStep h1,
#cupStep h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 4.2rem);
    line-height: 0.95;
    color: #fff2cf;
    text-shadow:
        0 4px 0 rgba(0, 0, 0, 0.55),
        0 0 18px rgba(255, 120, 38, 0.28);
}

.selected-driver {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    min-height: 500px;
    padding: 16px;
}

.cup-grid {
    width: 100%;
    display: grid;
    gap: 8px;
}

.mode-grid,
.menu-actions,
.room-actions {
    display: grid;
    gap: 8px;
}

.mode-grid {
    width: min(360px, 100%);
    grid-template-columns: 1fr;
}

#continueToKart {
    width: min(360px, 100%);
}

.menu-actions,
.room-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-card,
.cup-card,
.race-card,
.kart-card {
    border-color: rgba(255, 209, 102, 0.58);
    background:
        linear-gradient(180deg, rgba(76, 41, 32, 0.92), rgba(31, 23, 24, 0.94)),
        repeating-linear-gradient(90deg, rgba(255, 209, 102, 0.08) 0 2px, transparent 2px 8px);
}

.mode-card.selected {
    border-color: var(--gold);
    color: #fff9ec;
    background:
        linear-gradient(180deg, rgba(145, 44, 28, 0.96), rgba(56, 25, 23, 0.98)),
        radial-gradient(circle at 50% 0%, rgba(255, 209, 102, 0.3), transparent 70%);
    box-shadow: inset 0 0 0 1px rgba(255, 249, 236, 0.16), 0 0 18px rgba(255, 82, 42, 0.22);
}

.multiplayer-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.room-code {
    min-height: 48px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(255, 209, 102, 0.5);
    border-radius: 8px;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.28);
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.room-actions {
    grid-template-columns: 1fr 1fr auto;
}

.room-actions input {
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.1);
    font: inherit;
    font-weight: 800;
    text-transform: uppercase;
}

.multiplayer-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.room-status,
.room-players {
    width: 100%;
    border: 1px solid rgba(255, 209, 102, 0.34);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 800;
}

.room-status {
    padding: 8px 10px;
    color: var(--gold);
}

.room-players {
    display: grid;
    gap: 4px;
    padding: 8px;
}

.room-player {
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.race-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.cup-card {
    position: relative;
    min-height: 58px;
    padding: 8px 10px;
    width: 100%;
    border: 2px solid rgba(255, 209, 102, 0.5);
    border-radius: 8px;
    color: var(--ink);
    text-align: center;
}

.race-card {
    min-height: 36px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.07);
    font-size: 0.72rem;
    font-weight: 800;
}

.race-card.selected {
    border-color: var(--mint);
    background: rgba(114, 242, 200, 0.2);
}

.cup-card strong,
.cup-card span {
    display: block;
}

.cup-card strong {
    font-size: 0.96rem;
    color: #ffd166;
}

.cup-card span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.25;
}

.cup-card.selected {
    border-color: #fff2a8;
    color: #fff9ec;
    background:
        radial-gradient(circle at 50% 10%, rgba(255, 230, 118, 0.38), transparent 62%),
        linear-gradient(180deg, rgba(190, 56, 28, 0.98), rgba(86, 24, 18, 0.98));
    box-shadow:
        inset 0 0 0 2px rgba(255, 249, 236, 0.22),
        0 0 0 3px rgba(255, 209, 102, 0.24),
        0 0 24px rgba(255, 82, 42, 0.42),
        0 10px 24px rgba(0, 0, 0, 0.32);
}

.cup-card.selected::before,
.cup-card.selected::after {
    content: "▶";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffd166;
    font-size: 1rem;
    text-shadow: 0 0 8px rgba(255, 209, 102, 0.8);
}

.cup-card.selected::before {
    left: 12px;
}

.cup-card.selected::after {
    right: 12px;
    transform: translateY(-50%) scaleX(-1);
}

.cup-card.selected strong {
    color: #fff2a8;
    text-shadow: 0 0 10px rgba(255, 209, 102, 0.52);
}

.cup-card.selected span {
    color: #fff9ec;
}

.start-menu h1 {
    margin: 0;
    max-width: 360px;
    font-size: clamp(1.9rem, 3.5vw, 3.5rem);
    line-height: 0.92;
    letter-spacing: 0;
    text-shadow: 0 5px 0 rgba(0, 0, 0, 0.26);
}

.start-menu p {
    width: min(360px, 100%);
    margin: 10px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 800;
}

.welcome-screen button,
.start-menu button {
    min-width: 180px;
    height: 46px;
    border-color: rgba(255, 209, 102, 0.8);
    background: linear-gradient(180deg, rgba(145, 44, 28, 0.96), rgba(56, 25, 23, 0.98));
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.welcome-screen button {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

.menu-art {
    width: 164px;
    height: 128px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 14px 12px rgba(0, 0, 0, 0.38));
    transform-origin: center;
    transition: filter 120ms ease;
}

.menu-art.spinning {
    filter:
        drop-shadow(0 14px 12px rgba(0, 0, 0, 0.38))
        drop-shadow(0 0 12px rgba(255, 209, 102, 0.42));
}

.results-screen {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 30%, rgba(255, 209, 102, 0.24), transparent 18rem),
        linear-gradient(180deg, rgba(8, 9, 12, 0.35), rgba(8, 9, 12, 0.88)),
        url("assets/ui/start-screen.png") center / cover no-repeat;
}

.results-screen.hidden {
    display: none;
}

.results-panel {
    width: min(1040px, 96%);
    padding: 18px;
    border: 1px solid rgba(255, 209, 102, 0.45);
    border-radius: 8px;
    background: rgba(12, 14, 18, 0.82);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(10px);
    text-align: center;
}

.results-panel h2 {
    margin: 0 0 14px;
    color: var(--gold);
    font-size: clamp(1.6rem, 3vw, 2.7rem);
    line-height: 1;
    text-shadow: 0 5px 0 rgba(0, 0, 0, 0.42);
}

.podium-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.podium-card {
    position: relative;
    min-height: 270px;
    display: grid;
    place-items: center;
    align-content: end;
    gap: 12px;
    padding: 18px 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 126, 182, 0.2), rgba(255, 255, 255, 0.06));
}

.podium-card:first-child {
    min-height: 320px;
    border-color: rgba(255, 209, 102, 0.9);
}

.podium-card:nth-child(2) {
    min-height: 292px;
}

.podium-place {
    min-height: 20px;
    color: var(--gold);
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
}

.speech {
    position: relative;
    width: min(254px, 92%);
    min-height: 64px;
    display: grid;
    place-items: center;
    padding: 9px 10px;
    border: 2px solid rgba(255, 249, 236, 0.9);
    border-radius: 8px;
    color: #1c1510;
    background: #fff9ec;
    font-size: 0.86rem;
    font-weight: 900;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.speech::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -20px;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: #fff9ec;
}

.podium-card img {
    width: min(118px, 70%);
    height: 96px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 14px 8px rgba(0, 0, 0, 0.45));
}

.podium-name {
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 900;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

.kart-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    max-height: min(540px, calc(100vh - 180px));
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(255, 255, 255, 0.08);
}

.kart-grid::-webkit-scrollbar {
    width: 10px;
}

.kart-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.kart-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold), var(--pink));
    border-radius: 8px;
}

.kart-card {
    display: grid;
    grid-template-rows: 62px auto;
    place-items: center;
    gap: 4px;
    min-height: 92px;
    padding: 7px 5px;
    border: 2px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: var(--ink);
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 209, 102, 0.18), transparent 46%),
        linear-gradient(180deg, rgba(76, 41, 32, 0.92), rgba(31, 23, 24, 0.94));
    box-shadow: inset 0 -18px 34px rgba(0, 0, 0, 0.16);
}

.kart-card:hover {
    border-color: rgba(255, 209, 102, 0.7);
}

.kart-card.selected {
    border-color: var(--gold);
    background:
        linear-gradient(180deg, rgba(145, 44, 28, 0.96), rgba(56, 25, 23, 0.98)),
        radial-gradient(circle at 50% 18%, rgba(255, 209, 102, 0.22), transparent 64%);
}

.kart-card img {
    max-width: 72px;
    max-height: 56px;
    image-rendering: pixelated;
    filter: drop-shadow(0 8px 7px rgba(0, 0, 0, 0.34));
}

.kart-card span {
    max-width: 100%;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tips {
    min-width: 0;
    color: var(--muted);
    font-size: 0.92rem;
    text-align: right;
}

.rotate-phone {
    display: none;
}

.touch-controls {
    display: none;
}

@media (max-width: 720px) {
    body {
        overflow: auto;
    }

    .shell {
        align-items: start;
        padding: 10px;
    }

    .hud,
    .controls {
        flex-wrap: wrap;
    }

    .hud > div {
        min-width: calc(33% - 10px);
    }

    #restart {
        width: 100%;
    }

    .select-wrap,
    .tips,
    select {
        width: 100%;
    }

    .tips {
        text-align: left;
    }

    canvas {
        max-height: none;
    }

    #kartStep {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .selected-driver {
        min-height: 0;
    }

    .multiplayer-disabled #kartStep .selected-driver {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .kart-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-height: 360px;
    }

    .menu-art {
        width: 132px;
        height: 104px;
    }
}

@media (max-width: 950px) and (orientation: landscape) {
    body {
        overflow: hidden;
    }

    .shell {
        padding: 6px;
    }

    .game-panel,
    .game-panel:fullscreen {
        width: 100vw;
        height: 100vh;
        gap: 5px;
        padding: 6px;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .hud,
    .controls {
        min-height: 38px;
        padding: 5px 6px;
        gap: 6px;
    }

    .hud > div {
        min-width: 64px;
    }

    strong {
        font-size: 0.92rem;
    }

    button {
        height: 30px;
        padding: 0 9px;
        font-size: 0.78rem;
    }

    canvas {
        height: 100%;
        max-height: none;
    }

    .start-menu,
    .welcome-screen {
        padding: 8px;
    }

    #roomStep,
    #cupStep {
        width: min(680px, 96vw);
        max-height: calc(100vh - 84px);
        overflow-y: auto;
        padding: 10px;
        gap: 8px;
    }

    #roomStep h1,
    #cupStep h1 {
        font-size: clamp(1.5rem, 6vw, 2.4rem);
    }

    .room-actions {
        grid-template-columns: 1fr 1fr auto;
    }

    #kartStep {
        grid-template-columns: minmax(220px, 0.72fr) minmax(380px, 1.28fr);
        gap: 8px;
        max-height: calc(100vh - 84px);
    }

    .selected-driver {
        min-height: 0;
        padding: 10px;
        gap: 7px;
    }

    .kart-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        max-height: calc(100vh - 92px);
        padding: 8px;
    }

    .kart-card {
        grid-template-rows: 42px auto;
        min-height: 70px;
    }

    .kart-card img {
        max-width: 58px;
        max-height: 40px;
    }

    .menu-art {
        width: 92px;
        height: 72px;
    }

    .tips {
        font-size: 0.76rem;
    }

    .touch-controls {
        position: absolute;
        inset: auto 10px 10px;
        z-index: 12;
        display: flex;
        justify-content: space-between;
        pointer-events: none;
    }

    .touch-left,
    .touch-right {
        display: flex;
        gap: 8px;
        pointer-events: auto;
    }

    .touch-controls button {
        width: 58px;
        height: 48px;
        padding: 0;
        border: 2px solid rgba(255, 209, 102, 0.55);
        background: rgba(8, 9, 12, 0.58);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(8px);
        touch-action: none;
    }
}

@media (hover: hover) and (pointer: fine) {
    .touch-controls {
        display: none;
    }
}

@media (max-width: 950px) and (orientation: portrait) {
    .shell {
        display: none;
    }

    .rotate-phone {
        min-height: 100vh;
        display: grid;
        place-items: center;
        gap: 8px;
        padding: 28px;
        color: var(--ink);
        background:
            radial-gradient(circle at 50% 30%, rgba(255, 209, 102, 0.15), transparent 16rem),
            linear-gradient(135deg, #141820, #252231 48%, #102e30);
        text-align: center;
    }

    .rotate-phone strong {
        font-size: clamp(2rem, 12vw, 4rem);
        line-height: 0.9;
    }

    .rotate-phone span {
        color: var(--muted);
        font-weight: 800;
    }
}
