:root {
    --bg: #08111f;
    --bg-2: #0e1930;
    --panel: #0f1a31;
    --panel-soft: #162544;
    --border: rgba(255,255,255,.08);
    --text: #edf2ff;
    --muted: #9dacd6;
    --accent: #7c5cff;
    --accent-2: #00c2a8;
    --danger: #ef6b73;
    --warning: #f3b45b;
    --success: #4cd38a;
    --shadow: 0 24px 60px rgba(0,0,0,.38);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: radial-gradient(circle at top, #16284b 0%, #0a1324 46%, #060b16 100%);
    color: var(--text);
}

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

button,
input {
    font: inherit;
}

    button[disabled] {
        cursor: not-allowed;
        opacity: .78;
    }

input {
    width: 100%;
    background: #0c1730;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--text);
    outline: none;
}

    input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 4px rgba(124,92,255,.15);
    }

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

.public-brand {
    max-width: max-content;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid;
    place-items: center;
    font-weight: 800;
    box-shadow: var(--shadow);
}

.brand-title {
    font-weight: 800;
    font-size: 18px;
}

.brand-subtitle {
    font-size: 13px;
    color: var(--muted);
}

.eyebrow {
    font-size: 12px;
    letter-spacing: .18em;
    color: #a9b7ff;
    text-transform: uppercase;
    margin-bottom: 10px;
}

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

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 16px;
    padding: 14px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, filter .15s ease;
}

    .btn:hover {
        transform: translateY(-1px);
        filter: brightness(1.03);
    }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}

.btn-secondary {
    background: #182847;
    color: #fff;
    border: 1px solid rgba(255,255,255,.08);
}

.btn-block {
    width: 100%;
}

.form-grid {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

    .form-grid label span {
        display: block;
        margin-bottom: 8px;
        color: #d4ddfb;
    }

.validation {
    color: #ff9ca1;
    font-size: 14px;
}

.login-shell-only {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.simple-auth {
    width: 100%;
    display: flex;
    justify-content: center;
}

.compact-auth {
    max-width: 460px;
}

.auth-card {
    background: rgba(10,18,35,.86);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.minimal-auth-card {
    width: min(100%, 440px);
    padding: 32px;
}


.demo-notice {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(0,194,168,.08);
    border: 1px solid rgba(0,194,168,.22);
    color: #dffcf6;
    line-height: 1.5;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(255,255,255,.06);
    padding: 2px 8px;
    border-radius: 10px;
}

.demo-credentials {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.05);
    display: grid;
    gap: 8px;
    color: #d8e0ff;
}

.simple-shell {
    min-height: 100vh;
    padding: 24px;
}

.simple-topbar {
    max-width: 1200px;
    margin: 0 auto 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inline-logout {
    margin: 0;
}

.simple-content {
    max-width: 1200px;
    margin: 0 auto;
}

.slim-content {
    max-width: 1200px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin: 0 0 24px;
}

.compact-lobby-head {
    margin-bottom: 22px;
}

.page-head h1 {
    margin: 0 0 8px;
    font-size: 36px;
    line-height: 1.1;
}

.alert {
    margin-bottom: 22px;
    padding: 16px 18px;
    background: rgba(239,107,115,.14);
    border: 1px solid rgba(239,107,115,.35);
    color: #ffd5d8;
    border-radius: 18px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    align-items: stretch;
}

.game-card {
    background: rgba(10,18,35,.86);
    border: 1px solid var(--border);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 430px;
}

.game-image {
    height: 210px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #121e36;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.game-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px;
}

    .game-body h3 {
        margin: 0 0 10px;
        font-size: 28px;
        line-height: 1.15;
    }

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #d8e1ff;
    font-size: 13px;
    margin-bottom: 14px;
    opacity: .92;
}

.game-note {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.55;
    min-height: 48px;
}

.countdown,
.maintenance-countdown {
    margin: 0 0 18px;
    color: #ffe09d;
    font-weight: 700;
    font-size: 14px;
}

.game-status-row {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 14px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-online {
    background: rgba(76,211,138,.14);
    border-color: rgba(76,211,138,.28);
    color: #8ff0b4;
}

.status-maintenance {
    background: rgba(243,180,91,.14);
    border-color: rgba(243,180,91,.28);
    color: #ffd38e;
}

.status-offline {
    background: rgba(239,107,115,.14);
    border-color: rgba(239,107,115,.28);
    color: #ffb0b6;
}

.game-actions {
    margin-top: auto;
}

.room-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.frame-panel {
    padding: 14px;
    background: rgba(12,18,35,.84);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

    .frame-panel iframe {
        width: 100%;
        height: 75vh;
        border: none;
        border-radius: 20px;
        background: #050811;
    }

.full-frame-panel {
    min-height: 78vh;
}

.premium-topbar {
    max-width: 100%;
    margin: 0 auto 18px;
    padding: 16px 20px;
    background: rgba(10,17,31,.78);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 18px 48px rgba(0,0,0,.28);
}

.premium-topbar-user {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.05);
    color: #eff4ff;
}

.topbar-chip-soft {
    background: rgba(255,255,255,.03);
    color: #cfd8f8;
}

.topbar-chip-balance {
    background: linear-gradient(135deg, rgba(124,92,255,.24), rgba(0,194,168,.22));
    border-color: rgba(255,255,255,.12);
}

.topbar-chip-user {
    font-weight: 700;
}

.chip-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #b8c4ea;
}

.topbar-game-name {
    font-weight: 600;
}

.topbar-logout-btn {
    min-height: 48px;
    padding-inline: 20px;
}

.game-room-stage {
    display: grid;
    gap: 18px;
}

.game-room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 4px;
}

    .game-room-header h1 {
        margin: 0 0 8px;
        font-size: clamp(28px, 3.6vw, 42px);
        line-height: 1.05;
    }

.cinematic-frame-panel {
    padding: 10px;
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(17,27,47,.96), rgba(8,13,24,.92));
    border: 1px solid rgba(255,255,255,.08);
}

    .cinematic-frame-panel iframe {
        height: calc(100vh - 190px);
        min-height: 680px;
        border-radius: 24px;
    }

.strong-note,
.small-note {
    display: none;
}

/* ===== STANDARD RESPONSIVE ===== */

@media (max-width: 900px) {
    .simple-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-user {
        width: 100%;
        justify-content: space-between;
    }

    .page-head h1 {
        font-size: 30px;
    }

    .premium-topbar {
        padding: 14px;
    }

    .game-room-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cinematic-frame-panel iframe {
        height: calc(100vh - 260px);
        min-height: 520px;
    }
}

@media (max-width: 700px) {
    .page-head,
    .topbar-user {
        flex-direction: column;
        align-items: flex-start;
    }

    .minimal-auth-card {
        padding: 24px;
    }

    .game-body h3 {
        font-size: 24px;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .topbar-chip,
    .topbar-logout-btn {
        width: 100%;
        justify-content: center;
    }

    .cinematic-frame-panel iframe {
        height: calc(100vh - 320px);
        min-height: 420px;
    }
}

/* ===== GAME OVERLAY MODE ===== */

body.game-room-body {
    background: radial-gradient(circle at top, #12203c 0%, #09111f 42%, #050912 100%);
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.simple-shell.game-shell-overlay {
    position: relative;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.simple-content.game-content-overlay {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.game-room-stage-overlay {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    display: block;
}

.game-frame-overlay {
    position: relative;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    overflow: hidden;
    background: #050811;
    box-shadow: none;
}

    .game-frame-overlay iframe {
        display: block;
        width: 100%;
        height: 100dvh;
        min-height: 100dvh;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        background: #050811;
    }

/* ===== OVERLAY HEADER ===== */

.simple-topbar.premium-topbar.premium-topbar-overlay {
    position: fixed;
    top: 6px;
    left: 6px;
    right: 6px;
    z-index: 9999;
    margin: 0;
    max-width: none;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    min-height: 46px !important;
    background: rgba(8,14,26,.58);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 14px !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
}

    .simple-topbar.premium-topbar.premium-topbar-overlay .brand {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .brand-mark {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        min-height: 30px !important;
        border-radius: 9px !important;
        font-size: 12px !important;
        flex: 0 0 auto;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .brand-title {
        font-size: 13px !important;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .brand-subtitle {
        display: none !important;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-user,
    .simple-topbar.premium-topbar.premium-topbar-overlay .premium-topbar-user {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        width: auto !important;
        min-width: 0;
        flex: 0 1 auto;
        margin-left: auto;
        overflow: hidden;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        flex-wrap: nowrap !important;
        min-height: 30px !important;
        max-height: 30px !important;
        padding: 4px 8px !important;
        border-radius: 9px !important;
        gap: 4px !important;
        width: auto !important;
        min-width: 0;
        max-width: 125px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 11px !important;
        line-height: 1;
    }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip .chip-label {
            display: none !important;
        }

    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip-user {
        max-width: 90px;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip-balance {
        max-width: 110px;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-game-name {
        display: none !important;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-logout-btn,
    .simple-topbar.premium-topbar.premium-topbar-overlay .btn,
    .simple-topbar.premium-topbar.premium-topbar-overlay button {
        min-height: 30px !important;
        max-height: 30px !important;
        padding: 4px 9px !important;
        border-radius: 9px !important;
        font-size: 11px !important;
        line-height: 1;
        white-space: nowrap;
        width: auto !important;
        flex: 0 0 auto;
    }

/* ===== OVERLAY RESPONSIVE FIXES ===== */

@media (max-width: 900px) {
    .simple-topbar.premium-topbar.premium-topbar-overlay,
    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-user,
    .simple-topbar.premium-topbar.premium-topbar-overlay .premium-topbar-user {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay {
        top: 5px !important;
        left: 5px !important;
        right: 5px !important;
        padding: 8px 10px !important;
        min-height: 46px !important;
        gap: 8px !important;
    }

        .simple-topbar.premium-topbar.premium-topbar-overlay .brand-mark {
            width: 30px !important;
            height: 30px !important;
            min-width: 30px !important;
            min-height: 30px !important;
            font-size: 12px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .brand-title {
            font-size: 13px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip {
            min-height: 30px !important;
            max-height: 30px !important;
            padding: 4px 8px !important;
            font-size: 11px !important;
            max-width: 115px;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-logout-btn,
        .simple-topbar.premium-topbar.premium-topbar-overlay .btn,
        .simple-topbar.premium-topbar.premium-topbar-overlay button {
            min-height: 30px !important;
            max-height: 30px !important;
            font-size: 11px !important;
            padding: 4px 9px !important;
        }
}

@media (max-width: 700px) {
    .simple-topbar.premium-topbar.premium-topbar-overlay,
    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-user,
    .simple-topbar.premium-topbar.premium-topbar-overlay .premium-topbar-user {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay {
        top: 6px !important;
        left: 6px !important;
        right: 6px !important;
        padding: 10px 12px !important;
        min-height: 50px !important;
        border-radius: 14px !important;
        gap: 8px !important;
    }

        .simple-topbar.premium-topbar.premium-topbar-overlay .brand {
            gap: 8px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .brand-mark {
            width: 30px !important;
            height: 30px !important;
            min-width: 30px !important;
            min-height: 30px !important;
            border-radius: 9px !important;
            font-size: 12px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .brand-title {
            font-size: 13px !important;
            max-width: 95px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-user,
        .simple-topbar.premium-topbar.premium-topbar-overlay .premium-topbar-user {
            gap: 6px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip {
            min-height: 30px !important;
            max-height: 30px !important;
            padding: 4px 8px !important;
            border-radius: 9px !important;
            font-size: 11px !important;
            max-width: 110px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip-balance {
            max-width: 112px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip-user {
            max-width: 82px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-logout-btn,
        .simple-topbar.premium-topbar.premium-topbar-overlay .btn,
        .simple-topbar.premium-topbar.premium-topbar-overlay button {
            min-height: 30px !important;
            max-height: 30px !important;
            padding: 4px 9px !important;
            border-radius: 9px !important;
            font-size: 11px !important;
        }
}

@media (max-width: 480px) {
    .simple-topbar.premium-topbar.premium-topbar-overlay {
        top: 4px !important;
        left: 4px !important;
        right: 4px !important;
        padding: 8px 10px !important;
        min-height: 44px !important;
        border-radius: 13px !important;
        gap: 7px !important;
    }

        .simple-topbar.premium-topbar.premium-topbar-overlay .brand-mark {
            width: 28px !important;
            height: 28px !important;
            min-width: 28px !important;
            min-height: 28px !important;
            font-size: 11px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .brand-title {
            font-size: 12px !important;
            max-width: 78px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip {
            min-height: 28px !important;
            max-height: 28px !important;
            padding: 3px 7px !important;
            font-size: 10px !important;
            max-width: 95px !important;
        }

        .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-logout-btn,
        .simple-topbar.premium-topbar.premium-topbar-overlay .btn,
        .simple-topbar.premium-topbar.premium-topbar-overlay button {
            min-height: 28px !important;
            max-height: 28px !important;
            padding: 3px 8px !important;
            font-size: 10px !important;
        }
}

@media (max-width: 380px) {
    .simple-topbar.premium-topbar.premium-topbar-overlay .brand-title {
        max-width: 58px !important;
        font-size: 10px !important;
    }

    .simple-topbar.premium-topbar.premium-topbar-overlay .topbar-chip-balance {
        max-width: 78px !important;
    }
}
