/*
 * Sprint Car Showdown â€” Main Stylesheet
 * -------------------------------------
 * Dark motorsports-inspired design.
 * Uses CSS artwork only; no external fonts or images required.
 */

/* ---------- Theme and reset ---------- */

:root {
    color-scheme: dark;
    --bg: #0b0d0e;
    --panel: #131719;
    --panel-raised: #191e20;
    --border: #2a3031;
    --text: #f3f2ec;
    --muted: #9da5a3;
    --accent: #e9ff61;
    --accent-dark: #c5df35;
    --orange: #ff7849;
    --radius: 16px;
    --content-width: 1160px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(ellipse at 80% 0%, rgb(233 255 97 / 5%), transparent 34rem),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

a {
    color: inherit;
}

::selection {
    color: var(--bg);
    background: var(--accent);
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.page-shell {
    width: min(var(--content-width), calc(100% - 48px));
    margin-inline: auto;
}

/* ---------- Header and brand ---------- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-block: 25px;
    border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgb(233 255 97 / 50%);
    border-radius: 12px;
    background: var(--accent);
    color: #10130b;
    font-size: 21px;
    font-weight: 950;
    letter-spacing: -2px;
    transform: skew(-5deg);
}

.brand-copy {
    display: grid;
    gap: 1px;
}

.brand-name {
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.11em;
    line-height: 1.3;
    text-transform: uppercase;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.19em;
    text-transform: uppercase;
}

.header-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px rgb(233 255 97 / 45%);
}

/* ---------- Hero ---------- */

.hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 48px;
    min-height: 390px;
    padding-block: 54px 60px;
}

.hero-copy {
    position: relative;
    z-index: 1;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.eyebrow-line {
    display: inline-block;
    width: 27px;
    height: 2px;
    background: var(--accent);
}

.hero h1 {
    max-width: 620px;
    margin: 0;
    font-size: clamp(44px, 6.3vw, 78px);
    font-weight: 950;
    letter-spacing: -0.075em;
    line-height: 0.98;
    text-transform: uppercase;
}

.hero h1 span {
    display: block;
    color: var(--accent);
}

.hero-description {
    max-width: 460px;
    margin: 23px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 11px;
    margin-top: 25px;
    color: #d3d8d3;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tag-divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

/* ---------- CSS-built racing artwork ---------- */

.hero-art {
    position: relative;
    display: grid;
    min-height: 280px;
    place-items: center;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid #303638;
    border-radius: 20px;
    background:
        linear-gradient(135deg, transparent 45%, rgb(255 255 255 / 3%) 45% 46%, transparent 46%),
        linear-gradient(35deg, #161b1c, #0f1213 60%, #202526);
}

.hero-art::before,
.hero-art::after {
    position: absolute;
    z-index: -1;
    content: "";
    pointer-events: none;
}

.hero-art::before {
    inset: 0;
    background-image:
        linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(135deg, black, transparent 85%);
}

.hero-art::after {
    top: -45%;
    right: -25%;
    width: 80%;
    height: 150%;
    border: 1px solid rgb(233 255 97 / 14%);
    border-radius: 50%;
    transform: rotate(-28deg);
    box-shadow:
        0 0 0 18px rgb(233 255 97 / 3%),
        0 0 0 38px rgb(233 255 97 / 3%),
        0 0 0 60px rgb(233 255 97 / 2%);
}

.art-glow {
    position: absolute;
    top: 14%;
    right: 15%;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: rgb(233 255 97 / 11%);
    filter: blur(55px);
}

.art-speed-lines {
    position: absolute;
    top: 29%;
    left: 0;
    width: 100%;
    height: 42%;
    background: repeating-linear-gradient(
        170deg,
        transparent 0 17px,
        rgb(255 255 255 / 5%) 18px 19px,
        transparent 20px 33px
    );
    transform: skewY(-9deg);
}

.art-number {
    position: relative;
    z-index: 1;
    color: var(--accent);
    font-size: clamp(130px, 20vw, 230px);
    font-weight: 1000;
    letter-spacing: -0.12em;
    line-height: 0.9;
    text-shadow: 0 10px 50px rgb(233 255 97 / 10%);
    transform: skew(-8deg);
}

.art-caption {
    position: absolute;
    right: 20px;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    padding-top: 13px;
    border-top: 1px solid rgb(255 255 255 / 17%);
}

.caption-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.caption-title {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.art-stripe {
    width: 58px;
    height: 7px;
    flex: 0 0 auto;
    background: repeating-linear-gradient(
        115deg,
        var(--accent) 0 8px,
        transparent 8px 12px
    );
}

/* ---------- Create and join section ---------- */

.game-entry {
    padding-block: 30px 55px;
    border-top: 1px solid rgb(255 255 255 / 8%);
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(25px, 3vw, 34px);
    font-weight: 900;
    letter-spacing: -0.045em;
    line-height: 1.2;
    text-transform: uppercase;
}

.section-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.build-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid #454b35;
    border-radius: 999px;
    color: var(--accent);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.entry-card {
    position: relative;
    min-width: 0;
    padding: 26px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, #171b1c, #111415);
    transition: border-color 180ms ease, transform 180ms ease;
}

.entry-card:hover {
    border-color: #485044;
    transform: translateY(-2px);
}

.create-card {
    border-top: 2px solid var(--accent);
}

.join-card {
    border-top: 2px solid #555e60;
}

.card-topline {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 20px;
}

.card-icon {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #343a37;
    border-radius: 12px;
    background: #202624;
    color: var(--accent);
    font-size: 21px;
    font-weight: 850;
}

.card-kicker {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.entry-card h3 {
    margin: 2px 0 0;
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -0.025em;
    text-transform: uppercase;
}

.entry-card > p {
    min-height: 44px;
    margin: 0 0 21px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.entry-card label {
    display: block;
    margin-bottom: 8px;
    color: #e2e5df;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.entry-card input {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-bottom: 14px;
    padding: 11px 13px;
    border: 1px solid #363d3e;
    border-radius: 9px;
    outline: none;
    background: #0d1011;
    color: var(--text);
    font-size: 14px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.entry-card input::placeholder {
    color: #69716e;
}

.entry-card input:hover {
    border-color: #59615d;
}

.entry-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(233 255 97 / 10%);
}

.entry-card input[aria-invalid="true"] {
    border-color: var(--orange);
}

/* ---------- Buttons ---------- */

.button {
    display: flex;
    width: 100%;
    min-height: 49px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
    transition:
        background 150ms ease,
        border-color 150ms ease,
        color 150ms ease,
        transform 150ms ease;
}

.button span {
    font-size: 18px;
    line-height: 1;
    transition: transform 150ms ease;
}

.button:hover span {
    transform: translateX(3px);
}

.button:active {
    transform: scale(0.99);
}

.button-primary {
    background: var(--accent);
    color: #11140a;
}

.button-primary:hover {
    background: #f0ff91;
}

.button-secondary {
    border-color: #3a4242;
    background: #202526;
    color: var(--text);
}

.button-secondary:hover {
    border-color: #747d7a;
    background: #292f30;
}

/* ---------- Feedback and game notes ---------- */

.feedback-message {
    min-height: 0;
    margin-top: 16px;
    padding: 0;
    border-radius: 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.feedback-message:not(:empty) {
    padding: 13px 16px;
    border: 1px solid #353d35;
    background: #151a16;
}

.feedback-message[data-state="error"] {
    border-color: rgb(255 120 73 / 45%);
    color: #ffad8c;
}

.feedback-message[data-state="success"] {
    border-color: rgb(233 255 97 / 35%);
    color: var(--accent);
}

.race-notes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--border);
}

.note-item {
    display: flex;
    gap: 14px;
    padding: 22px 20px;
    background: #111415;
}

.note-number {
    color: var(--accent);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.06em;
}

.note-item h3 {
    margin: 0 0 5px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.note-item p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
}

/* ---------- Footer ---------- */

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 42px;
    padding-block: 22px 28px;
    border-top: 1px solid rgb(255 255 255 / 8%);
    color: var(--muted);
    font-size: 10px;
}

.site-footer p {
    margin: 0;
}

.site-footer strong {
    color: #dfe4dd;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------- Responsive layouts ---------- */

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr 0.8fr;
        gap: 24px;
        padding-block: 45px;
    }

    .hero h1 {
        font-size: clamp(42px, 7vw, 65px);
    }

    .hero-art {
        min-height: 250px;
    }

    .entry-card {
        padding: 21px;
    }

    .race-notes {
        grid-template-columns: 1fr;
    }

    .note-item {
        padding: 18px 20px;
    }
}

@media (max-width: 650px) {
    .page-shell {
        width: min(100% - 32px, var(--content-width));
    }

    .site-header {
        padding-block: 18px;
    }

    .brand-mark {
        width: 39px;
        height: 39px;
        font-size: 19px;
    }

    .brand-name {
        font-size: 12px;
    }

    .brand-subtitle {
        font-size: 9px;
    }

    .header-status {
        gap: 6px;
        font-size: 10px;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 29px;
        padding-block: 43px 38px;
    }

    .hero h1 {
        font-size: clamp(47px, 12vw, 72px);
    }

    .hero-description {
        margin-top: 18px;
        font-size: 14px;
    }

    .hero-art {
        min-height: 220px;
    }

    .art-number {
        font-size: clamp(130px, 40vw, 200px);
    }

    .game-entry {
        padding-block: 27px 38px;
    }

    .section-heading {
        align-items: start;
        flex-direction: column;
        gap: 12px;
    }

    .entry-grid {
        grid-template-columns: 1fr;
    }

    .entry-card {
        padding: 22px;
    }

    .entry-card > p {
        min-height: 0;
    }

    .site-footer {
        align-items: start;
        flex-direction: column;
        gap: 7px;
        margin-top: 30px;
    }
}

@media (max-width: 380px) {
    .header-status {
        max-width: 94px;
        text-align: right;
    }

    .hero-tags {
        gap: 8px;
        font-size: 9px;
    }

    .art-caption {
        right: 14px;
        bottom: 14px;
        left: 14px;
    }
}

/* Respect operating-system reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ---------- Main navigation and simplified pages ---------- */

.site-header {
    position: relative;
    flex-wrap: wrap;
    padding-block: 18px;
}

.main-navigation {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    transition:
        color 150ms ease,
        background 150ms ease,
        border-color 150ms ease;
}

.nav-link:hover {
    border-color: var(--border);
    color: var(--text);
}

.nav-link.active {
    border-color: rgb(233 255 97 / 25%);
    background: rgb(233 255 97 / 8%);
    color: var(--accent);
}

.welcome-heading {
    max-width: 760px;
    margin-inline: auto;
    padding-block: 58px 38px;
    text-align: center;
}

.welcome-heading .eyebrow {
    justify-content: center;
    margin-bottom: 13px;
}

.welcome-heading h1,
.placeholder-page h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
    font-weight: 950;
    letter-spacing: -0.065em;
    line-height: 1.12;
}

.welcome-heading h1 span {
    color: var(--accent);
}

.welcome-heading > p:last-child {
    max-width: 550px;
    margin: 17px auto 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

.entry-card h2 {
    margin: 2px 0 8px;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -0.035em;
}

.entry-card > p {
    min-height: 0;
}

.page-section[hidden] {
    display: none !important;
}

.placeholder-page {
    max-width: 760px;
    min-height: 420px;
    margin-inline: auto;
    padding-block: 90px 70px;
}

.placeholder-page .eyebrow {
    margin-bottom: 14px;
}

.placeholder-page > p:not(.eyebrow) {
    max-width: 600px;
    margin-block: 18px 25px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.9;
}

.coming-soon {
    display: inline-flex;
    padding: 8px 12px;
    border: 1px solid rgb(233 255 97 / 25%);
    border-radius: 7px;
    background: rgb(233 255 97 / 6%);
    color: var(--accent);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0.1em;
}

.site-footer {
    margin-top: 26px;
}

/* Keep navigation comfortable on tablets and phones. */

@media (max-width: 760px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .main-navigation {
        width: 100%;
        justify-content: flex-start;
        gap: 4px;
    }

    .nav-link {
        flex: 1 1 auto;
        padding-inline: 10px;
    }

    .welcome-heading {
        padding-block: 42px 28px;
    }

    .placeholder-page {
        min-height: 340px;
        padding-block: 55px 45px;
    }
}

@media (max-width: 420px) {
    .main-navigation {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-link {
        width: 100%;
    }

    .welcome-heading h1 {
        font-size: 35px;
    }
}

/* Sprint Car Showdown: Lobby and room settings
   ---------------------------------------------
   Appended to preserve the existing website redesign. */

.entry-card select {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 8px 0 20px;
    padding: 12px 14px;
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
    background: var(--input-background, #111827);
    color: inherit;
    font: inherit;
    color-scheme: dark;
}

.entry-card select:focus-visible,
.lobby-actions button:focus-visible,
.lobby-room-code button:focus-visible {
    outline: 2px solid var(--accent-color, #38bdf8);
    outline-offset: 3px;
}

.lobby-page {
    width: min(100% - 32px, 900px);
    margin-inline: auto;
}

.lobby-panel {
    display: grid;
    gap: 28px;
    margin-top: 28px;
    padding: clamp(18px, 4vw, 32px);
    border: 1px solid var(--border-color, #334155);
    border-radius: 18px;
    background: var(--card-background, #111827);
    box-shadow: 0 16px 40px rgb(0 0 0 / 18%);
}

.lobby-room-code {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-color, #334155);
}

.lobby-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted-color, #94a3b8);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.lobby-room-code strong {
    overflow-wrap: anywhere;
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    letter-spacing: 0.16em;
}

.lobby-room-code .lobby-label {
    flex-basis: 100%;
    margin-bottom: 0;
}

.lobby-room-code button {
    margin-left: auto;
}

.lobby-settings {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.lobby-settings > div {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    background: rgb(255 255 255 / 3%);
}

.lobby-settings strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 1.05rem;
}

.lobby-player-section h2 {
    margin: 0 0 14px;
}

.lobby-player-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lobby-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    background: rgb(255 255 255 / 3%);
}

.lobby-player-identity {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.lobby-player-identity strong {
    overflow-wrap: anywhere;
}

.lobby-player-role {
    color: var(--muted-color, #94a3b8);
    font-size: 0.8rem;
}

.lobby-ready-status {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 700;
}

.lobby-ready-status.is-ready {
    color: var(--success-color, #4ade80);
}

.lobby-ready-status.is-not-ready {
    color: var(--muted-color, #94a3b8);
}

.lobby-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.lobby-actions button {
    flex: 1 1 160px;
}

.lobby-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.lobby-page .feedback-message {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .lobby-settings {
        grid-template-columns: 1fr;
    }

    .lobby-settings > div {
        padding: 13px 15px;
    }

    .lobby-room-code button {
        margin-left: 0;
    }

    .lobby-player {
        align-items: flex-start;
    }

    .lobby-actions {
        flex-direction: column;
    }

    .lobby-actions button {
        width: 100%;
    }
}

/* ---------- Multiplayer car draft ---------- */

.draft-page {
    width: 100%;
}

.draft-page > #draft-intro {
    max-width: 760px;
    color: var(--muted);
    line-height: 1.65;
}

.draft-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 26px 0;
}

.draft-summary > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 9px;
    padding: 18px;
    border: 1px solid var(--border, #353d35);
    border-radius: 12px;
    background: var(--surface, #151a16);
}

.draft-summary strong {
    overflow-wrap: anywhere;
    font-size: 1.05rem;
}

.draft-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
    gap: 22px;
}

.draft-stage,
.draft-cars {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border, #353d35);
    border-radius: 14px;
    background: var(--surface, #151a16);
}

.draft-stage h2,
.draft-cars h2 {
    margin-top: 0;
}

.draft-stage > p,
.draft-cars-heading > p {
    color: var(--muted);
    line-height: 1.6;
}

.draft-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 18px 0;
}

.draft-actions .button {
    width: auto;
    min-width: 160px;
    flex: 1 1 160px;
    justify-content: center;
}

.draft-actions .button[hidden] {
    display: none !important;
}

.draft-page .feedback-message {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.draft-order-section {
    margin-top: 26px;
}

.draft-order-section h3 {
    margin-bottom: 12px;
}

.draft-roll-list,
.draft-pick-history {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 24px;
}

.draft-roll-item {
    padding: 12px;
    border: 1px solid var(--border, #353d35);
    border-radius: 10px;
    background: var(--background, #101413);
}

.draft-roll-item strong,
.draft-roll-item span {
    display: block;
    overflow-wrap: anywhere;
}

.draft-roll-item span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.draft-pick-history li {
    padding-left: 3px;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.draft-cars-heading {
    margin-bottom: 18px;
}

.draft-car-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.draft-car-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 15px;
    border: 1px solid var(--border, #353d35);
    border-radius: 12px;
    background: var(--background, #101413);
}

.draft-car-card h3 {
    margin: 0;
    font-size: 1.25rem;
}

.draft-car-card p {
    margin: 0;
    overflow-wrap: anywhere;
}

.draft-car-driver {
    font-weight: 600;
}

.draft-car-stats {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.draft-pick-button {
    width: 100%;
    min-height: 42px;
    margin-top: auto;
    justify-content: center;
    font-size: 0.9rem;
}

.draft-pick-button:disabled,
.draft-actions .button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

@media (max-width: 900px) {
    .draft-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .draft-car-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .draft-summary {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        margin: 20px 0;
    }

    .draft-summary > div {
        padding: 14px;
    }

    .draft-stage,
    .draft-cars {
        padding: 16px;
    }

    .draft-actions {
        flex-direction: column;
    }

    .draft-actions .button {
        width: 100%;
        flex-basis: auto;
    }

    .draft-car-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .draft-car-card {
        padding: 12px;
    }

    .draft-car-stats {
        font-size: 0.82rem;
    }
}

/* Sorted, single-column driver roster for the draft. */
.draft-car-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.draft-car-card {
    display: grid;
    grid-template-columns:
        minmax(55px, 0.45fr)
        minmax(140px, 1.2fr)
        minmax(220px, 2fr)
        minmax(100px, 0.7fr);
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}

.draft-car-card h3 {
    font-size: 1.05rem;
}

.draft-pick-button {
    width: auto;
    margin-top: 0;
}

@media (max-width: 600px) {
    .draft-car-card {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        gap: 8px;
        padding: 10px;
    }

    .draft-car-card h3 {
        grid-column: 1;
        grid-row: 1;
    }

    .draft-car-driver {
        grid-column: 2;
        grid-row: 1;
    }

    .draft-car-stats {
        grid-column: 2;
        grid-row: 2;
        font-size: 0.8rem;
    }

    .draft-pick-button {
        grid-column: 3;
        grid-row: 1 / span 2;
        padding: 8px;
    }
}

/* Keep each movement label directly beside its value. */
.draft-car-stats {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .draft-car-stats {
        grid-column: 1 / span 2;
        grid-row: 2;
        white-space: nowrap;
        font-size: 0.78rem;
    }
}


/* Draft order and player teams. */
.draft-roll-list {
    grid-template-columns: repeat(
        auto-fit,
        minmax(135px, 1fr)
    );
    padding-left: 0;
    list-style: none;
}

.draft-roll-item {
    min-width: 0;
}

.draft-teams-section {
    margin-top: 26px;
}

.draft-team-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.draft-team-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border, #353d35);
    border-radius: 10px;
    background: var(--background, #101413);
}

.draft-team-card h4 {
    margin: 0 0 12px;
    overflow-wrap: anywhere;
}

.draft-team-roster {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.draft-team-car {
    display: grid;
    gap: 4px;
    padding-top: 9px;
    border-top: 1px solid var(--border, #353d35);
}

.draft-team-car strong {
    overflow-wrap: anywhere;
}

.draft-team-car span,
.draft-team-empty {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

@media (max-width: 600px) {
    .draft-roll-list,
    .draft-team-list {
        grid-template-columns: minmax(0, 1fr);
    }
}
/* =========================================================
   Race screen layout
   This is a display shell; live game data is connected later.
   ========================================================= */

.page-shell:has(#page-race:not([hidden])) {
    /* Keep the laptop layout wide while avoiding an oversized layout on very large displays. */
    width: calc(100% - 40px);
    max-width: 1800px;
}

@media (min-width: 1600px) {
    .page-shell:has(#page-race:not([hidden])) {
        /* Slightly more breathing room on large monitors; laptop sizing stays unchanged. */
        max-width: 1640px;
    }
}

.race-page {
    color: #edf2f5;
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.race-page-heading,
.race-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.race-page-heading h1 {
    margin: 0;
}

.race-subtitle,
.race-muted,
.race-control-hint {
    color: #9eabb6;
}

.race-subtitle {
    margin: 8px 0 0;
}

.race-connection-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #34434c;
    border-radius: 999px;
    padding: 9px 13px;
    color: #b9c5cc;
    background: #172129;
    font-size: .85rem;
    white-space: nowrap;
}

.race-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e1a64b;
    box-shadow: 0 0 10px #e1a64b55;
}

.race-main-layout {
    display: grid;
    grid-template-columns: minmax(0, 3.2fr) minmax(270px, 1fr);
    gap: 18px;
    /* Match the combined sidebar panels to the track panel height. */
    align-items: stretch;
}

/* Keep the track in the left column and span the four equal information panels across the full race layout. */
.race-left-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    min-width: 0;
}

.race-under-track-layout {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    min-width: 0;
    align-items: stretch;
}

.race-under-track-layout > .race-info-panel {
    min-width: 0;
    height: 100%;
}

.race-qualifying-standings-wrap {
    min-width: 0;
}

.race-standings-caption {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: .76rem;
}

.race-qualifying-standings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.race-qualifying-standings li {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid #303e47;
    border-radius: 7px;
    background: #10171b;
    font-size: .8rem;
}

.race-qualifying-standings .race-standings-rank {
    color: var(--accent);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.race-qualifying-standings .race-standings-car-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.race-qualifying-standings .race-standings-car {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.race-qualifying-standings .race-standings-owner {
    overflow: hidden;
    color: var(--muted);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.race-qualifying-standings .race-standings-distance {
    color: var(--muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.race-qualifying-standings .race-standings-empty {
    display: block;
    color: var(--muted);
}

.race-track-panel,
.race-info-panel,
.race-bottom-panel {
    min-width: 0;
    border: 1px solid #303e47;
    border-radius: 15px;
    background: #172129;
    box-shadow: 0 10px 26px #00000020;
}

.race-track-panel {
    /* Let the track artwork rise to the top of its panel. */
    position: relative;
    padding: 0 18px 0;
}

.race-track-viewport {
    /* The SVG viewBox is shifted upward so the oval nearly reaches the top edge. */
    margin-top: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #10191f;
}

.race-track-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 260px;
}

.track-background {
    fill: #10191f;
}

.track-surface {
    fill: #765b42;
    stroke: #c0a07b;
    stroke-width: 3;
}

.track-lane-line {
    fill: none;
    stroke: #e2c9a5;
    stroke-width: 1.7;
    opacity: .85;
}

.track-inner-boundary {
    fill: #31533f;
    stroke: #d1b48a;
    stroke-width: 3;
}

.track-section-dividers line {
    stroke: #e9d4b5;
    stroke-width: 1.2;
    opacity: .65;
}

.track-section-labels text {
    fill: #fff1dc;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    paint-order: stroke;
    stroke: #765b42;
    stroke-width: 2px;
    stroke-linejoin: round;
}

.track-infield-title {
    fill: #e4eee5;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 2px;
}

.track-infield-subtitle {
    fill: #b4c9b8;
    font-size: 12px;
}

.track-start-finish line {
    stroke: #ffffff;
    stroke-width: 5;
    stroke-dasharray: 5 4;
}

.race-track-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 15px 2px 0;
    color: #aebbc3;
    font-size: .78rem;
}

.race-track-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-lane {
    background: #b18a61;
}

.legend-divider {
    background: #e9d4b5;
}

.legend-start {
    background: #ffffff;
}

.race-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    min-height: 0;
}

.race-sidebar .race-movement-panel {
    flex: 0 0 auto;
}

.race-sidebar .race-turn-summary-panel {
    flex: 1 1 auto;
    min-height: 0;
}

.race-info-panel {
    padding: 17px;
}

.race-segment-placeholder {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 14px;
    border: 1px solid #34434c;
    border-radius: 10px;
    background: #111a20;
}

.race-info-label,
.race-info-list dt {
    color: #9eabb6;
    font-size: .78rem;
}

.race-segment-placeholder strong {
    font-size: 1.05rem;
}

.race-muted {
    font-size: .76rem;
    line-height: 1.45;
}

.race-info-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
    margin: 17px 0 0;
}

.race-info-list div {
    min-width: 0;
}

.race-info-list dt {
    margin-bottom: 5px;
}

.race-info-list dd {
    margin: 0;
    font-size: .9rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.race-status-pill {
    display: inline-block;
    border: 1px solid #47555e;
    border-radius: 999px;
    padding: 4px 8px;
    color: #c3cdd3;
    font-size: .72rem;
    font-weight: 600;
}

.race-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    gap: 7px;
    text-align: center;
    color: #aab7bf;
}

.race-empty-state p {
    margin: 0;
    color: #dbe2e6;
    font-size: .88rem;
    font-weight: 650;
}

.race-empty-state > span:last-child {
    max-width: 250px;
    font-size: .76rem;
    line-height: 1.45;
}

.race-empty-icon {
    color: #d1a36c;
    font-size: 1.5rem;
    line-height: 1;
}

.race-events-panel {
    flex: 1;
}

.race-bottom-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
    align-items: stretch;
}

.race-bottom-panel {
    padding: 18px;
}

/* Dice and movement controls live together at the top of the right sidebar. */
.race-movement-panel {
    padding: 15px;
}

.race-movement-panel .race-dice-row {
    margin-bottom: 14px;
}

.race-movement-panel .qualifying-controls {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.race-movement-panel .qualifying-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.race-movement-panel .qualifying-actions button,
.race-movement-panel .race-primary-button {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--accent-dark);
    border-radius: 9px;
    padding: 10px 12px;
    color: #11140a;
    background: var(--accent);
    font-weight: 800;
    cursor: pointer;
}

.race-movement-panel .qualifying-actions button:hover:not(:disabled),
.race-movement-panel .race-primary-button:hover:not(:disabled) {
    background: #f0ff91;
}

.race-movement-panel .qualifying-actions button:disabled,
.race-movement-panel .race-primary-button:disabled {
    color: #827548;
    background: #665b32;
    border-color: #7b6d3a;
    cursor: not-allowed;
}

.race-movement-panel #qualifying-feedback,
.race-movement-panel #qualifying-status,
.race-movement-panel #qualifying-roll-progress {
    margin: 0;
    font-size: .8rem;
    line-height: 1.4;
}



.race-bottom-empty {
    min-height: 120px;
}

.race-dice-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.race-die-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 12px 6px;
    border: 1px solid #394851;
    border-radius: 10px;
    background: #111a20;
}

.race-die-card span {
    color: #aab7bf;
    font-size: .72rem;
    text-align: center;
}

.race-die-card strong {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid #4c5b64;
    border-radius: 9px;
    background: #202e37;
    color: #f1f4f6;
    font-size: 1.2rem;
}

.race-control-hint {
    min-height: 40px;
    margin: 13px 0;
    font-size: .78rem;
    line-height: 1.5;
}

.race-primary-button {
    width: 100%;
    border: 1px solid #47545d;
    border-radius: 9px;
    padding: 11px 14px;
    background: #29363e;
    color: #9eabb6;
    font: inherit;
    font-size: .85rem;
    font-weight: 700;
    cursor: not-allowed;
}

@media (max-width: 1100px) {
    .race-main-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .race-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .race-sidebar .race-events-panel {
        grid-column: 1 / -1;
    }

    .race-bottom-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .race-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .race-track-panel,
    .race-info-panel,
    .race-bottom-panel {
        padding: 13px;
    }

    .race-track-svg {
        min-height: 0;
    }

    .track-section-labels text {
        font-size: 15px;
    }

    .race-sidebar,
    .race-bottom-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .race-under-track-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .race-sidebar .race-events-panel {
        grid-column: auto;
    }

    .race-panel-note {
        font-size: .72rem;
    }
}

/* Track drawing: final geometry and specification colors */
.race-track-svg .track-background {
    fill: #172129;
}

.race-track-svg .track-surface {
    fill: #986a43;
    stroke: #000000;
    stroke-width: 4;
}

.race-track-svg .lane-boundary {
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.25;
}

.race-track-svg .track-lanes path:first-child,
.race-track-svg .track-lanes path:last-child {
    stroke: #000000;
    stroke-width: 4;
}

.race-track-svg .track-infield {
    fill: #172129;
    stroke: #000000;
    stroke-width: 4;
}

.race-track-svg .track-section-dividers line {
    stroke: #ffffff;
    stroke-width: 1;
    opacity: .95;
}

/* Live car markers sit above the numbered track spaces. */
.race-track-svg .track-car-token {
    pointer-events: none;
}
.race-track-svg .track-car-token rect {
    fill: #172129;
    stroke: #f4d29b;
    stroke-width: 1.5;
}
.race-track-svg .track-car-token text {
    fill: #ffffff;
    stroke: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 800;
    pointer-events: none;
}
.race-track-svg .track-space-labels text {
    display: none;
}

.race-track-svg .track-start-finish text {
    fill: #ffffff;
    stroke: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 8px;
    font-weight: 800;
}

.race-page:not([hidden]) .race-track-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 2 / 1;
}

/* Keep this tab focused on its action button; other qualifying details belong elsewhere. */
.race-movement-panel #qualifying-status,
.race-movement-panel .qualifying-next-car,
.race-movement-panel #qualifying-roll-progress,
.race-movement-panel #qualifying-feedback,
.race-movement-panel #qualifying-results,
.race-movement-panel h3 {
    display: none !important;
}

.race-movement-panel .qualifying-actions #qualifying-roll-button {
    display: none !important;
}

.race-movement-panel .qualifying-movement-choices > p,
.race-movement-panel .qualifying-movement-choices > h3 {
    display: none !important;
}

.race-movement-panel .qualifying-confirm-movement-button {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--accent-dark);
    border-radius: 9px;
    padding: 10px 12px;
    color: #11140a;
    background: var(--accent);
    font-weight: 800;
    cursor: pointer;
}

.race-movement-panel .qualifying-confirm-movement-button:hover:not(:disabled) {
    background: #f0ff91;
}

.race-movement-panel .qualifying-confirm-movement-button:disabled {
    color: #827548;
    background: #665b32;
    border-color: #7b6d3a;
    cursor: not-allowed;
}


/* Keep backend qualifying details available to the existing game logic,
   but do not display them in the compact movement-controls tab. */
.race-movement-panel #qualifying-status,
.race-movement-panel .qualifying-next-car,
.race-movement-panel #qualifying-roll-progress,
.race-movement-panel .qualifying-results-heading,
.race-movement-panel h3,
.race-movement-panel #qualifying-results,
.race-movement-panel .race-control-hint,
.race-movement-panel .race-primary-button {
    display: none !important;
}


/* Restore the three dice at the top of the movement tab, each with its own color. */
.race-movement-panel .race-dice-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 14px;
}

.race-movement-panel .race-die-card:nth-child(1) {
    border-color: #27864a;
    background: #10291b;
}
.race-movement-panel .race-die-card:nth-child(1) strong {
    border-color: #36a85e;
    background: #218344;
    color: #f4fff7;
}

.race-movement-panel .race-die-card:nth-child(2) {
    border-color: #c49b22;
    background: #30270d;
}
.race-movement-panel .race-die-card:nth-child(2) strong {
    border-color: #e7bd39;
    background: #f2c94c;
    color: #171b1e;
}

.race-movement-panel .race-die-card:nth-child(3) {
    border-color: #a93636;
    background: #301515;
}
.race-movement-panel .race-die-card:nth-child(3) strong {
    border-color: #d84b4b;
    background: #b83232;
    color: #fff5f5;
}

/* Compact Current Turn panel. */
.race-turn-summary-panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 7px;
}

.race-turn-summary-panel .race-panel-heading {
    margin: 0;
    padding: 0;
    gap: 2px;
    line-height: 1;
}

.race-turn-summary-panel .race-panel-heading h2 {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.05;
}

.race-turn-car-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 6px;
    border: 1px solid #39434b;
    border-radius: 4px;
    background: #171d22;
}

.race-turn-car-name .race-info-label {
    font-size: 0.62rem;
    line-height: 1;
}

.race-turn-car-name strong {
    color: #f4f6f8;
    font-size: 0.84rem;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.race-turn-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.race-turn-stat,
.race-turn-stat-wide {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 34px;
    padding: 4px 5px;
    border: 1px solid #39434b;
    border-radius: 4px;
    background: #20272d;
}

.race-turn-stat span {
    color: #aeb8c0;
    font-size: 0.58rem;
    line-height: 1.1;
    overflow-wrap: normal;
}

.race-turn-stat strong {
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.race-turn-stat-wide:last-child {
    grid-column: 1 / -1;
}
/* Give Current Turn stat boxes more room on laptop-sized screens. */
@media (min-width: 1101px) and (max-width: 1599px) {
    .race-turn-stats {
        gap: 10px;
    }

    .race-turn-stat,
    .race-turn-stat-wide {
        min-height: 58px;
        padding: 0px 11px;
        gap: 5px;
    }

    .race-turn-stat span {
        font-size: 0.76rem;
    }

    .race-turn-stat strong {
        font-size: 1.08rem;
    }
}
/* Qualifying wheel-event history: grow with its entries rather than scrolling internally. */
.race-event-log {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 0;
    padding: 0;
}

.race-event-log li {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 9px;
    border: 1px solid #303e47;
    border-radius: 7px;
    background: #10171b;
    font-size: .8rem;
}

.race-event-log .race-event-log-car {
    color: #e8edf0;
    font-weight: 750;
}

.race-event-log .race-event-log-details {
    color: #aab7bf;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.race-event-log .race-event-log-empty {
    color: #aab7bf;
    background: transparent;
    border-style: dashed;
}

/* Race name, progress and player color key on the track panel. */
.race-track-panel {
    position: relative;
}

.race-track-status {
    position: absolute;
    z-index: 5;
    top: 10px;
    right: 28px;
    left: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none;
}

.race-track-status strong {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 7px;
    background: rgb(13 18 21 / 88%);
    color: #f3f2ec;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.race-track-player-legend {
    position: absolute;
    z-index: 5;
    bottom: 10px;
    left: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 14px;
    max-width: calc(100% - 56px);
    pointer-events: none;
}
.race-track-condition {
    position: absolute;
    z-index: 5;
    right: 28px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 7px;
    background: rgb(13 18 21 / 88%);
    color: #f3f2ec;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
}
.race-track-player {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 23px;
    padding: 2px 7px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 6px;
    background: rgb(13 18 21 / 88%);
    color: #f3f2ec;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.race-track-player-color {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border: 1px solid rgb(255 255 255 / 65%);
    border-radius: 50%;
}

.race-track-player-empty {
    padding: 3px 8px;
    border-radius: 6px;
    background: rgb(13 18 21 / 88%);
    color: #c3cbc9;
    font-size: 11px;
}

@media (max-width: 900px) {
    .race-track-status {
        top: 7px;
        right: 24px;
        left: 24px;
    }

    .race-track-player-legend {
        bottom: 7px;
        left: 24px;
    }
    .race-track-condition {
        right: 24px;
        bottom: 7px;
        font-size: 10px;
    }

    .race-track-status strong {
        font-size: 10px;
    }

    .race-track-player {
        font-size: 10px;
    }
}


/* ---------- Heat 1 preparation dialog ---------- */

#heat-preparation-dialog {
    width: min(1180px, calc(100% - 32px));
    max-width: 1180px;
    max-height: min(88vh, 900px);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgb(233 255 97 / 42%);
    border-radius: 16px;
    background: #131719;
    color: var(--text);
    box-shadow: 0 24px 90px rgb(0 0 0 / 72%);
}

#heat-preparation-dialog::backdrop {
    background: rgb(0 0 0 / 78%);
    backdrop-filter: blur(5px);
}

.heat-preparation-content {
    display: grid;
    gap: 14px;
    max-height: min(88vh, 900px);
    padding: 28px;
    overflow: auto;
}

.heat-preparation-content .eyebrow {
    margin: 0;
}

.heat-preparation-content h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.05;
    text-transform: uppercase;
}

.heat-preparation-condition {
    width: fit-content;
    margin: 0;
    padding: 7px 12px;
    border: 1px solid rgb(233 255 97 / 45%);
    border-radius: 7px;
    color: var(--accent);
    font-weight: 800;
}

.heat-preparation-instructions {
    margin: 0;
    color: var(--muted);
}

.heat-preparation-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.heat-preparation-section {
    min-width: 0;
}

.heat-preparation-section h3 {
    margin: 0 0 9px;
    color: var(--accent);
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.heat-preparation-standings-wrap {
    max-height: 38vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.heat-preparation-standings {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.heat-preparation-standings th,
.heat-preparation-standings td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.heat-preparation-standings th {
    position: sticky;
    top: 0;
    background: #202729;
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.heat-preparation-standings tbody tr:last-child td {
    border-bottom: 0;
}

.heat-preparation-players {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.heat-preparation-player {
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 12px;
}

.heat-preparation-player.is-ready {
    border-color: rgb(233 255 97 / 45%);
    color: var(--accent);
}

.heat-preparation-feedback {
    min-height: 20px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

#heat-preparation-ready {
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #10130b;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#heat-preparation-ready:disabled {
    opacity: 0.65;
}

@media (max-width: 760px) {
    .heat-preparation-columns {
        grid-template-columns: 1fr;
    }

    .heat-preparation-standings-wrap {
        max-height: 32vh;
    }
}

/* Race incident dialog styling */
#incident-dialog {
    width: min(460px, calc(100% - 32px));
    padding: 26px;
    border: 2px solid #e9ff61;
    border-radius: 16px;
    background: #131719;
    color: var(--text);
    box-shadow: 0 24px 90px rgb(0 0 0 / 72%);
}

#incident-dialog::backdrop {
    background: rgb(0 0 0 / 78%);
    backdrop-filter: blur(5px);
}

.incident-cars {
    display: grid;
    gap: 10px;
    max-height: min(42vh, 360px);
    overflow-y: auto;
    margin: 14px 0;
    padding: 0;
    list-style: none;
}

.incident-car-entry {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 10px;
    background: rgb(255 255 255 / 4%);
    line-height: 1.4;
}

.incident-car-original {
    border-color: rgb(233 255 97 / 48%);
}

.incident-car-owner {
    color: var(--muted);
    font-size: .9em;
}

#incident-acknowledge {
    min-width: 104px;
    padding: 11px 24px;
    border: 1px solid #e9ff61;
    border-radius: 999px;
    background: #e9ff61;
    color: #111713;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

#incident-acknowledge:hover:not(:disabled) {
    background: #f4ff9a;
    border-color: #f4ff9a;
}

#incident-acknowledge:disabled {
    opacity: .6;
    cursor: wait;
}

.race-event-yellow-flag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 3px 0;
    color: #f0e64a;
    font-size: .9em;
}

.race-event-yellow-flag svg {
    width: 25px;
    height: 18px;
    flex: 0 0 auto;
}

/* Season standings and championship lobbies */
.season-lobby-page,
.season-championship-page {
    width: min(1400px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.season-lobby-grid,
.season-winners-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.season-standings-panel,
.season-ready-panel,
.season-winner-card {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border, #344047);
    border-radius: 16px;
    background: var(--panel, #171e22);
}

.season-standings-panel h2,
.season-ready-panel h2 {
    margin-top: 0;
}

.season-table-wrap {
    max-height: 520px;
    overflow: auto;
}

.season-points-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .94rem;
}

.season-points-table th,
.season-points-table td {
    padding: 10px 9px;
    border-bottom: 1px solid rgb(255 255 255 / 9%);
    text-align: left;
    white-space: nowrap;
}

.season-points-table th {
    position: sticky;
    top: 0;
    background: #20292e;
    color: var(--muted, #aeb9bd);
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.season-points-table tbody tr:first-child td {
    color: #f0d36b;
    font-weight: 800;
}

.season-ready-panel {
    margin-top: 22px;
    text-align: center;
}

.season-ready-players {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 18px 0;
}

.season-ready-player {
    padding: 8px 12px;
    border: 1px solid #59636a;
    border-radius: 999px;
    color: var(--muted, #c2c9cc);
}

.season-ready-player.is-ready {
    border-color: #86c98c;
    color: #a8e6ad;
}

.season-championship-page {
    text-align: center;
}

.season-championship-page > h1 {
    margin: 8px 0;
    font-size: clamp(2.6rem, 7vw, 5rem);
    color: #f0d36b;
}

.season-championship-subtitle {
    margin-bottom: 28px;
    color: var(--muted, #b9c2c6);
}

.season-winner-card {
    padding: 30px 22px;
    border-color: #9b8546;
    background: linear-gradient(145deg, #29271e, #171e22 70%);
}

.season-winner-card h2 {
    margin: 8px 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.season-winner-card strong {
    display: inline-block;
    margin-top: 12px;
    color: #f0d36b;
    font-size: 1.25rem;
}

.season-final-standings {
    text-align: left;
}

@media (max-width: 850px) {
    .season-lobby-grid,
    .season-winners-grid {
        grid-template-columns: 1fr;
    }
    .season-table-wrap {
        max-height: 420px;
    }
}

/* Account screens */
.account-panel {
    margin-top: 28px;
    padding: 26px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    background: rgba(20,24,20,.72);
}
.account-access-form,
#account-profile-form {
    display: grid;
    gap: 10px;
    align-content: start;
}
.account-panel input {
    width: 100%;
    box-sizing: border-box;
}
.account-access-form { max-width: 520px; }
.account-access-form label,
#account-profile-form label { margin-top: 8px; }
.account-actions,
.saved-game-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.text-button { border: 0; padding: 8px 0; background: transparent; color: #d9b45b; text-decoration: underline; cursor: pointer; }
.account-feedback { min-height: 1.5em; margin-bottom: 0; }
.account-feedback.is-error { color: #ff9b86; }
.account-note { opacity: .75; font-size: .9rem; }
#account-signout { margin-top: 18px; }
@media (max-width: 700px) {
    .account-actions { flex-direction: column; }
    .account-actions button { width: 100%; }
    .account-panel { padding: 18px; }
}

/* Account-linked saved games shown on the My Games page. */
.my-games-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.saved-game-card {
    padding: 18px;
    border: 1px solid #dedfd9;
    border-radius: 12px;
    background: #fff;
}
.saved-game-card h3 {
    margin: 0 0 8px;
}
.saved-game-card p {
    margin: 0 0 14px;
    color: #62665f;
}
.saved-game-actions { margin-top: 16px; }
.saved-game-remove { border-color: #b9bcb5; color: #42463f; }
.my-games-intro { max-width: 680px; }
#my-games-account-status { color: #c9cbbf; }
