:root {
    --bg-top: #173928;
    --bg-bottom: #07120d;
    --panel: rgba(7, 17, 18, 0.74);
    --panel-border: rgba(255, 255, 255, 0.11);
    --text: #f7fff7;
    --muted: rgba(224, 241, 226, 0.74);
    --accent: #ffe06d;
    --shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
    --font-title: "Avenir Next Condensed", "Arial Narrow", "Trebuchet MS", sans-serif;
    --font-body: "Trebuchet MS", Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 224, 109, 0.12), transparent 26%),
        radial-gradient(circle at top right, rgba(115, 255, 195, 0.12), transparent 24%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body {
    position: relative;
}

#raceCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

.hud {
    position: absolute;
    inset: 0 0 auto 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 22px;
    padding: 18px 20px 0;
    pointer-events: none;
}

.brand-card,
.score-row,
.message-card,
.qr-shell,
.room-pill {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    transition: opacity 220ms ease, background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease, backdrop-filter 220ms ease;
}

.brand-card {
    max-width: 480px;
    padding: 18px 20px;
    border-radius: 28px;
}

.eyebrow,
.qr-caption,
.message-title {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 11px;
    color: var(--accent);
}

.brand-card h1 {
    margin: 8px 0 10px;
    font-family: var(--font-title);
    font-size: clamp(40px, 5vw, 76px);
    line-height: 0.92;
}

.brand-card p,
.message-copy,
.qr-copy,
.score-row-status {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.scoreboard {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: min(390px, 35vw);
}

.score-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 18px;
}

.score-row.empty {
    grid-template-columns: 1fr;
    text-align: center;
    color: var(--muted);
}

.score-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 18px currentColor;
}

.score-row-copy {
    min-width: 0;
}

.score-row-name {
    display: block;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-row-lap {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-title);
}

.center-message {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 26px;
    pointer-events: none;
}

.message-card {
    max-width: 660px;
    padding: 22px 24px;
    border-radius: 30px;
    text-align: center;
    transition: opacity 220ms ease, transform 220ms ease;
}

.center-message.hidden .message-card {
    opacity: 0;
    transform: translateY(10px);
}

.qr-shell {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 178px;
    padding: 14px;
    border-radius: 28px;
    color: inherit;
    text-decoration: none;
}

#qrCode {
    margin-left: auto;
    margin-right: auto;
    margin-top: 10px;
    padding: 10px;
    width: fit-content;
    background: #fff;
    border-radius: 18px;
}

#qrCode img,
#qrCode canvas {
    display: block;
}

.qr-caption,
.qr-copy {
    text-align: center;
}

.live-player .brand-card,
.live-player .score-row,
.live-player .qr-shell,
.live-player .room-pill {
    opacity: 0.34;
    background: rgba(7, 17, 18, 0.28);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
}

.live-player #qrCode {
    opacity: 0.58;
}

.room-pill {
    position: absolute;
    left: 20px;
    bottom: 20px;
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
}

.qr-copy {
    display: none;
}

@media (max-width: 900px) {
    .brand-card {
        max-width: min(56vw, 360px);
    }

    .scoreboard {
        width: min(42vw, 300px);
    }
}

@media (max-width: 620px) {
    .hud {
        padding: 12px 12px 0;
        gap: 12px;
    }

    .brand-card {
        max-width: min(58vw, 220px);
        padding: 12px 14px;
        border-radius: 22px;
    }

    .brand-card h1 {
        margin: 6px 0 0;
        font-size: 28px;
    }

    .brand-card p {
        display: none;
    }

    .eyebrow,
    .qr-caption,
    .message-title {
        font-size: 9px;
        letter-spacing: 0.18em;
    }

    .scoreboard {
        width: min(46vw, 190px);
        gap: 6px;
    }

    .score-row {
        padding: 7px 8px;
        gap: 8px;
        border-radius: 14px;
    }

    .score-row-name,
    .score-row-status {
        font-size: 11px;
    }

    .score-row-lap {
        font-size: 22px;
    }

    .message-card {
        padding: 18px;
        border-radius: 24px;
    }

    .qr-shell {
        right: 12px;
        bottom: 12px;
        padding: 10px;
        border-radius: 22px;
    }

    .room-pill {
        left: 12px;
        bottom: 12px;
        padding: 8px 12px;
        font-size: 12px;
    }
}