:root {
    --bg-0: #050913;
    --bg-1: #08101f;
    --bg-2: rgba(10, 18, 34, 0.86);
    --panel-border: rgba(130, 179, 255, 0.2);
    --text: #eef5ff;
    --muted: #95a8cb;
    --accent: #ffde59;
    --cyan: #62ddff;
    --left-column-width: 360px;
    --edge-gap: 22px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(70, 129, 255, 0.24), transparent 30%),
        radial-gradient(circle at bottom left, rgba(255, 222, 89, 0.08), transparent 28%),
        linear-gradient(180deg, var(--bg-1), var(--bg-0));
    color: var(--text);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

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(98, 221, 255, 0.14), transparent 30%),
        linear-gradient(180deg, rgba(8, 16, 31, 0.95), rgba(5, 9, 19, 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, 34, 0.9);
    border: 1px solid rgba(130, 179, 255, 0.2);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.4);
}

#mazeCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
}

.hud-shell {
    position: fixed;
    top: var(--edge-gap);
    left: var(--edge-gap);
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: min(var(--left-column-width), calc(100vw - (var(--edge-gap) * 2)));
    z-index: 2;
    transform-origin: top left;
}

.brand-card,
.scoreboard {
    border: 1px solid var(--panel-border);
    background: var(--bg-2);
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.hud-shell,
.qr-shell,
.brand-card,
.scoreboard {
    transition: transform 220ms ease, opacity 220ms ease, filter 220ms ease;
}

.brand-card,
.scoreboard {
    border-radius: 24px;
}

.brand-card {
    position: relative;
    padding: 18px 18px 16px;
}

.room-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(130, 179, 255, 0.18);
}

.eyebrow {
    color: var(--cyan);
    font-size: 0.74rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

.brand-card h1 {
    margin: 8px 0 10px;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 0.95;
}

.brand-card p,
.score-empty {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.info-row {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.info-chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}

.info-label {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.info-value {
    display: block;
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #d6e5ff;
    font-size: 0.84rem;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.dot-dot {
    background: #ffd76a;
}

.power-dot {
    background: #7af7ff;
    box-shadow: 0 0 16px rgba(122, 247, 255, 0.75);
}

.scoreboard {
    max-height: min(46vh, 420px);
    overflow: auto;
    padding: 12px;
}

.score-empty {
    padding: 12px 10px;
}

.score-card {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 18px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.score-card:last-child {
    margin-bottom: 0;
}

.score-avatar {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #0a1220;
    background: hsl(var(--hue), 90%, 68%);
    box-shadow: 0 12px 22px hsla(var(--hue), 90%, 60%, 0.28);
}

.score-main {
    min-width: 0;
}

.score-name {
    font-size: 1rem;
    font-weight: 700;
}

.score-meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.84rem;
}

.score-points {
    text-align: right;
}

.score-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
}

.score-label {
    color: var(--muted);
    font-size: 0.8rem;
}

.qr-shell {
    position: fixed;
    left: var(--edge-gap);
    bottom: var(--edge-gap);
    z-index: 2;
    transform-origin: bottom left;
    transform: scale(0.8);
}

.rcRoomQrCodeLink {
    display: block;
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
    width: 150px;
    margin-top: 8px;
    margin-right: auto;
    margin-bottom: 8px;
    margin-left: 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 {
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
    width: 150px;
    height: 150px;
    overflow: hidden;
}

.rcRoomQrCode img,
.rcRoomQrCode canvas {
    display: block;
    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;
}

body.compact-panels .hud-shell {
    transform: scale(0.84);
    opacity: 0.72;
}

body.compact-panels .qr-shell {
    transform: scale(0.67);
    transform-origin: bottom left;
    opacity: 0.66;
}

@media (max-width: 900px) {
    :root {
        --left-column-width: 320px;
        --edge-gap: 16px;
    }

    .hud-shell {
        width: min(var(--left-column-width), calc(100vw - (var(--edge-gap) * 2)));
    }
}

@media (max-width: 1000px), (max-height: 600px) {
    :root {
        --left-column-width: 250px;
        --edge-gap: 12px;
    }

    .hud-shell {
        gap: 10px;
    }

    .brand-card {
        padding: 12px 13px 11px;
    }

    .room-badge {
        top: 9px;
        right: 9px;
        padding: 4px 7px;
        font-size: 0.56rem;
    }

    .eyebrow {
        font-size: 0.6rem;
        letter-spacing: 0.18em;
    }

    .brand-card h1 {
        margin: 5px 0 6px;
        font-size: clamp(1.18rem, 3vw, 1.55rem);
    }

    .brand-card p {
        font-size: 0.76rem;
        line-height: 1.28;
    }

    .legend-row {
        gap: 6px;
        margin-top: 10px;
    }

    .info-row {
        gap: 8px;
        margin-top: 10px;
    }

    .info-chip {
        padding: 7px 8px;
        border-radius: 12px;
    }

    .info-label {
        font-size: 0.56rem;
    }

    .info-value {
        margin-top: 3px;
        font-size: 0.74rem;
    }

    .legend-chip {
        padding: 5px 8px;
        font-size: 0.68rem;
    }

    .scoreboard {
        max-height: min(29vh, 156px);
        padding: 8px;
    }

    .score-card {
        grid-template-columns: 34px 1fr auto;
        gap: 8px;
        padding: 8px;
        margin-bottom: 7px;
        border-radius: 14px;
    }

    .score-avatar {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        font-size: 0.95rem;
    }

    .score-name {
        font-size: 0.8rem;
    }

    .score-meta,
    .score-label,
    .score-empty {
        font-size: 0.66rem;
    }

    .score-value {
        font-size: 1rem;
    }

    .qr-shell {
        bottom: var(--edge-gap);
        transform: scale(0.74);
    }

}

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

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

/* Older-browser fallback path.
   These rules intentionally avoid custom properties, CSS grid, min()/clamp(),
   inset, and backdrop-filter dependencies so Tizen 2-era WebKit still gets a
   complete, readable display. Modern browsers keep the same visual direction. */

html,
body {
    background: #050913;
    color: #eef5ff;
}

.screen-warning {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.screen-warning-card {
    color: #eef5ff;
    background: rgba(10, 18, 34, 0.92);
    border-radius: 18px;
}

#mazeCanvas {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hud-shell {
    top: 22px;
    left: 22px;
    display: block;
    width: 360px;
    max-width: 42%;
}

.brand-card,
.scoreboard {
    margin-bottom: 16px;
}

.brand-card,
.scoreboard {
    border: 1px solid rgba(130, 179, 255, 0.2);
    background: rgba(10, 18, 34, 0.88);
    -webkit-backdrop-filter: blur(16px);
}

.brand-card,
.scoreboard {
    border-radius: 22px;
}

.room-badge {
    color: #eef5ff;
}

.eyebrow {
    color: #62ddff;
}

.brand-card h1 {
    font-size: 2.25rem;
}

.brand-card p,
.score-empty,
.info-label,
.score-meta,
.score-label {
    color: #95a8cb;
}

.legend-row,
.info-row {
    display: block;
}

.legend-chip {
    display: inline-block;
    margin: 0 6px 7px 0;
    color: #d6e5ff;
}

.legend-dot {
    display: inline-block;
    margin-right: 6px;
    vertical-align: -1px;
}

.info-chip {
    display: inline-block;
    width: 46%;
    margin-right: 2%;
    vertical-align: top;
}

.scoreboard {
    max-height: 420px;
}

.score-card {
    position: relative;
    display: block;
    min-height: 74px;
    overflow: hidden;
}

.score-avatar {
    float: left;
    display: block;
    line-height: 50px;
    text-align: center;
    background: #ffde59;
}

.score-main {
    display: block;
    margin-left: 62px;
    margin-right: 86px;
    padding-top: 5px;
}

.score-points {
    position: absolute;
    top: 13px;
    right: 12px;
}

.qr-shell {
    left: 22px;
    bottom: 22px;
}

body.compact-panels .hud-shell {
    opacity: 0.72;
}

body.compact-panels .qr-shell {
    transform: scale(0.67);
    transform-origin: bottom left;
    opacity: 0.66;
}

@media (max-width: 1000px), (max-height: 600px) {
    .hud-shell {
        top: 12px;
        left: 12px;
        width: 250px;
        max-width: 43%;
    }

    .brand-card,
    .scoreboard {
        margin-bottom: 10px;
    }

    .brand-card h1 {
        font-size: 1.45rem;
    }

    .scoreboard {
        max-height: 156px;
    }

    .score-card {
        min-height: 50px;
    }

    .score-avatar {
        line-height: 34px;
    }

    .score-main {
        margin-left: 42px;
        margin-right: 60px;
        padding-top: 1px;
    }

    .score-points {
        top: 8px;
        right: 8px;
    }

    .qr-shell {
        left: 12px;
        bottom: 12px;
    }
}

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

.lean-paint .brand-card,
.lean-paint .scoreboard,
.lean-paint .screen-warning-card,
.lean-paint .score-card,
.lean-paint .score-avatar,
.lean-paint .power-dot {
    box-shadow: none !important;
    filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.lean-paint .brand-card,
.lean-paint .scoreboard {
    background: rgba(10, 18, 34, 0.94);
}

.lean-paint .hud-shell,
.lean-paint .qr-shell,
.lean-paint .brand-card,
.lean-paint .scoreboard {
    transition: none;
}
