/* =========================================
   NOVA — design tokens
   ========================================= */

:root {
    --bg-0: #060509;
    --bg-1: #0d0a16;

    --accent: #7c3aed;
    --accent-2: #a78bfa;
    --accent-soft: rgba(124, 58, 237, .16);
    --accent-glow: rgba(124, 58, 237, .55);

    --live: #22c55e;

    --surface: rgba(255, 255, 255, .045);
    --surface-strong: rgba(255, 255, 255, .07);
    --surface-faint: rgba(255, 255, 255, .025);

    --border: rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .16);

    --text: #faf9fc;
    --text-dim: #cbc8d2;
    --text-faint: rgba(245, 242, 250, .64);

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;

    --font-display: "Cosmos", "Space Grotesk", Inter, system-ui, sans-serif;
    --font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --shadow-panel: 0 12px 40px rgba(0, 0, 0, .3);
    --ease: cubic-bezier(.4, 0, .2, 1);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-optical-sizing: auto;
    font-kerning: normal;

    color: var(--text);

    background:
        radial-gradient(ellipse 900px 500px at 50% -10%, var(--accent-soft), transparent 60%),
        radial-gradient(circle at top, rgba(255,255,255,.03), transparent 45%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 55%);
    background-attachment: fixed;

    min-height: 100vh;

    overflow-x: hidden;

    animation: pageIn .5s var(--ease) both;
}

.privacy-consent {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 4, 10, 0.9);
    backdrop-filter: blur(12px);
}

.privacy-consent[hidden] {
    display: none;
}

.privacy-consent-card {
    width: min(520px, 100%);
    padding: 28px;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 20px;
    background: #17141f;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}

.privacy-consent-card h2 {
    margin: 10px 0;
    font-size: 30px;
}

.privacy-consent-card p {
    color: #c8c2d4;
    line-height: 1.55;
}

.privacy-consent-card a,
.legal-footer a {
    color: #b89cff;
}

.privacy-consent-card button {
    width: 100%;
    margin-top: 8px;
    padding: 13px 16px;
    color: #fff;
    border: 0;
    border-radius: 11px;
    background: #7c4dff;
    font-weight: 800;
    cursor: pointer;
}

.legal-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 20px;
    padding: 24px;
    color: #85808f;
    font-size: 13px;
}

/* subtle film-grain texture for a tactile glass finish */
body::before {
    content: "";

    position: fixed;
    inset: 0;

    z-index: 0;
    pointer-events: none;

    opacity: .035;
    mix-blend-mode: overlay;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

header, .layout, .auth-box {
    position: relative;
    z-index: 1;
}

@keyframes pageIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: .2px;
}

button, input, select {
    font-family: inherit;
}

button {
    transition: transform .12s var(--ease);
}

button:active {
    transform: scale(.96);
}

a {
    color: var(--accent-2);
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, .35);
}

/* =========================================
   Header / logo
   ========================================= */

header {
    position: sticky;
    top: 0;
    z-index: 100;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    height: 76px;

    padding: 0 28px;

    background: rgba(10, 8, 16, 0.6);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    border-bottom: 1px solid var(--border);
}

header::after {
    content: "";

    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;

    height: 1px;

    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);

    opacity: .6;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;

    justify-self: start;
}

.logo-mark {
    width: 40px;
    height: 40px;

    display: block;

    border-radius: 11px;

    filter: drop-shadow(0 0 14px var(--accent-glow));

    transition: filter .25s var(--ease);
}

.logo:hover .logo-mark {
    filter: drop-shadow(0 0 22px var(--accent-glow));
}

.logo-word {
    font-family: "Cosmos SemiBold", "Cosmos", var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 5px;

    background: linear-gradient(135deg, #ffffff 30%, var(--accent-2) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-tagline {
    margin-left: 2px;
    padding: 4px 7px;
    border: 1px solid rgba(167, 139, 250, .24);
    border-radius: 999px;
    background: rgba(124, 58, 237, .1);
    color: var(--accent-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
}

.topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid rgba(34, 197, 94, .16);
    border-radius: 999px;
    background: rgba(34, 197, 94, .045);
}

.online {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-left: 24px;

    font-size: 15px;
    font-weight: 600;

    color: var(--text-dim);
}

.live-dot {
    width: 9px;
    height: 9px;

    background: var(--live);

    border-radius: 50%;

    box-shadow:
        0 0 6px rgba(34, 197, 94, .7),
        0 0 12px rgba(34, 197, 94, .45);

    animation: livePulse 1.8s infinite;
}

.live-text {
    letter-spacing: 1.5px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
}

.viewers {
    margin-left: 14px;
    color: var(--text-dim);
    font-size: 14px;
}

#onlineCount {
    color: var(--accent-2);
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;

    justify-self: end;
}

.topbar-actions button,
.icon-btn,
.login-btn {
    height: 42px;

    padding: 0 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);

    color: var(--text);

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}

.icon-btn {
    width: 42px;
    padding: 0;
    font-size: 16px;
}

.topbar-actions button:hover,
.icon-btn:hover,
.login-btn:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.install-app-btn {
    gap: 8px;
    border-color: rgba(167, 139, 250, .42) !important;
    background: rgba(124, 58, 237, .12) !important;
}

.install-app-btn[hidden] {
    display: none;
}

.install-app-btn > span:first-child {
    font-size: 18px;
    line-height: 1;
}

.install-help {
    width: min(420px, calc(100% - 32px));
    padding: 26px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #191421, #100c18);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(0,0,0,.72);
}

.install-help::backdrop {
    background: rgba(5, 4, 9, .76);
    backdrop-filter: blur(5px);
}

.install-help h2 {
    margin: 8px 0 12px;
    font-size: 21px;
}

.install-help ol {
    display: grid;
    gap: 9px;
    margin: 0 0 18px;
    padding-left: 22px;
    color: var(--text-dim);
    line-height: 1.45;
}

.install-help button,
.offline-card button {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid rgba(124, 58, 237, .45);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(124,58,237,.32), rgba(124,58,237,.1));
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.offline-page {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    place-items: center;
    background: radial-gradient(circle at 50% 15%, rgba(124, 58, 237, .18), transparent 40%), var(--bg);
}

.offline-card {
    width: min(430px, 100%);
    padding: 30px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: rgba(22, 18, 31, .9);
    text-align: center;
    box-shadow: 0 24px 70px rgba(0,0,0,.5);
}

.offline-card img {
    width: 92px;
    height: 92px;
    margin-bottom: 16px;
    border-radius: 22px;
}

.offline-card h1 {
    margin: 7px 0 10px;
    font-size: 28px;
}

.offline-card p {
    margin: 0 0 20px;
    color: var(--text-dim);
    line-height: 1.55;
}

.login-btn {
    border-color: rgba(124, 58, 237, .4);
    background: linear-gradient(135deg, rgba(124,58,237,.28), rgba(124,58,237,.08));
}

.login-btn:hover {
    border-color: var(--accent-2);
}

@keyframes livePulse {
    0%   { transform: scale(1);    opacity: 1; }
    50%  { transform: scale(1.25); opacity: .7; }
    100% { transform: scale(1);    opacity: 1; }
}

/* =========================================
   Layout
   ========================================= */

.layout {
    display: grid;

    grid-template-columns: minmax(0, 1fr) 380px;

    gap: 32px;

    max-width: 1600px;

    margin: 0 auto;

    padding: 32px;
}

.player-section {
    display: flex;
    flex-direction: column;

    max-width: 1360px;
    width: 100%;
}

.player {
    width: 100%;

    aspect-ratio: 16 / 9;

    overflow: hidden;

    border-radius: var(--radius-lg);

    background: var(--surface-faint);

    border: 1px solid var(--border);

    box-shadow: var(--shadow-panel);

    position: relative;
}

.player::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.035);
}

#player {
    width: 100%;
    height: 100%;
}

iframe#player {
    pointer-events: none;
}

.player-transition {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    background: #08070d;
    color: rgba(255, 255, 255, .78);
    font-weight: 600;
    letter-spacing: .02em;
}

.player-transition[hidden] {
    display: none;
}

.player-detached {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 9px;
    padding: 24px;
    background: radial-gradient(circle at 50% 35%, rgba(124, 58, 237, .17), transparent 42%), #08070d;
    color: var(--text);
    text-align: center;
}

.player-detached[hidden] {
    display: none;
}

.player-detached-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 1px solid rgba(167, 139, 250, .34);
    border-radius: 16px;
    background: rgba(124, 58, 237, .12);
    color: var(--accent-2);
    font-size: 24px;
}

.player-detached strong {
    font-family: var(--font-display);
    font-size: clamp(16px, 2.2vw, 22px);
}

.player-detached > span:last-child {
    color: var(--text-faint);
    font-size: 12px;
}

.player.pip-active iframe#player {
    visibility: hidden;
}

.player.pip-active .player-fullscreen-btn {
    display: none;
}

.player:fullscreen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
    background: #000;
}

.player:fullscreen #player {
    width: 100%;
    height: 100%;
}

body.player-immersive,
body.modal-open {
    overflow: hidden;
}

body.player-immersive header {
    visibility: hidden;
}

.player.is-fullscreen-fallback {
    position: fixed;
    inset: 0;
    z-index: 15000;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    background: #000;
}

.player.is-fullscreen-fallback #player {
    width: 100%;
    height: 100%;
}

.player.is-fullscreen-fallback .player-overlay-btn {
    top: max(10px, env(safe-area-inset-top));
}

.player.is-fullscreen-fallback .player-fullscreen-btn {
    right: max(10px, env(safe-area-inset-right));
}

.player.is-fullscreen-fallback .player-pip-btn {
    right: max(64px, calc(env(safe-area-inset-right) + 54px));
}

.player-overlay-btn {
    position: absolute;
    top: 16px;
    z-index: 3;

    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;

    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(12, 12, 18, .82);
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}

.player-overlay-btn:hover {
    background: rgba(30, 22, 48, .94);
    border-color: rgba(139, 92, 246, .7);
    transform: translateY(-1px);
}

.player-overlay-btn[hidden] {
    display: none;
}

.player-fullscreen-btn {
    right: 16px;
}

.player-pip-btn {
    right: 174px;
}

body.pip-window {
    margin: 0;
    overflow: hidden;
    background: #000;
}

body.pip-window .pip-content-frame {
    display: block;
    width: 100vw;
    height: 100vh;
    border: 0;
}

body.pip-page {
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    background: #050508;
}

.pip-player-shell,
#pipPlayer,
iframe#pipPlayer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

iframe#pipPlayer {
    border: 0;
    pointer-events: none;
}

.pip-status {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #08070d;
    color: var(--text-dim);
}

.pip-status[hidden] {
    display: none;
}

.pip-return-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    background: rgba(12, 12, 18, .86);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.volume-panel {
    display: flex;
    align-items: center;
    gap: 14px;

    margin-top: 20px;

    padding: 12px 14px;

    border-radius: var(--radius-lg);

    background: var(--surface);

    border: 1px solid var(--border);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    box-shadow: var(--shadow-panel);
}

#volumeMuteBtn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);

    color: var(--text);

    cursor: pointer;

    font-size: 18px;

    transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}

#volumeMuteBtn:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

#volumeSlider {
    flex: 1;

    height: 6px;

    appearance: none;
    -webkit-appearance: none;

    background: rgba(255,255,255,.12);

    border-radius: 999px;

    cursor: pointer;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;

    width: 16px;
    height: 16px;

    border-radius: 50%;

    background: #ffffff;

    border: 2px solid var(--accent-2);

    cursor: pointer;

    transition: transform .15s var(--ease);
}

#volumeSlider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

#volumeSlider::-moz-range-thumb {
    width: 16px;
    height: 16px;

    border: 2px solid var(--accent-2);

    border-radius: 50%;

    background: #ffffff;

    cursor: pointer;
}

#volumeSlider::-moz-range-track {
    height: 6px;

    background: rgba(255,255,255,.12);

    border-radius: 999px;
}

#volumeValue {
    width: 52px;
    flex-shrink: 0;

    text-align: right;
    font-weight: 700;

    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.volume-system-hint {
    flex: 1;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
}

.player-actions {
    display: flex;
    gap: 12px;

    margin-top: 14px;
}

.player-actions button {
    flex: 1;

    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);

    color: var(--text);

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}

.player-actions button:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

#skipBtn.voted {
    border-color: var(--accent-2);
    color: var(--accent-2);
}

#skipCount {
    font-size: 12px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

#suggestBtn {
    border-color: rgba(124, 58, 237, .4);
    background: linear-gradient(135deg, rgba(124,58,237,.28), rgba(124,58,237,.08));
}

#suggestBtn:hover {
    border-color: var(--accent-2);
}

#suggestPanel .hint {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.4;
}

#suggestResult {
    font-size: 13px;
    color: var(--accent-2);
    min-height: 16px;
}

#suggestResult:empty {
    display: none;
}

#suggestResult.error {
    color: #f87171;
    font-weight: 600;

    padding: 10px 12px;

    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, .1);
    border: 1px solid rgba(248, 113, 113, .3);
}

.info {
    display: grid;
    grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
    gap: 20px;

    margin-top: 20px;
}

.now,
.next,
.chat {
    min-width: 0;
    padding: 24px;

    border-radius: var(--radius-lg);

    background: var(--surface);

    border: 1px solid var(--border);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    box-shadow: var(--shadow-panel);

    transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}

.player,
.volume-panel,
.now,
.next,
.chat,
.auth-box,
#moderationPanel,
#suggestPanel {
    box-shadow:
        var(--shadow-panel),
        inset 0 1px 0 rgba(255,255,255,.06);
}

.now:hover,
.next:hover {
    border-color: var(--border-strong);
    box-shadow:
        var(--shadow-panel),
        inset 0 1px 0 rgba(255,255,255,.06),
        0 0 0 1px rgba(124,58,237,.12);
}

.now h2,
.next h2,
.chat h2 {
    margin-bottom: 15px;

    font-size: 15px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.now p {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;

    transition: opacity .25s var(--ease);
}

.now p.swap,
.next.swap {
    opacity: 0;
}

#countdown {
    display: inline-block;
    margin-top: 10px;

    font-size: 13px;
    font-weight: 600;
    color: var(--accent-2);
    font-variant-numeric: tabular-nums;
}

.next ul {
    list-style: none;
    padding-left: 0;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

.next li {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 12px;

    border-radius: var(--radius-sm);
    background: var(--surface-faint);
    border: 1px solid var(--border);
    border-left: 2px solid transparent;

    font-size: 14px;
    color: var(--text-dim);

    transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}

.next-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: rgba(124, 58, 237, .12);
    color: var(--accent-2);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
}

.next-video-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.next-video-info b {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.next-video-info small {
    color: var(--text-faint);
    font-size: 12px;
}

.next li:hover {
    background: var(--surface);
    border-left-color: var(--accent-2);
    color: var(--text);
}

.program-guide {
    margin-top: 20px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-panel);
}

.program-guide summary {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

#programSummary {
    color: var(--text-faint);
    font-weight: 500;
}

.program-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

#programHorizon {
    color: var(--text-faint);
    font-size: 12px;
}

#programNowBtn {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid rgba(124, 58, 237, .4);
    border-radius: 10px;
    background: rgba(124, 58, 237, .12);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#programNowBtn:hover {
    background: rgba(124, 58, 237, .22);
}

#programList {
    display: grid;
    gap: 8px;
    max-height: 420px;
    margin: 16px 0 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

#programList li {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-faint);
}

#programList li.current {
    border: 1px solid rgba(124, 58, 237, .38);
    background: rgba(124, 58, 237, .1);
}

#programList li.program-day {
    display: block;
    margin-top: 6px;
    padding: 10px 4px 5px;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

#programList li.program-day:first-child {
    margin-top: 0;
    padding-top: 2px;
    border-top: 0;
}

#programList .program-time-range {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
}

#programList time {
    color: var(--accent-2);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

#programList .program-time-end {
    color: var(--text-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#programList .program-live-label {
    color: var(--accent-2);
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

#programList span {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

#programList b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#programList small {
    color: var(--text-faint);
}

.chat {
    height: calc(100vh - 124px);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 100px;
}

#moderationBtn {
    margin-bottom: 14px;

    height: 38px;
    padding: 0 14px;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    background: var(--surface);
    color: var(--text);

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition: background .2s var(--ease), border-color .2s var(--ease);
}

#moderationBtn:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
}

.messages {
    margin-top: 4px;

    height: 100%;

    padding: 18px;

    border-radius: 16px;

    background: var(--surface-faint);

    border: 1px solid rgba(255,255,255,.06);

    overflow-y: auto;

    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.14);
    border-radius: 999px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.22);
}

.message {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    max-width: 100%;

    animation: messageIn .25s var(--ease) both;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.avatar {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 50%;

    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;

    font-weight: 700;
    font-size: 14px;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.message-content {
    flex: 1;
    min-width: 0;

    background: var(--surface);

    border: 1px solid var(--border);

    padding: 10px 14px;

    border-radius: 16px;

    backdrop-filter: blur(12px);
}

.message-header {
    display: flex;
    gap: 10px;
    align-items: center;

    margin-bottom: 5px;
}

.username {
    font-weight: 700;
    font-size: 14px;
}

.time {
    font-size: 12px;
    color: var(--text-faint);
}

.message-text {
    color: rgba(255,255,255,.82);
    line-height: 1.4;
    font-size: 14px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.message-replied {
    margin-bottom: 8px;
    padding: 7px 9px;
    border-left: 2px solid var(--accent-2);
    border-radius: 6px;
    background: rgba(124, 58, 237, .08);
    color: var(--text-faint);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
}

.message-reply-btn,
.message-delete-btn,
.reaction-trigger,
.reaction-choice,
.message-reaction {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
}

.message-reply-btn {
    min-height: 32px;
    padding: 5px 2px;
    font-size: 12px;
}

.message-delete-btn {
    min-height: 32px;
    padding: 5px 2px;
    font-size: 12px;
    color: #ff8a82;
}

.message-delete-btn[hidden] {
    display: none;
}

.message-delete-btn:hover {
    color: #ffb1ac;
}

.message-reply-btn:hover,
.reaction-trigger:hover {
    color: var(--text);
}

.reaction-trigger {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
}

.reaction-trigger[aria-expanded="true"] {
    border-color: rgba(139, 92, 246, .55);
    background: rgba(124, 58, 237, .14);
    color: #fff;
}

.reaction-picker {
    position: absolute;
    right: 0;
    bottom: 38px;
    left: auto;
    z-index: 5;
    display: flex;
    gap: 3px;
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: rgba(20, 18, 28, .96);
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
    backdrop-filter: blur(16px);
}

.reaction-picker[hidden] {
    display: none;
}

.reaction-choice {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    font-size: 19px;
}

.reaction-choice:hover,
.reaction-choice:focus-visible {
    background: rgba(255,255,255,.1);
    transform: translateY(-2px) scale(1.08);
}

.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}

.message-reactions[hidden] {
    display: none;
}

.message-reaction {
    min-width: 30px;
    min-height: 28px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    font-size: 13px;
}

.message-reaction:hover,
.message-reaction.active {
    border-color: rgba(139, 92, 246, .7);
    background: rgba(124, 58, 237, .18);
    color: #fff;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    background: rgba(5, 4, 9, .72);
    backdrop-filter: blur(5px);
    animation: overlayIn .18s var(--ease) both;
}

.confirm-overlay[hidden],
.confirm-dialog[hidden] {
    display: none;
}

.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 10021;
    width: min(430px, calc(100% - 32px));
    padding: 26px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #191421, #100c18);
    box-shadow: 0 24px 70px rgba(0,0,0,.68);
    transform: translate(-50%, -50%);
    animation: confirmIn .2s var(--ease) both;
}

@keyframes confirmIn {
    from { opacity: 0; transform: translate(-50%, calc(-50% - 8px)) scale(.98); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.confirm-dialog-kicker {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}

.confirm-dialog h2 {
    margin: 7px 0 8px;
    font-size: 21px;
}

.confirm-dialog p {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
}

.confirm-message-preview {
    margin: 16px 0;
    padding: 11px 13px;
    border-left: 3px solid rgba(255, 89, 79, .72);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.confirm-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.confirm-dialog-actions button {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.confirm-dialog-actions .confirm-danger {
    border-color: rgba(255, 59, 48, .5);
    background: rgba(255, 59, 48, .14);
    color: #ffaaa4;
}

.guest-banner {
    margin-top: 12px;

    padding: 12px 14px;

    border-radius: var(--radius-sm);

    background: rgba(124, 58, 237, .1);
    border: 1px solid rgba(124, 58, 237, .3);

    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.5;
}

.guest-banner a {
    color: var(--accent-2);
    font-weight: 600;
    text-decoration: none;
}

.guest-banner a:hover {
    text-decoration: underline;
}

.chat-input {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.chat-reply {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    border-left: 2px solid var(--accent-2);
    border-radius: 8px;
    background: rgba(124, 58, 237, .1);
    color: var(--text-faint);
    font-size: 12px;
}

.chat-reply[hidden] {
    display: none;
}

.chat-reply > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-reply strong {
    color: var(--text);
}

.chat-reply button {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: var(--text);
    cursor: pointer;
}

.chat-input input {
    flex: 1;
    min-width: 0;

    height: 42px;

    padding: 0 14px;

    border-radius: var(--radius-sm);

    border: 1px solid var(--border);

    background: var(--surface);

    color: var(--text);

    outline: none;

    backdrop-filter: blur(10px);

    transition: border-color .2s var(--ease), background .2s var(--ease);
}

.chat-input input:focus {
    border-color: var(--accent-2);
    background: var(--surface-strong);
}

.chat-input input::placeholder {
    color: var(--text-faint);
}

.chat-input button {
    width: 44px;
    height: 42px;

    border-radius: var(--radius-sm);

    border: 1px solid var(--border);

    background: linear-gradient(135deg, var(--accent), #6d28d9);

    color: white;

    font-size: 15px;

    cursor: pointer;

    transition: transform .15s var(--ease), filter .2s var(--ease);
}

.chat-input button:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

/* =========================================
   Auth / profile card (auth.html, profile.html)
   ========================================= */

body:has(.auth-box) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-page {
    min-height: 100svh;
}

.auth-shell {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(440px, 100%);
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
}

.auth-brand img {
    width: 38px;
    height: 38px;
    filter: drop-shadow(0 0 18px var(--accent-glow));
}

.auth-brand > span {
    font-family: "Cosmos SemiBold", "Cosmos", var(--font-display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .22em;
}

.auth-brand small {
    padding: 4px 7px;
    border: 1px solid rgba(167, 139, 250, .24);
    border-radius: 999px;
    color: var(--accent-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}

.auth-box {
    width: 100%;
    max-width: 400px;

    padding: 36px 32px;

    border-radius: var(--radius-lg);

    background: var(--surface);
    border: 1px solid var(--border);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    box-shadow: var(--shadow-panel);

    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-login-card {
    max-width: 440px;
    padding: 38px;
    gap: 18px;
}

.auth-kicker {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    text-align: center;
    text-transform: uppercase;
}

.auth-login-card h1 {
    margin: -4px 0 0;
    font-family: var(--font-display);
    font-size: 30px;
    line-height: 1.1;
    text-align: center;
}

.auth-login-card .auth-subtitle {
    min-height: 0;
    margin-bottom: 4px;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
}

.auth-login-card form {
    display: grid;
    gap: 18px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
}

.auth-field input {
    width: 100%;
}

.auth-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 2px;
}

.auth-login-card .auth-primary {
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(124, 58, 237, .22);
}

.auth-login-card .auth-result {
    min-height: 16px;
    color: #f87171;
    font-size: 13px;
    text-align: center;
}

.auth-back-link {
    color: var(--text-dim);
    font-size: 12px;
    text-decoration: none;
}

.auth-back-link:hover {
    color: var(--text);
}

.auth-box button.back-btn {
    align-self: flex-start;

    height: 34px;
    padding: 0 12px;
    margin-bottom: -4px;

    border: none;
    background: transparent;

    color: var(--text-dim);

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition: color .2s var(--ease), transform .15s var(--ease);
}

.auth-box button.back-btn:hover {
    color: var(--accent-2);
    background: transparent;
    border-color: transparent;
    transform: translateX(-2px);
}

.auth-box h2 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 10px;

    background: linear-gradient(135deg, #ffffff 30%, var(--accent-2) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-box input {
    height: 46px;

    padding: 0 16px;

    border-radius: var(--radius-md);

    border: 1px solid var(--border);

    background: var(--surface-faint);

    color: var(--text);

    font-size: 14px;

    outline: none;

    transition: border-color .2s var(--ease), background .2s var(--ease);
}

.auth-box input:focus {
    border-color: var(--accent-2);
    background: var(--surface-strong);
}

.auth-box input::placeholder {
    color: var(--text-faint);
}

.auth-box button {
    height: 46px;

    border-radius: var(--radius-md);

    border: 1px solid var(--border);

    background: var(--surface);

    color: var(--text);

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}

.auth-box button:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.auth-box button[onclick^="login"] {
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-color: transparent;
}

.auth-box button[onclick^="login"]:hover {
    filter: brightness(1.1);
}

.auth-box p {
    text-align: center;
    font-size: 13px;
    color: #f87171;
    min-height: 16px;
}

.auth-box p:empty {
    display: none;
}

.auth-box p.banner-warning {
    display: block;

    text-align: left;

    padding: 12px 14px;

    border-radius: var(--radius-sm);

    background: rgba(245, 158, 11, .1);
    border: 1px solid rgba(245, 158, 11, .3);

    color: #fbbf24;
    font-weight: 500;
    line-height: 1.4;
}

/* profile-specific rows */

.auth-box p:has(b, #username) {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;

    text-align: left;
    color: var(--text-dim);
    font-size: 14px;
}

.auth-box p b {
    color: var(--text);
}

#profileActions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#profileActions button {
    flex: 1;
}

#passwordSection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#changePasswordBtn {
    width: 100%;
}

#passwordForm {
    display: flex;
    flex-direction: column;
    gap: 10px;

    padding: 16px;

    border-radius: var(--radius-md);
    background: var(--surface-faint);
    border: 1px solid var(--border);
}

.password-form-actions {
    display: flex;
    gap: 10px;
}

.password-form-actions button {
    flex: 1;
}

#passwordResult {
    font-size: 13px;
    color: var(--accent-2);
    min-height: 16px;
    text-align: center;
}

#passwordResult:empty {
    display: none;
}

#passwordResult.error {
    color: #f87171;
}

#telegramLoginBox {
    display: flex;
    justify-content: center;
    min-height: 40px;
}

.auth-box button#telegramLinkBtn,
.auth-box button#discordLinkBtn {
    width: 100%;
    background: var(--surface-strong);
    border-color: var(--border);
}

.auth-box button#telegramLinkBtn:hover,
.auth-box button#discordLinkBtn:hover {
    border-color: var(--border-strong);
}

#telegramLinkOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(3, 3, 7, .88);
    backdrop-filter: blur(8px);
}

#telegramLinkPanel {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 21;
    transform: translate(-50%, -50%);

    width: min(380px, calc(100vw - 32px));
    padding: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: #14131b;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .72);

    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    text-align: center;
}

#telegramLinkPanel p {
    margin: 0;
    color: #d5d1df;
    font-size: 14px;
    line-height: 1.55;
}

#telegramLinkPanel h3 {
    color: #fff;
    font-size: 21px;
}

#telegramLinkPanel button {
    height: 46px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text);
}

.auth-box button#discordLinkBtn {
    background: linear-gradient(135deg, rgba(88,101,242,.35), rgba(88,101,242,.12));
    border-color: rgba(88,101,242,.4);
}

.auth-box button#discordLinkBtn:hover {
    border-color: #5865f2;
}

.auth-box button#telegramLinkBtn {
    background: linear-gradient(135deg, rgba(42,171,238,.35), rgba(42,171,238,.12));
    border-color: rgba(42,171,238,.4);
}

.auth-box button#telegramLinkBtn:hover {
    border-color: #2aabee;
}

/* =========================================
   Profile
   ========================================= */

.profile-page {
    align-items: flex-start !important;
    min-height: 100svh;
    padding-block: 40px !important;
}

.profile-shell {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(680px, 100%);
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.profile-card {
    max-width: 680px;
    padding: 28px;
    gap: 18px;
}

.profile-card-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px 80px 8px;
}

.profile-card-header h1 {
    font-family: var(--font-display);
    font-size: 30px;
}

.profile-card-header .back-btn {
    position: absolute;
    top: 0;
    left: 0;
}

.profile-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-faint);
}

.profile-section-title {
    display: flex;
    min-height: 32px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.profile-avatar {
    display: inline-flex;
    width: 96px;
    height: 96px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(167, 139, 250, .32);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #5b21b6);
    color: #fff;
    font-size: 34px;
    font-weight: 800;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.profile-avatar-editor {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 14px;
    background: radial-gradient(circle at top, rgba(124,58,237,.14), rgba(255,255,255,.02) 65%);
}

.profile-avatar-actions {
    display: flex;
    width: min(100%, 360px);
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.profile-avatar-actions button {
    display: inline-flex;
    width: auto !important;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    line-height: 1.2;
    white-space: nowrap;
}

#deleteAvatarBtn {
    border-color: rgba(248, 113, 113, .36);
    color: #fca5a5;
}

.profile-avatar-editor p {
    max-width: 480px;
    color: var(--text-faint);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

#avatarResult {
    min-height: 17px;
    color: var(--accent-2);
    font-size: 12px;
}

#avatarResult.error {
    color: #f87171;
}

.profile-row,
.connection-card {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 11px;
    background: rgba(255,255,255,.025);
}

.profile-row > span,
.connection-card span {
    color: var(--text-dim);
    font-size: 13px;
}

.profile-row > div,
.connection-card > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
}

.profile-row b,
.connection-card b {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-card > div {
    flex-direction: column;
    align-items: flex-start;
}

.profile-card .connection-card button {
    width: auto !important;
    height: 36px;
    padding: 0 12px;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.profile-actions button {
    flex: 1;
}

.profile-card #passwordSection {
    margin-top: 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.profile-card .profile-logout {
    border-color: rgba(248, 113, 113, .28);
    background: rgba(248, 113, 113, .065);
    color: #fca5a5;
}

.profile-card .profile-logout:hover {
    border-color: rgba(248, 113, 113, .5);
}

.profile-card #usernameInput {
    width: min(240px, 100%);
    height: 36px;
}

/* =========================================
   Moderation panel
   ========================================= */

#moderationOverlay,
#suggestOverlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(5, 4, 9, .65);
    backdrop-filter: blur(4px);

    z-index: 9998;

    animation: overlayIn .2s var(--ease) both;
}

#moderationPanel,
#suggestPanel {
    position: fixed;

    top: 10vh;
    left: 50%;

    transform: translateX(-50%);

    width: 460px;
    max-width: 90%;

    max-height: 80vh;
    overflow-y: auto;

    padding: 28px;

    border-radius: var(--radius-lg);

    background: linear-gradient(180deg, #16121f, #100c18);

    border: 1px solid var(--border-strong);

    box-shadow: 0 24px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(124,58,237,.08);

    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 12px;

    animation: panelIn .22s var(--ease) both;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes panelIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(.98); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

#moderationPanel h2,
#suggestPanel h2 {
    font-size: 18px;
    margin-bottom: 6px;
}

.service-panel-header,
.service-search-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.service-panel-header h2 {
    margin: 2px 0 0 !important;
}

#moderationPanel .service-close,
#suggestPanel .service-close {
    width: 38px;
    padding: 0;
    flex: 0 0 38px;
    font-size: 24px;
}

.service-search-row input {
    min-width: 0;
    flex: 1;
}

#moderationPanel .service-primary,
#suggestPanel .service-primary {
    border-color: rgba(124, 58, 237, .45);
    background: linear-gradient(135deg, rgba(124,58,237,.34), rgba(124,58,237,.12));
}

.moderation-user-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-faint);
}

.moderation-user-card p {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-dim);
    font-size: 13px;
}

.moderation-user-card p b {
    color: var(--text);
}

#moderationPanel hr,
#suggestPanel hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

#moderationPanel input,
#moderationPanel select,
#suggestPanel input {
    width: 100%;
    height: 42px;

    padding: 0 14px;

    border-radius: var(--radius-sm);

    border: 1px solid var(--border);

    background: var(--surface-faint);

    color: var(--text);

    font-size: 14px;

    outline: none;

    transition: border-color .2s var(--ease);
}

#moderationPanel input:focus,
#moderationPanel select:focus,
#suggestPanel input:focus {
    border-color: var(--accent-2);
}

#moderationPanel select option {
    background: #16121f;
    color: var(--text);
}

#moderationPanel button,
#suggestPanel button {
    height: 42px;

    padding: 0 16px;

    border-radius: var(--radius-sm);

    border: 1px solid var(--border);

    background: var(--surface);

    color: var(--text);

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: background .2s var(--ease), border-color .2s var(--ease);
}

#moderationPanel button:hover,
#suggestPanel button:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
}

#moderationPanel > button:last-child,
#suggestPanel > button:last-child {
    align-self: flex-start;
    background: transparent;
    color: var(--text-dim);
}

#moderationUser {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mod-actions-row {
    display: flex;
    gap: 10px;
}

.mod-actions-row button {
    flex: 1;
    min-width: 0;
}

.mod-actions-row .mod-danger-btn {
    border-color: rgba(255, 59, 48, .45);
    background: rgba(255, 59, 48, .12);
    color: #ff8a82;
}

#modBanReason {
    width: 100%;
}

.mod-control-group {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
}

.mod-control-group label {
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 700;
}

.mod-control-group input,
.mod-control-group select {
    width: 100%;
}

.mod-danger-group {
    border-color: rgba(255, 59, 48, .25);
    background: rgba(255, 59, 48, .035);
}

.mod-control-group .mod-danger-btn {
    border-color: rgba(255, 59, 48, .45);
    background: rgba(255, 59, 48, .12);
    color: #ff8a82;
}

.mod-history-list {
    display: grid;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    color: var(--text-faint);
    font-size: 12px;
}

.mod-history-list p {
    display: block !important;
    margin: 0;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,.035);
}

.mod-log-section {
    margin-top: 12px;
    color: var(--text-dim);
}

.mod-log-section summary {
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: 700;
}

#moderationUser p {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-dim);
}

#moderationUser p b {
    color: var(--text);
}

#ownerPanelBtn {
    margin-bottom: 10px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(124, 58, 237, .45);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(124,58,237,.3), rgba(42,171,238,.12));
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

#ownerPanelBtn:hover {
    border-color: var(--accent-2);
}

#ownerOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(3, 3, 7, .82);
    backdrop-filter: blur(8px);
}

#ownerPanel {
    position: fixed;
    top: 6vh;
    left: 50%;
    z-index: 10001;
    width: min(820px, calc(100vw - 32px));
    max-height: 88vh;
    padding: 24px;
    transform: translateX(-50%);
    overflow-y: auto;
    flex-direction: column;
    gap: 18px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: rgba(18, 16, 24, .98);
    box-shadow: 0 24px 80px rgba(0,0,0,.55);
}

.owner-panel-header,
.owner-section-title,
.owner-current,
.owner-ai-control,
.owner-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.owner-program-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.owner-program-stats > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-faint);
}

.owner-program-stats b {
    color: var(--accent-2);
    font-size: 20px;
}

.owner-program-stats span {
    color: var(--text-faint);
    font-size: 12px;
}

.owner-item-actions select {
    min-width: 130px;
    padding: 8px 10px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-strong);
}

.owner-panel-header h2,
.owner-section-title h3 {
    margin: 0;
}

.owner-section-title > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.owner-section-hint {
    color: var(--text-dim);
    font-size: 12px;
}

#ownerReferenceCount.ready {
    color: #6ee7b7;
}

.owner-kicker {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
}

#ownerPanel button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-strong);
    color: var(--text);
    cursor: pointer;
}

#ownerPanel button:hover {
    border-color: var(--border-strong);
}

#ownerPanel button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

#ownerPanel button.danger {
    border-color: rgba(248, 113, 113, .4);
    color: #fca5a5;
}

#ownerPanel button.approve {
    border-color: rgba(52, 211, 153, .4);
    color: #6ee7b7;
}

#ownerPanel .owner-close {
    width: 38px;
    padding: 0;
    font-size: 24px;
}

.owner-current,
.owner-ai-control,
.owner-item {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.025);
}

.owner-current > div,
.owner-ai-control > div,
.owner-item-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.owner-current span,
.owner-ai-control span,
.owner-item-info span,
.owner-empty,
.owner-status {
    color: var(--text-dim);
    font-size: 13px;
}

.owner-item-info b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owner-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.owner-item-actions {
    display: flex;
    flex-shrink: 0;
    gap: 7px;
}

.owner-status {
    min-height: 18px;
}

.owner-status.error {
    color: #f87171;
}

.owner-empty {
    padding: 16px;
    text-align: center;
}

.owner-video-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(124, 58, 237, .32);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(124,58,237,.09), rgba(42,171,238,.035));
}

#ownerVideoInput {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: rgba(255,255,255,.035);
    color: var(--text);
}

#ownerVideoInput:focus {
    border-color: var(--accent-2);
}

.owner-video-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.owner-rights-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 14px;
    background: rgba(13, 13, 22, 0.7);
}

.owner-rights-form input,
.owner-rights-form select,
.owner-rights-form textarea {
    min-width: 0;
    padding: 11px 12px;
    color: #fff;
    border: 1px solid #34303f;
    border-radius: 10px;
    background: #17151d;
    font: inherit;
}

.owner-rights-form textarea {
    min-height: 72px;
    resize: vertical;
}

.owner-rights-form textarea,
.owner-rights-form button {
    grid-column: 1 / -1;
}

.owner-rights-summary {
    padding: 10px 12px;
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 10px;
    color: var(--muted);
    background: rgba(139, 92, 246, 0.08);
}

.ad-label {
    align-self: flex-start;
    padding: 5px 9px;
    border: 1px solid rgba(251, 191, 36, 0.55);
    border-radius: 999px;
    color: #fde68a;
    background: rgba(120, 53, 15, 0.45);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.owner-ad-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}

.owner-ad-form input,
.owner-ad-form select {
    min-width: 0;
    padding: 11px 12px;
    color: var(--text);
    border: 1px solid #34303f;
    border-radius: 10px;
    background: #17151d;
}

.owner-ad-form .approve {
    grid-column: 1 / -1;
}

.owner-ad-interval {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.owner-rights-date {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.owner-rights-request {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    padding: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    background: rgba(13, 13, 22, 0.55);
}

.owner-rights-request input,
.owner-rights-request select,
.owner-rights-request textarea {
    min-width: 0;
    padding: 10px 12px;
    color: var(--text);
    border: 1px solid #34303f;
    border-radius: 10px;
    background: #17151d;
    font: inherit;
}

.owner-rights-request [hidden] {
    display: none;
}

.owner-rights-request textarea,
.owner-rights-request .owner-video-actions,
.owner-rights-request .owner-section-hint {
    grid-column: 1 / -1;
}

.owner-rights-request textarea {
    min-height: 180px;
    resize: vertical;
}

.owner-search-item {
    background: rgba(7, 7, 12, .42);
}

/* =========================================
   Responsive
   ========================================= */

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

    .chat {
        position: static;
        height: min(520px, 68vh);
    }
}

@media (max-width: 640px) {
    header {
        padding: 0 16px;
        height: 64px;
    }

    .logo-word {
        display: none;
    }

    .logo-tagline {
        margin-left: -8px;
    }

    .viewers {
        display: none;
    }

    .topbar-center {
        gap: 8px;
        padding: 0 10px;
    }

    .live-text {
        display: inline;
        font-size: 11px;
    }

    #installAppBtn {
        width: 42px;
        padding: 0;
    }

    .install-app-label {
        display: none;
    }

    .layout {
        padding: 16px;
        gap: 20px;
    }

    .auth-page,
    .profile-page {
        padding: 20px 16px !important;
    }

    .auth-login-card,
    .profile-card {
        padding: 22px 18px;
    }

    .auth-login-card h1,
    .profile-card-header h1 {
        font-size: 26px;
    }

    .profile-card-header {
        align-items: flex-start;
        padding: 48px 0 6px;
    }

    .profile-card-header .back-btn {
        left: -10px;
    }

    .profile-row,
    .connection-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .connection-card {
        position: relative;
    }

    .profile-card .connection-card button {
        width: 100% !important;
    }

    .service-search-row {
        align-items: stretch;
        flex-direction: column;
    }

    .player {
        border-radius: 16px;
    }

    .player-fullscreen-btn {
        top: 10px;
        right: 10px;
        width: 44px;
        padding: 0;
        justify-content: center;
    }

    .player-pip-btn {
        top: 10px;
        right: 64px;
        width: 44px;
        padding: 0;
        justify-content: center;
    }

    .player-overlay-btn span:last-child {
        display: none;
    }

    .volume-panel {
        margin-top: 12px;
        border-radius: 16px;
    }

    .guest-banner {
        font-size: 12px;
    }

    .info {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-top: 14px;
    }

    .now,
    .next,
    .chat {
        padding: 18px;
        border-radius: 16px;
    }

    .chat {
        height: 420px;
    }

    .messages {
        padding: 14px;
    }

    .next-video-info b {
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    #programList b {
        display: -webkit-box;
        overflow: hidden;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    #moderationPanel,
    #suggestPanel,
    #ownerPanel {
        padding: 20px;
    }

    .owner-current,
    .owner-ai-control,
    .owner-item {
        align-items: stretch;
        flex-direction: column;
    }

    .owner-item-actions {
        flex-wrap: wrap;
    }

    .owner-panel-header,
    .owner-section-title {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .owner-rights-form {
        grid-template-columns: 1fr;
    }

    .owner-ad-form {
        grid-template-columns: 1fr;
    }

    .owner-ad-form .approve {
        grid-column: auto;
    }

    .owner-rights-request {
        grid-template-columns: 1fr;
    }

    .owner-program-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .message-reply-btn,
    .message-delete-btn {
        min-height: 40px;
        padding: 8px 2px;
    }

    .reaction-trigger {
        width: 40px;
        height: 40px;
    }

    .reaction-picker {
        bottom: 46px;
    }

    .reaction-choice {
        width: 36px;
        height: 36px;
    }
}

@supports (padding: max(0px)) {
    header {
        height: calc(76px + env(safe-area-inset-top));
        min-height: calc(76px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
        padding-left: max(28px, env(safe-area-inset-left));
        padding-right: max(28px, env(safe-area-inset-right));
    }

    .privacy-consent {
        padding-top: max(20px, calc(env(safe-area-inset-top) + 12px));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
        padding-left: max(20px, env(safe-area-inset-left));
    }

    .privacy-consent-card,
    .confirm-dialog,
    .install-help {
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 40px);
        overflow-y: auto;
    }

    .layout,
    .legal-footer {
        padding-left: max(32px, env(safe-area-inset-left));
        padding-right: max(32px, env(safe-area-inset-right));
    }

    .legal-footer {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    @media (max-width: 640px) {
        header {
            height: calc(64px + env(safe-area-inset-top));
            min-height: calc(64px + env(safe-area-inset-top));
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }

        .layout,
        .legal-footer {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }

        .auth-page,
        .profile-page {
            padding-top: max(20px, calc(env(safe-area-inset-top) + 12px)) !important;
            padding-left: max(16px, env(safe-area-inset-left)) !important;
            padding-right: max(16px, env(safe-area-inset-right)) !important;
            padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
        }

        #moderationPanel,
        #suggestPanel,
        #ownerPanel {
            top: calc(64px + env(safe-area-inset-top) + 12px);
            max-height: calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
        }

        .profile-avatar-actions button {
            flex: 1 1 145px;
        }
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    #moderationPanel,
    #suggestPanel,
    #ownerPanel {
        top: calc(76px + env(safe-area-inset-top) + 12px);
        max-height: calc(100dvh - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    }
}

@media (max-width: 420px) {
    .confirm-dialog {
        padding: 21px;
    }

    .auth-actions,
    .password-form-actions {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}

/* Маленький скрытый сигнал LumaCloud */
.easter-egg {
    position: fixed;
    z-index: 25;
    left: 12px;
    bottom: 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.easter-egg-trigger {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 2px;
    overflow: hidden;
    border: 1px solid rgba(123, 149, 188, 0.18);
    border-radius: 11px;
    background: rgba(8, 11, 19, 0.72);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
    opacity: 0.24;
    cursor: pointer;
    pointer-events: auto;
    transition:
        opacity 180ms ease,
        transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.easter-egg-trigger img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
}

.easter-egg-trigger:hover,
.easter-egg-trigger:focus-visible,
.easter-egg.is-open .easter-egg-trigger {
    opacity: 0.92;
    transform: translateY(-3px) rotate(-4deg) scale(1.08);
    border-color: rgba(61, 190, 255, 0.48);
    box-shadow: 0 8px 24px rgba(17, 116, 255, 0.25);
}

.easter-egg-trigger:focus-visible {
    outline: 2px solid rgba(116, 204, 255, 0.8);
    outline-offset: 3px;
}

.easter-egg-message {
    width: max-content;
    max-width: min(230px, calc(100vw - 70px));
    padding: 10px 12px;
    border: 1px solid rgba(107, 146, 203, 0.24);
    border-radius: 12px;
    background: rgba(8, 11, 19, 0.94);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
    color: rgba(233, 243, 255, 0.9);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 12px;
    letter-spacing: 0.08em;
    opacity: 0;
    transform: translateX(-7px) scale(0.96);
    transform-origin: left bottom;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 180ms ease,
        transform 220ms ease,
        visibility 180ms;
}

.easter-egg-message span,
.easter-egg-message small {
    display: block;
}

.easter-egg-message small {
    margin-top: 3px;
    color: rgba(182, 198, 222, 0.72);
    font-size: 10px;
    letter-spacing: 0.04em;
}

.easter-egg.is-open .easter-egg-message {
    opacity: 1;
    transform: translateX(0) scale(1);
    visibility: visible;
    pointer-events: auto;
}

@supports (padding: max(0px)) {
    .easter-egg {
        left: max(12px, env(safe-area-inset-left));
        bottom: max(12px, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .easter-egg-trigger,
    .easter-egg-message {
        transition-duration: 0.01ms;
    }
}

@media (pointer: coarse) {
    .easter-egg-trigger {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 7px;
    }
}

/* =========================================
   Animated viewer counter
   Visual-only enhancement for #onlineCount
   ========================================= */

.online-count-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.viewer-counter {
    --viewer-counter-height: 16px;
    position: relative;
    display: inline-flex;
    align-items: center;
    height: var(--viewer-counter-height);
    overflow: hidden;
    color: var(--accent-2);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    vertical-align: -2px;
}

.viewer-counter-track {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: var(--viewer-counter-height);
}

.viewer-counter-digit {
    position: relative;
    display: inline-block;
    width: .64em;
    height: var(--viewer-counter-height);
    overflow: hidden;
}

.viewer-counter-reel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}

.viewer-counter-number {
    display: flex;
    flex: 0 0 var(--viewer-counter-height);
    height: var(--viewer-counter-height);
    align-items: center;
    justify-content: center;
}

/* Counter edge gradients removed */

@media (prefers-reduced-motion: reduce) {
    .viewer-counter-reel {
        transition: none;
    }
}


/* =========================================
   AUTH LAYOUT HOTFIX
   Keeps the login interface centered above GradientWaves.
   ========================================= */
body.auth-page {
    position: relative;
    display: block !important;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0 !important;
    overflow: hidden;
}

body.auth-page .gradient-waves-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    pointer-events: none;
}

body.auth-page .gradient-waves-background canvas {
    display: block;
    width: 100%;
    height: 100%;
}

body.auth-page .auth-shell {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: min(440px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translate(-50%, -50%);
}

@media (max-width: 520px) {
    body.auth-page .auth-shell {
        width: calc(100vw - 28px);
        max-height: calc(100dvh - 28px);
    }
}


/* =========================================
   Lucide icon system
   ========================================= */

.lucide {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    stroke-width: 2;
    color: currentColor;
    vertical-align: -0.14em;
}

button .lucide,
a .lucide,
.guest-banner .lucide,
.banner-warning .lucide,
.auth-result .lucide,
#avatarResult .lucide,
#passwordResult .lucide,
#suggestResult .lucide,
#modMuteStatus .lucide,
#modBanStatus .lucide { width: 18px; height: 18px; }

button:has(> .lucide),
a:has(> .lucide) { display: inline-flex; align-items: center; gap: 8px; }

.viewers { display: inline-flex; align-items: center; gap: 7px; }
.viewers > .lucide { width: 17px; height: 17px; }
.player-overlay-btn > .lucide, #volumeMuteBtn > .lucide, .chat-input button > .lucide { width: 20px; height: 20px; }
.install-app-btn > .lucide { width: 18px; height: 18px; }
.player-detached-icon .lucide { width: 25px; height: 25px; }
.username { display: inline-flex; align-items: center; gap: 4px; }
.username .lucide, #roleBadge .lucide { width: 15px; height: 15px; }
.message-replied { display: flex; align-items: center; gap: 6px; }
.message-replied .lucide { width: 14px; height: 14px; }
.reaction-trigger .lucide { width: 18px; height: 18px; }
.auth-back-link .lucide, .back-btn .lucide { width: 16px; height: 16px; }
.guest-banner, .banner-warning, #modMuteStatus, #modBanStatus, #suggestResult, #avatarResult, #passwordResult { display: flex; align-items: center; gap: 8px; }
.owner-item-actions button:has(.lucide) { min-width: 38px; padding-inline: 10px; justify-content: center; }

/* =========================================
   Lucide safe interaction fix
   ========================================= */

.lucide,
.lucide *,
[data-lucide],
[data-lucide] * {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.lucide {
    display: inline-block;
    vertical-align: middle;
    margin: 0;
}

/* Icon-only controls keep their original dimensions and center content. */
#volumeMuteBtn,
#sendMessage,
.reaction-trigger,
.service-close,
.owner-close,
#cancelChatReply {
    align-items: center;
    justify-content: center;
}

#volumeMuteBtn .lucide,
#sendMessage .lucide,
.reaction-trigger .lucide,
.service-close .lucide,
.owner-close .lucide,
#cancelChatReply .lucide {
    margin: 0;
}


/* =========================================
   NOVA profile background + wordmark font
   Design-only update
   ========================================= */
body.profile-page {
    position: relative;
    overflow-x: hidden;
}

body.profile-page .gradient-waves-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    pointer-events: none;
}

body.profile-page .gradient-waves-background canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.logo-word,
.auth-brand > span {
    font-family: "Cosmos SemiBold", "Cosmos", var(--font-display);
    font-weight: 600;
}

/* NOVA logo intro animation */
.logo-mark,
.logo-word,
.logo-tagline,
.auth-brand img,
.auth-brand > span {
    animation: novaLogoReveal .7s cubic-bezier(.22,1,.36,1) both;
}

.logo-word,
.auth-brand > span {
    animation-delay: .08s;
}

.logo-tagline {
    animation-delay: .16s;
}

@keyframes novaLogoReveal {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* NOVA Lucide micro interactions */
[data-lucide] {
    transition:
        transform .25s cubic-bezier(.22, 1, .36, 1),
        opacity .25s ease,
        filter .25s ease;
    transform-origin: center;
}

button:hover [data-lucide],
a:hover [data-lucide],
.back-btn:hover [data-lucide],
.auth-back-link:hover [data-lucide] {
    transform: translateX(2px) scale(1.06);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, .45));
}

button:active [data-lucide],
a:active [data-lucide] {
    transform: scale(.94);
}

[data-lucide="volume-2"]:hover,
[data-lucide="volume-x"]:hover,
[data-lucide="send-horizontal"]:hover {
    transform: scale(1.08);
}

.role-badge [data-lucide],
.avatar-result [data-lucide],
.password-result [data-lucide] {
    animation: novaIconPulse .45s cubic-bezier(.22,1,.36,1);
}

@keyframes novaIconPulse {
    from {
        opacity: .4;
        transform: scale(.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* NOVA button motion system v3 - unified premium interactions */

button {
    position: relative;
    overflow: hidden;
    transition:
        transform .24s cubic-bezier(.2,.8,.2,1),
        border-color .24s ease,
        background .24s ease,
        box-shadow .24s ease,
        opacity .24s ease;
}

button > .lucide,
button > svg,
button > span,
button > i {
    display: inline-flex;
    align-items: center;
    transition: transform .24s cubic-bezier(.2,.8,.2,1), filter .24s ease;
}

/* Primary / filled NOVA buttons */
.login-btn,
.auth-primary,
.service-primary,
.install-app-btn,
.approve {
    box-shadow: 0 8px 24px rgba(139, 92, 246, .18);
}

.login-btn:hover,
.auth-primary:hover,
.service-primary:hover,
.install-app-btn:hover,
.approve:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, .32);
}

.login-btn:hover > *,
.auth-primary:hover > *,
.service-primary:hover > *,
.install-app-btn:hover > *,
.approve:hover > * {
    transform: translateY(-1px);
}

/* Glass NOVA buttons */
.icon-btn,
.topbar-actions button,
.player-actions button,
.chat-input button,
.player-overlay-btn {
    backdrop-filter: blur(12px);
}

.icon-btn:hover,
.topbar-actions button:hover,
.player-actions button:hover,
.chat-input button:hover,
.player-overlay-btn:hover {
    transform: translateY(-1px);
    background: rgba(139, 92, 246, .12);
}

.icon-btn:hover > *,
.topbar-actions button:hover > *,
.player-actions button:hover > *,
.chat-input button:hover > *,
.player-overlay-btn:hover > * {
    transform: translateY(-1px) scale(1.04);
}

/* Outline buttons */
.back-btn,
.auth-box button:not(.auth-primary),
.profile-card-header .back-btn {
    border: 1px solid rgba(167, 139, 250, .25);
}

.back-btn:hover,
.auth-box button:not(.auth-primary):hover,
.profile-card-header .back-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(167, 139, 250, .65);
    box-shadow: 0 0 18px rgba(139, 92, 246, .2);
}

.back-btn:hover > *,
.auth-box button:not(.auth-primary):hover > *,
.profile-card-header .back-btn:hover > * {
    transform: translateX(2px);
}

/* Minimal / text buttons */
button:not(.login-btn):not(.auth-primary):not(.service-primary):not(.install-app-btn):not(.icon-btn):not(.approve):hover {
    transform: translateY(-1px);
}

button:not(.login-btn):not(.auth-primary):not(.service-primary):not(.install-app-btn):not(.icon-btn):not(.approve):hover > * {
    transform: translateY(-1px);
}

/* Unified press state */
button:active {
    transform: translateY(0) scale(.98);
}

button:active > * {
    transform: scale(.98);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    button,
    button > * {
        transition: none !important;
    }
}

/* NOVA button alignment correction — icon and label remain one centered unit */
button:has(> .lucide),
button:has(> svg),
button:has(> [data-lucide]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
}

button > .lucide,
button > svg,
button > [data-lucide] {
    display: block;
    align-self: center;
    margin: 0;
    vertical-align: middle;
    transform: none;
}

/* The button moves as a whole; its text and icon never separate. */
button:hover > *,
button:active > *,
button:hover [data-lucide],
button:active [data-lucide] {
    transform: none;
}

/* Primary glow is hover-only. */
.login-btn,
.auth-primary,
.service-primary,
.install-app-btn,
.approve {
    box-shadow: none;
}

.login-btn:hover,
.auth-primary:hover,
.service-primary:hover,
.install-app-btn:hover,
.approve:hover {
    box-shadow: 0 12px 32px rgba(139, 92, 246, .32);
}


/* Targeted correction: chat owner/moderation buttons only */
#ownerPanelBtn,
#moderationBtn {
    position: relative;
    text-align: center;
}

#ownerPanelBtn > span,
#moderationBtn > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: normal;
    transform: none;
}

#ownerPanelBtn > [data-lucide],
#moderationBtn > [data-lucide] {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin: 0;
    transform: translateY(-50%);
}

#ownerPanelBtn:hover > [data-lucide],
#ownerPanelBtn:active > [data-lucide],
#moderationBtn:hover > [data-lucide],
#moderationBtn:active > [data-lucide] {
    transform: translateY(-50%);
}

#ownerPanelBtn:hover > span,
#ownerPanelBtn:active > span,
#moderationBtn:hover > span,
#moderationBtn:active > span {
    transform: none;
}

/* NOVA wordmark — reliable Cosmos loading and application */
@font-face {
    font-family: "NOVA Cosmos";
    src: local("Cosmos SemiBold"),
         local("Cosmos-SemiBold"),
         local("Cosmos Bold"),
         local("Cosmos");
    font-style: normal;
    font-weight: 600 700;
    font-display: swap;
}

.logo-word,
.auth-brand > span {
    font-family: "NOVA Cosmos", "Cosmos", sans-serif !important;
    font-style: normal !important;
    font-weight: 700 !important;
    font-synthesis: none;
}

/* Targeted final correction: NOVA wordmark centering and the two player buttons only */
.logo-word {
    display: inline-flex;
    align-items: center;
    height: 40px;
    line-height: 1;
}

.auth-brand > span {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

#skipBtn,
#suggestBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#skipBtn > .player-action-content,
#suggestBtn > .player-action-content {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
    transform: translateY(0);
    transition: transform .24s cubic-bezier(.2,.8,.2,1);
}

#skipBtn > .player-action-content > .lucide,
#skipBtn > .player-action-content > svg,
#suggestBtn > .player-action-content > .lucide,
#suggestBtn > .player-action-content > svg {
    display: block;
    flex: 0 0 auto;
    margin: 0;
    transform: none;
}

#skipBtn:hover > .player-action-content,
#suggestBtn:hover > .player-action-content {
    transform: translateY(-1px);
}

#skipBtn:active > .player-action-content,
#suggestBtn:active > .player-action-content {
    transform: translateY(0) scale(.98);
}
