:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #141420;
    --bg-card: #1a1a2e;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --accent: #6c5ce7;
    --accent-hover: #7c6cf7;
    --error: #e74c3c;
    --success: #2ecc71;
    --border: #2a2a3e;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.hidden { display: none !important; }

#code-form .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

#code-form h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

#code-form .subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.input-group {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}

#code-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1.1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    text-transform: uppercase;
}

#code-input:focus {
    border-color: var(--accent);
}

#watch-btn {
    padding: 14px 28px;
    font-size: 1.1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
}

#watch-btn:hover { background: var(--accent-hover); }
#watch-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error {
    color: var(--error);
    margin-top: 16px;
    text-align: center;
    max-width: 400px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
}

#player-app {
    min-height: 100vh;
    background: #000;
}

#video-container {
    position: relative;
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

#quality-bar {
    position: absolute;
    bottom: 60px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: var(--radius);
    z-index: 10;
}

#channel-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.quality-btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.quality-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.quality-btn:hover {
    background: var(--accent-hover);
    color: white;
}

#expiry-notice {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(231, 76, 60, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    z-index: 10;
}

#error-overlay, #loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
}

.error-content {
    text-align: center;
}

.error-content h2 {
    font-size: 1.5rem;
    color: var(--error);
    margin-bottom: 8px;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

#unmute-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 2.5rem;
    border: 2px solid var(--accent);
    cursor: pointer;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s ease-in-out infinite;
}

#unmute-btn:hover {
    background: var(--accent);
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

#fullscreen-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}

#fullscreen-btn:hover {
    background: var(--accent-hover);
    color: white;
}

#video-container:fullscreen,
#video-container:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    background: #000;
}

#video-container:fullscreen #video-player,
#video-container:-webkit-full-screen #video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#error-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
}
