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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --success: #10b981;
    --error: #ef4444;
    --border: #475569;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #1a1f35 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 16px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 24px;
    padding: 12px;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1rem;
    margin-bottom: 8px;
}

.note {
    color: var(--text-dim);
    font-size: 0.7rem;
    font-style: italic;
    opacity: 0.7;
}

.controls-panel {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px var(--shadow);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    border: 1px solid var(--border);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-switch {
    display: flex;
    background: var(--background);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

.toggle-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    color: var(--text);
    background: var(--surface-light);
}

.toggle-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.select-input {
    padding: 10px 12px;
    border: 2px solid var(--border);
    background: var(--background);
    color: var(--text);
    font-size: 0.875rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.select-input:hover {
    border-color: var(--primary);
}

.select-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.video-container {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px var(--shadow);
    border: 1px solid var(--border);
}

.video-info {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.info-badge {
    padding: 6px 12px;
    background: var(--background);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    border: 1px solid var(--border);
}

.video-wrapper {
    position: relative;
    width: 100%;
    background: var(--background);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

#video-player {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    gap: 14px;
}

.loading-spinner.hidden {
    display: none;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-dim);
    font-size: 0.875rem;
}

.error-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    gap: 12px;
    padding: 24px;
    text-align: center;
}

.error-message.visible {
    display: flex;
}

.error-message svg {
    color: var(--error);
    width: 40px;
    height: 40px;
}

.error-message p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.error-message small {
    color: var(--text-dim);
    font-size: 0.8rem;
}

footer {
    text-align: center;
    margin-top: 24px;
    padding: 12px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .controls-panel {
        padding: 16px;
        gap: 12px;
    }

    .video-container {
        padding: 16px;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--surface-light);
}
