:root {
    --bg: #0f0f13;
    --surface: #1a1a24;
    --surface-hover: #22223a;
    --border: #2a2a3d;
    --text: #e4e4ed;
    --text-dim: #8888a0;
    --accent: #ff4444;
    --accent-hover: #ff6666;
    --mp4: #4f8cff;
    --mp4-hover: #6ea0ff;
    --mp3: #a855f7;
    --mp3-hover: #c084fc;
    --summary: #22c55e;
    --summary-hover: #4ade80;
    --premium-gold: #fbbf24;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nav */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-nav {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-nav:hover {
    color: var(--text);
    border-color: var(--text-dim);
}

.badge-premium {
    background: var(--premium-gold);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

/* Main */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.05rem;
}

/* Converter Box */
.converter-box {
    width: 100%;
    max-width: 600px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent);
}

.btn-fetch {
    background: var(--accent);
    border: none;
    color: white;
    padding: 0 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

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

/* Video Preview */
.video-preview {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.video-preview img {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.video-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.video-meta h3 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

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

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

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.btn-mp4 { background: var(--mp4); }
.btn-mp4:hover { background: var(--mp4-hover); }
.btn-mp3 { background: var(--mp3); }
.btn-mp3:hover { background: var(--mp3-hover); }
.btn-summary { background: var(--summary); }
.btn-summary:hover { background: var(--summary-hover); }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status */
.status {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

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

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

/* Summary */
.summary-result {
    margin-top: 1.5rem;
    padding: 1.2rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.summary-result h3 {
    font-size: 0.9rem;
    color: var(--summary);
    margin-bottom: 0.8rem;
}

#summary-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

/* Error */
.error-msg {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 8px;
    color: var(--accent);
    font-size: 0.85rem;
}

/* Free notice */
.free-notice {
    margin-top: 1.5rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-align: center;
}

.free-notice a {
    color: var(--premium-gold);
    text-decoration: none;
}

.free-notice a:hover {
    text-decoration: underline;
}

/* Login Box */
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-top: 4rem;
    text-align: center;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.login-box input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
}

.login-box input:focus {
    border-color: var(--accent);
}

.btn-login {
    background: var(--accent);
    margin-top: 0.5rem;
}

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

.back-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
}

.back-link:hover {
    color: var(--text);
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.8rem;
}

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

footer a:hover {
    color: var(--text);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .converter-box {
        padding: 1.2rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .video-preview {
        flex-direction: column;
    }

    .video-preview img {
        width: 100%;
        height: auto;
    }
}
