:root {
    --bg-top: #091321;
    --bg-bottom: #03070d;
    --panel: rgba(6, 13, 24, 0.78);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text: #f8fbff;
    --muted: rgba(215, 227, 242, 0.76);
    --accent: #ffd166;
    --cool: #70f1ff;
    --shadow: 0 26px 68px rgba(0, 0, 0, 0.44);
    --font-title: "Trebuchet MS", "Arial Rounded MT Bold", Impact, sans-serif;
    --font-body: Verdana, "Gill Sans", "Trebuchet MS", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow: hidden;
    color: var(--text);
    font-family: var(--font-body);
    background:
        radial-gradient(circle at top left, rgba(255, 209, 102, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(112, 241, 255, 0.12), transparent 24%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body {
    position: relative;
}

#gameCanvas {
    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: 20px;
    padding: 18px 20px 0;
    pointer-events: none;
}

.brand-card,
.score-row,
.message-card,
.summary-card,
.qr-shell,
.room-pill,
.footer-ribbon {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

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

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

.brand-card h1,
.summary-card h2 {
    margin: 8px 0 10px;
    font-family: var(--font-title);
    line-height: 0.92;
}

.brand-card h1 {
    font-size: clamp(40px, 5vw, 74px);
}

.summary-card h2 {
    font-size: clamp(32px, 4vw, 56px);
}

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

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

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

.score-row.empty {
    grid-template-columns: 1fr;
    text-align: center;
}

.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-meta {
    font-size: 12px;
}

.score-row-lives,
.score-row-score {
    font-family: var(--font-title);
    font-weight: 800;
    white-space: nowrap;
}

.score-row-lives {
    color: var(--cool);
}

.score-row-score {
    font-size: 28px;
    color: #fff6d8;
}

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

.message-card,
.summary-card {
    max-width: 680px;
    border-radius: 32px;
}

.message-card {
    padding: 22px 24px;
    text-align: center;
    transition: opacity 220ms ease, transform 220ms ease;
}

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

.summary-panel.hidden {
    opacity: 0;
    visibility: hidden;
}

.summary-card {
    width: min(860px, calc(100vw - 40px));
    padding: 26px 28px;
    pointer-events: auto;
}

.summary-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
}

.summary-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.summary-rank {
    font-family: var(--font-title);
    font-size: 26px;
    color: var(--accent);
}

.summary-name {
    font-weight: 700;
    font-size: 18px;
}

.summary-stat {
    text-align: right;
    min-width: 90px;
}

.summary-stat strong {
    display: block;
    font-family: var(--font-title);
    font-size: 24px;
    color: #fff6d8;
}

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

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

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

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

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

.room-pill {
    bottom: 20px;
}

.footer-ribbon {
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    color: var(--text);
}

.footer-ribbon span + span {
    color: var(--cool);
}

.live-player .brand-card,
.live-player .score-row,
.live-player .qr-shell,
.live-player .room-pill,
.live-player .footer-ribbon {
    opacity: 0.3;
    background: rgba(6, 13, 24, 0.28);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
}

@media (max-width: 980px) {
    .brand-card {
        max-width: min(52vw, 340px);
    }

    .scoreboard {
        width: min(38vw, 290px);
    }
}

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

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

    .brand-card h1 {
        font-size: 30px;
        margin-bottom: 4px;
    }

    .brand-card p {
        display: none;
    }

    .scoreboard {
        width: min(44vw, 200px);
        gap: 6px;
    }

    .score-row {
        grid-template-columns: auto 1fr auto;
        padding: 8px 9px;
        border-radius: 14px;
    }

    .score-row-lives {
        display: none;
    }

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

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

    .message-card,
    .summary-card {
        border-radius: 24px;
    }

    .message-card {
        padding: 18px;
    }

    .summary-card {
        padding: 18px;
    }

    .summary-row {
        grid-template-columns: auto auto 1fr;
        gap: 10px;
    }

    .summary-stat {
        min-width: 0;
        text-align: left;
    }

    .summary-stat strong {
        font-size: 20px;
    }

    .qr-shell,
    .room-pill {
        bottom: 12px;
    }

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

    .room-pill {
        left: 12px;
    }

    .footer-ribbon {
        bottom: 12px;
        gap: 10px;
        max-width: calc(100vw - 220px);
        padding: 8px 12px;
        font-size: 12px;
    }
}
