/* ============================================
   باحث مجتمع — نظام التصميم
   Tajawal • Royal Blue • Light + Dark
   ============================================ */

:root {
    /* ===== الوضع الفاتح (افتراضي) ===== */
    --snow-0:    #ffffff;
    --snow-50:   #f8fafc;
    --snow-100:  #f1f5f9;
    --snow-200:  #e2e8f0;
    --snow-300:  #cbd5e1;
    --snow-400:  #94a3b8;

    --ink-500:   #64748b;
    --ink-600:   #475569;
    --ink-700:   #334155;
    --ink-800:   #1e293b;
    --ink-900:   #0f172a;
    --ink-950:   #020617;

    --royal-50:  #eff6ff;
    --royal-100: #dbeafe;
    --royal-200: #bfdbfe;
    --royal-400: #60a5fa;
    --royal-500: #3b82f6;
    --royal-600: #2563eb;
    --royal-700: #1d4ed8;
    --royal-800: #1e40af;
    --royal-900: #1e3a8a;
    --royal-950: #172554;

    --gold-100:  #fef3c7;
    --gold-300:  #fcd34d;
    --gold-500:  #eab308;
    --gold-600:  #ca8a04;

    /* ===== متغيّرات دلالية (تتغيّر مع الثيم) ===== */
    --bg:         var(--snow-50);
    --surface:    var(--snow-0);
    --surface-2:  var(--snow-100);
    --surface-3:  var(--snow-200);
    --text:       var(--ink-900);
    --text-soft:  var(--ink-700);
    --muted:      var(--ink-500);
    --border:     var(--snow-200);
    --border-2:   var(--snow-300);

    --primary:        var(--royal-700);
    --primary-hover:  var(--royal-800);
    --primary-soft:   var(--royal-50);
    --primary-text:   #ffffff;
    --on-primary:     #ffffff;
    --primary-tint:   var(--royal-100);

    --accent:         var(--gold-600);
    --accent-soft:    var(--gold-100);

    /* أحمر دم الغزال لروابط يوتيوب */
    --yt:        #9f1239;
    --yt-hover:  #7f1230;
    --yt-soft:   rgba(159, 18, 57, 0.08);

    --header-bg:      rgba(255, 255, 255, 0.85);
    --hero-bg:        linear-gradient(180deg, #ffffff 0%, #f1f6fc 100%);
    --hero-glow-1:    rgba(29, 78, 216, 0.06);
    --hero-glow-2:    rgba(202, 138, 4, 0.05);

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow:    0 4px 8px rgba(15, 23, 42, 0.04), 0 2px 4px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 24px -8px rgba(15, 23, 42, 0.10), 0 4px 8px -2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.18), 0 8px 16px -4px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 0 0 4px rgba(29, 78, 216, 0.15);

    /* أبعاد */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    --t-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
    --t:      0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    --header-h: 72px;

    color-scheme: light;
}

/* ===== الوضع الداكن (كحلي) ===== */
[data-theme="dark"] {
    --bg:         #0a1628;
    --surface:    #0f1f3d;
    --surface-2:  #142849;
    --surface-3:  #1a3358;
    --text:       #f1f5f9;
    --text-soft:  #cbd5e1;
    --muted:      #94a3b8;
    --border:     #1e3a5f;
    --border-2:   #2a4a73;

    --primary:        var(--royal-500);
    --primary-hover:  var(--royal-400);
    --primary-soft:   rgba(59, 130, 246, 0.12);
    --primary-tint:   rgba(59, 130, 246, 0.2);
    --primary-text:   #ffffff;
    --on-primary:     #ffffff;

    --accent:         var(--gold-300);
    --accent-soft:    rgba(252, 211, 77, 0.14);

    /* أحمر دم الغزال (نسخة فاتحة لتباين على الكحلي) */
    --yt:        #fb7185;
    --yt-hover:  #fda4af;
    --yt-soft:   rgba(251, 113, 133, 0.12);

    --header-bg:      rgba(15, 31, 61, 0.85);
    --hero-bg:        linear-gradient(180deg, #0f1f3d 0%, #0a1628 100%);
    --hero-glow-1:    rgba(59, 130, 246, 0.10);
    --hero-glow-2:    rgba(252, 211, 77, 0.05);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow:    0 4px 8px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 24px -8px rgba(0, 0, 0, 0.5), 0 4px 8px -2px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.65), 0 8px 16px -4px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 0 4px rgba(59, 130, 246, 0.3);

    color-scheme: dark;
}

/* ============ Reset & Base ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }

body {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

.num, .stat-num, .time, .dur, .time-badge, .tx-status, .line-count {
    font-feature-settings: "tnum" 1;
    font-variant-numeric: tabular-nums;
}

a { color: var(--primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, button, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--primary-tint); color: var(--text); }

/* ============ Header (centered nav) ============ */
.site-header {
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    display: flex;
    align-items: center;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.header-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-5);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--text);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.01em;
    justify-self: start;
}
.logo:hover { color: var(--text); }
.logo-mark {
    background: linear-gradient(135deg, var(--royal-600) 0%, var(--royal-900) 100%);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 800;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.main-nav {
    display: flex;
    gap: var(--space-2);
    justify-self: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: var(--radius-pill);
}
.nav-link {
    color: var(--text-soft);
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--t-fast);
    line-height: 1;
}
.nav-link:hover { color: var(--primary); background: var(--surface); }
.nav-link.active {
    color: var(--on-primary);
    background: var(--primary);
    box-shadow: var(--shadow-sm);
}

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

.search-form {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 4px;
    transition: all var(--t-fast);
    width: 100%;
    max-width: 320px;
    height: 38px;
}
.search-form:focus-within { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.search-form input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: var(--text);
}
.search-form input::placeholder { color: var(--muted); }
.search-form button {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    display: grid;
    place-items: center;
    transition: all var(--t-fast);
}
.search-form button svg { width: 14px; height: 14px; }
.search-form button:hover { background: var(--primary-hover); transform: scale(1.08); }

.theme-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-pill);
    display: grid;
    place-items: center;
    color: var(--text-soft);
    transition: all var(--t-fast);
    flex-shrink: 0;
}
.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    transition: opacity var(--t), transform var(--t);
    grid-area: 1 / 1;
}
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ============ Container ============ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-10) var(--space-6);
}

/* ============ Hero ============ */
.hero {
    position: relative;
    background:
        radial-gradient(circle at 0% 0%, var(--hero-glow-1) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, var(--hero-glow-2) 0%, transparent 50%),
        var(--hero-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-16) var(--space-8);
    text-align: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-10);
}
.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--royal-700), var(--royal-500), var(--royal-700));
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary-tint);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: var(--space-5);
}
.hero-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.hero h1 {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-4);
}
.hero h1 .highlight {
    background: linear-gradient(135deg, var(--royal-600), var(--royal-900));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
[data-theme="dark"] .hero h1 .highlight {
    background: linear-gradient(135deg, var(--royal-400), var(--royal-200));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero p {
    color: var(--text-soft);
    font-size: clamp(15px, 1.5vw, 18px);
    max-width: 640px;
    margin: 0 auto var(--space-8);
}
.hero-search {
    max-width: 720px;
    margin: 0 auto var(--space-10);
    position: relative;
}
.hero-search input {
    width: 100%;
    padding: 18px 60px 18px 24px;
    border: 2px solid var(--border-2);
    border-radius: var(--radius-lg);
    font-size: 17px;
    background: var(--surface);
    color: var(--text);
    transition: all var(--t);
    outline: none;
    box-shadow: var(--shadow);
    font-family: inherit;
}
.hero-search input::placeholder { color: var(--muted); }
.hero-search input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}
.hero-search::before {
    content: "";
    position: absolute;
    inset-inline-end: 22px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0.7;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    max-width: 720px;
    margin: 0 auto var(--space-8);
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-3);
    text-align: center;
    transition: all var(--t);
}
.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.stat .num {
    display: block;
    font-size: clamp(22px, 2.5vw, 32px);
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.stat .lbl {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    margin-top: var(--space-2);
    display: block;
}

.cta-row {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 12px 24px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 15px;
    transition: all var(--t-fast);
    text-decoration: none;
    cursor: pointer;
}
.btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: var(--on-primary);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

/* ============ Mission section ============ */
.mission { margin-bottom: var(--space-12); }
.mission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
}
.mission-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--t);
    position: relative;
    overflow: hidden;
}
.mission-card::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--royal-500));
    opacity: 0.7;
}
.mission-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.mission-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
}
.mission-card h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-2);
}
.mission-card p {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.75;
}

/* ============ Section title ============ */
.section-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    letter-spacing: -0.01em;
}
.section-title::before {
    content: "";
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--royal-700), var(--royal-500));
    border-radius: 2px;
}

/* ============ Video grid & cards ============ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
}
.video-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    color: inherit;
    transition: all var(--t);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    position: relative;
}
.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    color: inherit;
}
.video-card .thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--surface-2);
    overflow: hidden;
}
.video-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--t-slow);
}
.video-card:hover .thumb img { transform: scale(1.05); }
.video-card .thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.4));
    opacity: 0;
    transition: opacity var(--t);
}
.video-card:hover .thumb::after { opacity: 1; }
.video-card .dur {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(2, 6, 23, 0.92);
    color: #fff;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 1;
}
.card-body {
    padding: var(--space-4);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.card-body h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 45px;
}
.card-body small {
    color: var(--muted);
    font-size: 13px;
    margin-top: auto;
}

/* ============ Search results ============ */
.results-section { margin-bottom: var(--space-10); }
.results-section h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.count {
    color: var(--muted);
    font-weight: 500;
    font-size: 14px;
    background: var(--surface-2);
    padding: 2px 10px;
    border-radius: var(--radius-pill);
}
.count-big {
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 14px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    margin-inline-start: var(--space-3);
    font-feature-settings: "tnum" 1;
}
.results-range {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: var(--space-4);
    font-feature-settings: "tnum" 1;
}
/* قائمة حلقات مدمجة (لنتائج البحث) */
.video-list-compact {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.compact-card {
    display: grid;
    grid-template-columns: 110px 1fr auto;
    gap: var(--space-3);
    align-items: center;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    transition: all var(--t-fast);
}
.compact-card:hover {
    border-color: var(--primary);
    color: inherit;
    background: var(--primary-soft);
    transform: translateX(-2px);
    box-shadow: var(--shadow-sm);
}
.compact-thumb {
    width: 110px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.compact-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}
.compact-dur {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    background: var(--surface-2);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    align-self: start;
    margin-top: 2px;
    white-space: nowrap;
}

.line-results { list-style: none; display: grid; gap: var(--space-3); }
.line-result-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    transition: all var(--t-fast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.line-result-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateX(-2px);
}
.line-link { display: block; color: inherit; }
.line-link:hover { color: inherit; }
.line-meta { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); flex-wrap: wrap; }
.ep-title { font-weight: 700; color: var(--text); flex: 1; font-size: 15px; }
.time-badge {
    background: var(--primary);
    color: var(--on-primary);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}
.line-text { color: var(--text-soft); line-height: 1.85; font-size: 15px; }
.yt-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-2);
    padding: 4px 10px;
    font-size: 13px;
    color: var(--yt);
    font-weight: 700;
    background: var(--yt-soft);
    border-radius: var(--radius-sm);
    transition: all var(--t-fast);
    width: fit-content;
}
.yt-link:hover {
    color: var(--yt-hover);
    gap: 10px;
    background: var(--yt-soft);
    transform: translateX(-2px);
}

mark {
    background: transparent;
    color: var(--gold-600);
    text-decoration: underline;
    text-decoration-color: var(--yt);
    text-decoration-thickness: 2.5px;
    text-underline-offset: 4px;
    font-weight: inherit;
    padding: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}
[data-theme="dark"] mark {
    color: var(--gold-300);
    text-decoration-color: var(--yt);
}

/* ============ Context lines (نتائج البحث) ============ */
.line-context {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--space-2);
}
.ctx-line {
    display: flex;
    gap: var(--space-3);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    line-height: 1.7;
    font-size: 14px;
    align-items: baseline;
}
.ctx-line.ctx-match {
    background: var(--primary-soft);
    border-right: 3px solid var(--primary);
    padding: 10px 14px;
    margin: 4px 0;
}
.ctx-time {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    min-width: 56px;
    flex-shrink: 0;
    opacity: 0.7;
    font-feature-settings: "tnum" 1;
}
.ctx-line.ctx-match .ctx-time {
    color: var(--primary);
    opacity: 1;
    font-weight: 700;
    font-size: 12px;
}
.ctx-text {
    flex: 1;
    color: var(--text-soft);
    font-size: 13.5px;
}
.ctx-line.ctx-match .ctx-text {
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
}

/* ============ Video Page ============ */
.video-page { padding: 0; }
.video-title {
    font-size: clamp(20px, 2.4vw, 28px);
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-6);
    line-height: 1.4;
    letter-spacing: -0.01em;
}
.video-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
}
.video-side {
    position: sticky;
    top: calc(var(--header-h) + var(--space-4));
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.video-embed iframe,
.video-embed > div,
.video-embed > div > iframe {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}
.video-meta {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-5);
    color: var(--text-soft);
    font-size: 14px;
}
.video-meta a { color: var(--primary); font-weight: 600; margin-inline-start: auto; }

/* ============ Transcript pane ============ */
.transcript-side {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h) - var(--space-10) * 2);
    min-height: 540px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.transcript-toolbar {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.tx-search {
    flex: 1;
    min-width: 0;
    padding: 9px 36px 9px 14px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: all var(--t-fast);
    font-family: inherit;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
}
.tx-search::placeholder { color: var(--muted); }
.tx-search:focus { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.tx-status {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    min-width: 64px;
    text-align: center;
    padding: 0 var(--space-2);
}
.tx-nav-btn, .tx-follow-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-2);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text);
    display: grid;
    place-items: center;
    transition: all var(--t-fast);
    flex-shrink: 0;
}
.tx-nav-btn:hover:not(:disabled),
.tx-follow-btn:hover {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}
.tx-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.tx-follow-btn { color: var(--accent); font-weight: 800; }
.tx-follow-btn[aria-pressed="true"] {
    background: var(--accent);
    color: var(--ink-900);
    border-color: var(--accent);
}
[data-theme="dark"] .tx-follow-btn[aria-pressed="true"] { color: var(--ink-950); }
.tx-follow-btn.off {
    background: var(--surface);
    color: var(--muted);
    border-color: var(--border-2);
}

.transcript {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    scroll-behavior: smooth;
}
.transcript::-webkit-scrollbar { width: 8px; }
.transcript::-webkit-scrollbar-track { background: transparent; }
.transcript::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
.transcript::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.transcript li {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--t-fast);
    margin-bottom: 2px;
    border-right: 3px solid transparent;
}
.transcript li:hover { background: var(--primary-soft); }
.transcript li.match {
    background: var(--accent-soft);
    border-right-color: var(--gold-300);
}
.transcript li.current-match {
    background: var(--accent-soft);
    border-right-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.transcript li.active {
    background: var(--primary-soft);
    border-right-color: var(--primary);
    font-weight: 600;
}
.transcript li.active .text { color: var(--primary); }
.transcript li.highlight-line {
    background: var(--accent-soft);
    border-right-color: var(--accent);
}

.transcript .time {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    min-width: 64px;
    text-align: center;
    user-select: none;
    background: var(--surface);
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    height: fit-content;
    flex-shrink: 0;
}
.transcript li.active .time {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}
.transcript .text { flex: 1; line-height: 1.85; color: var(--text); font-size: 15px; }

/* ============ Empty / Footer / Content toolbar ============ */
.empty {
    background: var(--surface);
    border: 1px dashed var(--border-2);
    padding: var(--space-12) var(--space-6);
    text-align: center;
    border-radius: var(--radius-lg);
    color: var(--muted);
    font-size: 15px;
}
.empty code {
    background: var(--surface-2);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-family: "Menlo", "Consolas", monospace;
    font-size: 13px;
}

.site-footer {
    margin-top: var(--space-16);
    padding: var(--space-8) var(--space-6);
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    text-align: start;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.footer-brand strong { color: var(--text); display: block; font-size: 15px; }
.footer-brand small { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }
.footer-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--royal-700), var(--royal-900));
    color: #fff;
    font-weight: 800;
    font-size: 22px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.footer-mission {
    color: var(--muted);
    font-size: 13px;
    max-width: 720px;
    line-height: 1.8;
    text-align: start;
}

.content-toolbar {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-5);
    box-shadow: var(--shadow-xs);
}
.content-toolbar .filter-input {
    flex: 1;
    min-width: 240px;
    padding: 10px 16px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    font-size: 15px;
    background: var(--surface);
    color: var(--text);
    transition: all var(--t-fast);
    font-family: inherit;
    outline: none;
}
.content-toolbar .filter-input::placeholder { color: var(--muted); }
.content-toolbar .filter-input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.content-toolbar .total {
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 14px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

/* ============ Splash screen ============ */
.splash-screen {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, var(--primary-soft) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, var(--accent-soft) 0%, transparent 40%),
        var(--bg);
    z-index: 9999;
    display: grid;
    place-items: center;
    transition: opacity 0.5s ease;
}
.splash-screen.fade-out { opacity: 0; pointer-events: none; }

.splash-content {
    text-align: center;
    padding: var(--space-6);
    animation: splashPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.splash-logo {
    width: 96px;
    height: 96px;
    background: linear-gradient(135deg, var(--royal-600) 0%, var(--royal-900) 100%);
    color: #fff;
    border-radius: 24px;
    font-size: 56px;
    font-weight: 800;
    display: grid;
    place-items: center;
    margin: 0 auto var(--space-5);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: splashLogoFloat 2s ease-in-out infinite;
}

.splash-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}
.splash-subtitle {
    color: var(--text-soft);
    font-size: 14px;
    margin-bottom: var(--space-6);
}
.splash-progress {
    width: 240px;
    height: 4px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin: 0 auto var(--space-6);
}
.splash-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--royal-500), var(--royal-700), var(--royal-500));
    background-size: 200% 100%;
    width: 0;
    border-radius: 999px;
    animation: splashFill 1.5s ease-out forwards, splashShimmer 1s linear infinite;
}
.splash-by {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

#auth-shell { transition: opacity 0.5s ease; }

@keyframes splashPop {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes splashFill {
    from { width: 0; }
    to { width: 100%; }
}
@keyframes splashShimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}
@keyframes splashLogoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ============ Auth pages (login + admin) ============ */
.auth-body {
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background-image:
        radial-gradient(circle at 20% 20%, var(--primary-soft) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, var(--accent-soft) 0%, transparent 40%);
}
.auth-shell {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    animation: fadeIn 0.4s ease-out;
}
.admin-shell { max-width: 800px; }
.auth-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-10) var(--space-8);
    box-shadow: var(--shadow-lg);
}
.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}
.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    border-radius: 16px;
    background: linear-gradient(135deg, var(--royal-600) 0%, var(--royal-900) 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 36px;
    font-weight: 800;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.auth-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-2);
}
.auth-header p {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.6;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}
.field input {
    padding: 12px 16px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: all var(--t-fast);
}
.field input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.field input::placeholder { color: var(--muted); }

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 15px;
    margin-top: var(--space-2);
}
.auth-error {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
[data-theme="dark"] .auth-error {
    background: rgba(248, 113, 113, 0.1);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.25);
}

.auth-footer {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.auth-admin-link {
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}
.auth-admin-link:hover { color: var(--primary); }

/* === Loader (download progress) === */
.auth-loader {
    text-align: center;
    padding: var(--space-4) 0;
}
.spinner-lg {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-4);
}
.loader-msg {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-4);
}
.progress-track {
    height: 10px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin: var(--space-3) 0;
}
.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--royal-500), var(--royal-700));
    border-radius: 999px;
    transition: width 0.2s ease;
    box-shadow: 0 0 10px var(--primary-soft);
}
.loader-detail {
    font-size: 13px;
    color: var(--text-soft);
    margin-top: var(--space-2);
    font-feature-settings: "tnum" 1;
}
.loader-pct {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin-top: var(--space-2);
    font-feature-settings: "tnum" 1;
}

/* === Admin panel === */
.admin-panel {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}
.admin-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}
.admin-header p { color: var(--muted); font-size: 13px; }
.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text);
}
.admin-section {
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--border);
}
.admin-section:last-child { border-bottom: none; }
.admin-section h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-4);
}
.admin-section-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.admin-section-head h2 { margin-bottom: 0; }
.users-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.user-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--t-fast);
}
.user-row:hover { border-color: var(--primary); }
.user-icon { font-size: 18px; }
.user-name {
    flex: 1;
    font-weight: 600;
    color: var(--text);
    font-family: "Menlo", "Consolas", monospace;
}
.user-del {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-2);
    background: var(--surface);
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all var(--t-fast);
}
.user-del:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.admin-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}
.save-section { background: var(--primary-soft); margin: 0 calc(-1 * var(--space-8)) calc(-1 * var(--space-8)); padding: var(--space-6) var(--space-8); border-radius: 0 0 var(--radius-xl) var(--radius-xl); border: none; }
.save-note {
    color: var(--text-soft);
    font-size: 13px;
    margin-bottom: var(--space-4);
    line-height: 1.7;
}
.save-note code {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--primary);
    font-family: "Menlo", "Consolas", monospace;
    font-size: 12px;
}
.big-btn { padding: 14px 24px; font-size: 15px; }
.save-status {
    margin-top: var(--space-3);
    padding: 10px 14px;
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
[data-theme="dark"] .save-status { color: #4ade80; }

/* === User chip in header === */
.user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    height: 38px;
}
.user-chip-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    font-family: "Menlo", "Consolas", monospace;
}
.user-chip-logout {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: all var(--t-fast);
}
.user-chip-logout:hover { background: #dc2626; color: #fff; }
@media (max-width: 600px) {
    .user-chip-name { display: none; }
    .user-chip { padding: 4px; }
}

/* ============ Search Dashboard ============ */
.search-dashboard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow);
    background-image:
        radial-gradient(circle at 0% 0%, var(--primary-soft) 0%, transparent 45%),
        radial-gradient(circle at 100% 100%, var(--accent-soft) 0%, transparent 45%);
    position: relative;
    overflow: hidden;
}
.search-dashboard::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--royal-700), var(--gold-500), #14b8a6, #a855f7);
}
.dashboard-title {
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-5);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.dashboard-q {
    color: var(--primary);
    background: var(--surface);
    padding: 4px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--primary-tint);
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
}
@media (max-width: 700px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-3);
    text-align: center;
    transition: all var(--t);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.sd-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto var(--space-3);
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.sd-num {
    font-size: 28px;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
    font-feature-settings: "tnum" 1;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-2);
}
.sd-lbl {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.sd-1::after { background: linear-gradient(90deg, var(--royal-500), var(--royal-700)); }
.sd-1 .sd-icon { background: linear-gradient(135deg, var(--royal-500), var(--royal-700)); }

.sd-2::after { background: linear-gradient(90deg, #f59e0b, #ca8a04); }
.sd-2 .sd-icon { background: linear-gradient(135deg, #f59e0b, #ca8a04); }

.sd-3::after { background: linear-gradient(90deg, #10b981, #047857); }
.sd-3 .sd-icon { background: linear-gradient(135deg, #10b981, #047857); }

.sd-4::after { background: linear-gradient(90deg, #a855f7, #7c3aed); }
.sd-4 .sd-icon { background: linear-gradient(135deg, #a855f7, #7c3aed); }

[data-theme="dark"] .stat-card {
    background: var(--surface-2);
}
[data-theme="dark"] .dashboard-q {
    background: var(--surface-2);
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: var(--space-6);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.pg-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-2);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all var(--t-fast);
    font-family: inherit;
}
.pg-btn:hover:not(:disabled):not(.active) {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}
.pg-btn.active {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
    cursor: default;
}
.pg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pg-nav { padding: 0 14px; }
.pg-ellipsis {
    color: var(--muted);
    padding: 0 6px;
    font-weight: 700;
    user-select: none;
}
.pg-info {
    margin-inline-start: auto;
    color: var(--muted);
    font-size: 13px;
    padding: 0 var(--space-3);
}
@media (max-width: 600px) {
    .pg-info { width: 100%; text-align: center; margin: var(--space-2) 0 0; }
    .pg-nav { padding: 0 10px; font-size: 13px; }
}

/* ============ Search loading state ============ */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-soft);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: var(--space-6);
}
.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

main { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .video-layout { grid-template-columns: 1fr; }
    .video-side { position: static; }
    .transcript-side { height: 600px; }
}

@media (max-width: 880px) {
    .header-inner { grid-template-columns: auto 1fr auto; gap: var(--space-3); }
    .main-nav { padding: 3px; }
    .nav-link { padding: 6px 12px; font-size: 13px; }
    .search-form { display: none; }
}

@media (max-width: 600px) {
    :root { --header-h: 64px; }
    .header-inner { padding: 0 var(--space-3); }
    .logo-text { display: none; }
    .container { padding: var(--space-6) var(--space-4); }
    .hero { padding: var(--space-10) var(--space-5); }
    .hero h1 { font-size: 26px; }
    .stats { gap: var(--space-2); }
    .stat { padding: var(--space-3) var(--space-2); }
    .stat .num { font-size: 18px; }
    .stat .lbl { font-size: 11px; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
    .card-body h3 { font-size: 13px; min-height: 38px; }
    .transcript-side { height: 500px; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 22px; }
    .hero p { font-size: 14px; }
    .hero-search input { padding: 14px 50px 14px 18px; font-size: 15px; }
    .hero-search::before { width: 18px; height: 18px; inset-inline-end: 16px; }
}
