* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top, rgba(110, 86, 255, 0.18), transparent 30%),
        radial-gradient(circle at 20% 20%, rgba(61, 127, 255, 0.12), transparent 25%),
        linear-gradient(180deg, #050814 0%, #0a1020 45%, #090d18 100%);
    color: #eef2ff;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.5px),
        radial-gradient(circle at 28% 42%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.6px),
        radial-gradient(circle at 77% 20%, rgba(255, 255, 255, 0.92) 0 1px, transparent 1.6px),
        radial-gradient(circle at 84% 62%, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.8px),
        radial-gradient(circle at 60% 78%, rgba(255, 255, 255, 0.68) 0 1px, transparent 1.8px);
    opacity: 0.45;
    pointer-events: none;
    z-index: -3;
}

.space-scene {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -2;
}

.space-nebula,
.space-milkyway,
.space-stars,
.space-char-stars,
.falling-stars {
    position: absolute;
    inset: 0;
}

.space-nebula {
    filter: blur(36px);
    opacity: 0.7;
}

.nebula-left {
    background:
        radial-gradient(circle at 20% 35%, rgba(88, 114, 255, 0.22), transparent 24%),
        radial-gradient(circle at 28% 42%, rgba(116, 71, 255, 0.18), transparent 18%);
}

.nebula-right {
    background:
        radial-gradient(circle at 82% 18%, rgba(123, 227, 255, 0.18), transparent 20%),
        radial-gradient(circle at 74% 70%, rgba(98, 80, 255, 0.16), transparent 22%);
}

.space-milkyway {
    inset: -10% -20%;
    background:
        radial-gradient(ellipse at center, rgba(255, 255, 255, 0.08) 0%, rgba(170, 195, 255, 0.06) 14%, rgba(111, 90, 255, 0.04) 26%, transparent 42%);
    transform: rotate(-16deg);
    opacity: 0.8;
}

.space-stars {
    background-repeat: repeat;
    animation: star-drift linear infinite;
}

.stars-small {
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 1px, transparent 1.4px),
        radial-gradient(circle, rgba(174, 211, 255, 0.78) 0 1px, transparent 1.5px);
    background-size: 170px 170px, 230px 230px;
    background-position: 0 0, 40px 70px;
    opacity: 0.4;
    animation-duration: 90s;
}

.stars-large {
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 1.4px, transparent 2px),
        radial-gradient(circle, rgba(153, 201, 255, 0.82) 0 1.2px, transparent 1.8px);
    background-size: 320px 320px, 260px 260px;
    background-position: 20px 30px, 100px 140px;
    opacity: 0.28;
    animation-duration: 140s;
}

.space-char-stars span,
.falling-stars span {
    position: absolute;
    left: var(--left);
    user-select: none;
}

.falling-stars-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 20;
}

.space-char-stars span {
    top: var(--top);
    color: rgba(255, 236, 161, 0.95);
    font-size: clamp(16px, 1.4vw, 24px);
    text-shadow:
        0 0 10px rgba(255, 221, 114, 0.55),
        0 0 22px rgba(163, 201, 255, 0.28);
    opacity: 0.8;
    animation: star-twinkle 4.5s ease-in-out infinite;
    animation-delay: var(--delay);
}

.falling-stars span {
    top: -10%;
    color: rgba(255, 236, 166, 0.9);
    font-size: clamp(14px, 1.1vw, 22px);
    text-shadow: 0 0 14px rgba(255, 228, 146, 0.45);
    opacity: 0;
    animation: falling-star var(--duration) linear infinite;
    animation-delay: var(--delay);
}

@keyframes star-drift {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(30px);
    }
}

@keyframes star-twinkle {
    0%,
    100% {
        transform: scale(0.95);
        opacity: 0.55;
    }
    50% {
        transform: scale(1.16);
        opacity: 0.98;
    }
}

@keyframes falling-star {
    0% {
        transform: translate3d(0, -8vh, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.95;
    }
    85% {
        opacity: 0.9;
    }
    100% {
        transform: translate3d(18px, 115vh, 0) rotate(16deg);
        opacity: 0;
    }
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-shell {
    width: min(100%, 420px);
}

.auth-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    backdrop-filter: blur(18px);
}

.auth-subtitle {
    color: #d6e2ff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-error {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #b63b5f;
    background: rgba(182, 59, 95, 0.16);
    color: #ffe0e8;
    font-size: 13px;
}

.auth-hint {
    padding: 12px;
    border-radius: 12px;
    background: #101826;
    border: 1px solid #2f3d5d;
    color: #a6b1cc;
    font-size: 12px;
    line-height: 1.6;
}

.page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 16px;
    padding: 16px;
    position: relative;
    z-index: 1;
}

.card {
    background: linear-gradient(180deg, rgba(18, 26, 47, 0.78), rgba(11, 16, 32, 0.82));
    border: 1px solid rgba(126, 150, 212, 0.24);
    border-radius: 16px;
    box-shadow:
        0 18px 48px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(18px);
}

.sidebar {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #101826;
    border: 1px solid #2f3d5d;
    font-size: 13px;
}

.account-bar button {
    width: auto;
    white-space: nowrap;
}

.main {
    display: grid;
    grid-template-rows: minmax(420px, 1fr);
    gap: 16px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    color: #f4f7ff;
    text-shadow: 0 0 18px rgba(133, 164, 255, 0.25);
    font-size: clamp(20px, 1.6vw, 26px);
    line-height: 1.1;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

h2 {
    color: #eaf1ff;
}

section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

input,
select,
button {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(103, 126, 190, 0.34);
    background: rgba(11, 19, 37, 0.72);
    color: #eef2ff;
    padding: 10px 12px;
}

.video-browser {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.video-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr 88px;
    gap: 8px;
    align-items: end;
}

.video-toolbar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.video-toolbar-item span {
    font-size: 12px;
    color: #a6b1cc;
}

.video-search input {
    width: 100%;
}

.video-breadcrumb {
    font-size: 12px;
    color: #a6b1cc;
    user-select: none;
}

.video-breadcrumb a {
    color: #9bb0ff;
    cursor: pointer;
    text-decoration: none;
}

.video-breadcrumb a:hover {
    text-decoration: underline;
}

.video-list {
    border: 1px solid rgba(82, 106, 166, 0.3);
    border-radius: 12px;
    background: rgba(9, 14, 28, 0.62);
    max-height: 420px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.video-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    width: 100%;
    padding: 10px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(14, 22, 42, 0.72);
    cursor: pointer;
    color: inherit;
    text-align: left;
}

.video-item:hover {
    border-color: #3a4e7a;
}

.video-item.active {
    border-color: rgba(118, 150, 255, 0.7);
    background: rgba(91, 122, 255, 0.18);
}

.video-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-item .meta {
    font-size: 12px;
    color: #a6b1cc;
}

.video-pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
}

.video-page-info {
    font-size: 12px;
    color: #a6b1cc;
    text-align: center;
}

.video-selected {
    font-size: 12px;
    color: #a6b1cc;
    padding: 8px 10px;
    border: 1px dashed #2f3d5d;
    border-radius: 10px;
}

button {
    cursor: pointer;
    background: linear-gradient(135deg, #4d6fff 0%, #765cff 100%);
    border-color: rgba(121, 113, 255, 0.75);
    box-shadow: 0 10px 24px rgba(77, 111, 255, 0.22);
}

button.is-muted {
    background: linear-gradient(135deg, #d34a58 0%, #a92b47 100%);
    border-color: rgba(226, 104, 122, 0.85);
    box-shadow: 0 10px 24px rgba(169, 43, 71, 0.28);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.player-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-stage {
    position: relative;
}

video {
    width: 100%;
    min-height: 360px;
    background: #000;
    border-radius: 12px;
    border: 1px solid rgba(112, 134, 191, 0.2);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.playback-hint {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(182, 134, 45, 0.45);
    background: rgba(182, 134, 45, 0.12);
    color: #ffe9b8;
    font-size: 13px;
    line-height: 1.5;
}

.playback-hint.error {
    border-color: rgba(182, 59, 95, 0.55);
    background: rgba(182, 59, 95, 0.14);
    color: #ffd9e3;
}

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

.voice-status {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #2f3d5d;
    background: rgba(11, 20, 38, 0.72);
    font-size: 13px;
    color: #dfe6ff;
}

.voice-status.success {
    border-color: #1f8f4e;
    background: rgba(31, 143, 78, 0.16);
}

.voice-status.warning {
    border-color: #b6862d;
    background: rgba(182, 134, 45, 0.16);
}

.voice-status.error {
    border-color: #b63b5f;
    background: rgba(182, 59, 95, 0.16);
}

.voice-peer-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.voice-peer-item {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #2f3d5d;
    background: rgba(11, 20, 38, 0.72);
    font-size: 12px;
    color: #a6b1cc;
}

.voice-peer-item.success {
    border-color: #1f8f4e;
}

.voice-peer-item.warning {
    border-color: #b6862d;
}

.voice-peer-item.error {
    border-color: #b63b5f;
}

.user-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-list li {
    padding: 10px 12px;
    background: rgba(11, 20, 38, 0.72);
    border: 1px solid rgba(78, 100, 154, 0.28);
    border-radius: 10px;
}

@media (max-width: 980px) {
    .page {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .main {
        grid-template-rows: auto auto;
    }

    .sidebar,
    .player-card {
        padding: 16px;
    }

    .account-bar {
        flex-wrap: wrap;
    }

    video {
        min-height: 260px;
    }

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

@media (max-width: 640px) {
    .page {
        gap: 12px;
        padding: 10px;
    }

    .sidebar,
    .player-card,
    .auth-card {
        padding: 14px;
        border-radius: 14px;
    }

    .sidebar {
        gap: 12px;
    }

    .account-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .account-bar button {
        width: 100%;
    }

    h1 {
        font-size: 18px;
    }

    h2 {
        font-size: 16px;
    }

    input,
    select,
    button {
        padding: 10px;
        font-size: 14px;
    }

    .video-list {
        max-height: 220px;
    }

    .video-toolbar,
    .video-pager {
        grid-template-columns: 1fr;
    }

    .video-page-info {
        order: -1;
    }

    .player-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    video {
        min-height: 210px;
    }

    .space-char-stars span {
        font-size: 16px;
    }

    .falling-stars span {
        font-size: 14px;
    }
}
