/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #ffffff;
    --bg-card: #f7f7f8;
    --text: #1a1a1a;
    --text-muted: #666;
    --border: #e0e0e0;
    --accent: #ff0033;
    --accent-hover: #cc0029;
    --accent-light: #fff0f2;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0f0f;
        --bg-card: #1a1a1a;
        --text: #f1f1f1;
        --text-muted: #aaa;
        --border: #333;
        --accent: #ff3355;
        --accent-hover: #ff1144;
        --accent-light: #2a1015;
        --shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 720px; margin: 0 auto; padding: 0 16px; width: 100%; }

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

/* === Header === */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}
.logo:hover { text-decoration: none; }
.site-header nav { display: flex; gap: 16px; }
.site-header nav a { color: var(--text-muted); font-size: 0.9rem; }
.site-header nav a:hover { color: var(--text); }

/* === Main === */
main { flex: 1; padding: 32px 0; }

/* === Hero / URL Form === */
.hero { text-align: center; margin-bottom: 32px; }
.hero h1 { font-size: 1.8rem; margin-bottom: 8px; }
.subtitle { color: var(--text-muted); margin-bottom: 24px; }

.url-form {
    display: flex;
    gap: 8px;
    max-width: 560px;
    margin: 0 auto;
}
.url-form input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
.url-form input:focus { border-color: var(--accent); }
.url-form button {
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.url-form button:hover { background: var(--accent-hover); }
.url-form button:disabled { opacity: 0.6; cursor: not-allowed; }

.error {
    color: var(--accent);
    font-size: 0.9rem;
    margin-top: 12px;
    text-align: center;
}

/* === Video Card === */
.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}
.video-card-inner {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.video-thumb {
    width: 200px;
    height: auto;
    border-radius: 6px;
    flex-shrink: 0;
    object-fit: cover;
}
.video-meta { flex: 1; min-width: 0; }
.video-meta h2 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.video-details { color: var(--text-muted); font-size: 0.9rem; }
.sep { margin: 0 6px; }

/* === Format Toggle === */
.format-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 260px;
}
.toggle-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.toggle-btn.active {
    background: var(--accent);
    color: #fff;
}

/* === Quality Pills === */
.quality-section { margin-bottom: 20px; }
.quality-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.quality-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.quality-pill {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.quality-pill:hover { border-color: var(--accent); }
.quality-pill.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}
.quality-pill .pill-size {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* === Download Button === */
.btn-download {
    display: block;
    text-align: center;
    padding: 14px 32px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-download:hover { background: var(--accent-hover); text-decoration: none; }

/* === Ad Slots === */
.ad-slot {
    text-align: center;
    margin: 16px auto;
    max-width: 728px;
}
.ad-banner .ad-placeholder {
    height: 90px;
    line-height: 90px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.ad-rect {
    max-width: 300px;
    margin: 20px auto;
}
.ad-rect .ad-placeholder {
    height: 250px;
    line-height: 250px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* === FAQ === */
.faq { margin-top: 48px; }
.faq h2 { font-size: 1.3rem; margin-bottom: 16px; }
details {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}
summary {
    cursor: pointer;
    font-weight: 500;
    list-style: none;
}
summary::before { content: '+ '; color: var(--accent); font-weight: 700; }
details[open] summary::before { content: '- '; }
details p { margin-top: 8px; color: var(--text-muted); font-size: 0.95rem; }

/* === Page Content (about, privacy, terms) === */
.page-content { max-width: 600px; }
.page-content h1 { font-size: 1.6rem; margin-bottom: 16px; }
.page-content h2 { font-size: 1.15rem; margin-top: 24px; margin-bottom: 8px; }
.page-content p, .page-content li { color: var(--text-muted); margin-bottom: 8px; }
.page-content ul { padding-left: 20px; }

/* === Error Page === */
.error-page { text-align: center; padding: 60px 0; }
.error-page h1 { font-size: 4rem; color: var(--accent); margin-bottom: 12px; }
.error-page p { margin-bottom: 24px; color: var(--text-muted); }
.error-page .btn-download { display: inline-block; }

/* === Footer === */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }
.disclaimer { font-size: 0.75rem; margin-top: 4px; }

/* === Spinner === */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Responsive === */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.4rem; }
    .url-form { flex-direction: column; }
    .url-form button { width: 100%; }
    .video-card-inner { flex-direction: column; }
    .video-thumb { width: 100%; max-height: 200px; }
    .format-toggle { max-width: 100%; }
}
