/* ==========================================================================
   Shorts Downloader — design system + page styles
   ========================================================================== */

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins-latin-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Poppins';
    src: url('../fonts/poppins-latin-800.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-latin-var.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
    color-scheme: light;

    /* Color */
    --bg: #ffffff;
    --bg-subtle: #f8fafc;
    --bg-muted: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --primary: #dd1d1d;
    --primary-hover: #b91818;
    --primary-active: #991515;
    --primary-subtle: #fdeded;
    --accent-text: #c81a1a;
    --accent-hover: #991515;
    --download: #15803d;
    --download-hover: #166534;
    --download-active: #14532d;
    --hero-glow: rgba(221, 29, 29, 0.11);
    --on-primary: #ffffff;
    --success: #16a34a;
    --success-subtle: #f0fdf4;
    --success-border: #bbf7d0;
    --error: #dc2626;
    --error-subtle: #fef2f2;
    --error-border: #fecaca;
    --warning: #b45309;
    --warning-subtle: #fffbeb;
    --warning-border: #fde68a;
    --focus-ring: #dd1d1d;
    --skeleton: #eef2f6;
    --grid-line: rgba(15, 23, 42, 0.045);

    /* Type */
    --font-display: 'Poppins', var(--font-sans);
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Devanagari', sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-display: clamp(2.125rem, 1.4rem + 3.2vw, 3.5rem);

    /* Space (4px scale) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Shape & elevation */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 1px 3px rgba(15, 23, 42, 0.05), 0 16px 40px -12px rgba(15, 23, 42, 0.16);

    /* Layout */
    --container: 1200px;
    --container-narrow: 720px;
    --gutter: clamp(1rem, 0.6rem + 2vw, 2rem);
    --header-h: 72px;

    /* Motion */
    --ease: cubic-bezier(0.2, 0, 0, 1);
    --duration-fast: 150ms;
    --duration: 200ms;
    --duration-slow: 250ms;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0b0f17;
        --bg-subtle: #0f1520;
        --bg-muted: #161e2b;
        --surface: #111823;
        --text: #e8edf5;
        --text-secondary: #94a3b8;
        --text-tertiary: #64748b;
        --border: #1f2a3a;
        --border-strong: #2c3a4f;
        --primary: #dd1d1d;
        --primary-hover: #b91818;
        --primary-active: #991515;
        --primary-subtle: rgba(239, 68, 68, 0.12);
        --accent-text: #f87171;
        --accent-hover: #fca5a5;
        --hero-glow: rgba(221, 29, 29, 0.16);
        --on-primary: #ffffff;
        --success: #4ade80;
        --success-subtle: rgba(34, 197, 94, 0.1);
        --success-border: rgba(74, 222, 128, 0.25);
        --error: #f87171;
        --error-subtle: rgba(239, 68, 68, 0.1);
        --error-border: rgba(248, 113, 113, 0.28);
        --warning: #fbbf24;
        --warning-subtle: rgba(245, 158, 11, 0.1);
        --warning-border: rgba(251, 191, 36, 0.25);
        --focus-ring: #f87171;
        --skeleton: #1a2332;
        --grid-line: rgba(226, 232, 240, 0.04);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px -4px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 1px 3px rgba(0, 0, 0, 0.3), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0f17;
    --bg-subtle: #0f1520;
    --bg-muted: #161e2b;
    --surface: #111823;
    --text: #e8edf5;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border: #1f2a3a;
    --border-strong: #2c3a4f;
    --primary: #dd1d1d;
    --primary-hover: #b91818;
    --primary-active: #991515;
    --primary-subtle: rgba(239, 68, 68, 0.12);
    --accent-text: #f87171;
    --accent-hover: #fca5a5;
    --hero-glow: rgba(221, 29, 29, 0.16);
    --on-primary: #ffffff;
    --success: #4ade80;
    --success-subtle: rgba(34, 197, 94, 0.1);
    --success-border: rgba(74, 222, 128, 0.25);
    --error: #f87171;
    --error-subtle: rgba(239, 68, 68, 0.1);
    --error-border: rgba(248, 113, 113, 0.28);
    --warning: #fbbf24;
    --warning-subtle: rgba(245, 158, 11, 0.1);
    --warning-border: rgba(251, 191, 36, 0.25);
    --focus-ring: #f87171;
    --skeleton: #1a2332;
    --grid-line: rgba(226, 232, 240, 0.04);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px -4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 1px 3px rgba(0, 0, 0, 0.3), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
    overflow-x: hidden;
}

main {
    flex: 1;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button,
input {
    font: inherit;
    color: inherit;
}

a {
    color: var(--accent-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--accent-hover);
}

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Components set their own display, so make the hidden attribute always win */
[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -100px;
    z-index: 100;
    padding: var(--space-2) var(--space-4);
    background: var(--text);
    color: var(--bg);
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-3);
    color: var(--bg);
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: var(--header-h);
    gap: var(--space-4);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    justify-self: start;
    min-height: 44px;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
}

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

.brand-mark {
    width: 30px;
    height: 30px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding-inline: var(--space-4);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg-muted);
}

.nav-link[aria-current] {
    color: var(--text);
    background: var(--bg-muted);
    font-weight: 600;
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    justify-self: end;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--bg-muted);
}

.theme-toggle .icon-moon,
:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: none;
    }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: block;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    justify-self: end;
}

.menu-toggle {
    display: none;
}

.mobile-menu {
    border-top: 1px solid var(--border);
    background: var(--bg);
    animation: reveal var(--duration) var(--ease) both;
}

.mobile-list {
    display: grid;
    gap: var(--space-1);
    padding-block: var(--space-3) var(--space-4);
    list-style: none;
}

.mobile-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 48px;
    padding-inline: var(--space-3);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
}

.mobile-link .icon {
    color: var(--text-secondary);
}

.mobile-link:hover,
.mobile-link[aria-current] {
    background: var(--bg-muted);
    color: var(--text);
}

.mobile-link[aria-current] {
    font-weight: 600;
}

.mobile-link[aria-current] .icon {
    color: var(--accent-text);
}

@media (max-width: 859px) {
    .header-inner {
        grid-template-columns: 1fr auto;
    }
    .site-nav {
        display: none;
    }
    .menu-toggle {
        display: inline-grid;
    }
}

@media (max-width: 379px) {
    .brand {
        gap: var(--space-2);
        font-size: 1rem;
    }
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    padding-block: var(--space-20) var(--space-16);
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    isolation: isolate;
    overflow: hidden;
}

/* A soft brand-tinted glow behind the heading */
.hero::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 560px;
    z-index: -1;
    background: radial-gradient(ellipse 55% 75% at 50% 0%, var(--hero-glow), transparent 70%);
}

.hero-inner {
    max-width: 880px;
    margin-inline: auto;
    text-align: center;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 1.2rem + 4.2vw, 4rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.hero-subtitle {
    max-width: 62ch;
    margin: var(--space-6) auto 0;
    color: var(--text-secondary);
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
    line-height: 1.7;
    text-wrap: pretty;
}

.hero-subtitle strong {
    color: var(--text);
    font-weight: 600;
}

.nowrap {
    white-space: nowrap;
}

/* ---------- Downloader form ---------- */

.downloader {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 760px;
    margin: var(--space-10) auto 0;
}

/* Visible label styled as a tab attached to the field */
.field-tab {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    margin-bottom: -2px;
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--primary);
    color: var(--on-primary);
    font-size: var(--text-sm);
    font-weight: 600;
}

.url-field {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    width: 100%;
    padding: 6px 6px 6px var(--space-4);
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.url-field:focus-within {
    box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.url-field[data-invalid="true"] {
    border-color: var(--error);
}

.url-field[data-invalid="true"]:focus-within {
    box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--error) 16%, transparent);
}

.url-field-icon {
    color: var(--text-tertiary);
}

.url-input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 var(--space-2);
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: var(--text-base);
    outline: none;
}

.url-input::placeholder {
    color: var(--text-tertiary);
}

/* Hide the browser's own clear button; we provide one */
.url-input::-webkit-search-cancel-button {
    display: none;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
}

.icon-btn:hover {
    color: var(--text);
    background: var(--bg-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

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

.btn[aria-busy="true"] {
    cursor: progress;
    opacity: 1;
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    color: var(--on-primary);
}

.btn-primary:active:not(:disabled) {
    background: var(--primary-active);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-muted);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-muted);
    color: var(--text);
}

/* Green download action: a distinct "go" color that never reads as the brand red or an error */
.btn-download {
    background: var(--download);
    color: #ffffff;
}

.btn-download:hover:not(:disabled) {
    background: var(--download-hover);
    color: #ffffff;
}

.btn-download:active:not(:disabled) {
    background: var(--download-active);
}

.btn-lg {
    min-height: 48px;
    padding: 0 var(--space-6);
    font-size: var(--text-base);
}

.btn-success,
.btn-success:disabled {
    background: var(--success-subtle);
    border-color: var(--success-border);
    color: var(--success);
    opacity: 1;
    cursor: default;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.field-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0 var(--space-3);
    margin-top: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    text-align: center;
}

.field-hint[data-tone="error"] {
    color: var(--error);
    font-weight: 500;
}

.field-hint > .icon {
    margin-right: calc(-1 * var(--space-2));
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 var(--space-1);
    border: 0;
    background: none;
    color: var(--accent-text);
    font-size: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    cursor: pointer;
}

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

/* Share buttons */

.share-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding: 0;
    list-style: none;
}

.share-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease),
        border-color var(--duration-fast) var(--ease);
}

.share-btn:hover {
    border-color: var(--border-strong);
    background: var(--bg-muted);
    color: var(--text);
    transform: translateY(-1px);
}

.share-btn .icon {
    width: 18px;
    height: 18px;
}

@media (max-width: 559px) {
    .hero {
        padding-block: var(--space-12) var(--space-10);
    }
    .downloader {
        margin-top: var(--space-8);
    }
    .field-tab {
        padding: 6px var(--space-4);
        font-size: var(--text-xs);
    }
    /* The input keeps room for the icon, clear and paste buttons;
       Get Video always wraps onto its own full-width row */
    .url-field {
        flex-wrap: wrap;
        padding-left: var(--space-3);
    }
    .url-input {
        flex: 1 1 calc(100% - 136px);
    }
    .url-field .btn-submit {
        flex: 1 1 100%;
    }
    .share-row {
        gap: var(--space-2);
    }
}

/* ---------- Results ---------- */

.results {
    max-width: var(--container-narrow);
    margin: var(--space-8) auto 0;
    text-align: left;
}

.results[hidden] {
    display: none;
}

.card,
.results > .alert {
    color: var(--text);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.reveal {
    animation: reveal var(--duration-slow) var(--ease) both;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.video-summary {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--space-5);
    align-items: center;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--skeleton);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-badge {
    position: absolute;
    right: var(--space-2);
    bottom: var(--space-2);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.video-meta {
    min-width: 0;
}

.video-title {
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.video-byline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    margin-top: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.video-byline span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.format-section {
    padding: var(--space-5);
}

.format-section + .format-section {
    padding-top: 0;
}

.format-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.format-list {
    list-style: none;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.format-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
    transition: background-color var(--duration-fast) var(--ease);
}

.format-row + .format-row {
    border-top: 1px solid var(--border);
}

.format-row:hover {
    background: var(--bg-subtle);
}

.format-row[hidden] {
    display: none;
}

.format-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    min-width: 0;
}

.format-quality {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 5.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--primary-subtle);
    color: var(--accent-text);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.format-specs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}


.format-row .btn {
    min-width: 132px;
}

.format-reveal > .btn {
    margin: 0 var(--space-5) var(--space-5);
}

.format-reveal > .format-section {
    padding-top: 0;
}

@media (max-width: 559px) {
    .format-reveal > .btn {
        margin-inline: var(--space-4);
        white-space: normal;
        text-align: left;
        line-height: 1.3;
    }
}

.more-formats {
    margin-top: var(--space-2);
}

.notice {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.notice .icon {
    margin-top: 2px;
    color: var(--text-tertiary);
}

.results-footer {
    display: flex;
    justify-content: center;
    margin-top: var(--space-4);
}

@media (max-width: 559px) {
    .video-summary {
        grid-template-columns: 1fr;
        gap: var(--space-4);
        padding: var(--space-4);
    }
    .format-section {
        padding: var(--space-4);
    }
    .format-row {
        padding-left: var(--space-3);
        gap: var(--space-3);
    }
    .format-row .btn {
        min-width: 0;
        padding-inline: var(--space-3);
    }
    .format-row .btn .btn-label-long {
        display: none;
    }
}

/* ---------- Skeleton ---------- */

.skeleton {
    background: var(--skeleton);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg) 55%, transparent), transparent);
    animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

.skeleton-line {
    height: 14px;
}

.sk-title {
    width: 90%;
}

.sk-title-2 {
    width: 60%;
    margin-top: 10px;
}

.sk-byline {
    width: 40%;
    height: 12px;
    margin-top: 18px;
}

.sk-heading {
    width: 100px;
    height: 10px;
    margin-bottom: 14px;
}

.skeleton-row {
    height: 64px;
    border-radius: 0;
}

.skeleton-row + .skeleton-row {
    border-top: 1px solid var(--border);
}

/* ---------- Alerts ---------- */

.alert {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    font-size: var(--text-sm);
}

.alert .icon {
    margin-top: 1px;
}

.alert-title {
    font-weight: 600;
    color: var(--text);
}

.alert-body {
    color: var(--text-secondary);
}

.alert-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.alert-error {
    border-color: var(--error-border);
    background: var(--error-subtle);
}

.alert-error > .icon {
    color: var(--error);
}

.alert-warning {
    border-color: var(--warning-border);
    background: var(--warning-subtle);
}

.alert-warning > .icon {
    color: var(--warning);
}

.alert-info {
    border-color: var(--border);
    background: var(--bg-subtle);
}

.alert-info > .icon {
    color: var(--text-secondary);
}

.alert-elapsed {
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.alert-success {
    border-color: var(--success-border);
    background: var(--success-subtle);
}

.alert-success > .icon {
    color: var(--success);
}

/* Alerts shown straight on the hero get a solid surface so they read on red */
.results > .alert {
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.card .alert {
    margin: 0 var(--space-5) var(--space-5);
}

/* ---------- Toasts ---------- */

.toast-region {
    position: fixed;
    z-index: 60;
    left: 50%;
    bottom: var(--space-6);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: min(420px, calc(100% - 2 * var(--gutter)));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--text);
    color: var(--bg);
    font-size: var(--text-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in var(--duration-slow) var(--ease) both;
}

.toast .icon {
    margin-top: 1px;
}

.toast[data-tone="success"] .icon {
    color: #4ade80;
}

.toast[data-tone="error"] .icon {
    color: #f87171;
}

:root[data-theme="dark"] .toast[data-tone="success"] .icon {
    color: var(--success);
}

.toast.is-leaving {
    animation: toast-out var(--duration) var(--ease) both;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(4px);
    }
}

/* ---------- Sections ---------- */

.section {
    padding-block: var(--space-20);
}

.section + .section {
    border-top: 1px solid var(--border);
}

.section-subtle {
    background: var(--bg-subtle);
}

.section-header {
    max-width: 560px;
    margin-bottom: var(--space-10);
}

.section-header-center {
    margin-inline: auto;
    text-align: center;
}

.section-kicker {
    margin-bottom: var(--space-2);
    color: var(--accent-text);
    font-size: var(--text-sm);
    font-weight: 600;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.625rem, 1.3rem + 1.2vw, 2.125rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.section-lead {
    margin-top: var(--space-3);
    color: var(--text-secondary);
    font-size: var(--text-lg);
    text-wrap: pretty;
}

@media (max-width: 559px) {
    .section {
        padding-block: var(--space-16);
    }
    .section-header {
        margin-bottom: var(--space-8);
    }
    .section-lead {
        font-size: var(--text-base);
    }
}

/* Steps */

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    list-style: none;
    padding: 0;
    counter-reset: step;
}

.step {
    position: relative;
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    counter-increment: step;
}

.step-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: var(--space-5);
    border-radius: var(--radius);
    background: var(--primary-subtle);
    color: var(--accent-text);
}

.step::after {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    top: var(--space-6);
    right: var(--space-6);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.step-title {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.step-text {
    margin-top: var(--space-2);
    color: var(--text-secondary);
}

@media (max-width: 799px) {
    .steps {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
}

/* Features */

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-10) var(--space-8);
    list-style: none;
    padding: 0;
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.feature-title {
    font-size: var(--text-base);
    font-weight: 600;
}

.feature-text {
    margin-top: var(--space-1);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

@media (max-width: 899px) {
    .features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 559px) {
    .features {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }
}

/* FAQ */

.faq {
    max-width: var(--container-narrow);
    margin-inline: auto;
    border-top: 1px solid var(--border);
}

.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 44px;
    padding-block: var(--space-5);
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    transition: color var(--duration-fast) var(--ease);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary:hover {
    color: var(--accent-text);
}

.faq-item summary .icon {
    color: var(--text-tertiary);
    transition: transform var(--duration) var(--ease);
}

.faq-item[open] summary .icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-width: 62ch;
    padding-bottom: var(--space-5);
    color: var(--text-secondary);
}

.faq-item[open] .faq-answer {
    animation: reveal var(--duration) var(--ease) both;
}

.faq-answer p + p,
.faq-answer p + ul,
.faq-answer ul + p {
    margin-top: var(--space-3);
}

.faq-answer ul {
    padding-left: var(--space-5);
}

.faq-answer code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--bg-muted);
    color: var(--text);
    font-size: 0.875em;
    overflow-wrap: anywhere;
}

.section-kicker-caps {
    font-size: var(--text-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ---------- Guide ---------- */

.guide-card {
    max-width: 960px;
    margin-inline: auto;
    padding: clamp(1.25rem, 0.5rem + 3.5vw, 3rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.toc {
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
}

.toc-title {
    margin-bottom: var(--space-3);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.toc-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease),
        color var(--duration-fast) var(--ease);
}

.chip:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--accent-text);
}

.guide {
    margin-top: var(--space-10);
}

.guide section {
    margin-top: var(--space-12);
}

.guide > section:first-child {
    margin-top: 0;
}

.guide h2,
.guide h3 {
    font-family: var(--font-display);
    font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.guide p,
.guide ul,
.guide ol {
    margin-top: var(--space-4);
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.75;
}

.guide ul,
.guide ol {
    padding-left: 1.25rem;
}

.guide li + li {
    margin-top: var(--space-2);
}

.guide li::marker {
    color: var(--accent-text);
    font-weight: 600;
}

.guide strong,
.guide td strong {
    color: var(--text);
    font-weight: 600;
}

.guide code,
.guide kbd,
.faq-answer kbd {
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-muted);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    overflow-wrap: anywhere;
}

.table-wrap {
    margin-top: var(--space-4);
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.guide table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.guide th,
.guide td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.guide th {
    background: var(--bg-subtle);
    color: var(--text);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.guide td {
    color: var(--text-secondary);
    line-height: 1.6;
}

.guide td:first-child {
    color: var(--text);
    font-weight: 500;
}

.guide td code,
.guide p code,
.guide li code {
    white-space: nowrap;
}

/* Phones: let long example links wrap inside table cells instead of scrolling */
@media (max-width: 559px) {
    .guide td code,
    .guide td .nowrap,
    .guide th {
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .guide th,
    .guide td {
        padding: var(--space-3);
    }
}

.guide tbody tr:last-child td {
    border-bottom: 0;
}

/* ---------- Back to top ---------- */

.back-to-top {
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    z-index: 40;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    animation: reveal var(--duration) var(--ease) both;
    transition: transform var(--duration-fast) var(--ease);
}

.back-to-top:hover {
    transform: translateY(-2px);
}

/* ---------- Footer ---------- */

.site-footer {
    padding-block: var(--space-12) var(--space-8);
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    font-size: var(--text-sm);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, 1fr);
    gap: var(--space-8);
}

.footer-about {
    max-width: 340px;
}

.footer-about p {
    margin-top: var(--space-2);
    color: var(--text-secondary);
}

.footer-heading {
    margin-bottom: var(--space-2);
    color: var(--text);
    font-size: var(--text-sm);
    font-weight: 600;
}

.footer-links {
    display: grid;
    padding: 0;
    list-style: none;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
    color: var(--text-secondary);
    text-decoration: none;
}

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

@media (max-width: 859px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-about {
        grid-column: 1 / -1;
        max-width: none;
    }
}

@media (max-width: 559px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
    }
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2) var(--space-6);
    margin-top: var(--space-10);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    padding: 0;
    list-style: none;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.breadcrumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--text-secondary);
    text-decoration: none;
}

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

.breadcrumbs [aria-current] {
    color: var(--text);
    font-weight: 500;
}

.icon-xs {
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
}

.hero-crumbs {
    display: flex;
    justify-content: center;
    margin-top: calc(-1 * var(--space-10));
    margin-bottom: var(--space-8);
}

@media (max-width: 559px) {
    .hero-crumbs {
        margin-top: calc(-1 * var(--space-6));
        margin-bottom: var(--space-5);
    }
}

/* ---------- Page hero (content pages) ---------- */

.page-hero .breadcrumbs ol {
    justify-content: center;
}

.page-hero {
    position: relative;
    padding-block: var(--space-10) var(--space-12);
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    isolation: isolate;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 380px;
    z-index: -1;
    background: radial-gradient(ellipse 50% 80% at 50% 0%, var(--hero-glow), transparent 70%);
}

.page-hero-inner {
    max-width: 760px;
    margin: var(--space-8) auto 0;
    text-align: center;
}

.page-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 1.3rem + 2.8vw, 3.25rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.page-lead {
    margin-top: var(--space-4);
    color: var(--text-secondary);
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
    line-height: 1.65;
    text-wrap: pretty;
}

.page-meta {
    margin-top: var(--space-4);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.section-tight {
    padding-block: var(--space-12);
}

.section-article {
    padding-block: var(--space-12) var(--space-16);
}

.section-article .guide {
    margin-top: var(--space-8);
}

.section-article .guide-card > .guide:first-child {
    margin-top: 0;
}

.callout {
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-lg);
    background: var(--warning-subtle);
    color: var(--text) !important;
    font-size: var(--text-sm) !important;
}

/* ---------- Link cards ---------- */

.link-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-5);
    padding: 0;
    list-style: none;
}

.link-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease),
        transform var(--duration-fast) var(--ease);
}

.link-card:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: var(--shadow);
    color: var(--text);
    transform: translateY(-2px);
}

.link-card-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: var(--space-4);
    border-radius: var(--radius);
    background: var(--primary-subtle);
    color: var(--accent-text);
}

.link-card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.link-card-text {
    flex: 1;
    margin-top: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.link-card-more {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-4);
    color: var(--accent-text);
    font-size: var(--text-sm);
    font-weight: 600;
}

.link-card:hover .link-card-more .icon {
    transform: translateX(2px);
}

.link-card-more .icon {
    transition: transform var(--duration-fast) var(--ease);
}

/* ---------- Call to action ---------- */

.cta-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4) var(--space-6);
    margin-top: var(--space-12);
    padding: var(--space-6);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
    border-radius: var(--radius-xl);
    background: var(--primary-subtle);
}

.cta-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text) !important;
    margin: 0 !important;
}

.cta-text {
    margin-top: var(--space-1) !important;
    color: var(--text-secondary);
    font-size: var(--text-base) !important;
}

/* ---------- Legal / simple pages ---------- */

.prose-page {
    padding-block: var(--space-16) var(--space-20);
}

.prose {
    max-width: 68ch;
    margin-inline: auto;
}

.prose h1 {
    font-family: var(--font-display);
    font-size: clamp(1.875rem, 1.5rem + 1.4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.prose .updated {
    margin-top: var(--space-2);
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.prose > :first-child {
    margin-top: 0;
}

.prose h2 {
    font-family: var(--font-display);
    margin-top: var(--space-10);
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.015em;
}

.prose p,
.prose ul {
    margin-top: var(--space-3);
    color: var(--text-secondary);
}

.prose ul {
    padding-left: var(--space-5);
}

.prose li + li {
    margin-top: var(--space-1);
}

.prose strong {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Tools ---------- */

/* Extra fields under the link (embed and timestamp generators) */
.tool-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
    width: 100%;
    margin-top: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    text-align: left;
}

.tool-options-title {
    grid-column: 1 / -1;
    font-size: var(--text-sm);
    font-weight: 600;
}

.option-field {
    display: grid;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 500;
}

.option-input {
    width: 100%;
    min-height: 44px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-weight: 400;
}

.option-input:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.option-field[data-invalid="true"] .option-input {
    border-color: var(--error);
}

.option-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    font-size: var(--text-sm);
    cursor: pointer;
}

.option-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.tool-card-head {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.tool-section {
    padding: var(--space-5);
}

.tool-section + .tool-section {
    padding-top: 0;
}

.tool-section .format-heading .badge {
    letter-spacing: 0;
}

.tool-meta {
    margin-bottom: var(--space-3);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.tool-card > .tool-actions {
    margin: 0 var(--space-5) var(--space-5);
}

.format-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
}

.format-buttons .btn {
    min-width: 0;
}

.thumb-preview {
    margin: var(--space-5) var(--space-5) 0;
}

.thumb-preview img {
    object-fit: contain;
}

.tool-card .alert {
    margin: 0 var(--space-5) var(--space-5);
}

/* Tags and hashtags: each one is a button that copies it */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0;
    list-style: none;
}

.btn-chip {
    min-height: 40px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text);
    font-weight: 500;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
}

.btn-chip:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--accent-text);
}

.output-box {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    color: var(--text);
    font: inherit;
    font-size: var(--text-sm);
    line-height: 1.6;
    resize: vertical;
}

.output-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Label / value / copy rows (channel ID, timestamp links) */
.kv-list {
    margin: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.kv-row {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
}

.kv-row + .kv-row {
    border-top: 1px solid var(--border);
}

.kv-label {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
}

.kv-data {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-width: 0;
}

.kv-value {
    min-width: 0;
    font-size: var(--text-sm);
    overflow-wrap: anywhere;
}

a.kv-value {
    color: var(--accent-text);
}

.chapter-list,
.link-list {
    display: grid;
    gap: var(--space-2);
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
}

.chapter-list li {
    display: flex;
    gap: var(--space-3);
}

.chapter-time {
    min-width: 3.5rem;
    color: var(--accent-text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.link-list a {
    color: var(--accent-text);
    overflow-wrap: anywhere;
}

.channel-head {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.channel-head .video-byline {
    margin-top: var(--space-1);
}

.channel-avatar {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--skeleton);
}

.avatar-preview {
    display: flex;
    justify-content: center;
    padding: var(--space-6) var(--space-5) var(--space-2);
}

.avatar-preview img {
    width: min(240px, 60vw);
    height: auto;
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.embed-preview {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: var(--radius);
    background: #000;
}

.embed-preview-vertical {
    max-width: 320px;
    aspect-ratio: 9 / 16;
    margin-inline: auto;
}

.section-more {
    margin-top: var(--space-6);
    text-align: center;
}

/* Tools page: one block per group */
.tool-group + .tool-group {
    margin-top: var(--space-12);
}

.tool-group-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
}

.tool-group-lead {
    margin: var(--space-1) 0 var(--space-5);
    color: var(--text-secondary);
}

@media (max-width: 559px) {
    .tool-card-head,
    .tool-section,
    .channel-head {
        padding: var(--space-4);
    }
    .kv-list {
        margin: var(--space-4);
    }
    .kv-row {
        grid-template-columns: 1fr;
        gap: var(--space-1);
        padding-left: var(--space-3);
    }
    .thumb-preview {
        margin: var(--space-4) var(--space-4) 0;
    }
    .format-buttons .btn {
        padding-inline: var(--space-3);
    }
    .tool-card > .tool-actions {
        margin: 0 var(--space-4) var(--space-4);
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .spinner {
        animation: spin 1.5s linear infinite !important;
    }
}
