:root {
    --background: #090b10;
    --surface: rgba(18, 21, 30, .82);
    --surface-2: #151923;
    --surface-3: #1d2230;

    --border: rgba(255,255,255,.075);
    --border-strong: rgba(255,255,255,.12);

    --text: #f7f8fb;
    --muted: #9298a8;

    --accent: #7c5cff;
    --accent-2: #a58cff;
    --accent-soft: rgba(124,92,255,.16);

    --live: #ff476f;
    --success: #55dfa3;

    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    background: var(--background);
    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    overflow-x: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.ambient {
    position: fixed;
    pointer-events: none;
    filter: blur(120px);
    opacity: .13;
    border-radius: 100%;
}

.ambient-one {
    width: 520px;
    height: 520px;
    background: #7255ff;
    top: -220px;
    left: 20%;
}

.ambient-two {
    width: 420px;
    height: 420px;
    background: #8d42ff;
    bottom: -200px;
    right: 5%;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) 330px;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;

    padding: 22px 16px;

    background: rgba(10,12,18,.88);
    backdrop-filter: blur(24px);

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

    display: flex;
    flex-direction: column;
}

.brand {
    padding: 2px 8px 28px;

    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border-radius: 12px;

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

    font-weight: 900;
    font-size: 20px;

    box-shadow:
        0 12px 32px rgba(124,92,255,.25);
}

.brand-name {
    font-weight: 800;
    letter-spacing: -.03em;
}

.brand-subtitle {
    color: var(--accent-2);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .28em;
}

nav {
    display: grid;
    gap: 5px;
}

.nav-item {
    border: 0;
    color: var(--muted);
    background: transparent;

    padding: 11px 12px;
    border-radius: 11px;

    display: flex;
    align-items: center;
    gap: 11px;

    text-align: left;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255,255,255,.04);
}

.nav-item.active {
    color: #fff;
    background: var(--accent-soft);
}

.sidebar-heading {
    margin: 30px 11px 12px;

    color: #656b79;

    font-weight: 800;
    font-size: 10px;
    letter-spacing: .16em;
}

.channel {
    padding: 9px;

    display: flex;
    align-items: center;
    gap: 9px;

    border-radius: 12px;
}

.channel:hover {
    background: rgba(255,255,255,.04);
}

.channel-avatar {
    position: relative;

    width: 35px;
    height: 35px;

    display: grid;
    place-items: center;

    border-radius: 50%;
    background: var(--surface-3);

    font-size: 13px;
    font-weight: 800;
}

.channel-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;

    width: 10px;
    height: 10px;

    border-radius: 50%;
    border: 2px solid #0d1017;

    background: #555b68;
}

.channel-dot.live {
    background: var(--live);
}

.channel-info {
    min-width: 0;
    flex: 1;

    display: grid;
}

.channel-info strong {
    font-size: 13px;
}

.channel-info span {
    color: var(--muted);
    font-size: 11px;
}

.sidebar-user {
    margin-top: auto;

    padding: 12px 8px 0;

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

    display: flex;
    align-items: center;
    gap: 9px;
}

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

    display: grid;
    place-items: center;

    border-radius: 50%;
    background: var(--surface-3);

    font-weight: 700;
}

.user-info {
    flex: 1;
    min-width: 0;

    display: grid;
}

.user-info strong {
    font-size: 12px;
}

.user-info span {
    color: var(--muted);
    font-size: 10px;
}

.settings-button,
.chat-header button {
    border: 0;
    background: transparent;
    color: var(--muted);
}

.content {
    width: 100%;
    max-width: 1320px;

    margin: 0 auto;
    padding: 26px 28px 50px;
}

.topbar {
    margin-bottom: 22px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eyebrow {
    color: var(--accent-2);

    font-size: 9px;
    font-weight: 900;
    letter-spacing: .18em;
}

h1,
h2,
h3 {
    margin: 0;
}

h1 {
    margin-top: 4px;
    font-size: 25px;
    letter-spacing: -.04em;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.viewer-pill {
    height: 38px;

    padding: 0 13px;

    display: flex;
    align-items: center;
    gap: 7px;

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

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

    color: var(--muted);
    font-size: 12px;
}

.viewer-pill strong {
    color: var(--text);
}

.eye {
    color: var(--accent-2);
}

.account-button {
    height: 38px;

    padding: 0 16px;

    border: 0;
    border-radius: 11px;

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

    font-size: 12px;
    font-weight: 700;

    box-shadow:
        0 10px 28px rgba(124,92,255,.20);
}

.player-card,
.mixer-card {
    border: 1px solid var(--border);

    border-radius: var(--radius);

    background: var(--surface);

    backdrop-filter: blur(18px);

    overflow: hidden;
}

.player {
    position: relative;

    width: 100%;
    aspect-ratio: 16 / 9;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 40%,
            #22263a 0,
            #11141d 40%,
            #080a0f 100%
        );
}

.player-gradient {
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            180deg,
            rgba(0,0,0,.32),
            transparent 25%,
            transparent 65%,
            rgba(0,0,0,.7)
        );
}

.offline-state {
    position: absolute;
    inset: 0;

    display: grid;
    place-content: center;
    justify-items: center;

    text-align: center;
}

.offline-icon {
    width: 62px;
    height: 62px;

    margin-bottom: 18px;

    display: grid;
    place-items: center;

    border-radius: 20px;

    background: var(--accent-soft);
    color: var(--accent-2);

    font-size: 22px;

    box-shadow:
        inset 0 0 0 1px rgba(165,140,255,.18);
}

.offline-state h2 {
    margin-bottom: 7px;

    font-size: 20px;
    letter-spacing: -.03em;
}

.offline-state p {
    width: min(330px, 80%);

    margin: 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.6;
}

.player-top,
.player-controls {
    position: absolute;
    left: 18px;
    right: 18px;

    display: flex;
    align-items: center;
    gap: 8px;
}

.player-top {
    top: 17px;
}

.player-controls {
    bottom: 14px;
}

.status-badge,
.quality-badge {
    padding: 6px 9px;
    border-radius: 8px;

    backdrop-filter: blur(10px);

    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
}

.status-badge.offline {
    background: rgba(65,69,82,.75);
}

.status-badge.live {
    background: var(--live);
}

.quality-badge {
    background: rgba(0,0,0,.40);
    color: #d9dbe1;
}

.player-controls button {
    width: 32px;
    height: 32px;

    border: 0;
    border-radius: 9px;

    background: rgba(0,0,0,.35);
    color: white;
}

.player-spacer {
    flex: 1;
}

.latency {
    padding: 5px 8px;

    border-radius: 8px;

    background: rgba(0,0,0,.35);

    color: var(--success);
    font-size: 10px;
}

.stream-information {
    padding: 17px 19px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stream-information h2 {
    margin-bottom: 5px;

    font-size: 16px;
    letter-spacing: -.02em;
}

.category {
    color: var(--muted);
    font-size: 11px;
}

.follow-button {
    border: 1px solid var(--border-strong);
    border-radius: 9px;

    background: rgba(255,255,255,.035);
    color: var(--text);

    padding: 8px 12px;

    font-size: 11px;
}

.mixer-card {
    margin-top: 18px;
    padding: 19px;
}

.section-header {
    margin-bottom: 16px;

    display: flex;
    justify-content: space-between;
    align-items: end;
}

.section-header h2 {
    margin-top: 4px;

    font-size: 16px;
    letter-spacing: -.025em;
}

select {
    padding: 8px 29px 8px 10px;

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

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

    font-size: 11px;
}

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

.source {
    min-height: 68px;

    padding: 12px;

    display: flex;
    align-items: center;
    gap: 11px;

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

    background: rgba(255,255,255,.025);
}

.source-icon {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background: var(--surface-3);
}

.source-body {
    min-width: 0;
    flex: 1;

    display: grid;
    gap: 8px;
}

.source-title {
    display: flex;
    justify-content: space-between;

    font-size: 11px;
}

.source-title span,
.source-body > span {
    color: var(--muted);
    font-size: 10px;
}

input[type="range"] {
    width: 100%;

    accent-color: var(--accent);
}

.toggle {
    width: 42px;
    height: 27px;

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

    background: rgba(255,255,255,.04);
    color: var(--muted);

    font-size: 9px;
    font-weight: 900;
}

.toggle.active {
    border-color: rgba(124,92,255,.35);

    background: var(--accent-soft);
    color: var(--accent-2);
}

.chat-panel {
    position: sticky;
    top: 0;

    height: 100vh;

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

    background: rgba(11,13,19,.86);
    backdrop-filter: blur(24px);

    display: flex;
    flex-direction: column;
}

.chat-header {
    height: 76px;
    padding: 17px 18px;

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

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    margin-top: 3px;
    font-size: 16px;
}

.chat-messages {
    flex: 1;

    padding: 18px;

    display: grid;
    place-items: center;
}

.welcome {
    max-width: 240px;
    text-align: center;
}

.welcome-icon {
    width: 47px;
    height: 47px;

    margin: 0 auto 14px;

    display: grid;
    place-items: center;

    border-radius: 15px;

    background: var(--accent-soft);
    color: var(--accent-2);
}

.welcome h3 {
    font-size: 14px;
}

.welcome p {
    color: var(--muted);

    font-size: 11px;
    line-height: 1.55;
}

.reactions {
    padding: 9px 14px;

    display: flex;
    gap: 5px;

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

.reactions button {
    width: 35px;
    height: 32px;

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

    background: rgba(255,255,255,.025);
}

.chat-input {
    padding: 0 14px 14px;

    display: flex;
    gap: 7px;
}

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

    padding: 11px;

    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;

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

    font-size: 11px;
}

.chat-input button {
    width: 38px;

    border: 0;
    border-radius: 10px;

    background: var(--accent);
    color: white;
}

@media (max-width: 1150px) {
    .app-shell {
        grid-template-columns: 76px minmax(0,1fr) 300px;
    }

    .brand-name,
    .brand-subtitle,
    .nav-item:not(.active) {
        font-size: 0;
    }

    .nav-item {
        justify-content: center;
    }

    .sidebar-heading,
    .channel-info,
    .sidebar-user .user-info,
    .settings-button {
        display: none;
    }
}

@media (max-width: 900px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .chat-panel {
        position: relative;

        width: auto;
        height: 480px;

        margin: 0 18px 30px;

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

        overflow: hidden;
    }

    .content {
        padding: 18px;
    }
}

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

    .viewer-pill {
        display: none;
    }

    .player-card {
        border-radius: 12px;
    }

    .stream-information {
        align-items: flex-start;
        gap: 12px;
    }
}


/* =========================================
   AUTH
   ========================================= */

.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: grid;
    place-items: center;

    padding: 24px;

    background:
        radial-gradient(
            circle at 50% 20%,
            rgba(124, 92, 255, .17),
            transparent 35%
        ),
        rgba(7, 9, 14, .92);

    backdrop-filter: blur(24px);

    transition:
        opacity .22s ease,
        visibility .22s ease;
}

.auth-gate.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    width: min(420px, 100%);

    padding: 34px;

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

    border-radius: 24px;

    background:
        linear-gradient(
            145deg,
            rgba(26, 29, 41, .96),
            rgba(14, 17, 25, .96)
        );

    box-shadow:
        0 30px 100px
        rgba(0, 0, 0, .55);
}

.login-logo {
    margin-bottom: 25px;
}

.login-logo .brand-mark {
    width: 48px;
    height: 48px;

    border-radius: 15px;

    font-size: 23px;
}

.login-card > h1 {
    margin-top: 7px;

    font-size: 30px;
    letter-spacing: -.045em;
}

.login-description {
    margin:
        10px 0 27px;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.6;
}

#login-form {
    display: grid;
    gap: 17px;
}

.login-field {
    display: grid;
    gap: 7px;
}

.login-field > span {
    color: #c8ccd7;

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

.login-field input {
    width: 100%;
    height: 45px;

    padding: 0 13px;

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

    border-radius: 11px;

    outline: none;

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

    color: var(--text);

    font-size: 13px;

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        background .15s ease;
}

.login-field input:focus {
    border-color:
        rgba(124,92,255,.65);

    background:
        rgba(124,92,255,.045);

    box-shadow:
        0 0 0 3px
        rgba(124,92,255,.10);
}

.login-field input::placeholder {
    color: #626879;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--muted);

    font-size: 11px;

    cursor: pointer;
}

.remember-row input {
    accent-color: var(--accent);
}

.login-error {
    display: none;

    padding: 10px 12px;

    border:
        1px solid rgba(255,71,111,.22);

    border-radius: 9px;

    background:
        rgba(255,71,111,.08);

    color: #ff829d;

    font-size: 11px;
}

.login-error.visible {
    display: block;
}

.login-submit {
    height: 45px;

    border: 0;
    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            var(--accent),
            #966cff
        );

    color: white;

    font-size: 12px;
    font-weight: 800;

    box-shadow:
        0 12px 35px
        rgba(124,92,255,.25);
}

.login-submit:hover {
    filter: brightness(1.08);
}

.login-submit:disabled {
    opacity: .55;
    cursor: wait;
}

.login-footer {
    margin-top: 23px;

    color: #5e6473;

    text-align: center;

    font-size: 9px;
    letter-spacing: .08em;
}

.account-button {
    height: 38px;

    padding: 0 16px;

    border: 0;
    border-radius: 11px;

    color: #fff;

    background:
        linear-gradient(
            135deg,
            var(--accent),
            #9067ff
        );

    font-size: 12px;
    font-weight: 700;

    box-shadow:
        0 10px 28px
        rgba(124,92,255,.20);
}

.avatar {
    overflow: hidden;
}


/* =========================================
   REALTIME
   ========================================= */

.viewer-strip {
    min-height: 46px;

    padding: 9px 14px;

    display: flex;
    align-items: center;
    gap: 7px;

    overflow-x: auto;

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

.viewer-strip-label {
    flex: 0 0 auto;

    color: var(--muted);

    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.viewer-name {
    flex: 0 0 auto;

    padding: 5px 8px;

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

    border-radius: 8px;

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

    color: #d9dce5;

    font-size: 10px;
}

.chat-messages {
    display: block;
    overflow-y: auto;
}

.chat-message {
    padding: 8px 3px 11px;
}

.chat-message-meta {
    margin-bottom: 4px;

    display: flex;
    align-items: baseline;
    gap: 7px;
}

.chat-message-meta strong {
    color: var(--accent-2);
    font-size: 11px;
}

.chat-message-meta span {
    color: #555c6d;
    font-size: 8px;
}

.chat-message-body {
    color: #d8dbe4;

    font-size: 11px;
    line-height: 1.45;

    overflow-wrap: anywhere;
}

.reaction-layer {
    position: absolute;
    inset: 0;

    z-index: 5;

    pointer-events: none;
    overflow: hidden;
}

.floating-reaction {
    position: absolute;
    bottom: 55px;

    display: grid;
    justify-items: center;

    animation:
        reaction-float
        2.6s ease-out
        forwards;
}

.floating-reaction span {
    font-size: 34px;

    filter:
        drop-shadow(
            0 7px 15px
            rgba(0,0,0,.4)
        );
}

.floating-reaction small {
    margin-top: 2px;

    padding: 3px 6px;

    border-radius: 6px;

    background:
        rgba(0,0,0,.45);

    color: #ddd;
    font-size: 8px;
}

@keyframes reaction-float {
    0% {
        opacity: 0;

        transform:
            translateY(20px)
            scale(.8);
    }

    15% {
        opacity: 1;
    }

    75% {
        opacity: 1;
    }

    100% {
        opacity: 0;

        transform:
            translateY(-220px)
            scale(1.15);
    }
}

/* Fix de alinhamento do chat */
.chat-messages {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    text-align: left;
    padding: 14px 16px;
    gap: 2px;
}

.chat-message {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 8px 0 10px;
}

.chat-message-meta {
    width: 100%;
    justify-content: flex-start;
}

.chat-message-body {
    width: 100%;
    text-align: left;
}

/* Vídeo principal WebRTC */
.stream-video {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: contain;

    background: #000;

    z-index: 1;
}

.player-gradient {
    z-index: 2;
    pointer-events: none;
}

.offline-state {
    z-index: 3;
}

.player-top,
.player-controls {
    z-index: 4;
}

.reaction-layer {
    z-index: 5;
}

/* Oculta corretamente o estado offline quando a live está ativa */
.offline-state[hidden] {
    display: none !important;
}


/* Ícones dos controles do player */
.player-controls button svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
}
