:root {
    --bg-top: #152128;
    --bg-mid: #0b1115;
    --bg-bottom: #040708;
    --hud-column-width: 360px;
    --board-right-gap: 14px;
    --board-top-gap: 14px;
    --panel: rgba(10, 18, 23, 0.8);
    --panel-border: rgba(255, 255, 255, 0.09);
    --text: #f4f7f8;
    --muted: rgba(223, 231, 231, 0.72);
    --accent: #ffb347;
    --cool: #7ef0d2;
    --hazard: #d8ff61;
    --font-title: Georgia, "Palatino Linotype", "Book Antiqua", serif;
    --font-body: "Trebuchet MS", Verdana, sans-serif;
    --shadow: 0 28px 74px rgba(0, 0, 0, 0.42);
}

* {
    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, 179, 71, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(126, 240, 210, 0.12), transparent 26%),
        linear-gradient(180deg, var(--bg-top), var(--bg-mid) 52%, var(--bg-bottom));
}

body {
    position: relative;
}

.screen-warning {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top, rgba(255, 179, 71, 0.12), transparent 30%),
        linear-gradient(180deg, rgba(10, 18, 23, 0.95), rgba(4, 7, 8, 0.98));
    z-index: 50;
}

.screen-warning-card {
    max-width: 320px;
    padding: 20px 22px;
    border-radius: 24px;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    background: rgba(10, 18, 23, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

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

.hud {
    position: absolute;
    top: 14px;
    left: 14px;
    width: min(var(--hud-column-width), calc(100vw - var(--board-right-gap) - 180px));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    pointer-events: none;
}

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

.brand-card {
    max-width: 100%;
    padding: 18px 20px;
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 222px;
}

.brand-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

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

.room-badge {
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-card h1 {
    margin: 8px 0 12px;
    font-family: var(--font-title);
    font-size: clamp(26px, 3.3vw, 42px);
    line-height: 0.94;
    transition: font-size 220ms ease;
}

.status-copy,
.score-row-meta {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.info-ribbon {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.info-ribbon span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.status-panel {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 22px;
    min-height: 114px;
}

.status-title {
    margin: 8px 0 8px;
    font-family: var(--font-title);
    font-size: clamp(22px, 2.5vw, 32px);
    line-height: 0.98;
}

.scoreboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.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-copy {
    min-width: 0;
}

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

.score-row-meta {
    font-size: 12px;
}

.score-mode {
    font-family: var(--font-title);
    font-size: 17px;
    color: var(--cool);
    white-space: nowrap;
}

.score-points {
    font-family: var(--font-title);
    font-size: 27px;
    color: #fff0d5;
    white-space: nowrap;
}

.qr-shell {
    position: fixed;
    left: 14px;
    bottom: 14px;
    width: 188px;
    padding: 14px;
    border-radius: 28px;
    color: inherit;
    text-decoration: none;
    transform-origin: bottom left;
}

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

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

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

@media (max-width: 980px) {
    .brand-card {
        max-width: 100%;
    }

    .scoreboard {
        width: 100%;
    }
}

@media (max-width: 1000px), (max-height: 600px) {
    .hud {
        top: 8px;
        left: 8px;
        gap: 8px;
        width: min(var(--hud-column-width), calc(100vw - var(--board-right-gap) - 150px));
    }

    .brand-card,
    .score-row,
    .status-panel,
    .qr-shell {
        box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
    }

    .brand-card {
        padding: 10px 12px;
        border-radius: 18px;
    }

    .brand-topline {
        gap: 8px;
    }

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

    .room-badge {
        padding: 4px 7px;
        font-size: 9px;
    }

    .brand-card h1 {
        margin: 6px 0 8px;
        font-size: clamp(17px, 2.1vw, 24px);
    }

    .status-copy,
    .score-row-meta,
    .info-ribbon span {
        font-size: 10px;
        line-height: 1.3;
    }

    .info-ribbon {
        gap: 6px;
        margin-top: 10px;
    }

    .info-ribbon span {
        min-height: 24px;
        padding: 4px 8px;
    }

    .status-panel {
        margin-top: 10px;
        padding: 10px 12px;
        border-radius: 16px;
        min-height: 96px;
    }

    .status-title {
        margin: 6px 0;
        font-size: clamp(16px, 2.2vw, 22px);
    }

    .scoreboard {
        gap: 6px;
    }

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

    .score-name {
        font-size: 12px;
    }

    .score-mode {
        font-size: 12px;
    }

    .score-points {
        font-size: 18px;
    }

    .qr-shell {
        left: 8px;
        bottom: 8px;
        width: 116px;
        padding: 8px;
        border-radius: 18px;
    }

    #qrCode {
        margin-top: 6px;
        padding: 6px;
        border-radius: 12px;
    }

    #qrCode img,
    #qrCode canvas {
        width: 78px !important;
        height: 78px !important;
    }
}

@media (max-width: 760px) {
    .hud {
        width: min(var(--hud-column-width), calc(100vw - var(--board-right-gap) - 120px));
    }

    .brand-card {
        padding: 14px 16px;
        border-radius: 22px;
    }

    .brand-card h1 {
        font-size: clamp(20px, 4.2vw, 30px);
    }

    .status-copy,
    .info-ribbon span,
    .score-row-meta {
        font-size: 12px;
    }

    .status-title {
        font-size: clamp(18px, 3.4vw, 26px);
    }

    .scoreboard {
        width: 100%;
    }

    .score-row {
        grid-template-columns: auto 1fr auto;
    }

    .score-points {
        display: none;
    }

    .qr-shell {
        width: 154px;
        padding: 12px;
    }
}

@media (max-width: 700px) and (orientation: portrait) {
    .screen-warning {
        display: flex;
    }

    #arenaCanvas,
    .hud,
    .qr-shell {
        visibility: hidden;
    }
}
