:root {
    --bg-dark: #0d0d0d;
    --bg-card: #1a1a1a;
    --bg-card-alt: #2d1f0f;
    --accent: #FF6B00;
    --accent-hover: #ff8533;
    --accent-dim: #cc5500;
    --text-primary: #f0f0f0;
    --text-secondary: #999;
    --text-muted: #666;
    --border: #333;
    --error: #ff4444;
    --success: #44bb44;
    --radius: 12px;
}

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

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

.container {
    width: 100%;
    max-width: 720px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.subtitle {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 0.95rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Input Card */
.input-group {
    display: flex;
    gap: 12px;
}

#urlInput {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

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

#urlInput::placeholder {
    color: var(--text-muted);
}

#submitBtn {
    padding: 14px 28px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

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

#submitBtn:active {
    transform: scale(0.97);
}

#submitBtn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 0.8em;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-label input:checked + .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-label input:checked + .checkmark::after {
    content: "\2713";
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

/* Progress Card */
.progress-card {
    background: var(--bg-card-alt);
    border-color: var(--accent-dim);
}

.video-title {
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--accent);
    min-height: 1.2em;
}

.progress-stages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
}

.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.stage.active {
    opacity: 1;
}

.stage.done {
    opacity: 0.7;
}

.stage-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.stage.active .stage-icon {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(255, 107, 0, 0.3);
}

.stage.done .stage-icon {
    border-color: var(--success);
    color: var(--success);
}

.stage-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stage-connector {
    width: 40px;
    height: 2px;
    background: var(--border);
    margin: 0 8px;
    margin-bottom: 22px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Error Card */
.error-card {
    border-color: var(--error);
    text-align: center;
}

.error-icon {
    font-size: 2rem;
    color: var(--error);
    margin-bottom: 12px;
}

.error-message {
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* Result Card */
.result-card {
    background: var(--bg-card-alt);
    border-color: var(--success);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.result-header h2 {
    font-size: 1.2rem;
    color: var(--accent);
}

.result-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-text {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 16px;
}

.result-text::-webkit-scrollbar {
    width: 6px;
}

.result-text::-webkit-scrollbar-track {
    background: transparent;
}

.result-text::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Footer */
footer {
    margin-top: auto;
    padding-top: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Spinner animation for active stage */
.stage.active .stage-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 107, 0, 0.2); }
    50% { box-shadow: 0 0 20px rgba(255, 107, 0, 0.5); }
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 20px 12px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .input-group {
        flex-direction: column;
    }

    #submitBtn {
        justify-content: center;
    }

    .progress-stages {
        transform: scale(0.9);
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        text-align: center;
    }
}
