:root {
    color-scheme: dark;
    --bg: #070a13;
    --card: #0f1424;
    --card2: #12182a;
    --text: #f5f7ff;
    --muted: #a9b4ca;
    --border: #273047;
    --brand: #9b5cff;
    --brand2: #28d7ff;
    --aqua: #45ead6;
    --green: #53e58d;
    --orange: #ffad30;
    --gold: #ffd84a;
    --bad: #555e72;
    --warn: #d79a27;
    --ok: #20b66c;
    --shadow: 0 24px 70px rgba(0, 0, 0, .42);
    --glow: 0 0 40px rgba(155, 92, 255, .22)
}

body.light {
    --bg: #f5f7fb;
    --card: #fff;
    --card2: #f9fbff;
    --text: #111827;
    --muted: #68738a;
    --border: #e1e7f2;
    --brand: #6d5cff;
    --brand2: #168cff;
    --aqua: #00a99d;
    --shadow: 0 20px 50px rgba(27, 39, 70, .10);
    --glow: 0 0 30px rgba(109, 92, 255, .14)
}

* {
    box-sizing: border-box
}

html, body {
    max-width: 100%;
    overflow-x: hidden
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 0%, #0f1530 0%, #050714 60%, #03040c 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif
}

body.light {
    background: radial-gradient(circle at 12% -8%, rgba(109, 92, 255, .12), transparent 34%), radial-gradient(circle at 86% 7%, rgba(22, 140, 255, .10), transparent 32%), var(--bg)
}

a {
    color: inherit;
    text-decoration: none
}

.muted {
    color: var(--muted)
}

button, input, select {
    font: inherit
}

button {
    border: 0;
    border-radius: 18px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--brand), #33a8ff);
    color: white;
    cursor: pointer;
    font-weight: 900;
    transition: .16s transform, .16s box-shadow, .16s opacity;
    box-shadow: 0 12px 26px rgba(63, 112, 255, .22)
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(63, 112, 255, .29)
}

button.secondary {
    background: rgba(255, 255, 255, .025);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none
}

button.small {
    padding: 8px 12px;
    border-radius: 13px;
    font-size: 13px
}

button:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none
}

input, select {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .035);
    color: var(--text);
    border-radius: 16px;
    padding: 13px 15px;
    outline: none
}

select option {
    background: #12182a;
    color: #fff
}

header {
    height: 82px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    backdrop-filter: blur(18px);
    background: rgba(7, 10, 19, .74);
    z-index: 500;
    gap: 12px
}

body.light header {
    background: rgba(245, 247, 251, .76);
    border-bottom-color: var(--border)
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0
}

.brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 27px;
    font-weight: 1000;
    color: #d9c7ff;
    background: linear-gradient(135deg, rgba(155, 92, 255, .88), rgba(155, 92, 255, .22));
    border: 1px solid rgba(174, 112, 255, .35);
    box-shadow: 0 0 30px rgba(155, 92, 255, .35);
    flex: 0 0 auto
}

.brand b {
    font-size: 22px
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0
}

main {
    max-width: 1380px;
    margin: auto;
    padding: 30px
}

.panel, .room, .game, .modal-card, .side-card, .play-card {
    background: linear-gradient(180deg, rgba(19, 25, 43, .88), rgba(10, 14, 25, .92));
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .04)
}

body.light .panel, body.light .room, body.light .game, body.light .modal-card, body.light .side-card, body.light .play-card {
    background: linear-gradient(180deg, #fff, #f8fbff)
}

.hero {
    padding: 23px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--aqua);
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: 12px
}

.hero h1 {
    margin: 0;
    font-size: 48px;
    line-height: 1
}

.hero p {
    color: var(--muted);
    max-width: 650px
}

.stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end
}

.rooms {
    display: grid;
    grid-template-columns:repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px
}

.room {
    padding: 20px;
    display: grid;
    gap: 16px;
    position: relative;
    overflow: hidden
}

.room:before {
    content: "";
    position: absolute;
    inset: -1px;
    background: radial-gradient(circle at 16% 0, rgba(155, 92, 255, .22), transparent 34%);
    pointer-events: none
}

.room > * {
    position: relative
}

.room h3 {
    margin: 0;
    font-size: 30px
}

.meta {
    display: grid;
    grid-template-columns:repeat(2, 1fr);
    gap: 10px
}

.pill {
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 10px 12px;
    border-radius: 18px;
    font-size: 14px;
    background: rgba(255, 255, 255, .025)
}

.pill.live {
    color: var(--aqua);
    border-color: rgba(69, 234, 214, .42);
    box-shadow: 0 0 0 1px rgba(69, 234, 214, .08)
}

.pill.match {
    color: var(--orange);
    border-color: rgba(245, 158, 11, .38)
}

.pill.watch {
    color: var(--blue);
    border-color: rgba(59, 130, 246, .38)
}

.room-note {
    color: var(--muted);
    font-size: 18px
}

.actions {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 12px
}

.actions .copy-room {
    grid-column: 1/-1
}

.hidden {
    display: none !important
}

.locked {
    opacity: .72
}

.game {
    padding: 28px
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 22px
}

.room-title-line {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap
}

.top h2 {
    margin: 12px 0 4px;
    font-size: 44px
}

.top p {
    margin: 0;
    color: var(--muted)
}

.timer {
    font-size: 36px;
    font-weight: 1000;
    background: linear-gradient(135deg, var(--aqua), var(--brand2));
    -webkit-background-clip: text;
    color: transparent;
    white-space: nowrap
}

.game-actions {
    display: flex;
    align-items: center;
    gap: 12px
}

.match-layout {
    display: grid;
    grid-template-columns:minmax(0, 1fr) 335px 335px;
    gap: 18px;
    margin-top: 22px
}

.play-card, .side-card {
    padding: 18px;
    min-width: 0
}

.notice {
    border: 1px solid rgba(69, 234, 214, .35);
    border-radius: 20px;
    padding: 16px;
    color: var(--muted);
    margin-bottom: 16px;
    background: rgba(69, 234, 214, .035)
}

.board {
    display: grid;
    gap: 9px;
    margin: 18px 0;
    justify-content: center
}

.cell {
    width: clamp(36px, 11vw, 56px);
    height: clamp(36px, 11vw, 56px);
    border-radius: 16px;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    font-weight: 1000;
    text-transform: uppercase;
    background: rgba(255, 255, 255, .035);
    font-size: clamp(18px, 5vw, 24px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035)
}

.cell.filled {
    border-color: rgba(155, 92, 255, .75);
    box-shadow: 0 0 0 3px rgba(155, 92, 255, .12), 0 0 20px rgba(155, 92, 255, .14)
}

.m0 {
    background: linear-gradient(135deg, #525d73, #3e4658);
    color: white
}

.m1 {
    background: linear-gradient(135deg, #ffb12e, #b87915);
    color: white
}

.m2 {
    background: linear-gradient(135deg, #28d98a, #14985d);
    color: white
}

.guess-controls {
    display: grid;
    gap: 12px
}

.keyboard-hint {
    color: var(--muted);
    font-size: 13px;
    text-align: center
}

.keyboard {
    display: grid;
    gap: 8px;
    user-select: none
}

.key-row {
    display: flex;
    gap: 7px;
    justify-content: center
}

.key {
    min-width: 38px;
    height: 48px;
    padding: 0 10px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .055);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 1000;
    box-shadow: none
}

.key.wide {
    min-width: 78px;
    font-size: 13px
}

.keyboard.disabled {
    opacity: .55;
    pointer-events: none
}

.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px
}

.side-card h3 {
    margin: 8px 0 14px
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    color: var(--muted)
}

body.light .row {
    border-bottom-color: var(--border)
}

.row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0
}

.row b {
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.row .tag {
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 8px
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap
}

.tabs .active {
    background: rgba(155, 92, 255, .18);
    border-color: rgba(155, 92, 255, .5)
}

.leader-title {
    margin-top: 22px !important
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 24px;
    background: linear-gradient(135deg, rgba(155, 92, 255, .32), rgba(69, 234, 214, .15));
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 0 18px rgba(155, 92, 255, .12);
    flex: 0 0 auto
}

.avatar.sm {
    width: 34px;
    height: 34px;
    font-size: 20px
}

.avatar.lg {
    width: 58px;
    height: 58px;
    font-size: 34px
}

.winner-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, .025);
    display: flex;
    align-items: center;
    gap: 10px
}

.winner-rank {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--gold), #bc8120);
    color: #1d1400;
    font-weight: 1000;
    flex: 0 0 auto
}

.winner-rank.silver {
    background: linear-gradient(135deg, #f2f5f8, #8994a3)
}

.winner-rank.bronze {
    background: linear-gradient(135deg, #f4aa53, #9b5b24)
}

.room-link-card {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, .025);
    display: grid;
    grid-template-columns:auto 1fr auto;
    align-items: center;
    gap: 14px
}

.room-link-icon {
    width: 58px;
    height: 58px;
    border-radius: 19px;
    display: grid;
    place-items: center;
    background: rgba(155, 92, 255, .18);
    font-size: 28px;
    color: var(--brand);
    flex: 0 0 auto
}

.room-link-url {
    color: #b96cff;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0
}

.share-top {
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, .025);
    display: grid;
    grid-template-columns:minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center
}

@media (min-width: 1121px) {
    .share-top {
        min-width: 390px
    }
}

.share-top small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 4px
}

.share-top div {
    min-width: 0
}

.share-top div div {
    color: #b96cff;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.icon-btn {
    width: 54px;
    height: 54px;
    padding: 0;
    border-radius: 17px;
    display: grid;
    place-items: center;
    font-size: 23px;
    flex: 0 0 auto
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .58);
    display: grid;
    place-items: center;
    z-index: 20;
    padding: 18px;
    backdrop-filter: blur(8px)
}

.modal-card {
    width: min(470px, 100%);
    padding: 24px;
    max-height: calc(100vh - 36px);
    overflow-y: auto
}

.modal-card h2 {
    margin: 0 0 6px
}

.modal-card p {
    color: var(--muted)
}

.modal-card input {
    width: 100%;
    margin: 8px 0 14px
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--text);
    margin-top: 14px
}

.check span {
    color: var(--muted)
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap
}

.avatar-picker-title {
    font-weight: 900;
    margin: 10px 0;
    color: var(--muted)
}

.avatar-picker {
    display: grid;
    grid-template-columns:repeat(7, 1fr);
    gap: 9px
}

.avatar-choice {
    height: 48px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    font-size: 28px;
    cursor: pointer;
    transition: .14s transform, .14s border-color, .14s box-shadow
}

.avatar-choice:hover {
    transform: translateY(-1px)
}

.avatar-choice.active {
    border-color: rgba(155, 92, 255, .82);
    box-shadow: 0 0 0 3px rgba(155, 92, 255, .15), 0 0 22px rgba(155, 92, 255, .20);
    background: rgba(155, 92, 255, .14)
}

.win-badge {
    font-size: 48px;
    text-align: center;
    margin-bottom: 4px
}

@media (max-width: 1120px) {
    .match-layout {
        grid-template-columns:1fr
    }

    .top {
        flex-direction: column
    }

    .game-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap
    }

    .share-top {
        width: 100%
    }
}

@media (max-width: 720px) {
    header {
        padding: 0 14px
    }

    .brand small {
        display: none
    }

    .brand-icon {
        width: 42px;
        height: 42px
    }

    .hero {
        align-items: flex-start;
        flex-direction: column
    }

    .hero h1 {
        font-size: 34px
    }

    .rooms {
        grid-template-columns:1fr
    }

    .meta {
        grid-template-columns:1fr 1fr
    }

    .actions {
        grid-template-columns:1fr
    }

    .top h2 {
        font-size: 34px
    }

    .timer {
        font-size: 28px
    }

    .key {
        min-width: 29px;
        height: 42px;
        padding: 0 6px;
        border-radius: 10px
    }

    .key.wide {
        min-width: 56px;
        font-size: 11px
    }

    main {
        padding: 16px
    }

    .avatar-picker {
        grid-template-columns:repeat(5, 1fr)
    }

    .room-link-card {
        grid-template-columns:auto 1fr;
        gap: 10px
    }

    .room-link-card button {
        grid-column: 1/-1;
        width: 100%
    }

    .header-actions select {
        max-width: 130px
    }
}

@media (max-width: 480px) {
    header {
        height: auto;
        min-height: 64px;
        padding: 10px 12px;
        flex-wrap: wrap
    }

    .brand b {
        font-size: 18px
    }

    .brand-icon {
        width: 38px;
        height: 38px;
        font-size: 22px;
        border-radius: 13px
    }
}

@media (max-width: 380px) {
    .key {
        min-width: 26px;
        height: 40px;
        padding: 0 4px;
        border-radius: 9px;
        font-size: 13px
    }

    .key-row {
        gap: 5px
    }

    .key.wide {
        min-width: 48px;
        font-size: 10px
    }

    .avatar-picker {
        grid-template-columns:repeat(4, 1fr)
    }
}

/* ===== 2026 room cards from provided mockup ===== */
.rooms {
    grid-template-columns:repeat(auto-fill, minmax(430px, 1fr));
    align-items: start
}

.arena-room-card {
    --bg-stat: #11162a;
    --border-soft: rgba(255, 255, 255, .06);
    --text-secondary: #8b93a7;
    --purple: #a855f7;
    --purple-bright: #b794ff;
    --green: #22c55e;
    --blue: #3b82f6;
    --orange: #f59e0b;
    --teal: #14b8a6;
    --gold: #fbbf24;
    --silver: #cbd5e1;
    --bronze: #b45309;
    width: 100%;
    background: radial-gradient(ellipse at 50% 0%, #11183a 0%, #0a0e1f 50%, #06081a 100%);
    border: 1px solid rgba(255, 255, 255, .05);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
    overflow: hidden;
    position: relative;
    min-width: 0
}

.arena-room-card.locked {
    opacity: .68
}

.arena-room-card * {
    box-sizing: border-box
}

.arena-card-header {
    display: grid;
    grid-template-columns:minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center
}

.arena-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0
}

.arena-logo-tile {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    background: linear-gradient(135deg, #6b21a8 0%, #4c1d95 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 0 22px rgba(124, 58, 237, .4), inset 0 1px 0 rgba(255, 255, 255, .15);
    position: relative;
    flex-shrink: 0
}

.arena-logo-tile::before {
    content: '';
    position: absolute;
    top: 5px;
    right: 6px;
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 7px #fff
}

.arena-header-title {
    min-width: 0
}

.arena-header-title h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 9px;
    letter-spacing: -.02em;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.arena-room-badge {
    background: rgba(168, 85, 247, .15);
    color: var(--purple-bright);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 6px;
    flex-shrink: 0
}

.arena-header-subtitle {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 5px
}

.arena-bolt {
    color: var(--purple-bright);
    width: 12px;
    height: 12px;
    flex-shrink: 0
}

.arena-room-link-card {
    background: var(--bg-stat);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 220px
}

.arena-link-label {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 1px
}

.arena-link-url {
    color: var(--purple-bright);
    font-size: 11px;
    white-space: nowrap;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis
}

.arena-copy-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: rgba(168, 85, 247, .1);
    border: 1px solid rgba(168, 85, 247, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple-bright);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .2s;
    padding: 0;
    box-shadow: none
}

.arena-copy-btn:hover {
    background: rgba(168, 85, 247, .2);
    transform: none;
    box-shadow: none
}

.arena-copy-btn svg {
    width: 14px;
    height: 14px
}

.arena-stats-grid {
    display: grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap: 10px
}

.arena-stat-card {
    background: var(--bg-stat);
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    padding: 11px 12px;
    position: relative
}

.arena-stat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 7px
}

.arena-stat-header svg {
    width: 12px;
    height: 12px
}

.arena-stat-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.arena-stat-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1
}

.arena-stat-icon-box {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.arena-stat-icon-box svg {
    width: 15px;
    height: 15px
}

.arena-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    flex-shrink: 0
}

.arena-stat-online .arena-stat-value {
    color: var(--green)
}

.arena-stat-online .arena-stat-icon-box {
    background: rgba(34, 197, 94, .15);
    color: var(--green)
}

.arena-stat-watching .arena-stat-header, .arena-stat-watching .arena-stat-value {
    color: var(--blue)
}

.arena-stat-watching .arena-stat-icon-box {
    background: rgba(59, 130, 246, .15);
    color: var(--blue)
}

.arena-stat-match .arena-stat-header, .arena-stat-match .arena-stat-value {
    color: var(--orange)
}

.arena-stat-match .arena-stat-icon-box {
    background: rgba(245, 158, 11, .15);
    color: var(--orange)
}

.arena-stat-waiting .arena-stat-header, .arena-stat-waiting .arena-stat-value {
    color: var(--purple-bright)
}

.arena-stat-waiting .arena-stat-icon-box {
    background: rgba(168, 85, 247, .15);
    color: var(--purple-bright)
}

.arena-room-ends {
    background: var(--bg-stat);
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0
}

.arena-room-ends-left {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0
}

.arena-room-ends-icon {
    color: var(--teal);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.arena-room-ends-icon svg {
    width: 24px;
    height: 24px
}

.arena-room-ends-text {
    min-width: 0
}

.arena-room-ends-text .title {
    font-size: .9rem;
    font-weight: 800;
    margin-bottom: 1px
}

.arena-room-ends-text .sub {
    font-size: 11px;
    color: var(--text-secondary)
}

.arena-room-ends-time {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--teal);
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0
}

.arena-winners-section {
    background: var(--bg-stat);
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    padding: 12px 14px
}

.arena-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 11px;
    font-size: 13px;
    font-weight: 800
}

.arena-trophy-icon {
    color: var(--gold);
    width: 16px;
    height: 16px;
    flex-shrink: 0
}

.arena-winners-grid {
    display: grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap: 10px
}

.arena-winner-card {
    border-radius: 10px;
    padding: 10px 11px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    min-width: 0
}

.arena-winner-gold {
    background: radial-gradient(circle at 20% 30%, rgba(251, 191, 36, .18) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(251, 191, 36, .12) 0%, transparent 50%), linear-gradient(135deg, #1a1505 0%, #0f0a02 100%);
    border-color: rgba(251, 191, 36, .25)
}

.arena-winner-silver {
    background: radial-gradient(circle at 20% 30%, rgba(203, 213, 225, .12) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(203, 213, 225, .08) 0%, transparent 50%), linear-gradient(135deg, #131826 0%, #0a0e1c 100%);
    border-color: rgba(203, 213, 225, .18)
}

.arena-winner-bronze {
    background: radial-gradient(circle at 20% 30%, rgba(180, 83, 9, .18) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(180, 83, 9, .1) 0%, transparent 50%), linear-gradient(135deg, #1a0e05 0%, #0d0702 100%);
    border-color: rgba(180, 83, 9, .25)
}

.arena-winner-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(1px 1px at 10% 20%, rgba(251, 191, 36, .8) 50%, transparent 100%), radial-gradient(1px 1px at 30% 60%, rgba(251, 191, 36, .6) 50%, transparent 100%), radial-gradient(2px 2px at 60% 30%, rgba(251, 191, 36, .5) 50%, transparent 100%), radial-gradient(1px 1px at 80% 80%, rgba(251, 191, 36, .7) 50%, transparent 100%), radial-gradient(1px 1px at 90% 40%, rgba(251, 191, 36, .5) 50%, transparent 100%);
    pointer-events: none
}

.arena-winner-avatar-wrap {
    position: relative;
    flex-shrink: 0
}

.arena-winner-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    overflow: hidden;
    background: #1a1f35
}

.arena-winner-gold .arena-winner-avatar {
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(251, 191, 36, .3)
}

.arena-winner-silver .arena-winner-avatar {
    border-color: var(--silver)
}

.arena-winner-bronze .arena-winner-avatar {
    border-color: #d97706;
    box-shadow: 0 0 10px rgba(217, 119, 6, .3)
}

.arena-medal {
    position: absolute;
    top: -3px;
    left: -7px;
    width: 19px;
    height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 900;
    color: #fff;
    z-index: 2
}

.arena-medal svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%
}

.arena-medal span {
    position: relative;
    z-index: 1;
    margin-top: -5px
}

.arena-winner-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1
}

.arena-winner-name {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.arena-winner-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    min-width: 0
}

.arena-winner-time {
    color: var(--teal);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0
}

.arena-winner-tries {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.arena-unlocked-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    margin-bottom: -4px
}

.arena-cta-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 10px
}

.arena-cta-btn {
    border-radius: 11px;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform .2s;
    border: 1px solid var(--border-soft);
    text-decoration: none;
    color: inherit;
    box-shadow: none;
    min-width: 0
}

.arena-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: none
}

.arena-cta-btn[aria-disabled="true"] {
    pointer-events: none;
    opacity: .55
}

.arena-cta-participate {
    background: linear-gradient(90deg, #8b5cf6 0%, #6366f1 50%, #3b82f6 100%);
    border-color: rgba(139, 92, 246, .4);
    box-shadow: 0 6px 22px rgba(99, 102, 241, .25)
}

.arena-cta-watch {
    background: var(--bg-stat)
}

.arena-cta-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.arena-cta-icon svg {
    width: 16px;
    height: 16px
}

.arena-cta-participate .arena-cta-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff
}

.arena-cta-watch .arena-cta-icon {
    background: rgba(59, 130, 246, .15);
    color: var(--blue)
}

.arena-cta-text {
    flex: 1;
    text-align: left;
    min-width: 0
}

.arena-cta-title {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.arena-cta-sub {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.arena-cta-participate .arena-cta-sub {
    color: rgba(255, 255, 255, .8)
}

.arena-cta-arrow {
    color: rgba(255, 255, 255, .7);
    width: 16px;
    height: 16px;
    flex-shrink: 0
}

.arena-cta-watch .arena-cta-arrow {
    color: var(--text-secondary)
}

body.light .arena-room-card {
    background: radial-gradient(ellipse at 50% 0%, #ffffff 0%, #f8fbff 52%, #eef4ff 100%);
    border-color: #e1e7f2;
    color: #111827;
    box-shadow: 0 20px 50px rgba(27, 39, 70, .10)
}

body.light .arena-room-card {
    --bg-stat: #fff;
    --border-soft: #e1e7f2;
    --text-secondary: #68738a
}

.arena-empty-winners {
    grid-column: 1/-1;
    color: var(--text-secondary);
    font-size: 1.9rem;
    border: 1px dashed var(--border-soft);
    border-radius: 10px;
    padding: 12px;
    text-align: center
}

@media (max-width: 1100px) {
    .rooms {
        grid-template-columns:repeat(auto-fill, minmax(390px, 1fr))
    }

    .arena-card-header {
        grid-template-columns:1fr
    }

    .arena-room-link-card {
        min-width: 0;
        width: 100%
    }
}

@media (max-width: 640px) {
    .arena-room-card {
        overflow: visible
    }

    .rooms {
        grid-template-columns:1fr;
        gap: 12px
    }

    .arena-room-card {
        padding: 12px;
        gap: 10px;
        border-radius: 14px
    }

    .arena-header-title h3 {
        font-size: 19px
    }

    .arena-logo-tile {
        width: 42px;
        height: 42px;
        font-size: 22px
    }

    .arena-stats-grid {
        grid-template-columns:repeat(2, minmax(0, 1fr));
        gap: 8px
    }

    .arena-stat-card {
        padding: 10px 11px
    }

    .arena-stat-value {
        font-size: 20px
    }

    .arena-stat-icon-box {
        width: 26px;
        height: 26px
    }

    .arena-room-ends {
        padding: 10px 12px
    }

    .arena-room-ends-time {
        font-size: 22px
    }

    .arena-winners-grid {
        grid-template-columns:1fr;
        gap: 8px
    }

    .arena-cta-grid {
        grid-template-columns:1fr;
        gap: 8px
    }
}

@media (max-width: 400px) {
    .arena-header-title h3 {
        font-size: 17px;
        gap: 6px
    }

    .arena-room-badge {
        font-size: 10px;
        padding: 3px 7px
    }

    .arena-header-subtitle {
        font-size: 11px
    }

    .arena-stat-value {
        font-size: 18px
    }

    .arena-stat-header {
        font-size: 10px
    }

    .arena-room-ends-time {
        font-size: 20px
    }

    .arena-winner-time, .arena-winner-tries {
        font-size: 11px
    }
}

/* Lock state: no text labels, tooltip only */
.arena-unlocked-label, .arena-room-badge {
    display: none !important
}

.arena-cta-wrap {
    position: relative;
    min-width: 0
}

.arena-cta-wrap > .arena-cta-btn {
    width: 100%;
    height: 100%
}

.arena-lock-tooltip {
    cursor: not-allowed
}

.arena-lock-tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(6px);
    width: max-content;
    max-width: min(260px, calc(100vw - 40px));
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(24, 18, 38, .98), rgba(12, 17, 31, .98));
    border: 1px solid rgba(168, 85, 247, .35);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .35), 0 0 22px rgba(168, 85, 247, .24);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 50;
    white-space: normal
}

.arena-lock-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 5px);
    transform: translateX(-50%) translateY(6px) rotate(45deg);
    width: 12px;
    height: 12px;
    background: rgba(18, 18, 35, .98);
    border-right: 1px solid rgba(168, 85, 247, .35);
    border-bottom: 1px solid rgba(168, 85, 247, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 49
}

.arena-lock-tooltip:hover::before, .arena-lock-tooltip:hover::after, .arena-lock-tooltip:focus-within::before, .arena-lock-tooltip:focus-within::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0)
}

.arena-lock-tooltip:hover::after, .arena-lock-tooltip:focus-within::after {
    transform: translateX(-50%) translateY(0) rotate(45deg)
}

.arena-room-card.locked {
    opacity: .82;
    filter: saturate(.82)
}

.arena-room-card.locked .arena-cta-participate {
    background: linear-gradient(90deg, rgba(71, 85, 105, .82), rgba(88, 28, 135, .58));
    border-color: rgba(168, 85, 247, .18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08)
}

.arena-cta-btn[aria-disabled="true"] {
    pointer-events: none;
    opacity: .58
}

@media (max-width: 640px) {
    .arena-lock-tooltip::before {
        max-width: min(220px, calc(100vw - 40px))
    }
}

.lang-dropdown {
    position: relative;
    width: 230px;
    z-index: 600
}

.lang-trigger {
    width: 100%;
    height: 52px;
    border: 1px solid rgba(255, 255, 255, .09);
    background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
    backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .05);
    transition: .16s transform, .16s border-color, .16s box-shadow
}

.lang-trigger:hover {
    transform: translateY(-1px);
    border-color: rgba(69, 234, 214, .38);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .30), 0 0 30px rgba(69, 234, 214, .08), inset 0 1px 0 rgba(255, 255, 255, .07)
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    font-size: 14px;
    font-weight: 900
}

.lang-current-flag, .language-link span {
    font-size: 19px;
    line-height: 1;
    flex-shrink: 0
}

.lang-current-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.lang-arrow {
    opacity: .72;
    transition: .16s transform, .16s opacity;
    flex-shrink: 0
}

.lang-dropdown.open .lang-arrow {
    transform: rotate(180deg);
    opacity: 1
}

.lang-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    max-height: min(420px, calc(100vh - 110px));
    overflow: auto;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 20px;
    background: rgba(9, 13, 24, .97);
    backdrop-filter: blur(20px);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .52), 0 0 0 1px rgba(255, 255, 255, .03);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.98);
    transform-origin: top right;
    transition: .16s opacity, .16s visibility, .16s transform;
    z-index: 700
}

.lang-dropdown.open .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1)
}

.language-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 11px 12px;
    border-radius: 15px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 850;
    white-space: nowrap;
    transition: .14s background, .14s color, .14s transform
}

.language-link:hover {
    background: rgba(69, 234, 214, .08);
    color: var(--text);
    transform: translateX(2px)
}

.language-link.active {
    background: linear-gradient(135deg, rgba(155, 92, 255, .22), rgba(69, 234, 214, .10));
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05)
}

.language-link b {
    font-size: 14px
}

.seo-room-links {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden
}

body.light .lang-trigger {
    background: rgba(255, 255, 255, .88);
    border-color: var(--border);
    box-shadow: 0 12px 30px rgba(27, 39, 70, .10)
}

body.light .lang-menu {
    background: rgba(255, 255, 255, .98);
    border-color: var(--border);
    box-shadow: 0 28px 80px rgba(27, 39, 70, .18)
}

@media (max-width: 720px) {
    .lang-dropdown {
        width: 176px
    }

    .lang-menu {
        right: 0;
        width: min(260px, calc(100vw - 32px))
    }

    .lang-current-name {
        max-width: 100px
    }

    .language-link {
        min-height: 44px
    }

    .lang-trigger {
        height: 46px;
        padding: 0 12px;
        border-radius: 14px
    }
}

@media (max-width: 480px) {
    .lang-dropdown {
        width: auto;
        flex-shrink: 1
    }

    .lang-trigger {
        padding: 0 10px;
        gap: 6px
    }

    .lang-current-name {
        max-width: 70px;
        font-size: 13px
    }
}

#nick.disabled, #nick:disabled {
    opacity: .55;
    cursor: not-allowed
}

.join-player-btn.hidden {
    display: none !important
}


/* Polished solved CTA state */
.arena-cta-btn.arena-cta-solved,
.arena-cta-btn.arena-cta-solved[aria-disabled="true"] {
    position: relative;
    overflow: hidden;
    opacity: 1 !important;
    pointer-events: none;
    cursor: default !important;
    color: #ecfdf5 !important;
    background: radial-gradient(circle at 18% 18%, rgba(255, 255, 255, .30), transparent 28%),
    radial-gradient(circle at 92% 105%, rgba(20, 184, 166, .36), transparent 42%),
    linear-gradient(135deg, #16a34a 0%, #10b981 46%, #14b8a6 100%) !important;
    border-color: rgba(167, 243, 208, .62) !important;
    box-shadow: 0 12px 30px rgba(16, 185, 129, .28),
    inset 0 1px 0 rgba(255, 255, 255, .36),
    inset 0 -1px 0 rgba(6, 95, 70, .35) !important;
    transform: none !important;
}

.arena-cta-btn.arena-cta-solved:before {
    content: "";
    position: absolute;
    inset: -40% -25%;
    background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, .24) 47%, transparent 60%);
    transform: translateX(-55%);
    animation: solvedSheen 3.8s ease-in-out infinite;
    pointer-events: none;
}

.arena-cta-btn.arena-cta-solved:after {
    content: "DONE";
    position: absolute;
    top: 8px;
    right: 10px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .20);
    border: 1px solid rgba(255, 255, 255, .25);
    color: rgba(255, 255, 255, .92);
    font-size: 9px;
    font-weight: 950;
    letter-spacing: .12em;
    line-height: 1;
}

.arena-cta-btn.arena-cta-solved .arena-cta-icon {
    position: relative;
    z-index: 1;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .22) !important;
    color: #fff !important;
    font-size: 20px;
    font-weight: 950;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), 0 8px 18px rgba(5, 150, 105, .24);
}

.arena-cta-btn.arena-cta-solved .arena-cta-icon span {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #fff;
    color: #059669;
    line-height: 1;
    box-shadow: 0 5px 13px rgba(4, 120, 87, .22);
}

.arena-cta-btn.arena-cta-solved .arena-cta-text,
.arena-cta-btn.arena-cta-solved .arena-cta-title,
.arena-cta-btn.arena-cta-solved .arena-cta-sub {
    position: relative;
    z-index: 1;
}

.arena-cta-btn.arena-cta-solved .arena-cta-title {
    color: #fff !important;
    font-size: 14px;
    letter-spacing: -.01em;
    text-shadow: 0 1px 1px rgba(4, 120, 87, .28);
}

.arena-cta-btn.arena-cta-solved .arena-cta-sub {
    color: rgba(236, 253, 245, .88) !important;
}

.arena-cta-btn.arena-cta-solved .arena-cta-arrow {
    display: none !important
}

body.light .arena-cta-btn.arena-cta-solved,
body.light .arena-cta-btn.arena-cta-solved[aria-disabled="true"] {
    color: #064e3b !important;
    background: radial-gradient(circle at 18% 18%, rgba(255, 255, 255, .76), transparent 30%),
    linear-gradient(135deg, #dcfce7 0%, #bbf7d0 44%, #99f6e4 100%) !important;
    border-color: #86efac !important;
    box-shadow: 0 12px 28px rgba(16, 185, 129, .20), inset 0 1px 0 rgba(255, 255, 255, .75) !important;
}

body.light .arena-cta-btn.arena-cta-solved .arena-cta-title {
    color: #064e3b !important;
    text-shadow: none
}

body.light .arena-cta-btn.arena-cta-solved .arena-cta-sub {
    color: #047857 !important
}

body.light .arena-cta-btn.arena-cta-solved:after {
    background: rgba(255, 255, 255, .72);
    border-color: rgba(16, 185, 129, .22);
    color: #047857
}

@keyframes solvedSheen {
    0%, 55% {
        transform: translateX(-62%)
    }
    78%, 100% {
        transform: translateX(62%)
    }
}

@media (prefers-reduced-motion: reduce) {
    .arena-cta-btn.arena-cta-solved:before {
        animation: none;
        display: none
    }
}

/* Home hero stats use the same visual language as room card stats */
.hero .stats {
    display: grid;
    grid-template-columns:repeat(4, minmax(78px, 1fr));
    gap: 7px;
    justify-content: stretch;
    align-items: stretch;
    min-width: min(500px, 42vw);
    max-width: 540px;
}

.hero .home-stat-card {
    --bg-stat: rgba(255, 255, 255, .035);
    --border-soft: var(--border);
    --text-secondary: var(--muted);
    --green: #22c55e;
    --blue: #3b82f6;
    --orange: #f59e0b;
    --purple-bright: #b794ff;
    --teal: #14b8a6;
    min-width: 0;
    padding: 8px 9px;
    border-radius: 9px;
    background: var(--bg-stat);
    border-color: var(--border-soft);
}

.hero .home-stat-card .arena-stat-value {
    font-size: 19px;
    font-variant-numeric: tabular-nums;
}

.hero .home-stat-card .arena-stat-header {
    gap: 4px;
    margin-bottom: 4px;
    font-size: 10px;
    line-height: 1.1;
}

.hero .home-stat-card .arena-stat-header svg {
    width: 10px;
    height: 10px
}

.hero .home-stat-card .arena-stat-icon-box {
    width: 22px;
    height: 22px;
    border-radius: 6px
}

.hero .home-stat-card .arena-stat-icon-box svg {
    width: 12px;
    height: 12px
}

.hero .home-stat-card .arena-dot {
    width: 6px;
    height: 6px
}

.hero .arena-stat-rooms .arena-stat-header,
.hero .arena-stat-rooms .arena-stat-value {
    color: var(--teal, var(--aqua));
}

.hero .arena-stat-rooms .arena-stat-icon-box {
    background: rgba(69, 234, 214, .15);
    color: var(--teal, var(--aqua));
}

body.light .hero .home-stat-card {
    --bg-stat: #fff;
    --border-soft: #e1e7f2;
    --text-secondary: #68738a;
    box-shadow: 0 8px 18px rgba(27, 39, 70, .06);
}

@media (max-width: 980px) {
    .hero {
        align-items: stretch;
        flex-direction: column
    }

    .hero .stats {
        min-width: 0;
        width: 100%;
        grid-template-columns:repeat(5, minmax(0, 1fr));
        justify-content: stretch
    }
}

@media (max-width: 760px) {
    .hero .stats {
        grid-template-columns:repeat(2, minmax(0, 1fr))
    }

    .hero .arena-stat-rooms {
        grid-column: span 2
    }
}

@media (max-width: 420px) {
    .hero .stats {
        grid-template-columns:1fr
    }

    .hero .arena-stat-rooms {
        grid-column: auto
    }
}

/* Disable expensive blur on weaker devices / small screens */
@media (max-width: 480px) {
    header, .modal, .lang-trigger, .lang-menu {
        backdrop-filter: none
    }

    header {
        background: rgba(7, 10, 19, .94)
    }

    body.light header {
        background: rgba(245, 247, 251, .96)
    }
}