/* ═══════════════════════════════════════════════════════════════
   The Perfect Murder — Noir Murder Mystery Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --bg:           #080c16;
    --bg-card:      #0c1018;
    --bg-elevated:  #121620;
    --bg-input:     #0e121c;

    --border:       #1c2030;
    --border-light: #2a3040;

    --text:         #ede9df;
    --text-muted:   #7a7a85;
    --text-faint:   #48484f;

    --red:          #b91c1c;
    --red-bright:   #ef4444;
    --red-dim:      #280808;
    --red-glow:     rgba(185, 28, 28, 0.2);

    --gold:         #c9a045;
    --gold-dim:     #221a06;
    --gold-glow:    rgba(201, 160, 69, 0.18);

    --blue:         #2563eb;
    --blue-dim:     #0d1830;

    --teal:         #0d9488;
    --teal-dim:     #071e1c;
    --teal-glow:    rgba(13, 148, 136, 0.15);

    --radius:       5px;
    --radius-lg:    9px;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --font-serif:   'Crimson Text', Georgia, serif;

    --transition:   140ms ease;

    /* Shared subtle top-edge highlight for elevated cards */
    --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Grain texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='250' height='250' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9998;
}

/* Vignette */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(4,8,18,0.55) 100%);
    pointer-events: none;
    z-index: 9997;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: #d9b458; }

h1, h2 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.02em;
}

h3, h4 {
    font-family: var(--font-body);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

input, select, textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text);
    border-radius: var(--radius);
    padding: 0.55rem 0.75rem;
    font-size: 15px;
    font-family: var(--font-body);
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
input:focus, select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}
input::placeholder { color: var(--text-faint); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
input[type="number"] { width: 64px; text-align: center; }

label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 5px;
    margin-top: 14px;
}
label:first-child { margin-top: 0; }

/* ── App Shell ──────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 16px;
}

/* ── Top Bar ────────────────────────────────────────────────── */
.top-bar {
    background: rgba(8, 12, 22, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0 24px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ── Top-bar actions (user menu + language switcher) ───────── */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── User menu ─────────────────────────────────────────────── */
.user-menu {
    display: flex;
    align-items: center;
}
.user-menu-signin {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    letter-spacing: 0.02em;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.user-menu-signin:hover {
    color: var(--gold);
    border-color: var(--gold);
    background: rgba(201,160,69,0.06);
}
.user-menu-profile { position: relative; }
.user-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: default;
}
.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    background: linear-gradient(180deg, rgba(18,22,32,0.92), rgba(10,14,22,0.92));
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #b8b4ad;
    cursor: pointer;
    padding: 5px 10px 5px 11px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    transition: color var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.user-menu-toggle:hover {
    color: var(--gold);
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(25,24,16,0.95), rgba(15,14,10,0.95));
    box-shadow: 0 0 0 3px rgba(201,160,69,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
}
.user-menu-toggle.is-open {
    color: var(--gold);
    border-color: rgba(201,160,69,0.52);
    background: linear-gradient(180deg, rgba(31,28,18,0.98), rgba(15,14,10,0.98));
    box-shadow: 0 12px 28px rgba(0,0,0,0.32), 0 0 0 1px rgba(201,160,69,0.12), inset 0 1px 0 rgba(255,255,255,0.05);
}
.user-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.78;
}
.user-name {
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.72;
    transition: transform var(--transition), opacity var(--transition);
}
.user-menu-toggle.is-open .user-menu-chevron {
    transform: rotate(180deg);
    opacity: 1;
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 232px;
    background:
        radial-gradient(circle at top, rgba(201,160,69,0.08), transparent 38%),
        linear-gradient(180deg, rgba(18,22,31,0.98), rgba(10,13,20,0.98));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.48), inset 0 1px 0 rgba(255,255,255,0.04);
    z-index: 200;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -7px;
    right: 20px;
    width: 13px;
    height: 13px;
    background: linear-gradient(180deg, rgba(22,25,34,0.98), rgba(10,13,20,0.98));
    border-top: 1px solid rgba(255,255,255,0.08);
    border-left: 1px solid rgba(255,255,255,0.08);
    transform: rotate(45deg);
}
.user-dropdown-header {
    padding: 6px 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.user-dropdown-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(255,255,255,0.34);
}
.user-dropdown-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.user-dropdown-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0 0 8px;
}
.user-dropdown-form {
    margin: 0;
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #b5b2ab;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    appearance: none;
    transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}
.user-dropdown-item:hover {
    color: var(--text);
    background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}
.user-dropdown-item-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.84;
}
.user-dropdown-signout {
    color: #d1a7a7;
}
.user-dropdown-signout:hover {
    color: #f3d4d4;
    background: linear-gradient(90deg, rgba(185,28,28,0.16), rgba(185,28,28,0.05));
}
@media (max-width: 640px) {
    .user-name {
        max-width: 76px;
    }

    .user-dropdown {
        min-width: 210px;
        right: -2px;
    }
}

/* ── Language switcher ──────────────────────────────────────── */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    letter-spacing: 0.06em;
}
.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    transition: color var(--transition), background var(--transition);
}
.lang-btn:hover { color: var(--gold); }
.lang-btn.active { color: var(--gold); background: rgba(201,160,69,0.10); }
.lang-sep { color: var(--border); font-size: 10px; }

/* Subtle ruled line under top bar */
.top-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold) 40%, transparent);
    opacity: 0.15;
}

.top-bar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.01em;
    transition: color var(--transition);
}
.top-bar .brand:hover { color: var(--text); }

.brand-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.85;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger, .btn-link, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
    background: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--gold);
    color: #09090b;
    border-color: var(--gold);
    box-shadow: 0 0 16px var(--gold-glow), 0 1px 3px rgba(0,0,0,0.4);
}
.btn-primary:hover:not(:disabled) {
    background: #d9b458;
    border-color: #d9b458;
    box-shadow: 0 0 24px rgba(201,160,69,0.3), 0 2px 6px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border-light);
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--text-muted);
    background: var(--bg-elevated);
}

.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    box-shadow: 0 0 12px var(--red-glow);
}
.btn-danger:hover:not(:disabled) {
    background: var(--red-bright);
    border-color: var(--red-bright);
    box-shadow: 0 0 20px rgba(239,68,68,0.25);
}

.btn-link {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    padding: 0.4rem 0.6rem;
    font-weight: 400;
}
.btn-link:hover:not(:disabled) { color: var(--text); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
    padding: 0.4rem 0.9rem;
    font-size: 13px;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-light); }

button:disabled, .btn-primary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Error Banner ───────────────────────────────────────────── */
.error-banner {
    background: var(--red-dim);
    border: 1px solid var(--red);
    color: #f5c6c3;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 0 12px var(--red-glow);
}
.error-banner button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    opacity: 0.7;
}
.error-banner button:hover { opacity: 1; }

/* ── Lobby / Home ───────────────────────────────────────────── */
.lobby-container {
    max-width: 480px;
    margin: 40px auto 0;
    text-align: center;
}

/* Hero skyline art container */
.hero-art {
    width: 100%;
    margin-bottom: 8px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}
.hero-skyline {
    width: 100%;
    height: auto;
    display: block;
}

.lobby-container h1 {
    font-size: 52px;
    color: var(--gold);
    margin-bottom: 6px;
    text-shadow: 0 0 40px var(--gold-glow);
    cursor: default;
    user-select: none;
}

.lobby-container .subtitle {
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-serif);
    font-size: 17px;
    margin-bottom: 36px;
    cursor: default;
    user-select: none;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons .btn-primary,
.action-buttons .btn-secondary {
    min-width: 160px;
    padding: 0.75rem 1.5rem;
    font-size: 16px;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    text-align: left;
    margin-top: 8px;
    /* Subtle top highlight */
    box-shadow: var(--card-highlight), 0 4px 24px rgba(0,0,0,0.4);
}

.form-card h2 {
    font-family: var(--font-display);
    font-size: 22px;
    margin-bottom: 16px;
    color: var(--text);
}

.form-card .btn-primary {
    width: 100%;
    margin-top: 20px;
    padding: 0.75rem;
}

.form-card .btn-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    width: 100%;
}

.code-input {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 18px;
    font-family: monospace;
    text-align: center;
}

.hint {
    font-size: 13px;
    color: var(--text-faint);
    font-style: italic;
    margin: 8px 0;
    cursor: default;
    user-select: none;
}

/* ── Game Layout ────────────────────────────────────────────── */
.game-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.game-page-sky {
    position: fixed;
    inset: 54px 0 0 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.game-page-sky::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 18%, rgba(100, 140, 200, 0.07), transparent 34%);
    z-index: 1;
}

.game-page-sky::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg,
            rgba(6, 10, 22, 0.02) 0%,
            rgba(7, 12, 26, 0.02) 55%,
            rgba(8, 12, 24, 0.04) 68%,
            rgba(7, 10, 20, 0.12) 76%,
            rgba(6, 9, 18, 0.42) 80%,
            rgba(8, 12, 22, 0.82) 84%,
            rgba(8, 12, 22, 1.0) 87%,
            rgba(8, 12, 22, 1.0) 100%);
    z-index: 2;
}

.game-page-sky .sky-animation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.game-page-sky .sky-skyline {
    bottom: 12%;
    left: 0;
    transform: none;
    width: 100%;
    min-width: 0;
    height: 220px;
    color: rgba(8, 12, 22, 1);
    opacity: 1;
}

.game-page-sky .sky-orbit-guide {
    top: 56%;
    width: 74cqw;
    height: 44cqh;
    opacity: 0.3;
}

.game-page-sky .sky-body {
    transform: translate(-50%, -50%) translateY(clamp(-180px, -16vh, -110px));
}

.game-page-sky .sky-stars {
    z-index: 3;
    opacity: 1;
}

.game-page-sky .sky-star-1,
.game-page-sky .sky-star-2,
.game-page-sky .sky-star-3 {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
}

.game-page-sky .sky-horizon-mask {
    display: none;
}

.game-page-sky .sky-sun-body {
    width: 180px;
    height: 180px;
}

.game-page-sky .sky-moon-body {
    width: 160px;
    height: 160px;
}

.game-page-sky .sky-stars svg {
    transform: none;
}

.game-page-sky .sky-horizon-line {
    display: none;
}

.game-hero {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius-lg) + 2px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(14, 16, 28, 0.84), rgba(10, 10, 16, 0.88));
    backdrop-filter: blur(12px);
    box-shadow: var(--card-highlight), 0 14px 34px rgba(0, 0, 0, 0.22);
    isolation: isolate;
}

.game-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%);
    z-index: 1;
    pointer-events: none;
}

.game-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.05), transparent 44%);
    z-index: 1;
    pointer-events: none;
}


.game-hero.with-sky {
    border-color: rgba(255, 255, 255, 0.09);
}

.game-hero.lobby {
    background:
        linear-gradient(180deg, rgba(18, 18, 26, 0.9), rgba(10, 10, 16, 0.94));
}

/* ── Game Header ────────────────────────────────────────────── */
.game-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 2;
    padding: 14px 18px 12px;
}

.game-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.game-header-room {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.game-header-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.game-code {
    font-family: monospace;
    font-size: 17px;
    color: var(--gold);
    letter-spacing: 0.14em;
    text-shadow: 0 0 12px var(--gold-glow);
}

.game-room-state {
    color: var(--text-muted);
    font-size: 12px;
}

.game-room-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.game-room-divider {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    flex: 0 0 auto;
}

.game-header-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.header-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    background: rgba(17, 18, 28, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0 10px;
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    backdrop-filter: blur(8px);
}

.header-stat-pill strong {
    font-size: 13px;
    color: var(--text);
    line-height: 1;
}

.current-player-pill {
    justify-content: flex-start;
    max-width: min(100%, 260px);
}

.current-player-pill .header-stat-label {
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-muted);
}

.current-player-pill strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-stat-label {
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.game-header-summary {
    color: #c1b7a6;
    font-size: 12px;
    line-height: 1.4;
}

.phase-overview-shell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}

/* ── Phase bar (compact single-row) ─────────────────────────── */
.phase-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 8px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.phase-ready-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 0;
    min-width: 0;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.phase-ready-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.phase-ready-count {
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.phase-timer-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    white-space: nowrap;
}

.phase-timer-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.phase-overview {
    display: grid;
    gap: 12px;
    align-items: center;
    padding: 4px 0 2px;
    border: none;
    border-radius: var(--radius-lg);
    background: none;
    backdrop-filter: none;
}

.phase-overview.has-side {
    grid-template-columns: minmax(0, 1fr) auto;
}

.phase-overview.no-side {
    grid-template-columns: 1fr;
}

.phase-overview.lobby {
    border-color: var(--border);
}

.phase-overview.rolereveal {
    box-shadow: none;
}

.phase-overview.night {
    box-shadow: none;
}

.phase-overview.dawn {
    border-color: #4a3008;
}

.phase-overview.day {
    border-color: #153530;
}

.phase-overview.dusk {
    border-color: #4a2808;
}

.phase-overview.gameover {
    box-shadow: none;
}

.phase-overview-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.phase-overview-topline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.phase-overview-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phase-overview-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    min-height: 0;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    background: rgba(12, 13, 22, 0.68);
    backdrop-filter: blur(8px);
}

.phase-overview-card-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.phase-overview-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 0;
}

.phase-overview-status-copy {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.phase-overview-status-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.phase-overview-status-count {
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.phase-track-progress {
    position: relative;
    overflow: hidden;
    height: 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.45);
}

.phase-track-progress.compact {
    height: 5px;
    flex: 1 1 0;
    max-width: 160px;
    min-width: 40px;
}

.phase-track-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(27, 179, 145, 0.9), rgba(201, 160, 69, 0.92));
    box-shadow: 0 0 10px rgba(27, 179, 145, 0.25), 0 0 14px rgba(201, 160, 69, 0.18);
    transition: width 220ms ease;
}

.game-header-roles {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.header-role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.round-indicator {
    font-size: 12px;
    color: var(--text-faint);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.03em;
}

/* Phase badges */
.phase-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid transparent;
}
.phase-badge.lobby      { background: var(--bg-elevated); color: var(--text-faint); border-color: var(--border); }
.phase-badge.rolesassigned,
.phase-badge.rolereveal { background: var(--gold-dim); color: var(--gold); border-color: #4a3408; box-shadow: 0 0 8px var(--gold-glow); }
.phase-badge.night      { background: #0c0c28; color: #818cf8; border-color: #252560; box-shadow: 0 0 8px rgba(129,140,248,0.15); }
.phase-badge.dawn       { background: #221508; color: #f59e0b; border-color: #4a3008; }
.phase-badge.day        { background: var(--teal-dim); color: var(--teal); border-color: #143530; }
.phase-badge.voting     { background: #221008; color: #fb923c; border-color: #4a2808; }
.phase-badge.dusk       { background: #221008; color: #fb923c; border-color: #4a2808; }
.phase-badge.gameover   { background: var(--red-dim); color: var(--red-bright); border-color: #4a1010; box-shadow: 0 0 8px var(--red-glow); }

/* ── Party Overview ──────────────────────────────────────────── */
.overview-dashboard {
    background: linear-gradient(135deg, rgba(13, 13, 20, 0.98), rgba(16, 16, 24, 0.96));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--card-highlight), 0 8px 28px rgba(0, 0, 0, 0.28);
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.overview-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 124px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.overview-card-wide {
    grid-column: span 2;
}

.overview-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.overview-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.overview-code {
    font-family: monospace;
    letter-spacing: 0.14em;
    color: var(--gold);
    text-shadow: 0 0 12px var(--gold-glow);
}

.overview-meta {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.overview-role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.overview-role {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(201, 160, 69, 0.24);
    background: rgba(201, 160, 69, 0.1);
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
}

.private-panel {
    background: linear-gradient(135deg, rgba(16, 16, 20, 0.92), rgba(12, 12, 16, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--card-highlight), 0 2px 16px rgba(0, 0, 0, 0.28);
}

.private-panel--collapsed .private-panel-header {
    margin-bottom: 0;
}

/* Smooth expand/collapse for panel body */
.private-panel-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 280ms ease;
}
.private-panel-body.open {
    grid-template-rows: 1fr;
}
.private-panel-body > .private-panel-body-inner {
    overflow: hidden;
}

.private-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    transition: margin-bottom 280ms ease;
}

.private-panel-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 2px;
}

.private-panel-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
    transition: opacity 200ms ease, max-height 280ms ease;
    max-height: 3em;
    opacity: 1;
    overflow: hidden;
}

.private-panel:not(.private-panel--collapsed) .private-panel-hint {
    max-height: 0;
    opacity: 0;
}

.btn-privacy {
    white-space: nowrap;
}

/* ── Role Card ──────────────────────────────────────────────── */
.role-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-highlight);
}

.role-card.village {
    background: linear-gradient(135deg, var(--bg-card) 0%, #08160e 100%);
    border-color: #1e3828;
    box-shadow: var(--card-highlight), 0 0 20px var(--teal-glow);
}
.role-card.mafia {
    background: linear-gradient(135deg, var(--bg-card) 0%, #160808 100%);
    border-color: #3a1010;
    box-shadow: var(--card-highlight), 0 0 20px var(--red-glow);
}

.role-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
    font-family: var(--font-body);
    font-weight: 600;
}
.role-card.village h3 { color: var(--teal); }
.role-card.mafia h3   { color: var(--red-bright); }
.role-card h3 strong  { font-family: var(--font-display); font-size: 22px; }

.role-card p {
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-serif);
    font-size: 16px;
}

.mafia-team {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #2e1010;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.mafia-member {
    background: var(--red-dim);
    color: #f5c6c3;
    border: 1px solid #4a1010;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

.detective-result {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
}
.detective-result.is-mafia  { background: var(--red-dim); border: 1px solid var(--red); color: var(--red-bright); box-shadow: 0 0 10px var(--red-glow); }
.detective-result.not-mafia { background: var(--teal-dim); border: 1px solid var(--teal); color: var(--teal); box-shadow: 0 0 10px var(--teal-glow); }

/* ── Phase Panel ────────────────────────────────────────────── */
.phase-panel {
    background: linear-gradient(135deg, rgba(16, 16, 20, 0.92), rgba(12, 12, 16, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--card-highlight), 0 2px 16px rgba(0,0,0,0.28);
}

.phase-message {
    color: var(--text-muted);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 19px;
    text-align: center;
    padding: 16px 0 24px;
    line-height: 1.5;
}

.phase-message.success {
    color: var(--teal);
    font-style: normal;
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--teal-dim);
    border: 1px solid #1a4030;
    border-radius: var(--radius);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    margin-bottom: 0;
    box-shadow: 0 0 10px var(--teal-glow);
}

.vote-inline-msg {
    font-size: 12px;
    padding: 6px 12px;
    margin-top: 2px;
}

.phase-transition-summary {
    color: var(--text);
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 1.6;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(201, 160, 69, 0.18);
    background: linear-gradient(180deg, rgba(26, 24, 22, 0.96), rgba(18, 16, 14, 0.96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 8px 20px rgba(0,0,0,0.16);
}
.phase-ready-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(32, 35, 41, 0.96), rgba(18, 20, 24, 0.96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 8px 20px rgba(0,0,0,0.18);
}

.phase-ready-progress-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.phase-ready-progress-label {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.phase-ready-progress-count {
    color: var(--gold);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.phase-ready-progress-bar {
    position: relative;
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.45);
}

.phase-ready-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(27, 179, 145, 0.9), rgba(201, 160, 69, 0.92));
    box-shadow: 0 0 10px rgba(27, 179, 145, 0.25), 0 0 14px rgba(201, 160, 69, 0.18);
    transition: width 220ms ease;
}

/* ── Lobby Panel ────────────────────────────────────────────── */
.lobby-panel { text-align: center; }

.share-code {
    font-family: monospace;
    font-size: 42px;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--gold);
    background: var(--bg-elevated);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px 28px;
    display: inline-block;
    margin: 12px 0 8px;
    cursor: pointer;
    transition: all var(--transition);
    user-select: all;
    text-shadow: 0 0 20px var(--gold-glow);
}
.share-code:hover {
    border-color: var(--gold);
    border-style: solid;
    box-shadow: 0 0 20px var(--gold-glow);
}

.player-count { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

.config-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 16px 0;
    text-align: left;
}
.config-section h4 {
    font-size: 11px;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    gap: 12px;
}
.config-row:last-child { border-bottom: none; padding-bottom: 0; }
.config-row label {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 14px;
    color: var(--text);
    font-weight: 400;
}

.count-picker {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(12, 14, 22, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    flex-shrink: 0;
}

.count-picker-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: color var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.count-picker-option:hover:not(:disabled):not(.active) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.count-picker-option.active {
    color: var(--gold);
    background: rgba(201, 160, 69, 0.12);
    border-color: rgba(201, 160, 69, 0.4);
    box-shadow: 0 0 8px rgba(201, 160, 69, 0.1);
}

.joined-players {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 12px 0;
}

/* ── Players Section ────────────────────────────────────────── */
.players-section {
    background: linear-gradient(135deg, rgba(16, 16, 20, 0.92), rgba(12, 12, 16, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--card-highlight), 0 2px 16px rgba(0, 0, 0, 0.28);
}
.players-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 14px;
    font-weight: 700;
}

.player-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

/* ── Avatar card (in-game player list) ──────────────────────── */
.player-avatar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 72px;
    padding: 10px 8px 8px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.player-avatar {
    position: relative;
    overflow: visible;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-serif);
    background: var(--bg-elevated);
    border: 2px solid var(--border-light);
    color: var(--text);
    transition: all var(--transition);
}

.player-avatar-card.me .player-avatar {
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.player-avatar-card.dead .player-avatar {
    opacity: 0.4;
    border-color: var(--border);
    background: #12141a;
}

.avatar-status-dead {
    position: absolute;
    inset: -10px;
    color: var(--red-bright);
    opacity: 0.85;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(220, 60, 60, 0.6));
    animation: kill-cross-in 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes kill-cross-in {
    0%   { opacity: 0; transform: scale(0) rotate(-90deg); }
    60%  { opacity: 1; transform: scale(1.15) rotate(8deg); }
    100% { opacity: 0.85; transform: scale(1) rotate(0deg); }
}

.player-avatar-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-avatar-name.dimmed {
    opacity: 0.45;
}

.player-avatar-role {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-faint);
    border: 1px solid var(--border);
}

/* Role-colored avatar rings */
.player-avatar.mafia,
.player-avatar.don    { border-color: #b91c1c; }
.player-avatar.villager { border-color: #31433b; }
.player-avatar.doctor { border-color: var(--teal); }
.player-avatar.detective { border-color: #5b8def; }

/* Role-colored labels */
.player-avatar-role.mafia,
.player-avatar-role.don { color: var(--red-bright); background: var(--red-dim); border-color: #4a1010; }
.player-avatar-role.villager { color: #80d3c7; background: rgba(13, 148, 136, 0.1); border-color: #1a4030; }
.player-avatar-role.doctor { color: var(--teal); background: rgba(13, 148, 136, 0.1); border-color: #1a4030; }
.player-avatar-role.detective { color: #7cb8ff; background: rgba(92, 141, 239, 0.1); border-color: #1a3060; }

/* ── Lobby player chip ──────────────────────────────────────── */
.player-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border-light);
    background: var(--bg-elevated);
    color: var(--text);
}
.player-chip.me {
    border-color: var(--gold);
    background: var(--gold-dim);
    box-shadow: 0 0 8px var(--gold-glow);
}

.kick-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    margin-left: 2px;
    line-height: 1;
    transition: color var(--transition);
}
.kick-btn:hover {
    color: var(--red-bright, #e05252);
}

.host-tag, .dead-tag, .role-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.host-tag { background: var(--gold-dim); color: var(--gold); border: 1px solid #4a3408; }
.dead-tag { background: var(--red-dim); color: var(--red-bright); border: 1px solid #4a1010; }
.role-tag { background: var(--bg); color: var(--text-faint); border: 1px solid var(--border); }

/* ── Narrator Log ───────────────────────────────────────────── */
.narrator-log {
    background: linear-gradient(135deg, rgba(16, 16, 20, 0.92), rgba(12, 12, 16, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    max-height: 480px;
    overflow-y: auto;
    font-family: var(--font-serif);
    backdrop-filter: blur(12px);
    box-shadow: var(--card-highlight), 0 2px 16px rgba(0, 0, 0, 0.28);
    position: relative;
    /* Visible scrollbar for the game log */
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 160, 69, 0.35) transparent;
}
.narrator-log::-webkit-scrollbar { width: 6px; }
.narrator-log::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); border-radius: 3px; margin: 8px 0; }
.narrator-log::-webkit-scrollbar-thumb { background: rgba(201, 160, 69, 0.35); border-radius: 3px; }
.narrator-log::-webkit-scrollbar-thumb:hover { background: rgba(201, 160, 69, 0.55); }
.narrator-log h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 14px;
    font-weight: 700;
}

.log-round-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 8px;
    font-family: var(--font-sans);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
    font-weight: 700;
}
.log-round-separator::before,
.log-round-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201, 160, 69, 0.3), transparent);
}

.log-entry {
    font-family: inherit;
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 1.55;
    border-left: 2px solid transparent;
    animation: log-slide-in 220ms ease both;
}

@keyframes log-slide-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}
.log-entry:last-child { margin-bottom: 8px; }

.log-entry.info        { border-left-color: var(--border-light); color: var(--text-muted); }
.log-entry.death       { border-left-color: var(--red); color: #f5c6c3; background: #160606; }
.log-entry.phasechange {
    border-left-color: var(--gold);
    color: var(--gold);
    font-family: var(--font-serif);
    font-style: italic;
        font-weight: 600;
    font-size: 15px;
        letter-spacing: 0.015em;
        background: linear-gradient(90deg, rgba(201, 160, 69, 0.12), rgba(201, 160, 69, 0.02));
        box-shadow: inset 0 0 0 1px rgba(201, 160, 69, 0.08);
    text-shadow: 0 0 8px var(--gold-glow);
}
.log-entry.voteresult  { border-left-color: #fb923c; color: #fed7aa; background: #170e04; }
.log-entry.gameover    { border-left-color: var(--red-bright); color: var(--red-bright); font-weight: 700; font-size: 15px; background: var(--red-dim); }

/* ── Voting Panel ───────────────────────────────────────────── */
.voting-panel { display: flex; flex-direction: column; gap: 14px; }

.voting-panel > h3,
.action-prompt > h3 {
    margin: 0;
    font-size: 18px;
    font-family: var(--font-serif);
    color: var(--text);
}

.action-panel-copy {
    margin: -2px 0 2px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
    max-width: 62ch;
}

.phase-action-row {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.phase-timer-ghost {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.phase-action-row .btn-primary,
.phase-action-row .btn-danger,
.phase-action-row .btn-secondary {
    min-width: 220px;
}

/* ── Utilities ──────────────────────────────────────────────── */
.u-text-center { text-align: center; }

/* ── Night Panel ────────────────────────────────────────────── */
.night-panel { display: flex; flex-direction: column; gap: 16px; }

.night-action-frame {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.night-phase-intro {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: #080820;
    border: 1px solid #1a1a50;
    border-radius: var(--radius-lg);
    box-shadow: inset 0 1px 0 rgba(100,100,200,0.06), 0 0 30px rgba(50,50,180,0.08);
}

.night-phase-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.night-phase-copy > h3 {
    margin: 0;
    color: #d9dcff;
    font-family: var(--font-serif);
    font-size: 18px;
    line-height: 1.35;
}

.night-phase-copy > .action-panel-copy {
    margin: 0;
    color: rgba(222, 226, 255, 0.72);
    max-width: 56ch;
}

.night-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.night-secret-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    border: 1px solid rgba(200, 160, 70, 0.25);
    border-radius: var(--radius-lg);
    background: rgba(200, 160, 70, 0.04);
    animation: panel-fade-in 250ms ease both;
}

.night-secret-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.night-secret-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.7;
}

.night-role-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Role-themed secret panels */
.night-secret--mafia {
    border-color: rgba(220, 60, 60, 0.3);
    background: rgba(220, 60, 60, 0.05);
}
.night-secret--mafia .night-secret-label { color: var(--red-bright); }

.night-secret--doctor {
    border-color: rgba(60, 200, 140, 0.3);
    background: rgba(60, 200, 140, 0.05);
}
.night-secret--doctor .night-secret-label { color: var(--teal); }

.night-secret--detective {
    border-color: rgba(100, 140, 255, 0.3);
    background: rgba(100, 140, 255, 0.05);
}
.night-secret--detective .night-secret-label { color: #8aa8ff; }

.night-toolbar-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.night-moon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.night-reveal-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    animation: panel-fade-in 250ms ease both;
}

@keyframes panel-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.reveal-hint {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.villager-hint {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    margin-bottom: 8px;
}

/* ── Target List ────────────────────────────────────────────── */
.target-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

.target-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    font-family: var(--font-body);
    width: 100%;
}
.target-btn:hover { border-color: var(--text-muted); background: #202026; }
.target-btn.selected {
    border-color: var(--gold);
    background: var(--gold-dim);
    color: var(--text);
    box-shadow: 0 0 10px var(--gold-glow);
}
.target-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Vote bar ───────────────────────────────────────────────── */
.vote-bar-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: 12px;
}
.vote-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
    min-width: 56px;
    text-align: right;
}

/* ── Phase Timer ────────────────────────────────────────────── */
.phase-timer {
    display: inline-flex;
    align-items: center;
    font-family: monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 14px;
    min-width: 72px;
    justify-content: center;
    letter-spacing: 0.05em;
}
.phase-timer.warning {
    color: var(--red-bright);
    border-color: var(--red);
    box-shadow: 0 0 10px var(--red-glow);
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ── Timer Row ──────────────────────────────────────────────── */
.timer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

@media (max-width: 640px) {
    .phase-overview {
        grid-template-columns: 1fr;
    }

    .phase-overview-side {
        width: 100%;
    }

    .phase-action-row .btn-primary,
    .phase-action-row .btn-danger,
    .phase-action-row .btn-secondary {
        width: 100%;
    }
}

/* ── Host Controls ──────────────────────────────────────────── */
.host-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Host Dashboard ─────────────────────────────────────────── */
.host-dashboard {
    background: var(--bg-card);
    border: 1px solid #2e2200;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: inset 0 1px 0 rgba(201,160,69,0.04), 0 0 20px rgba(201,160,69,0.05);
}
.host-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--gold);
    background: rgba(201, 160, 69, 0.12);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(201, 160, 69, 0.24);
    letter-spacing: 0.08em;
}

.dashboard-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dashboard-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--gold-glow);
}

.host-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.host-table th {
    text-align: left;
    padding: 6px 10px;
    color: var(--text-faint);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}
.host-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.host-table tr:last-child td { border-bottom: none; }
.host-table tr.dead-row td { opacity: 0.35; }

.role-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.role-pill.mafia, .role-pill.don { background: var(--red-dim); color: var(--red-bright); border: 1px solid #4a1010; }
.role-pill.detective              { background: var(--blue-dim); color: #60a5fa; border: 1px solid #152a50; }
.role-pill.doctor                 { background: var(--teal-dim); color: var(--teal); border: 1px solid #153530; }
.role-pill.villager               { background: var(--bg-elevated); color: var(--text-faint); border: 1px solid var(--border); }
.role-pill.hidden                 { background: transparent; color: #4d4d82; border: 1px dashed #1e1e54; }

.night-action-cell { color: var(--text-faint); font-style: italic; font-size: 12px; }
.night-action-cell.submitted { color: var(--teal); font-style: normal; font-weight: 600; }

.consensus-indicator {
    font-size: 12px;
    color: var(--red-bright);
    font-weight: 600;
    margin-top: 6px;
}

/* ── Spectator View ─────────────────────────────────────────── */
.spectator-view {
    background: #06061a;
    border: 1px solid #18184a;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: inset 0 1px 0 rgba(129,140,248,0.05);
}
.spectator-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #818cf8;
    background: #0e0e30;
    border: 1px solid #28286a;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 14px;
}
.spectator-view h3 { font-size: 14px; margin-bottom: 10px; color: #818cf8; }
.spectator-view p { max-width: 60ch; }

.spectator-roles-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.spectator-roles-table th {
    text-align: left;
    padding: 5px 10px;
    color: #3a3a70;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid #141440;
    font-weight: 700;
}
.spectator-roles-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #0e0e3a;
    color: #7070b0;
}
.spectator-roles-table tr:last-child td { border-bottom: none; }

/* ── Game Over Panel ────────────────────────────────────────── */
.game-over-panel { text-align: center; }

.winner-art {
    display: block;
    margin: 0 auto 20px;
    opacity: 0.85;
}

.winner {
    padding: 32px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.winner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
}
.winner h2 { font-size: 44px; margin-bottom: 8px; position: relative; }
.winner p  { font-family: var(--font-serif); font-style: italic; font-size: 18px; position: relative; }

.winner.village {
    background: linear-gradient(135deg, #060d08, #0a1e10);
    border: 1px solid #1e3828;
    box-shadow: 0 0 40px rgba(13,148,136,0.12), inset 0 1px 0 rgba(13,148,136,0.08);
}
.winner.village h2 { color: var(--teal); text-shadow: 0 0 30px var(--teal-glow); }
.winner.village p  { color: #5eead4; }

.winner.mafia {
    background: linear-gradient(135deg, #0d0404, #1a0606);
    border: 1px solid #4a1010;
    box-shadow: 0 0 40px rgba(185,28,28,0.15), inset 0 1px 0 rgba(185,28,28,0.06);
}
.winner.mafia h2 { color: var(--red-bright); text-shadow: 0 0 30px var(--red-glow); }
.winner.mafia p  { color: #fca5a5; }

.game-over-panel .final-roles-heading {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    margin: 24px 0 14px;
    text-align: left;
}
.game-over-panel .player-grid { justify-content: center; margin-bottom: 28px; }

/* ── QR Join ────────────────────────────────────────────────── */
.qr-join {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 16px auto;
}

.qr-image {
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg);
    padding: 4px;
    display: block;
    image-rendering: pixelated;
}

.qr-hint {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

/* ── Config section header ──────────────────────────────────── */
.config-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.config-section-header h4 {
    margin-bottom: 0;
}
.suggest-btn {
    font-size: 11px;
    padding: 3px 10px;
    color: var(--gold);
    border-color: #4a3408;
    background: var(--gold-dim);
}
.suggest-btn:hover:not(:disabled) {
    background: rgba(201,160,69,0.18);
    border-color: var(--gold);
}

/* ── Timer Config ──────────────────────────────────────────── */
.timer-hint {
    font-size: 12px;
    color: var(--text-faint);
    font-style: italic;
    margin-bottom: 12px;
}
.timer-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.timer-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
    color: var(--text);
}
.timer-preset-btn:hover {
    border-color: var(--text-muted);
    background: var(--bg-elevated);
}
.timer-preset-btn.active {
    border-color: var(--gold);
    background: var(--gold-dim);
    box-shadow: 0 0 10px var(--gold-glow);
}
.preset-name {
    font-size: 14px;
    font-weight: 600;
}
.preset-detail {
    font-size: 11px;
    color: var(--text-faint);
    font-family: monospace;
    letter-spacing: 0.02em;
}

/* ── Game Recap ─────────────────────────────────────────────── */
.recap-section {
    margin: 24px 0;
    text-align: left;
}

/* Smooth expand/collapse for recap */
.recap-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 320ms ease;
}
.recap-body.open {
    grid-template-rows: 1fr;
}
.recap-body > .recap-body-inner {
    overflow: hidden;
}

.recap-toggle {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-body);
    transition: color var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}
.recap-toggle:hover { color: var(--text-muted); }

.recap-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.recap-round {
    border-left: 2px solid var(--border-light);
    padding-left: 16px;
    position: relative;
}
.recap-round::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-light);
    border: 1px solid var(--bg);
}

.recap-round-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.recap-event {
    font-size: 13px;
    padding: 5px 0;
    color: var(--text-muted);
    line-height: 1.5;
    border-bottom: 1px solid var(--border);
}
.recap-event:last-child { border-bottom: none; }
.recap-event.death       { color: #f5c6c3; }
.recap-event.voteresult  { color: #fed7aa; }
.recap-event.phasechange {
    color: var(--gold);
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.015em;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── Stats Dashboard ───────────────────────────────────────── */
.stats-container {
    max-width: 720px;
    margin: 40px auto 0;
}
.stats-container h1 {
    font-family: var(--font-display);
    font-size: 36px;
    color: var(--gold);
    margin-bottom: 24px;
    text-align: center;
    text-shadow: 0 0 30px var(--gold-glow);
}

.stats-empty-state {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 34px 28px;
    margin-bottom: 24px;
    text-align: center;
    background:
        radial-gradient(circle at top, rgba(201,160,69,0.12), transparent 40%),
        linear-gradient(180deg, rgba(15,19,28,0.98), rgba(10,13,20,0.98));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    box-shadow: var(--card-highlight), 0 18px 40px rgba(0,0,0,0.34);
    overflow: hidden;
}

.stats-empty-state::before {
    content: '';
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,160,69,0.5), transparent);
    opacity: 0.7;
}

.stats-empty-state-loading {
    min-height: 240px;
    justify-content: center;
}

.stats-empty-icon {
    width: 84px;
    height: 84px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--gold);
    background: radial-gradient(circle, rgba(201,160,69,0.14), rgba(201,160,69,0.04));
    border: 1px solid rgba(201,160,69,0.24);
    box-shadow: 0 0 36px rgba(201,160,69,0.08);
}

.stats-empty-icon svg {
    width: 42px;
    height: 42px;
}

.stats-empty-content {
    max-width: 480px;
}

.stats-empty-eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(255,255,255,0.45);
}

.stats-empty-content h2 {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 10px;
}

.stats-empty-copy {
    max-width: 38ch;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 15px;
}

.stats-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.stats-page-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--card-highlight);
}
.stats-card.village-card { border-color: #1e3828; }
.stats-card.mafia-card   { border-color: #3a1010; }

.stats-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}
.stats-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.stats-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.win-rate-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 24px;
    box-shadow: var(--card-highlight);
}
.win-rate-bar {
    display: flex;
    height: 32px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 10px;
}
.win-rate-fill {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: width 500ms ease;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.win-rate-fill.village { background: var(--teal); color: #041210; }
.win-rate-fill.mafia   { background: var(--red); color: #fff; }

.recent-games {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--card-highlight);
}
.recent-games h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 700;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.stats-table th {
    text-align: left;
    padding: 6px 10px;
    color: var(--text-faint);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}
.stats-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.stats-table tr:last-child td { border-bottom: none; }

.game-code-cell {
    font-family: monospace;
    letter-spacing: 0.1em;
    color: var(--gold);
}
.date-cell {
    color: var(--text-muted);
    font-size: 12px;
}

.winner-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.winner-pill.village { background: var(--teal-dim); color: var(--teal); border: 1px solid #153530; }
.winner-pill.mafia   { background: var(--red-dim); color: var(--red-bright); border: 1px solid #4a1010; }

@media (max-width: 640px) {
    .stats-container {
        margin-top: 28px;
    }

    .stats-container h1 {
        font-size: 30px;
        margin-bottom: 20px;
    }

    .stats-empty-state {
        padding: 28px 18px;
        border-radius: 16px;
    }

    .stats-empty-icon {
        width: 72px;
        height: 72px;
    }

    .stats-empty-content h2 {
        font-size: 24px;
    }

    .stats-empty-actions,
    .stats-page-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-empty-actions .btn-primary,
    .stats-empty-actions .btn-secondary,
    .stats-page-actions .btn-secondary {
        width: 100%;
    }
}

/* ── Profile page ──────────────────────────────────────────── */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--card-highlight);
}
.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gold-dim);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--gold);
}
.profile-avatar.guest {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border-color: var(--border);
}
.profile-avatar svg { width: 28px; height: 28px; }
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.profile-name {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text);
}
.profile-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
}
.profile-badge.guest {
    color: var(--text-faint);
}
.profile-cta {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: var(--card-highlight);
}
.profile-cta p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}
.profile-link-banner {
    background: var(--teal-dim);
    border: 1px solid #153530;
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--teal);
    text-align: center;
}

/* ── Blazor connection / error UI ──────────────────────────── */
#components-reconnect-modal,
#blazor-error-ui {
    z-index: 10000;
}

#components-reconnect-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 14%, rgba(201, 160, 69, 0.18), transparent 32%),
        radial-gradient(circle at 50% 0%, rgba(255, 244, 214, 0.06), transparent 18%),
        rgba(5, 5, 6, 0.76);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

.connection-status-card {
    position: relative;
    width: min(100%, 34rem);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(201, 160, 69, 0.28);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 26%),
        linear-gradient(135deg, rgba(201, 160, 69, 0.14), transparent 40%),
        linear-gradient(180deg, rgba(24, 18, 8, 0.82), rgba(12, 12, 14, 0.97));
    box-shadow:
        0 32px 90px rgba(0, 0, 0, 0.58),
        0 0 48px rgba(201, 160, 69, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    animation: connection-status-enter 180ms ease-out;
}

.connection-status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 28px;
    right: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201, 160, 69, 0.55), transparent);
}

.connection-status-card::after {
    content: '';
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    pointer-events: none;
}

.connection-status-card-error::after,
#blazor-error-ui .connection-status-card::after {
    border-color: rgba(255, 255, 255, 0.025);
}

.connection-status-card::selection {
    background: rgba(201, 160, 69, 0.25);
}

.connection-status-card h2 {
    font-size: clamp(1.75rem, 4vw, 2.3rem);
    color: var(--text);
    margin-bottom: 10px;
    max-width: 12ch;
    text-wrap: balance;
}

.connection-status-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.connection-status-kicker::before {
    content: '';
    width: 28px;
    height: 1px;
    background: currentColor;
    opacity: 0.6;
}

.connection-status-copy {
    display: none;
    margin: 0;
    max-width: 31ch;
    color: #c3b8a4;
    font-size: 15px;
    line-height: 1.65;
}

.connection-status-attempts {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    color: #9c8d6d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.connection-status-pulse {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--gold);
    box-shadow: 0 0 0 0 rgba(201, 160, 69, 0.5);
    animation: connection-status-pulse 1.4s ease-out infinite;
}

.connection-status-divider {
    color: var(--border-light);
}

.connection-status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.connection-status-actions .btn-primary,
.connection-status-actions .btn-secondary {
    min-width: 120px;
}

#components-reconnect-current-attempt,
#components-reconnect-max-retries {
    min-width: 1ch;
    color: var(--text);
}

#components-reconnect-modal.components-reconnect-show .connection-status-copy-waiting,
#components-reconnect-modal.components-reconnect-failed .connection-status-copy-failed,
#components-reconnect-modal.components-reconnect-rejected .connection-status-copy-rejected,
#blazor-error-ui .connection-status-copy {
    display: block;
}

#components-reconnect-modal.components-reconnect-show .connection-status-attempts,
#components-reconnect-modal.components-reconnect-failed .connection-status-attempts {
    display: inline-flex;
}

#blazor-error-ui {
    position: fixed;
    right: 24px;
    bottom: 24px;
    left: 24px;
    display: none;
    max-width: 34rem;
    margin-left: auto;
}

#blazor-error-ui .connection-status-card {
    border-color: rgba(239, 68, 68, 0.26);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 24%),
        linear-gradient(135deg, rgba(185, 28, 28, 0.26), transparent 42%),
        linear-gradient(180deg, rgba(28, 10, 10, 0.94), rgba(16, 10, 10, 0.98));
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.56),
        0 0 42px rgba(239, 68, 68, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#blazor-error-ui .connection-status-kicker {
    color: #fca5a5;
}

#blazor-error-ui .connection-status-copy {
    color: #e6b1b1;
}

#blazor-error-ui .connection-status-card::before {
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.6), transparent);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
}

@keyframes connection-status-enter {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes connection-status-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(201, 160, 69, 0.38);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 12px rgba(201, 160, 69, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(201, 160, 69, 0);
    }
}

/* ── Sky Animation (Sun/Moon orbital) ──────────────────────── */
@property --sky-sun-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@property --sky-moon-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 180deg;
}

@property --sky-sun-opacity {
    syntax: "<number>";
    inherits: false;
    initial-value: 1;
}

@property --sky-moon-opacity {
    syntax: "<number>";
    inherits: false;
    initial-value: 0;
}

@property --sky-stars-opacity {
    syntax: "<number>";
    inherits: false;
    initial-value: 0;
}

.sky-animation {
    --sky-sun-angle: 0deg;
    --sky-moon-angle: 180deg;
    --sky-sun-opacity: 1;
    --sky-moon-opacity: 0;
    --sky-stars-opacity: 0;
    --sky-gradient: linear-gradient(180deg, #78bcff 0%, #a8ddff 38%, #ffd17e 100%);
    --sky-halo: radial-gradient(circle at 50% 22%, rgba(255, 247, 218, 0.18) 0%, rgba(255, 247, 218, 0) 38%),
        radial-gradient(circle at 50% 110%, rgba(255, 184, 87, 0.18) 0%, rgba(255, 184, 87, 0) 34%);
    --sky-veil: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.04) 28%, rgba(7, 12, 22, 0.12) 100%);
    --sky-mask: linear-gradient(180deg, rgba(12, 14, 22, 0) 0%, rgba(12, 14, 22, 0.18) 28%, rgba(7, 8, 12, 0.92) 100%);
    --sky-orbit-stroke: rgba(255, 235, 174, 0.18);
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    isolation: isolate;
    container-type: size;
    border-radius: var(--radius-lg);
    border: 1px solid #5b4420;
    box-shadow: var(--card-highlight), 0 18px 40px rgba(0, 0, 0, 0.28);
    transition: border-color 1.6s ease, box-shadow 1.6s ease;
}

.sky-animation.sky-day {
    border-color: #7d5b24;
    box-shadow: var(--card-highlight), 0 18px 40px rgba(120, 84, 26, 0.2);
    --sky-gradient: linear-gradient(180deg, #1a3d6e 0%, #2c5a8a 34%, #5a85a8 68%, #9a7a48 100%);
    --sky-halo: radial-gradient(circle at 50% 22%, rgba(241, 245, 255, 0.12) 0%, rgba(241, 245, 255, 0) 36%),
        radial-gradient(circle at 50% 110%, rgba(196, 157, 95, 0.15) 0%, rgba(196, 157, 95, 0) 34%);
    --sky-veil: linear-gradient(180deg, rgba(214, 227, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 28%, rgba(10, 16, 28, 0.22) 100%);
    --sky-mask: linear-gradient(180deg, rgba(8, 12, 20, 0) 0%, rgba(8, 12, 20, 0.14) 28%, rgba(8, 10, 16, 0.92) 100%);
    --sky-orbit-stroke: rgba(226, 234, 255, 0.14);
}

.sky-animation.sky-afternoon {
    border-color: #784325;
    box-shadow: var(--card-highlight), 0 18px 44px rgba(138, 71, 20, 0.28);
    --sky-gradient: linear-gradient(180deg, #4f80cf 0%, #f0a159 50%, #d56f34 100%);
    --sky-halo: radial-gradient(circle at 62% 26%, rgba(255, 223, 162, 0.16) 0%, rgba(255, 223, 162, 0) 34%),
        radial-gradient(circle at 50% 112%, rgba(169, 76, 25, 0.16) 0%, rgba(169, 76, 25, 0) 36%);
    --sky-veil: linear-gradient(180deg, rgba(255, 236, 207, 0.14) 0%, rgba(255, 219, 174, 0.06) 34%, rgba(20, 12, 10, 0.18) 100%);
    --sky-mask: linear-gradient(180deg, rgba(12, 11, 14, 0) 0%, rgba(12, 11, 14, 0.2) 28%, rgba(14, 8, 8, 0.94) 100%);
    --sky-orbit-stroke: rgba(255, 213, 150, 0.16);
}

.sky-animation.sky-evening {
    border-color: #6f2b28;
    box-shadow: var(--card-highlight), 0 18px 44px rgba(92, 25, 34, 0.34);
    --sky-gradient: linear-gradient(180deg, #183560 0%, #7a2952 44%, #f27d42 100%);
    --sky-halo: radial-gradient(circle at 72% 32%, rgba(255, 191, 110, 0.16) 0%, rgba(255, 191, 110, 0) 30%),
        radial-gradient(circle at 50% 112%, rgba(112, 36, 59, 0.18) 0%, rgba(112, 36, 59, 0) 38%);
    --sky-veil: linear-gradient(180deg, rgba(255, 220, 179, 0.06) 0%, rgba(255, 183, 126, 0.04) 30%, rgba(18, 12, 24, 0.28) 100%);
    --sky-mask: linear-gradient(180deg, rgba(12, 11, 17, 0) 0%, rgba(12, 11, 17, 0.26) 32%, rgba(8, 8, 14, 0.95) 100%);
    --sky-orbit-stroke: rgba(255, 178, 104, 0.18);
}

.sky-animation.sky-night {
    border-color: #253a72;
    box-shadow: var(--card-highlight), 0 18px 44px rgba(10, 18, 42, 0.4);
    --sky-gradient: linear-gradient(180deg, #08101f 0%, #111c3c 42%, #1d234c 100%);
    --sky-halo: radial-gradient(circle at 50% 20%, rgba(102, 124, 255, 0.08) 0%, rgba(102, 124, 255, 0) 42%),
        radial-gradient(circle at 50% 112%, rgba(32, 38, 90, 0.16) 0%, rgba(32, 38, 90, 0) 40%);
    --sky-veil: linear-gradient(180deg, rgba(104, 124, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 24%, rgba(2, 5, 14, 0.28) 100%);
    --sky-mask: linear-gradient(180deg, rgba(6, 8, 18, 0) 0%, rgba(6, 8, 18, 0.24) 28%, rgba(4, 4, 10, 0.95) 100%);
    --sky-orbit-stroke: rgba(144, 164, 255, 0.16);
}

.sky-animation.sky-dawn {
    border-color: #5d3753;
    box-shadow: var(--card-highlight), 0 18px 44px rgba(88, 42, 70, 0.3);
    --sky-gradient: linear-gradient(180deg, #13182d 0%, #4b2752 48%, #f39d61 100%);
    --sky-halo: radial-gradient(circle at 24% 34%, rgba(255, 196, 123, 0.16) 0%, rgba(255, 196, 123, 0) 30%),
        radial-gradient(circle at 50% 112%, rgba(205, 103, 70, 0.18) 0%, rgba(205, 103, 70, 0) 38%);
    --sky-veil: linear-gradient(180deg, rgba(166, 178, 255, 0.06) 0%, rgba(255, 203, 149, 0.04) 28%, rgba(18, 10, 20, 0.24) 100%);
    --sky-mask: linear-gradient(180deg, rgba(11, 11, 18, 0) 0%, rgba(11, 11, 18, 0.22) 30%, rgba(7, 6, 11, 0.94) 100%);
    --sky-orbit-stroke: rgba(255, 189, 122, 0.18);
}

.sky-animation.sky-gameover {
    border-color: #6c1730;
    box-shadow: var(--card-highlight), 0 20px 46px rgba(77, 11, 24, 0.42);
    --sky-gradient: linear-gradient(180deg, #0a0612 0%, #2a0c25 48%, #240715 100%);
    --sky-halo: radial-gradient(circle at 50% 22%, rgba(123, 28, 61, 0.12) 0%, rgba(123, 28, 61, 0) 34%),
        radial-gradient(circle at 50% 112%, rgba(91, 9, 31, 0.16) 0%, rgba(91, 9, 31, 0) 36%);
    --sky-veil: linear-gradient(180deg, rgba(199, 40, 72, 0.06) 0%, rgba(255, 255, 255, 0.01) 20%, rgba(7, 2, 8, 0.3) 100%);
    --sky-mask: linear-gradient(180deg, rgba(10, 5, 10, 0) 0%, rgba(10, 5, 10, 0.26) 30%, rgba(5, 2, 6, 0.96) 100%);
    --sky-orbit-stroke: rgba(184, 63, 93, 0.18);
}

.sky-gradient {
    --sky-layer-gradient: linear-gradient(180deg, #78bcff 0%, #a8ddff 34%, #ffe7b8 72%, #f5bb6d 100%);
    --sky-layer-halo: radial-gradient(circle at 50% 22%, rgba(255, 247, 218, 0.18) 0%, rgba(255, 247, 218, 0) 38%), radial-gradient(circle at 50% 110%, rgba(255, 185, 95, 0.2) 0%, rgba(255, 185, 95, 0) 34%);
    --sky-layer-veil: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.04) 30%, rgba(16, 20, 34, 0.12) 100%);
    position: absolute;
    inset: 0;
    background: var(--sky-layer-gradient);
    z-index: 0;
}

.sky-gradient-overlay {
    opacity: 0;
    pointer-events: none;
}

.sky-gradient::before,
.sky-gradient::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sky-gradient::before {
    inset: -12%;
    background: var(--sky-layer-halo);
    opacity: 0.7;
    mix-blend-mode: screen;
    animation: sky-drift 28s linear infinite alternate;
}

.sky-gradient::after {
    background: var(--sky-layer-veil);
}

.sky-orbit-guide {
    position: absolute;
    left: 50%;
    top: 76%;
    width: 76cqw;
    height: 54cqh;
    transform: translate(-50%, -50%);
    border: 1px solid var(--sky-orbit-stroke);
    border-radius: 999px;
    opacity: 0.85;
    mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.15) 70%, transparent 100%);
    z-index: 1;
    transition: border-color 1.8s ease, opacity 1.8s ease;
}

.sky-stars {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}

.sky-stars svg {
    width: 100%;
    height: 100%;
}

/* Star twinkle */
@keyframes sky-twinkle-1 {
    0%, 100% { opacity: 0.9; }
    50%      { opacity: 0.35; }
}
@keyframes sky-twinkle-2 {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 0.3; }
}
@keyframes sky-twinkle-3 {
    0%, 100% { opacity: 0.8; }
    50%      { opacity: 0.25; }
}
.sky-star-1 { animation: sky-twinkle-1 3s ease-in-out infinite; }
.sky-star-2 { animation: sky-twinkle-2 4s ease-in-out infinite 1s; }
.sky-star-3 { animation: sky-twinkle-3 5s ease-in-out infinite 2s; }

@keyframes sky-drift {
    0% { transform: translate3d(-2%, -1%, 0) scale(1); }
    100% { transform: translate3d(2%, 1%, 0) scale(1.03); }
}

@keyframes sky-breathe {
    0%, 100% { transform: scale(0.98); }
    50% { transform: scale(1.02); }
}

/* Art deco skyline — centered, covers bottom portion as horizon mask */
.sky-skyline {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    min-width: 320px;
    height: 84px;
    z-index: 4;
    color: #0a0a10;
    transition: color 2s ease;
}
.sky-animation.sky-day .sky-skyline,
.sky-animation.sky-afternoon .sky-skyline { color: #1a1510; }
.sky-animation.sky-evening .sky-skyline   { color: #120810; }
.sky-animation.sky-dawn .sky-skyline      { color: #0e0810; }

/* Window glow changes with time of day */
.sky-animation.sky-night .sky-windows   { opacity: 0.7; }
.sky-animation.sky-dawn .sky-windows    { opacity: 0.5; }
.sky-animation.sky-day .sky-windows     { opacity: 0.15; }
.sky-animation.sky-afternoon .sky-windows { opacity: 0.25; }
.sky-animation.sky-evening .sky-windows { opacity: 0.55; }

.sky-body {
    position: absolute;
    z-index: 2;
    transform: translate(-50%, -50%);
    pointer-events: none;
    will-change: left, top, opacity;
}

.sky-sun-body {
    width: 64px;
    height: 64px;
    opacity: 1;
}

.sky-moon-body {
    width: 56px;
    height: 56px;
    opacity: 0;
}

.sky-sun,
.sky-moon {
    width: 100%;
    height: 100%;
    display: block;
    animation: sky-breathe 8s ease-in-out infinite;
    transition: filter 1.8s ease, opacity 1.6s ease;
}

.sky-sun {
    filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.36));
}

.sky-moon {
    filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.26));
}

.sky-animation.sky-day .sky-sun { filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.42)); }
.sky-animation.sky-afternoon .sky-sun { filter: drop-shadow(0 0 14px rgba(249, 115, 22, 0.38)); }
.sky-animation.sky-evening .sky-sun { filter: drop-shadow(0 0 16px rgba(248, 113, 113, 0.34)); }
.sky-animation.sky-night .sky-sun { filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.14)); }
.sky-animation.sky-dawn .sky-sun { filter: drop-shadow(0 0 14px rgba(251, 146, 60, 0.38)); }
.sky-animation.sky-gameover .sky-sun { filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.16)); }

.sky-animation.sky-day .sky-moon { filter: drop-shadow(0 0 4px rgba(129, 140, 248, 0.06)); }
.sky-animation.sky-afternoon .sky-moon { filter: drop-shadow(0 0 5px rgba(129, 140, 248, 0.1)); }
.sky-animation.sky-evening .sky-moon { filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.18)); }
.sky-animation.sky-night .sky-moon { filter: drop-shadow(0 0 14px rgba(148, 163, 255, 0.34)); }
.sky-animation.sky-dawn .sky-moon { filter: drop-shadow(0 0 10px rgba(148, 163, 255, 0.22)); }
.sky-animation.sky-gameover .sky-moon { filter: drop-shadow(0 0 10px rgba(248, 113, 113, 0.14)); }

.sky-horizon-mask {
    position: absolute;
    inset: auto 0 0 0;
    height: 42%;
    z-index: 3;
    background: var(--sky-mask);
    pointer-events: none;
    transition: background 1.8s ease;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .sky-gradient,
    .sky-stars,
    .sky-sun,
    .sky-moon,
    .sky-animation,
    .sky-skyline,
    .sky-horizon-mask,
    .sky-orbit-guide { transition: none; }

    .sky-star-1,
    .sky-star-2,
    .sky-star-3,
    .sky-gradient::before,
    .sky-sun,
    .sky-moon { animation: none; }
}

/* Horizon line color by time */
.sky-animation.sky-day .sky-horizon-line       { color: #c9a045; opacity: 0.2; }
.sky-animation.sky-evening .sky-horizon-line   { color: #c04830; opacity: 0.3; }
.sky-animation.sky-night .sky-horizon-line     { color: #818cf8; opacity: 0.12; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .app-main { padding: 16px 12px; }
    .lobby-container { margin-top: 24px; }
    .lobby-container h1 { font-size: 36px; }
    .share-code { font-size: 30px; letter-spacing: 0.15em; padding: 12px 16px; }
    .form-card { padding: 20px; }
    .phase-panel, .players-section, .narrator-log, .host-dashboard, .overview-dashboard { padding: 16px; }
    .game-header { padding: 11px 14px 8px; }
    .game-header-main, .private-panel-header, .night-toolbar { flex-direction: column; align-items: stretch; }
    .game-header-badges { justify-content: flex-start; }
    .game-code { font-size: 20px; }
    .header-stat-pill { justify-content: space-between; }
    .phase-overview { grid-template-columns: 1fr; padding: 2px 0 0; }
    .game-header-roles { flex-direction: column; gap: 10px; }
    .host-table, .spectator-roles-table { font-size: 12px; }
    .night-phase-intro { flex-direction: column; text-align: center; align-items: center; }
    .night-moon { width: 44px; height: 44px; }
    .game-page-sky { inset: 54px 0 0 0; }
    .game-page-sky .sky-animation { height: 100%; min-height: 100%; }
    .game-page-sky .sky-skyline { bottom: 14%; height: 180px; }
    .game-page-sky .sky-orbit-guide { top: 54%; width: 84cqw; height: 38cqh; }
    .game-page-sky .sky-body { transform: translate(-50%, -50%) translateY(-84px); }
    .game-page-sky .sky-sun-body { width: 100px; height: 100px; }
    .game-page-sky .sky-moon-body { width: 86px; height: 86px; }
    .game-page-sky .sky-stars svg { transform: scale(1.08); }
    .sky-animation { height: 110px; }
    .sky-sun-body { width: 56px; height: 56px; }
    .sky-moon-body { width: 48px; height: 48px; }
    .overview-card-wide { grid-column: span 1; }
    #components-reconnect-modal { padding: 16px; }
    .connection-status-card { padding: 22px 20px; }
    .connection-status-card::before { left: 20px; right: 20px; }
    .connection-status-card::after { inset: 12px; }
    .connection-status-card h2 { max-width: none; }
    .connection-status-copy { max-width: none; }
    .connection-status-actions > * { flex: 1 1 100%; }
    #blazor-error-ui {
        right: 12px;
        bottom: 12px;
        left: 12px;
        max-width: none;
    }
}

/* ── Dev / Debug Page ─────────────────────────────────────── */

.dev-page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.dev-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dev-title {
    font-family: var(--font-display);
    color: var(--gold);
    margin-bottom: 0;
}

.dev-copy {
    max-width: 72ch;
    color: var(--text-muted);
}

.dev-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(16, 16, 20, 0.92), rgba(12, 12, 16, 0.88));
    backdrop-filter: blur(10px);
    box-shadow: var(--card-highlight), 0 10px 26px rgba(0, 0, 0, 0.22);
}

.dev-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.dev-section-header h2 {
    font-size: 24px;
}

.dev-section-header p {
    color: var(--text-muted);
}

.dev-info {
    display: flex;
    gap: 12px;
    align-items: center;
    font-family: var(--font-body);
    color: var(--text-muted);
    flex-wrap: wrap;
}

.dev-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.dev-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.02);
    min-width: 0;
}

.dev-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.dev-value { color: var(--gold); font-weight: 600; font-size: 15px; }
.dev-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.dev-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.dev-btn:hover { border-color: var(--gold-dim); background: var(--bg-elevated); }
.dev-btn-active { border-color: var(--gold); color: var(--gold); background: var(--bg-elevated); }
.dev-btn-cycle { border-color: var(--teal-dim); color: var(--teal); }
.dev-btn-cycle:hover { border-color: var(--teal); }

.dev-preview-frame {
    margin: 4px -4px 0;
}

.dev-sky-frame {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 900px) {
    .dev-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .dev-page {
        padding: 24px 12px 40px;
    }

    .dev-card {
        padding: 16px;
    }

    .dev-section-header {
        flex-direction: column;
    }

    .dev-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Privacy Policy ────────────────────────────────────────── */

.privacy-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    color: var(--text);
}

.privacy-container h1 {
    font-family: var(--font-display);
    color: var(--gold);
    margin-bottom: 4px;
}

.privacy-updated {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

.privacy-container section {
    margin-bottom: 28px;
}

.privacy-container h2 {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--text);
    margin-bottom: 8px;
}

.privacy-container h3 {
    font-size: 16px;
    color: var(--text-muted);
    margin: 12px 0 6px;
}

.privacy-container ul {
    padding-left: 20px;
    margin: 6px 0;
}

.privacy-container li {
    margin-bottom: 4px;
    color: var(--text-muted);
    line-height: 1.6;
}

.privacy-container p {
    color: var(--text-muted);
    line-height: 1.6;
}

.privacy-container a {
    color: var(--gold);
}

.privacy-back {
    margin-top: 32px;
    text-align: center;
}

/* ── Cookie consent banner ─────────────────────────────────── */

.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 1000;
    font-size: 14px;
}

.cookie-consent p {
    margin: 0;
    color: var(--text-muted);
}

.cookie-consent a {
    color: var(--gold);
}

.btn-small {
    padding: 6px 16px;
    font-size: 13px;
}

/* ── Account pages (Login / Register) ──────────────────────── */
.account-container {
    max-width: 400px;
    margin: 60px auto 0;
    text-align: center;
}

.account-container h1 {
    font-family: var(--font-display);
    font-size: 36px;
    color: var(--gold);
    margin-bottom: 24px;
    text-shadow: 0 0 30px var(--gold-glow);
}

.account-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    text-align: left;
    box-shadow: var(--card-highlight), 0 4px 24px rgba(0,0,0,0.4);
}

.account-field {
    text-align: left;
    margin-bottom: 16px;
}

.account-error {
    background: var(--red-dim);
    border: 1px solid var(--red);
    color: var(--red-bright);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 14px;
    text-align: left;
}

.account-submit {
    width: 100%;
    margin-top: 20px;
    padding: 0.75rem;
}

.account-alt {
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-muted);
}

.account-alt a {
    color: var(--gold);
    text-decoration: none;
}

.account-alt a:hover {
    text-decoration: underline;
}

.validation-message {
    color: var(--red-bright);
    font-size: 12px;
    margin-top: 2px;
}
