:root {
    --race-bg: #11171d;
    --race-surface: #182129;
    --race-surface-2: #202b34;
    --race-line: #34414a;
    --race-text: #f4f1ea;
    --race-muted: #aeb8bd;
    --race-accent: #e96b3b;
    --race-accent-dark: #b94722;
    --race-success: #79b88c;
    --race-danger: #ef725e;
    --race-radius: 18px;
}

.learning-race-page {
    margin: 0;
    min-width: 320px;
    min-height: 100dvh;
    overflow-x: hidden;
    background: var(--race-bg);
    color: var(--race-text);
    font-family: Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.learning-race-page .site-main,
.learning-race-page .page-shell,
.learning-race-page .page-shell-wide {
    min-height: 100dvh;
    padding: 0;
    margin: 0;
}

.race-app,
.race-app * {
    box-sizing: border-box;
}

.race-app h1,
.race-app h2,
.race-app h3,
.race-app h4,
.race-app button,
.race-app input,
.race-app select,
.race-app textarea {
    font-family: Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.race-app {
    position: relative;
    isolation: isolate;
    min-height: 100dvh;
    overflow: hidden;
    color: var(--race-text);
    background:
        radial-gradient(circle at 78% 8%, rgb(233 107 59 / 0.17), transparent 28rem),
        linear-gradient(128deg, #11171d 0%, #151e25 52%, #0f151a 100%);
}

.race-app::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.24;
    background-image: repeating-linear-gradient(112deg, transparent 0 62px, rgb(244 241 234 / 0.025) 63px 64px);
}

.race-app[data-theme="neon_rain"] {
    --race-bg: #071116;
    --race-surface: #0c1c22;
    --race-surface-2: #10272d;
    --race-line: #29464b;
    --race-text: #eef6f2;
    --race-muted: #a8c1c2;
    --race-accent: #f2ca45;
    --race-accent-dark: #b89627;
    --race-success: #6fc5a5;
    --race-danger: #ef725e;
    background:
        radial-gradient(circle at 78% 8%, rgb(72 216 209 / 0.13), transparent 28rem),
        linear-gradient(128deg, #071116 0%, #0b1d23 52%, #071318 100%);
}

.race-app[data-theme="neon_rain"]::before {
    opacity: 0.32;
    background-image:
        repeating-linear-gradient(108deg, transparent 0 74px, rgb(72 216 209 / 0.035) 75px 76px),
        linear-gradient(180deg, transparent, rgb(72 216 209 / 0.03));
}

.race-app[data-theme="neon_rain"] .race-topbar {
    background: rgb(7 17 22 / 0.9);
}

.race-app[data-theme="neon_rain"] .race-entry-copy::before {
    border-color: rgb(72 216 209 / 0.14);
    background:
        linear-gradient(90deg, transparent 48%, rgb(72 216 209 / 0.24) 49% 51%, transparent 52%),
        repeating-linear-gradient(0deg, transparent 0 62px, rgb(242 202 69 / 0.2) 63px 70px, transparent 71px 124px),
        #102329;
    box-shadow: 0 0 0 28px rgb(72 216 209 / 0.06);
}

.race-app[data-theme="neon_rain"] .race-entry-form,
.race-app[data-theme="neon_rain"] .race-controls-card,
.race-app[data-theme="neon_rain"] .race-result-sheet,
.race-app[data-theme="neon_rain"] .race-question-panel,
.race-app[data-theme="neon_rain"] .race-feedback {
    border-color: rgb(72 216 209 / 0.18);
    background: rgb(10 28 34 / 0.96);
}

.race-app[data-theme="neon_rain"] .race-field input,
.race-app[data-theme="neon_rain"] .race-field select,
.race-app[data-theme="neon_rain"] .race-key-layout kbd,
.race-app[data-theme="neon_rain"] .race-choice {
    border-color: #36585d;
    background: #07151a;
}

.race-app[data-theme="neon_rain"] .race-field input:focus,
.race-app[data-theme="neon_rain"] .race-field select:focus {
    box-shadow: 0 0 0 3px rgb(242 202 69 / 0.2);
}

.race-app[data-theme="neon_rain"] .race-sound[aria-pressed="true"] {
    border-color: rgb(242 202 69 / 0.72);
    background: rgb(242 202 69 / 0.12);
}

.race-app[data-theme="neon_rain"] .race-primary-button {
    color: #171407;
}

.race-app[data-theme="neon_rain"] .race-primary-button:hover {
    background: #f6d768;
}

.race-app[data-theme="neon_rain"] .race-choice:hover,
.race-app[data-theme="neon_rain"] .race-choice:focus-visible {
    background: rgb(242 202 69 / 0.11);
}

.race-app[data-theme="neon_rain"] .race-canvas-wrap {
    border-color: #36585d;
    background: #08171c;
    box-shadow: 0 34px 90px rgb(1 8 11 / 0.46), inset 0 1px 0 rgb(72 216 209 / 0.1);
}

.race-app[data-theme="neon_rain"] .race-speed {
    border-color: rgb(72 216 209 / 0.24);
    background: rgb(5 18 23 / 0.82);
}

.race-app[data-theme="neon_rain"] .race-question-layer {
    background: rgb(3 13 17 / 0.82);
}

.race-app [hidden] {
    display: none !important;
}

.race-topbar {
    position: relative;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 68px;
    padding: 12px clamp(18px, 3vw, 48px);
    border-bottom: 1px solid rgb(244 241 234 / 0.1);
    background: rgb(17 23 29 / 0.86);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.race-back,
.race-brand,
.race-sound {
    color: var(--race-text);
    text-decoration: none;
}

.race-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    font-size: 0.88rem;
    font-weight: 700;
}

.race-back span:first-child {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid var(--race-line);
    border-radius: 50%;
}

.race-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.race-brand-mark {
    position: relative;
    display: block;
    width: 34px;
    height: 22px;
    transform: skewX(-14deg);
}

.race-brand-mark::before,
.race-brand-mark::after,
.race-brand-mark i {
    content: "";
    position: absolute;
    left: 0;
    height: 4px;
    border-radius: 2px;
    background: var(--race-accent);
}

.race-brand-mark::before { top: 1px; width: 34px; }
.race-brand-mark i:first-child { top: 9px; width: 25px; }
.race-brand-mark i:last-child { top: 17px; width: 16px; }

.race-sound {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--race-line);
    border-radius: 12px;
    background: var(--race-surface);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

.race-sound-icon {
    position: relative;
    width: 15px;
    height: 14px;
    border-left: 6px solid var(--race-muted);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.race-sound-icon::before {
    content: "";
    position: absolute;
    left: -11px;
    top: -3px;
    width: 5px;
    height: 6px;
    border-radius: 2px 0 0 2px;
    background: var(--race-muted);
}

.race-sound[aria-pressed="true"] {
    border-color: rgb(233 107 59 / 0.7);
    background: rgb(233 107 59 / 0.13);
}

.race-sound[aria-pressed="true"] .race-sound-icon {
    border-left-color: var(--race-accent);
}

.race-sound[aria-pressed="true"] .race-sound-icon::before {
    background: var(--race-accent);
}

.race-main {
    width: min(1440px, 100%);
    min-height: calc(100dvh - 68px);
    margin: 0 auto;
}

.race-screen {
    width: 100%;
    min-height: calc(100dvh - 68px);
    animation: race-screen-in 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.race-screen-active {
    display: grid;
}

@keyframes race-screen-in {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

#race-identity {
    grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
    align-items: stretch;
}

.race-entry-copy {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100dvh - 68px);
    padding: clamp(48px, 7vw, 108px);
    overflow: hidden;
}

.race-entry-copy::before {
    content: "";
    position: absolute;
    right: -12%;
    bottom: -28%;
    width: 68%;
    aspect-ratio: 0.82;
    border: 1px solid rgb(244 241 234 / 0.1);
    transform: perspective(600px) rotateX(62deg) rotateZ(-18deg);
    background:
        linear-gradient(90deg, transparent 48%, rgb(244 241 234 / 0.15) 49% 51%, transparent 52%),
        repeating-linear-gradient(0deg, transparent 0 62px, rgb(244 241 234 / 0.18) 63px 70px, transparent 71px 124px),
        #252c31;
    box-shadow: 0 0 0 28px rgb(233 107 59 / 0.08);
}

.race-entry-copy > * {
    position: relative;
    z-index: 1;
}

.race-kicker {
    margin: 0 0 20px;
    color: var(--race-accent);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.race-entry-copy h1,
.race-briefing-copy h1,
.race-result-hero h1 {
    max-width: 780px;
    margin: 0;
    color: var(--race-text);
    font-size: clamp(2.65rem, 5.7vw, 6rem);
    font-weight: 800;
    letter-spacing: -0.065em;
    line-height: 0.96;
}

.race-entry-copy > p:not(.race-kicker) {
    max-width: 610px;
    margin: 26px 0 0;
    color: var(--race-muted);
    font-size: clamp(1rem, 1.25vw, 1.16rem);
    line-height: 1.75;
}

.race-rule-line {
    display: flex;
    gap: 0;
    width: fit-content;
    margin-top: 36px;
    border-top: 1px solid var(--race-line);
    border-bottom: 1px solid var(--race-line);
}

.race-rule-line span {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 128px;
    padding: 15px 20px;
    color: var(--race-muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.race-rule-line span + span {
    border-left: 1px solid var(--race-line);
}

.race-rule-line strong {
    color: var(--race-text);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.race-entry-form {
    align-self: center;
    width: min(520px, calc(100% - 48px));
    margin: 36px auto;
    padding: clamp(28px, 4vw, 48px);
    border: 1px solid rgb(244 241 234 / 0.14);
    border-radius: var(--race-radius);
    background: rgb(24 33 41 / 0.94);
    box-shadow: 0 30px 80px rgb(4 9 13 / 0.28), inset 0 1px 0 rgb(244 241 234 / 0.06);
}

.race-form-heading {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 34px;
}

.race-form-number {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    color: var(--race-bg);
    background: var(--race-accent);
    font-size: 0.8rem;
    font-weight: 900;
}

.race-form-heading h2,
.race-controls-card h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.035em;
}

.race-form-heading p {
    margin: 7px 0 0;
    color: var(--race-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.race-field {
    display: grid;
    gap: 8px;
    margin-bottom: 22px;
}

.race-field label {
    color: var(--race-text);
    font-size: 0.83rem;
    font-weight: 800;
}

.race-field input,
.race-field select {
    width: 100%;
    height: 52px;
    padding: 0 15px;
    border: 1px solid #46535c;
    border-radius: 12px;
    outline: none;
    color: var(--race-text);
    background: #11191f;
    font: inherit;
    font-size: 0.96rem;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.race-field input::placeholder {
    color: #88959b;
}

.race-field input:focus,
.race-field select:focus {
    border-color: var(--race-accent);
    box-shadow: 0 0 0 3px rgb(233 107 59 / 0.18);
}

.race-field input[aria-invalid="true"],
.race-field select[aria-invalid="true"] {
    border-color: var(--race-danger);
}

.race-field-help,
.race-field-error,
.race-form-error {
    min-height: 18px;
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.45;
}

.race-field-help { color: #98a5aa; }
.race-field-error,
.race-form-error { color: #ff9c8d; }
.race-form-error { margin-top: 12px; text-align: center; }

.race-primary-button,
.race-secondary-button,
.race-text-button,
.race-choice {
    font: inherit;
}

.race-primary-button,
.race-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.race-primary-button {
    width: 100%;
    border: 1px solid var(--race-accent);
    color: #17120f;
    background: var(--race-accent);
}

.race-primary-button:hover { background: #f07b4f; }
.race-primary-button:active,
.race-secondary-button:active,
.race-choice:active { transform: translateY(1px) scale(0.99); }
.race-primary-button:disabled { opacity: 0.58; cursor: wait; }

.race-secondary-button {
    border: 1px solid var(--race-line);
    color: var(--race-text);
    background: var(--race-surface);
}

.race-text-button {
    padding: 10px 0;
    border: 0;
    color: var(--race-muted);
    background: transparent;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

#race-briefing {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.7fr);
    gap: clamp(24px, 4vw, 68px);
    align-items: center;
    padding: clamp(32px, 5vw, 76px);
}

.race-briefing-panel {
    min-width: 0;
}

.race-briefing-copy h1 {
    font-size: clamp(2.7rem, 5.2vw, 5.4rem);
}

.race-briefing-copy h1 em {
    display: inline-block;
    padding-bottom: 5px;
    color: var(--race-accent);
    font-style: normal;
    line-height: 1.08;
}

.race-briefing-copy > p:last-child {
    max-width: 660px;
    margin: 24px 0 0;
    color: var(--race-muted);
    font-size: 1rem;
    line-height: 1.7;
}

.race-student-ticket {
    display: grid;
    grid-template-columns: 1.6fr repeat(3, 0.7fr);
    margin-top: 44px;
    border-top: 1px solid var(--race-line);
    border-bottom: 1px solid var(--race-line);
}

.race-student-ticket > div {
    display: grid;
    gap: 8px;
    padding: 18px 16px;
}

.race-student-ticket > div + div { border-left: 1px solid var(--race-line); }
.race-student-ticket span { color: var(--race-muted); font-size: 0.72rem; font-weight: 700; }
.race-student-ticket strong { font-size: 1rem; font-variant-numeric: tabular-nums; }

.race-controls-card {
    padding: 34px;
    border: 1px solid rgb(244 241 234 / 0.14);
    border-radius: var(--race-radius);
    background: var(--race-surface);
    box-shadow: inset 0 1px 0 rgb(244 241 234 / 0.05);
}

.race-key-layout {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    gap: 7px;
    width: fit-content;
    margin: 26px auto;
}

.race-key-layout kbd {
    display: grid;
    width: 52px;
    height: 46px;
    place-items: center;
    border: 1px solid #52616a;
    border-bottom-width: 4px;
    border-radius: 10px;
    color: var(--race-text);
    background: #10181e;
    font: 800 1.05rem Manrope, sans-serif;
}

.race-controls-card > p {
    margin: 0;
    color: var(--race-muted);
    font-size: 0.87rem;
    line-height: 1.6;
    text-align: center;
}

.race-briefing-actions {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.race-game-screen {
    min-height: calc(100dvh - 68px);
    padding: 18px clamp(14px, 2.5vw, 36px) 28px;
}

.race-hud {
    display: grid;
    grid-template-columns: minmax(170px, 1.5fr) 0.7fr 0.7fr minmax(180px, 1fr);
    gap: 1px;
    max-width: 1280px;
    margin: 0 auto 12px;
    overflow: hidden;
    border: 1px solid var(--race-line);
    border-radius: 14px;
    background: var(--race-line);
}

.race-hud > div {
    min-width: 0;
    padding: 11px 16px;
    background: var(--race-surface);
}

.race-hud-student,
.race-hud-stat,
.race-hud-lives {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.race-hud-student span,
.race-hud-stat strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 900;
}

.race-hud-student small,
.race-hud-stat > span,
.race-hud-lives > span {
    color: var(--race-muted);
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.race-hud-stat strong {
    font-variant-numeric: tabular-nums;
}

.race-life-row {
    display: flex;
    gap: 7px;
}

.race-life {
    position: relative;
    width: 21px;
    height: 12px;
    border-radius: 4px 5px 3px 3px;
    background: var(--race-accent);
}

.race-life::before {
    content: "";
    position: absolute;
    top: -4px;
    left: 5px;
    width: 11px;
    height: 6px;
    border-radius: 5px 5px 0 0;
    background: var(--race-accent);
}

.race-life::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: -3px;
    height: 4px;
    border-radius: 2px;
    background: #0c1115;
    box-shadow: 13px 0 #0c1115;
}

.race-life-lost { opacity: 0.2; filter: grayscale(1); }

.race-canvas-wrap {
    position: relative;
    width: min(1280px, 100%);
    aspect-ratio: 16 / 8.65;
    max-height: calc(100dvh - 168px);
    min-height: 360px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid #46535c;
    border-radius: var(--race-radius);
    background: #20252a;
    box-shadow: 0 34px 90px rgb(3 8 12 / 0.34), inset 0 1px 0 rgb(244 241 234 / 0.08);
}

#race-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.race-speed {
    position: absolute;
    right: 18px;
    bottom: 18px;
    display: grid;
    min-width: 88px;
    padding: 10px 13px;
    border: 1px solid rgb(244 241 234 / 0.18);
    border-radius: 12px;
    background: rgb(13 19 24 / 0.78);
    backdrop-filter: blur(10px);
    text-align: right;
}

.race-speed strong { font-size: 1.4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.race-speed span { color: var(--race-muted); font-size: 0.62rem; font-weight: 800; }

.race-countdown,
.race-pause-label {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--race-text);
    background: rgb(11 17 21 / 0.42);
    backdrop-filter: blur(2px);
    font-size: clamp(4rem, 14vw, 10rem);
    font-weight: 900;
    letter-spacing: -0.07em;
    text-shadow: 0 8px 40px rgb(3 8 12 / 0.35);
}

.race-pause-label {
    font-size: 1.2rem;
    letter-spacing: 0;
}

.race-question-layer {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: grid;
    place-items: center;
    padding: clamp(14px, 3vw, 36px);
    background: rgb(10 15 19 / 0.8);
    backdrop-filter: blur(12px) saturate(0.8);
    -webkit-backdrop-filter: blur(12px) saturate(0.8);
}

.race-question-panel {
    width: min(840px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: clamp(22px, 3vw, 38px);
    border: 1px solid rgb(244 241 234 / 0.18);
    border-radius: var(--race-radius);
    background: #19232b;
    box-shadow: 0 30px 90px rgb(2 7 10 / 0.48), inset 0 1px 0 rgb(244 241 234 / 0.06);
}

.race-question-meta {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--race-line);
    color: var(--race-muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.race-question-meta span:first-child { color: var(--race-accent); }

.race-question-panel h2 {
    margin: 24px 0;
    color: var(--race-text);
    font-size: clamp(1.35rem, 2.5vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.3;
}

.race-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.race-choice {
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 13px;
    min-height: 70px;
    padding: 12px 15px;
    border: 1px solid #46545d;
    border-radius: 12px;
    color: var(--race-text);
    background: #11191f;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.race-choice:hover,
.race-choice:focus-visible {
    border-color: var(--race-accent);
    background: rgb(233 107 59 / 0.1);
    outline: none;
}

.race-choice:disabled { opacity: 0.68; cursor: wait; }

.race-choice-key {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 10px;
    color: #17120f;
    background: var(--race-accent);
    font-weight: 900;
}

.race-choice-text { font-size: 0.9rem; font-weight: 700; line-height: 1.45; }
.race-question-status { min-height: 20px; margin: 14px 0 0; color: var(--race-muted); font-size: 0.8rem; }

.race-feedback {
    position: absolute;
    z-index: 9;
    left: 50%;
    top: 50%;
    width: min(480px, calc(100% - 32px));
    padding: 28px;
    transform: translate(-50%, -50%);
    border: 1px solid rgb(244 241 234 / 0.2);
    border-radius: var(--race-radius);
    background: #19232b;
    box-shadow: 0 28px 80px rgb(3 8 12 / 0.52);
    text-align: center;
}

.race-feedback strong { display: block; color: var(--race-accent); font-size: 1.5rem; }
.race-feedback p { margin: 10px 0 0; color: var(--race-muted); line-height: 1.6; }

.race-mobile-notice {
    display: none;
}

.race-canvas-description {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#race-result {
    grid-template-columns: minmax(0, 0.9fr) minmax(480px, 1.1fr);
    gap: clamp(28px, 5vw, 80px);
    align-items: center;
    padding: clamp(34px, 5vw, 76px);
}

.race-result-hero h1 { font-size: clamp(3.2rem, 7vw, 7rem); }
.race-result-hero > p:not(.race-kicker) { max-width: 520px; margin: 22px 0 0; color: var(--race-muted); line-height: 1.7; }

.race-final-score {
    display: flex;
    align-items: end;
    gap: 18px;
    width: fit-content;
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid var(--race-line);
}

.race-final-score span { padding-bottom: 8px; color: var(--race-muted); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.race-final-score strong { color: var(--race-accent); font-size: clamp(3rem, 6vw, 5.5rem); line-height: 0.9; font-variant-numeric: tabular-nums; }

.race-result-sheet {
    padding: clamp(24px, 3vw, 40px);
    border: 1px solid rgb(244 241 234 / 0.14);
    border-radius: var(--race-radius);
    background: var(--race-surface);
    box-shadow: inset 0 1px 0 rgb(244 241 234 / 0.05);
}

.race-result-identity {
    display: grid;
    gap: 4px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--race-line);
}

.race-result-identity span,
.race-result-grid dt { color: var(--race-muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.race-result-identity strong { font-size: 1.28rem; }
.race-result-identity small { color: var(--race-muted); }

.race-result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
}

.race-result-grid > div {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 18px 10px 18px 0;
    border-bottom: 1px solid var(--race-line);
}

.race-result-grid dd {
    margin: 0;
    color: var(--race-text);
    font-size: 1.05rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.race-result-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-top: 24px;
}

.race-global-error {
    position: fixed;
    z-index: 50;
    right: 20px;
    bottom: 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 18px;
    width: min(440px, calc(100% - 40px));
    padding: 16px 18px;
    border: 1px solid rgb(239 114 94 / 0.62);
    border-radius: 14px;
    background: #2b1e1e;
    box-shadow: 0 20px 60px rgb(3 8 12 / 0.4);
}

.race-global-error strong { color: #ffb1a5; }
.race-global-error span { grid-column: 1; color: #e4c6c1; font-size: 0.82rem; }
.race-global-error button { grid-column: 2; grid-row: 1 / 3; align-self: center; border: 0; color: var(--race-text); background: transparent; font: 800 0.78rem Manrope, sans-serif; cursor: pointer; }

.race-app button:focus-visible,
.race-app a:focus-visible {
    outline: 3px solid rgb(233 107 59 / 0.45);
    outline-offset: 3px;
}

@media (max-width: 980px) {
    #race-identity,
    #race-briefing,
    #race-result {
        grid-template-columns: 1fr;
    }

    .race-entry-copy { min-height: auto; padding: 54px 28px 28px; }
    .race-entry-copy::before { opacity: 0.55; }
    .race-entry-form { margin: 18px auto 54px; }
    #race-briefing, #race-result { align-content: start; }
    .race-controls-card { width: min(540px, 100%); }
    .race-result-sheet { width: 100%; }
}

@media (max-width: 767px) {
    .race-topbar {
        grid-template-columns: auto 1fr auto;
        min-height: 62px;
        padding: 10px 14px;
    }

    .race-back span:last-child,
    .race-sound-label { display: none; }
    .race-brand { justify-self: center; font-size: 0.78rem; }
    .race-sound { width: 38px; padding: 8px 11px; }
    .race-main, .race-screen { min-height: calc(100dvh - 62px); }
    .race-entry-copy h1 { font-size: clamp(2.4rem, 13vw, 4.2rem); }
    .race-entry-copy > p:not(.race-kicker) { margin-top: 20px; }
    .race-rule-line { width: 100%; }
    .race-rule-line span { flex: 1; min-width: 0; padding: 12px 8px; justify-content: center; text-align: center; }
    .race-rule-line strong { display: block; }
    .race-entry-form { width: calc(100% - 28px); padding: 24px 20px; }
    #race-briefing, #race-result { padding: 34px 18px; }
    .race-briefing-copy h1 { font-size: clamp(2.45rem, 12vw, 4rem); }
    .race-student-ticket { grid-template-columns: 1fr 1fr; }
    .race-student-ticket > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--race-line); }
    .race-student-ticket > div:nth-child(4) { border-top: 1px solid var(--race-line); }
    .race-controls-card { padding: 26px 20px; }
    .race-game-screen { padding: 10px; }
    .race-hud { grid-template-columns: 1fr 1fr; }
    .race-hud > div { padding: 9px 10px; }
    .race-hud-lives { border-left: 0; }
    .race-canvas-wrap { min-height: 430px; max-height: calc(100dvh - 190px); aspect-ratio: auto; }
    .race-mobile-notice {
        position: absolute;
        z-index: 5;
        inset: auto 12px 12px;
        display: grid;
        gap: 3px;
        padding: 12px 14px;
        border: 1px solid rgb(244 241 234 / 0.18);
        border-radius: 12px;
        background: rgb(17 23 29 / 0.92);
        color: var(--race-text);
        text-align: center;
    }
    .race-mobile-notice span { color: var(--race-muted); font-size: 0.74rem; }
    .race-choices { grid-template-columns: 1fr; }
    .race-choice { min-height: 58px; }
    .race-question-panel { padding: 20px 16px; }
    .race-result-hero h1 { font-size: clamp(3rem, 18vw, 5.2rem); }
    .race-result-grid { grid-template-columns: 1fr 1fr; }
    .race-result-actions { grid-template-columns: 1fr; }
    .race-secondary-button { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .race-screen { animation: none; }
    .race-app *, .race-app *::before, .race-app *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .race-topbar,
    .race-question-layer,
    .race-speed {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .race-topbar { background: #11171d; }
    .race-question-layer { background: #10171c; }
}
