:root {
    --bg-ink: #0f1118;
    --bg-panel: rgba(19, 24, 37, 0.72);
    --line-soft: rgba(255, 255, 255, 0.12);
    --text-main: #f9f3e6;
    --text-muted: rgba(249, 243, 230, 0.76);
    --accent-gold: #f7b955;
    --accent-coral: #ff7b61;
    --accent-aqua: #74d7cf;
    --shadow-strong: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    position: relative;
    height: 100vh;
    overflow: hidden;
    font-family: "Trebuchet MS", "Gill Sans", sans-serif;
    color: #f9f3e6;
    color: var(--text-main);
    background: #151b28;
}

.backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0 1px, transparent 2px),
        radial-gradient(circle at 70% 65%, rgba(255, 255, 255, 0.06) 0 1px, transparent 2px);
    background-size: 120px 120px, 160px 160px;
    opacity: 0.35;
    pointer-events: none;
}

.app-shell {
    position: relative;
    z-index: 1;
    display: block;
    height: 100vh;
    overflow: hidden;
    padding: 0;
}

.display-panel,
.side-panel {
    display: block;
}

.display-panel {
    min-height: 0;
}

.side-panel {
    min-height: 0;
}

.side-panel>* {
    flex: 0 0 auto;
    margin-bottom: 20px;
}

.info-card,
.score-card {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border: 1px solid var(--line-soft);
    background: rgba(19, 24, 37, 0.72);
    background: var(--bg-panel);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.info-card {
    cursor: pointer;
}

.info-card,
.score-card {
    border-radius: 16px;
    padding: 16px 18px;
}

.info-card h1,
.score-card h2 {
    margin: 4px 0 0;
    font-family: "Gill Sans", "Trebuchet MS", sans-serif;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.08;
}

.info-card h1 {
    font-size: 1.7rem;
}

.info-copy,
.info-card p {
    margin: 0;
    color: rgba(249, 243, 230, 0.76);
    color: var(--text-muted);
    line-height: 1.4;
    font-size: 0.95rem;
}

.eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #74d7cf;
    color: var(--accent-aqua);
}

.info-header {
    display: block;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.info-title {
    min-width: 0;
}

.info-title .eyebrow,
.score-header .eyebrow {
    display: block;
    margin-bottom: 2px;
}

.info-block {
    display: block;
    display: grid;
    gap: 4px;
    margin-top: 8px;
}

.info-block>* {
    margin-bottom: 4px;
}

@supports (display: grid) {
    .info-block>* {
        margin-bottom: 0;
    }
}

.status-copy {
    color: #f9f3e6;
    color: var(--text-main);
    opacity: 0.92;
    font-size: 0.9rem;
}

.card-frame {
    position: relative;
    flex: 0 1 auto;
    min-height: 0;
    width: 400px;
    height: 400px;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    border-radius: 18px;
    padding: 24px;
    padding: clamp(18px, 2vw, 28px);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.2), transparent 48%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 28px 80px rgba(0, 0, 0, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow-strong);
}

#displayCanvas {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    border-radius: 18px;
}

.round-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.round-strip span {
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(249, 243, 230, 0.76);
    color: var(--text-muted);
    font-size: 0.82rem;
}

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

.rcRoomQrCodeLink {
    display: block;
    width: 150px;
    margin-top: 8px;
    margin-bottom: 8px;
    margin-left: auto;
    margin-right: auto;
    border: solid 8px #fff;
    border-radius: 8px;
    color: #fff;
    background-color: #fff;
    box-shadow: 0 0 0 1px #fff;
    text-align: center;
    transition: opacity 1s ease;
    text-decoration: none;
    transform-origin: top left;
    transform: scale(1);
}

.rcTechLabel {
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    margin: 0 0 8px 0;
    padding: 4px;
    letter-spacing: 0.2em;
}

.rcRoomQrCode {
    width: 150px;
    height: 150px;
}

.rcRoomId {
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 16px;
    padding: 4px;
    margin: 8px 0 0 0;
    letter-spacing: 0.25em;
}

.rcRoomQrCodeLink,
.rcTechLabel,
.rcRoomQrCode,
.rcRoomId {
    box-sizing: content-box;
}

.scoreboard {
    display: block;
    display: grid;
    gap: 10px;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.scoreboard>* {
    margin-bottom: 10px;
}

@supports (display: grid) {
    .scoreboard>* {
        margin-bottom: 0;
    }
}

.score-card {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

.score-header {
    margin-bottom: 14px;
}

.score-row {
    position: relative;
    display: block;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    overflow: hidden;
    min-height: 58px;
    padding: 11px 13px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.score-row:after {
    content: "";
    display: table;
    clear: both;
}

.score-row.is-leading {
    background: linear-gradient(135deg, rgba(247, 185, 85, 0.22), rgba(255, 123, 97, 0.16));
    border-color: rgba(247, 185, 85, 0.35);
}

.score-rank {
    float: left;
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    display: block;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #f7b955;
    color: var(--accent-gold);
    font-weight: 700;
}

.score-name {
    display: block;
    display: grid;
    gap: 2px;
    margin: 0 52px 0 46px;
    min-width: 0;
}

.score-name strong {
    display: block;
    font-size: 1rem;
}

.score-name span {
    display: block;
    color: rgba(249, 243, 230, 0.76);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.score-value {
    position: absolute;
    top: 50%;
    right: 13px;
    margin-top: -17px;
    line-height: 34px;
    font-size: 1.9rem;
    font-weight: 700;
    color: #f7b955;
    color: var(--accent-gold);
}

@supports (display: grid) {
    .score-row {
        overflow: visible;
        min-height: 0;
    }

    .score-rank,
    .score-value {
        float: none;
        position: static;
        margin-top: 0;
        margin-right: 10px;
        line-height: normal;
    }

    .score-name {
        margin: 0;
    }

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

@media (max-height: 800px) {
    .app-shell {
        gap: 10px;
        padding: 10px;
    }

    .display-panel,
    .side-panel {
        gap: 10px;
    }

    .info-card,
    .score-card {
        padding: 10px 12px;
    }

    .info-card,
    .score-card {
        border-radius: 10px;
    }

    .card-frame {
        border-radius: 16px;
    }

    #displayCanvas {
        border-radius: 10px;
    }

    .info-card h1 {
        font-size: 1.2rem;
    }

    .eyebrow {
        font-size: 0.58rem;
    }

    .info-copy,
    .info-card p,
    .status-copy {
        font-size: 0.74rem;
        line-height: 1.2;
    }

    .round-strip {
        gap: 5px;
        margin-top: 8px;
    }

    .round-strip span,
    .round-strip span {
        padding: 5px 8px;
        font-size: 0.68rem;
    }

    .score-header {
        margin-bottom: 6px;
    }

    .score-row {
        gap: 8px;
        padding: 7px 9px;
        min-height: 40px;
    }

    .score-rank {
        width: 24px;
        height: 24px;
        line-height: 24px;
        font-size: 0.74rem;
    }

    .score-name {
        margin-left: 32px;
        margin-right: 42px;
    }

    @supports (display: grid) {
        .score-row {
            min-height: 0;
        }

        .score-name {
            margin: 0;
        }
    }

    .score-name strong {
        font-size: 0.78rem;
    }

    .score-name span {
        font-size: 0.68rem;
    }

    .score-value {
        right: 9px;
        margin-top: -12px;
        line-height: 24px;
        font-size: 1.18rem;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 16px;
        gap: 16px;
    }

    .info-card,
    .score-card {
        border-radius: 8px;
    }

    .card-frame {
        border-radius: 10px;
    }

    #displayCanvas {
        border-radius: 8px;
    }
    .score-header {
        flex-direction: column;
    }
}

/* ===================================================================
   Lean paint path — activated by JS on devices without backdrop-filter
   (e.g. Samsung Tizen 2 digital signage). Replaces every gradient and
   compositing effect with flat solid colours so that each repaint is a
   trivial memory fill instead of per-pixel gradient evaluations on CPU.
   =================================================================== */

.lean-paint .backdrop {
    display: none;
}

.lean-paint body,
body.lean-paint {
    background: #151b28;
}

.lean-paint .card-frame {
    background: rgba(255, 255, 255, 0.06);
}

.lean-paint .score-row.is-leading {
    background: rgba(247, 185, 85, 0.14);
}

.lean-paint .info-card,
.lean-paint .score-card,
.lean-paint .card-frame {
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
