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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
}

header {
    background: #1a1a2e;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e94560;
}

header h1 { font-size: 1.4rem; color: #e94560; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-start { background: #00c853; color: #000; }
.btn-stop { background: #e94560; color: #fff; }
.btn-logout { background: #3949ab; color: #fff; }
.btn-outline {
    background: transparent;
    color: #e0e0e0;
    border: 1px solid #46507b;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: #1a1a2e;
    border-radius: 10px;
    padding: 1.2rem;
    border: 1px solid #2a2a4a;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h3 { font-size: 1.1rem; }

.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.online { background: #00c853; box-shadow: 0 0 6px #00c853; }
.status-dot.offline { background: #666; }

.card input {
    width: 100%;
    padding: 0.5rem;
    margin: 0.3rem 0;
    background: #0f0f23;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.card label {
    font-size: 0.8rem;
    color: #888;
    display: block;
    margin-top: 0.5rem;
}

.card .actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
    align-items: center;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.btn-save { background: #1e88e5; color: #fff; }
.btn-oauth { background: #7c4dff; color: #fff; }
.logout-form { margin: 0; }

.toggle {
    position: relative;
    width: 44px; height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: #444; border-radius: 22px; cursor: pointer;
    transition: 0.3s;
}
.toggle .slider:before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 2px; bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle input:checked + .slider { background: #00c853; }
.toggle input:checked + .slider:before { transform: translateX(22px); }

/* Preview player */
.preview-wrap {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    max-width: 640px;
    aspect-ratio: 16/9;
    margin-bottom: 1.5rem;
}
.preview-wrap video {
    width: 100%;
    height: 100%;
    display: block;
}
.preview-offline {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.1rem;
    background: #0a0a0a;
}
.preview-offline.hidden { display: none; }

.section-title {
    font-size: 1.1rem;
    color: #e94560;
    margin: 1.5rem 0 1rem;
    border-bottom: 1px solid #2a2a4a;
    padding-bottom: 0.5rem;
}

/* Chat */
#chat-box {
    background: #1a1a2e;
    border-radius: 10px;
    padding: 1rem;
    height: 300px;
    overflow-y: auto;
    border: 1px solid #2a2a4a;
}

.chat-msg {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.chat-msg .platform { color: #e94560; font-weight: 600; }
.chat-msg .author { color: #1e88e5; font-weight: 600; }
.chat-msg .text { color: #ccc; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.8rem;
}

.stat-card {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #2a2a4a;
}
.stat-card .count {
    font-size: 2rem;
    font-weight: 700;
    color: #00c853;
}
.stat-card .label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.3rem;
}

.hidden { display: none; }

.public-page {
    background:
        radial-gradient(circle at top left, rgba(233, 69, 96, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(30, 136, 229, 0.16), transparent 32%),
        #0f0f0f;
}

.public-shell {
    max-width: 980px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

.public-shell.narrow {
    max-width: 760px;
}

.hero-card,
.info-card,
.prose-card {
    background: rgba(26, 26, 46, 0.92);
    border: 1px solid #2a2a4a;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
}

.hero-card {
    padding: 2rem;
}

.eyebrow {
    color: #8ba0d5;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    margin-bottom: 0.8rem;
}

.hero-card h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.05;
    margin-bottom: 1rem;
}

.lead {
    color: #b8c1d9;
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 780px;
}

.hero-actions {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.2rem;
}

.info-card {
    padding: 1.2rem;
}

.info-card h2,
.prose-card h2 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
    color: #f0f3ff;
}

.info-card p,
.prose-card p {
    color: #b8c1d9;
    line-height: 1.7;
}

.info-card a,
.prose-card a {
    color: #8ebfff;
}

.auth-card {
    max-width: 520px;
    margin: 3rem auto 0;
}

.auth-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.auth-form label {
    color: #8fa1d3;
    font-size: 0.88rem;
}

.auth-form input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    background: #101527;
    border: 1px solid #2e3b61;
    border-radius: 8px;
    color: #f5f7ff;
    font-size: 0.95rem;
}

.auth-submit {
    margin-top: 0.6rem;
}

.alert {
    margin-top: 1rem;
    padding: 0.8rem 0.95rem;
    border-radius: 10px;
    background: rgba(233, 69, 96, 0.12);
    border: 1px solid rgba(233, 69, 96, 0.4);
    color: #ffd6de;
}

.prose-card {
    padding: 2rem;
    display: grid;
    gap: 1rem;
}

@media (max-width: 720px) {
    header {
        padding: 1rem 1.2rem;
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }

    .controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .public-shell {
        padding: 1.5rem 1rem 2.5rem;
    }

    .hero-card,
    .prose-card {
        padding: 1.3rem;
    }
}
