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

:root {
  /* ── Premium Streaming — warm carbon blacks, aged cream, burnished gold ── */
  --bg: #0C0B0A;
  --surface: #141210;
  --surface2: #1D1B18;
  --surface3: #262320;
  --border: rgba(255,246,232,0.065);
  --border-hover: rgba(255,246,232,0.13);
  --text: #F2EEE9;
  --text-dim: #ADA8A2;
  --text-muted: #7A7570;
  --accent: #c9a84c;
  --accent-soft: #d4b562;
  --accent-dim: rgba(201,168,76,0.15);
  --accent-glow: rgba(201,168,76,0.4);
  --surface-tint: transparent;
  --highlight: #ECE5DC;
  --bg-sidebar: var(--surface);
  --red: #e05c5c;
  --blue: #5c9be0;
  --blue-dim: rgba(92,155,224,0.15);
  --green: #5cb87a;
  --green-dim: rgba(92,184,122,0.15);
  --purple: #9b7fe8;
  --purple-dim: rgba(155,127,232,0.15);
  --radius: 6px;
  --radius-lg: 12px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
  --surface-shine: rgba(255,248,232,0.04);
  --vignette-opacity: 0.44;
  --shadow-card: 0 2px 12px rgba(6,4,2,0.45), 0 1px 3px rgba(6,4,2,0.28);
  --shadow-card-hover: 0 22px 62px rgba(4,2,0,0.76), 0 6px 22px rgba(6,4,2,0.42);
  --shadow-modal: 0 32px 96px rgba(3,2,0,0.86), 0 12px 36px rgba(6,4,2,0.50);
  --shadow-sidebar: 2px 0 24px rgba(4,2,0,0.40);
  --shadow-topbar: 0 1px 0 var(--border), 0 6px 28px rgba(4,2,0,0.28);
}

:root.light-mode {
  /* ── Default light — warm stone, natural parchment ── */
  --bg: #FAF8F5;
  --surface: #EDEAE4;
  --surface2: #E2DDD6;
  --surface3: #D5CEC5;
  --border: rgba(30,22,10,0.11);
  --border-hover: rgba(30,22,10,0.21);
  --text: #28221A;
  --text-dim: #4A4438;
  --text-muted: #6A6254;
  --accent: #9a7209;
  --accent-dim: rgba(154,114,9,0.15);
  --accent-glow: rgba(154,114,9,0.35);
  --red: #c43838;
  --blue: #3a6d94;
  --blue-dim: rgba(58,109,148,0.15);
  --green: #3a8a4e;
  --green-dim: rgba(58,138,78,0.15);
  --purple: #6a4aad;
  --purple-dim: rgba(106,74,173,0.15);
  --surface-shine: rgba(255,252,244,0.60);
  --vignette-opacity: 0.05;
  --shadow-card: 0 2px 8px rgba(20,14,4,0.09), 0 1px 3px rgba(20,14,4,0.05);
  --shadow-card-hover: 0 10px 34px rgba(20,14,4,0.14), 0 4px 12px rgba(20,14,4,0.08);
  --shadow-modal: 0 16px 52px rgba(20,14,4,0.14), 0 6px 22px rgba(20,14,4,0.08);
  --shadow-sidebar: 2px 0 12px rgba(20,14,4,0.07);
  --shadow-topbar: 0 1px 0 var(--border), 0 4px 16px rgba(20,14,4,0.06);
}

/* ===== VAULT THEMES ===== */

/* ── Earthy: Editorial / Tobacco Library — cognac, burnished copper, aged parchment ── */
body[data-theme="earthy"] {
  --bg: #130E09;
  --bg-sidebar: #191209;
  --surface: #201610;
  --surface2: #2C1E14;
  --surface3: #38271A;
  --border: rgba(255,210,140,0.07);
  --border-hover: rgba(255,210,140,0.15);
  --accent: #C27A38;
  --accent-soft: #DA9F60;
  --accent-dim: rgba(194,122,56,0.14);
  --accent-glow: rgba(194,122,56,0.40);
  --surface-tint: transparent;
  --highlight: #E8D0A0;
  --surface-shine: rgba(255,212,130,0.035);
  --vignette-opacity: 0.50;
  --shadow-card: 0 2px 12px rgba(10,5,0,0.50), 0 1px 3px rgba(10,5,0,0.30);
  --shadow-card-hover: 0 22px 62px rgba(8,4,0,0.76), 0 6px 22px rgba(10,5,0,0.44);
  --shadow-modal: 0 32px 96px rgba(6,2,0,0.88), 0 12px 36px rgba(10,5,0,0.52);
  --shadow-sidebar: 2px 0 24px rgba(6,2,0,0.42);
  --shadow-topbar: 0 1px 0 var(--border), 0 6px 28px rgba(6,2,0,0.28);
}

/* ── Beachy: Deep Ocean Gallery — abyssal teal, luminous seafoam, sea-glass silver ── */
body[data-theme="beachy"] {
  --bg: #091316;
  --bg-sidebar: #0C1A1E;
  --surface: #112228;
  --surface2: #172D36;
  --surface3: #1D3842;
  --border: rgba(178,238,246,0.065);
  --border-hover: rgba(178,238,246,0.13);
  --accent: #38BCC4;
  --accent-soft: #7AD8DC;
  --accent-dim: rgba(56,188,196,0.13);
  --accent-glow: rgba(56,188,196,0.42);
  --surface-tint: transparent;
  --highlight: #B8EEF2;
  --surface-shine: rgba(138,226,238,0.035);
  --vignette-opacity: 0.48;
  --shadow-card: 0 2px 12px rgba(0,8,12,0.48), 0 1px 3px rgba(0,8,12,0.30);
  --shadow-card-hover: 0 22px 62px rgba(0,6,10,0.78), 0 6px 22px rgba(0,8,12,0.44);
  --shadow-modal: 0 32px 96px rgba(0,4,8,0.90), 0 12px 36px rgba(0,8,12,0.54);
  --shadow-sidebar: 2px 0 24px rgba(0,4,8,0.44);
  --shadow-topbar: 0 1px 0 var(--border), 0 6px 28px rgba(0,4,8,0.30);
}

/* ── Space: Cinema Screening Room — film-black, projection violet, 70mm atmosphere ── */
body[data-theme="space"] {
  --bg: #080912;
  --bg-sidebar: #0C0E1C;
  --surface: #0F122A;
  --surface2: #161936;
  --surface3: #1D2042;
  --border: rgba(196,190,255,0.065);
  --border-hover: rgba(196,190,255,0.13);
  --accent: #7C6EE8;
  --accent-soft: #A898F2;
  --accent-dim: rgba(124,110,232,0.14);
  --accent-glow: rgba(124,110,232,0.44);
  --surface-tint: transparent;
  --highlight: #D0CCFA;
  --surface-shine: rgba(174,166,255,0.04);
  --vignette-opacity: 0.52;
  --shadow-card: 0 2px 12px rgba(4,3,12,0.52), 0 1px 3px rgba(4,3,12,0.32);
  --shadow-card-hover: 0 22px 62px rgba(3,2,10,0.82), 0 6px 22px rgba(4,3,12,0.48);
  --shadow-modal: 0 32px 96px rgba(2,1,8,0.92), 0 12px 36px rgba(4,3,12,0.56);
  --shadow-sidebar: 2px 0 24px rgba(2,1,8,0.48);
  --shadow-topbar: 0 1px 0 var(--border), 0 6px 28px rgba(2,1,8,0.32);
}

/* ===== LIGHT THEMES (fully self-contained) ===== */

/* ── Ivory: Cinema Lobby — amber projection warmth, aged cream, brass hardware ── */
body[data-theme="ivory"] {
  --bg: #FAF5EC;
  --bg-sidebar: #F1E9D8;
  --surface: #EDE2CE;
  --surface2: #E2D5BC;
  --surface3: #D5C6A8;
  --border: rgba(82,55,18,0.09);
  --border-hover: rgba(82,55,18,0.19);
  --text: #1C160D;
  --text-dim: #4A3E2A;
  --text-muted: #7E6C50;
  --accent: #9E7530;
  --accent-soft: #C49852;
  --accent-dim: rgba(158,117,48,0.13);
  --accent-glow: rgba(158,117,48,0.32);
  --surface-tint: transparent;
  --highlight: #F6E8C6;
  --red: #C0392B; --blue: #2E6DA4; --green: #27734A; --purple: #7B52A6;
  --blue-dim: rgba(46,109,164,0.14);
  --green-dim: rgba(39,115,74,0.14);
  --purple-dim: rgba(123,82,166,0.14);
  --surface-shine: rgba(255,244,218,0.62);
  --vignette-opacity: 0.07;
  --shadow-card: 0 2px 8px rgba(62,40,8,0.10), 0 1px 3px rgba(62,40,8,0.06);
  --shadow-card-hover: 0 10px 34px rgba(62,40,8,0.16), 0 4px 12px rgba(62,40,8,0.10);
  --shadow-modal: 0 16px 52px rgba(62,40,8,0.16), 0 6px 22px rgba(62,40,8,0.10);
  --shadow-sidebar: 2px 0 12px rgba(62,40,8,0.09);
  --shadow-topbar: 0 1px 0 var(--border), 0 4px 16px rgba(62,40,8,0.06);
}

/* ── Paper: Editorial Magazine — matte newsprint, ink-black type, print silence ── */
body[data-theme="paper"] {
  --bg: #F5F0E6;
  --bg-sidebar: #EDE5D4;
  --surface: #E5DDD0;
  --surface2: #D9D0C0;
  --surface3: #CCC2AE;
  --border: rgba(44,32,14,0.09);
  --border-hover: rgba(44,32,14,0.18);
  --text: #181310;
  --text-dim: #4A4038;
  --text-muted: #7C7062;
  --accent: #6C4C24;
  --accent-soft: #9A7248;
  --accent-dim: rgba(108,76,36,0.13);
  --accent-glow: rgba(108,76,36,0.28);
  --surface-tint: transparent;
  --highlight: #EAE0CC;
  --red: #B83030; --blue: #2A5F8A; --green: #246640; --purple: #70489A;
  --blue-dim: rgba(42,95,138,0.14);
  --green-dim: rgba(36,102,64,0.14);
  --purple-dim: rgba(112,72,154,0.14);
  --surface-shine: rgba(255,250,238,0.58);
  --vignette-opacity: 0.06;
  --shadow-card: 0 2px 8px rgba(44,32,8,0.09), 0 1px 3px rgba(44,32,8,0.05);
  --shadow-card-hover: 0 10px 34px rgba(44,32,8,0.15), 0 4px 12px rgba(44,32,8,0.09);
  --shadow-modal: 0 16px 52px rgba(44,32,8,0.15), 0 6px 22px rgba(44,32,8,0.09);
  --shadow-sidebar: 2px 0 12px rgba(44,32,8,0.08);
  --shadow-topbar: 0 1px 0 var(--border), 0 4px 16px rgba(44,32,8,0.06);
}

/* ── Sand: Desert Atelier — noon dune light, hammered gold, terracotta shadow ── */
body[data-theme="sand"] {
  --bg: #FAF2E0;
  --bg-sidebar: #F0E6CC;
  --surface: #E8D9BA;
  --surface2: #DDD0A8;
  --surface3: #CEC090;
  --border: rgba(90,60,8,0.10);
  --border-hover: rgba(90,60,8,0.21);
  --text: #1E1806;
  --text-dim: #504228;
  --text-muted: #8A7848;
  --accent: #C47C18;
  --accent-soft: #E09F40;
  --accent-dim: rgba(196,124,24,0.13);
  --accent-glow: rgba(196,124,24,0.34);
  --surface-tint: transparent;
  --highlight: #F2DFA8;
  --red: #C43030; --blue: #2E6898; --green: #2A6E42; --purple: #7050A2;
  --blue-dim: rgba(46,104,152,0.14);
  --green-dim: rgba(42,110,66,0.14);
  --purple-dim: rgba(112,80,162,0.14);
  --surface-shine: rgba(255,246,210,0.58);
  --vignette-opacity: 0.08;
  --shadow-card: 0 2px 8px rgba(72,48,4,0.11), 0 1px 3px rgba(72,48,4,0.06);
  --shadow-card-hover: 0 10px 34px rgba(72,48,4,0.17), 0 4px 12px rgba(72,48,4,0.10);
  --shadow-modal: 0 16px 52px rgba(72,48,4,0.17), 0 6px 22px rgba(72,48,4,0.10);
  --shadow-sidebar: 2px 0 12px rgba(72,48,4,0.09);
  --shadow-topbar: 0 1px 0 var(--border), 0 4px 16px rgba(72,48,4,0.07);
}

/* ── Pearl: Contemporary Gallery — museum plaster, cool architectural white, gallery violet ── */
body[data-theme="pearl"] {
  --bg: #F5F4F9;
  --bg-sidebar: #ECEAF4;
  --surface: #E3E1EE;
  --surface2: #D7D5E6;
  --surface3: #C8C5D8;
  --border: rgba(22,18,50,0.09);
  --border-hover: rgba(22,18,50,0.18);
  --text: #12101E;
  --text-dim: #3C3852;
  --text-muted: #70688C;
  --accent: #524496;
  --accent-soft: #7E70C4;
  --accent-dim: rgba(82,68,150,0.13);
  --accent-glow: rgba(82,68,150,0.28);
  --surface-tint: transparent;
  --highlight: #E0DCF6;
  --red: #BA3838; --blue: #3A6AAA; --green: #2E7850; --purple: #524496;
  --blue-dim: rgba(58,106,170,0.14);
  --green-dim: rgba(46,120,80,0.14);
  --purple-dim: rgba(82,68,150,0.14);
  --surface-shine: rgba(248,246,255,0.65);
  --vignette-opacity: 0.05;
  --shadow-card: 0 2px 8px rgba(18,12,40,0.09), 0 1px 3px rgba(18,12,40,0.05);
  --shadow-card-hover: 0 10px 34px rgba(18,12,40,0.14), 0 4px 12px rgba(18,12,40,0.08);
  --shadow-modal: 0 16px 52px rgba(18,12,40,0.14), 0 6px 22px rgba(18,12,40,0.08);
  --shadow-sidebar: 2px 0 12px rgba(18,12,40,0.07);
  --shadow-topbar: 0 1px 0 var(--border), 0 4px 16px rgba(18,12,40,0.05);
}

/* ── Mist: Premium Streaming Light — overcast glass, streaming cobalt, digital clarity ── */
body[data-theme="mist"] {
  --bg: #EEF1F6;
  --bg-sidebar: #E5E9F2;
  --surface: #D9DEE9;
  --surface2: #CDD4E2;
  --surface3: #BEC7D6;
  --border: rgba(14,22,50,0.09);
  --border-hover: rgba(14,22,50,0.18);
  --text: #0E1620;
  --text-dim: #384054;
  --text-muted: #68758C;
  --accent: #2A66B2;
  --accent-soft: #4C88D4;
  --accent-dim: rgba(42,102,178,0.13);
  --accent-glow: rgba(42,102,178,0.30);
  --surface-tint: transparent;
  --highlight: #CCE0F6;
  --red: #B83636; --blue: #2A66B2; --green: #2C7848; --purple: #6A5498;
  --blue-dim: rgba(42,102,178,0.14);
  --green-dim: rgba(44,120,72,0.14);
  --purple-dim: rgba(106,84,152,0.14);
  --surface-shine: rgba(240,246,255,0.60);
  --vignette-opacity: 0.05;
  --shadow-card: 0 2px 8px rgba(10,18,44,0.09), 0 1px 3px rgba(10,18,44,0.05);
  --shadow-card-hover: 0 10px 34px rgba(10,18,44,0.14), 0 4px 12px rgba(10,18,44,0.08);
  --shadow-modal: 0 16px 52px rgba(10,18,44,0.14), 0 6px 22px rgba(10,18,44,0.08);
  --shadow-sidebar: 2px 0 12px rgba(10,18,44,0.07);
  --shadow-topbar: 0 1px 0 var(--border), 0 4px 16px rgba(10,18,44,0.05);
}

/* ── Studio: Design Studio — absolute white, precision gray, monochrome ink ── */
body[data-theme="studio"] {
  --bg: #FEFEFE;
  --bg-sidebar: #F4F4F4;
  --surface: #ECECEC;
  --surface2: #E0E0E0;
  --surface3: #D2D2D2;
  --border: rgba(0,0,0,0.09);
  --border-hover: rgba(0,0,0,0.18);
  --text: #0A0A0A;
  --text-dim: #404040;
  --text-muted: #747474;
  --accent: #1A1A1A;
  --accent-soft: #4A4A4A;
  --accent-dim: rgba(26,26,26,0.10);
  --accent-glow: rgba(26,26,26,0.22);
  --surface-tint: transparent;
  --highlight: #EEEEEE;
  --red: #C03030; --blue: #2A5C96; --green: #246B3C; --purple: #6A4AAE;
  --blue-dim: rgba(42,92,150,0.14);
  --green-dim: rgba(36,107,60,0.14);
  --purple-dim: rgba(106,74,174,0.14);
  --surface-shine: rgba(255,255,255,0.70);
  --vignette-opacity: 0.04;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 10px 34px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.07);
  --shadow-modal: 0 16px 52px rgba(0,0,0,0.12), 0 6px 22px rgba(0,0,0,0.07);
  --shadow-sidebar: 2px 0 12px rgba(0,0,0,0.06);
  --shadow-topbar: 0 1px 0 var(--border), 0 4px 16px rgba(0,0,0,0.04);
}

/* ===== CONTRAST SYSTEM ===== */
/* Balanced = defaults defined in :root / body[data-theme] — no attribute needed */

/* --- Dark base (default + earthy/beachy/space inherit text from :root) --- */
html[data-contrast="soft"] {
  --text: #c8c4bf;
  --text-dim: #8a8682;
  --text-muted: #606060;
  --border: rgba(255,255,255,0.045);
  --border-hover: rgba(255,255,255,0.09);
}
html[data-contrast="high"] {
  --text: #FDFCFA;
  --text-dim: #cec9c2;
  --text-muted: #aaa49c;
  --border: rgba(255,255,255,0.14);
  --border-hover: rgba(255,255,255,0.28);
}
/* --- Default light mode --- */
html.light-mode[data-contrast="soft"] {
  --text: #4A4640;
  --text-dim: #6E6860;
  --text-muted: #908880;
  --border: rgba(0,0,0,0.07);
  --border-hover: rgba(0,0,0,0.13);
}
html.light-mode[data-contrast="high"] {
  --text: #0E0C0A;
  --text-dim: #302C28;
  --text-muted: #504C46;
  --border: rgba(0,0,0,0.18);
  --border-hover: rgba(0,0,0,0.32);
}
/* --- Ivory --- */
html[data-contrast="soft"] body[data-theme="ivory"] {
  --text: #3E3828; --text-dim: #665E4A; --text-muted: #9A8E78;
  --border: rgba(82,55,18,0.07); --border-hover: rgba(82,55,18,0.13);
}
html[data-contrast="high"] body[data-theme="ivory"] {
  --text: #0A0804; --text-dim: #2A2216; --text-muted: #5C5040;
  --border: rgba(82,55,18,0.18); --border-hover: rgba(82,55,18,0.34);
}
/* --- Paper --- */
html[data-contrast="soft"] body[data-theme="paper"] {
  --text: #3C3830; --text-dim: #645E54; --text-muted: #938880;
  --border: rgba(44,32,14,0.07); --border-hover: rgba(44,32,14,0.13);
}
html[data-contrast="high"] body[data-theme="paper"] {
  --text: #080604; --text-dim: #2A2620; --text-muted: #5A5448;
  --border: rgba(44,32,14,0.18); --border-hover: rgba(44,32,14,0.32);
}
/* --- Sand --- */
html[data-contrast="soft"] body[data-theme="sand"] {
  --text: #403A22; --text-dim: #6A6238; --text-muted: #9A8C62;
  --border: rgba(90,60,8,0.07); --border-hover: rgba(90,60,8,0.14);
}
html[data-contrast="high"] body[data-theme="sand"] {
  --text: #0A0800; --text-dim: #302A10; --text-muted: #605436;
  --border: rgba(90,60,8,0.19); --border-hover: rgba(90,60,8,0.34);
}
/* --- Pearl --- */
html[data-contrast="soft"] body[data-theme="pearl"] {
  --text: #363248; --text-dim: #5E5A74; --text-muted: #908CA2;
  --border: rgba(22,18,50,0.07); --border-hover: rgba(22,18,50,0.13);
}
html[data-contrast="high"] body[data-theme="pearl"] {
  --text: #080614; --text-dim: #26223A; --text-muted: #545068;
  --border: rgba(22,18,50,0.18); --border-hover: rgba(22,18,50,0.32);
}
/* --- Mist --- */
html[data-contrast="soft"] body[data-theme="mist"] {
  --text: #303848; --text-dim: #586474; --text-muted: #8692A4;
  --border: rgba(14,22,50,0.07); --border-hover: rgba(14,22,50,0.13);
}
html[data-contrast="high"] body[data-theme="mist"] {
  --text: #060C14; --text-dim: #1E2632; --text-muted: #4C5866;
  --border: rgba(14,22,50,0.18); --border-hover: rgba(14,22,50,0.32);
}
/* --- Studio --- */
html[data-contrast="soft"] body[data-theme="studio"] {
  --text: #2E2E2E; --text-dim: #5A5A5A; --text-muted: #8A8A8A;
  --border: rgba(0,0,0,0.07); --border-hover: rgba(0,0,0,0.13);
}
html[data-contrast="high"] body[data-theme="studio"] {
  --text: #000000; --text-dim: #181818; --text-muted: #484848;
  --border: rgba(0,0,0,0.22); --border-hover: rgba(0,0,0,0.40);
}

/* ===== CONTRAST SLIDER ===== */
.contrast-slider-wrap { padding: 2px 0; }
input[type="range"].contrast-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px; border-radius: 2px;
  background: linear-gradient(to right, var(--surface3), var(--accent));
  outline: none; cursor: pointer; display: block; margin: 10px 0 8px;
}
input[type="range"].contrast-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  box-shadow: 0 0 0 3px var(--accent-dim); cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
input[type="range"].contrast-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18); box-shadow: 0 0 0 5px var(--accent-dim);
}
input[type="range"].contrast-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); cursor: pointer;
}
.contrast-track-labels {
  display: flex; justify-content: space-between;
  font-family: 'DM Mono', monospace; font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
  user-select: none;
}
.contrast-track-labels span { transition: color var(--transition); cursor: pointer; }
.contrast-track-labels span.clabel-active { color: var(--accent); }

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; font-weight: 300; font-size: 16px; min-height: 100vh; overflow-x: hidden; }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}
/* Cinematic vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 52%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 9998;
  opacity: var(--vignette-opacity);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* ===== AUTH SCREEN ===== */
#auth-container {
  width: 100%;
  min-height: 100vh;
}

.auth-screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0908;
  position: relative;
  overflow: hidden;
  padding: 40px 20px;
}

.auth-grain {
  position: absolute;
  inset: 0;
  opacity: 0;
  display: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  background: linear-gradient(165deg, rgba(25,23,20,0.95) 0%, rgba(15,14,12,0.98) 100%);
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: 20px;
  padding: 56px 40px 44px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03),
    0 25px 60px rgba(0,0,0,0.5),
    0 0 120px rgba(201,168,76,0.04);
  backdrop-filter: blur(20px);
  animation: authCardIn 0.8s ease both;
}

@keyframes authCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo-word {
  font-family: 'Playfair Display', serif;
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #f5f0e8;
  display: block;
  line-height: 1;
  text-shadow: 0 2px 20px rgba(201,168,76,0.15);
}

.auth-logo-sub {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: rgba(201,168,76,0.6);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-top: 8px;
  display: block;
}

.auth-logo-line {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.4), transparent);
  margin: 20px auto 0;
}

.auth-tagline {
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: rgba(245,240,232,0.35);
  letter-spacing: 0.04em;
  margin-bottom: 36px;
}

.auth-footer-text {
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(201,168,76,0.25);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 32px;
}

/* Override FirebaseUI styles to match theme */
#auth-container .firebaseui-container {
  max-width: 100% !important;
  font-family: 'DM Sans', sans-serif !important;
}

#auth-container .firebaseui-card-content {
  padding: 0 !important;
}

#auth-container .firebaseui-card-header {
  display: none !important;
}

#auth-container .firebaseui-card-actions {
  padding: 0 !important;
}

#auth-container .mdl-button--raised.mdl-button--colored {
  background: linear-gradient(135deg, rgba(201,168,76,0.9) 0%, rgba(180,140,50,0.9) 100%) !important;
  color: #0a0908 !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  letter-spacing: 0.04em !important;
  border-radius: 10px !important;
  padding: 12px 24px !important;
  box-shadow: 0 4px 20px rgba(201,168,76,0.2) !important;
  transition: all 0.3s ease !important;
}

#auth-container .mdl-button--raised.mdl-button--colored:hover {
  box-shadow: 0 6px 30px rgba(201,168,76,0.35) !important;
  transform: translateY(-1px);
}

#auth-container .firebaseui-idp-button {
  border-radius: 10px !important;
  padding: 12px 16px !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  transition: all 0.3s ease !important;
  max-width: 100% !important;
}

#auth-container .firebaseui-idp-button:hover {
  background: rgba(255,255,255,0.1) !important;
  border-color: rgba(201,168,76,0.2) !important;
}

#auth-container .firebaseui-idp-text {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  color: #f5f0e8 !important;
}

#auth-container .firebaseui-input,
#auth-container .firebaseui-input-invalid {
  background: rgba(255,255,255,0.04) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-radius: 8px !important;
  color: #f5f0e8 !important;
  font-family: 'DM Sans', sans-serif !important;
  padding: 12px 14px !important;
}

#auth-container .firebaseui-label {
  color: rgba(245,240,232,0.5) !important;
  font-family: 'DM Mono', monospace !important;
  font-size: 11px !important;
  letter-spacing: 0.08em !important;
}

#auth-container .firebaseui-link {
  color: rgba(201,168,76,0.7) !important;
}

#auth-container .firebaseui-form-actions .mdl-button--primary {
  color: rgba(201,168,76,0.8) !important;
}

#auth-container .firebaseui-tos {
  color: rgba(245,240,232,0.25) !important;
  font-size: 11px !important;
}

#auth-container .firebaseui-tos a {
  color: rgba(201,168,76,0.5) !important;
}

/* ── Floating poster halo ── */
.auth-posters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-poster {
  position: absolute;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  will-change: transform, opacity;
  backface-visibility: hidden;
  animation: posterIn 1s ease both;
  animation-delay: var(--d, 0s);
  pointer-events: auto;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.4s ease;
}

.auth-poster:hover {
  transform: scale(1.08) rotate(0deg) !important;
  box-shadow: 0 8px 40px rgba(201,168,76,0.15), 0 0 20px rgba(201,168,76,0.08);
  z-index: 5 !important;
}

.auth-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes posterIn {
  from { opacity: 0; transform: scale(0.85) rotate(var(--r, 0deg)); }
  to   { opacity: var(--op, 0.2); transform: scale(1) rotate(var(--r, 0deg)); }
}

/* ── Drift keyframes ── */

/* Front — gentle wide orbit */
@keyframes driftFront {
  0%   { transform: translate3d(0, 0, 0)       rotate(var(--r, 0deg)); }
  25%  { transform: translate3d(6px, -10px, 0)  rotate(calc(var(--r, 0deg) + 1deg)); }
  50%  { transform: translate3d(-3px, -16px, 0) rotate(calc(var(--r, 0deg) - 0.5deg)); }
  75%  { transform: translate3d(-8px, -6px, 0)  rotate(calc(var(--r, 0deg) + 0.7deg)); }
  100% { transform: translate3d(0, 0, 0)        rotate(var(--r, 0deg)); }
}

@keyframes driftFrontAlt {
  0%   { transform: translate3d(0, 0, 0)        rotate(var(--r, 0deg)); }
  25%  { transform: translate3d(-5px, -8px, 0)   rotate(calc(var(--r, 0deg) - 0.8deg)); }
  50%  { transform: translate3d(7px, -14px, 0)   rotate(calc(var(--r, 0deg) + 1deg)); }
  75%  { transform: translate3d(4px, -4px, 0)    rotate(calc(var(--r, 0deg) - 0.4deg)); }
  100% { transform: translate3d(0, 0, 0)         rotate(var(--r, 0deg)); }
}

/* Mid — moderate drift */
@keyframes driftMid {
  0%   { transform: translate3d(0, 0, 0)       rotate(var(--r, 0deg)); }
  33%  { transform: translate3d(4px, -8px, 0)   rotate(calc(var(--r, 0deg) + 0.6deg)); }
  66%  { transform: translate3d(-5px, -11px, 0) rotate(calc(var(--r, 0deg) - 0.4deg)); }
  100% { transform: translate3d(0, 0, 0)        rotate(var(--r, 0deg)); }
}

@keyframes driftMidAlt {
  0%   { transform: translate3d(0, 0, 0)       rotate(var(--r, 0deg)); }
  33%  { transform: translate3d(-3px, -6px, 0)  rotate(calc(var(--r, 0deg) - 0.5deg)); }
  66%  { transform: translate3d(5px, -10px, 0)  rotate(calc(var(--r, 0deg) + 0.5deg)); }
  100% { transform: translate3d(0, 0, 0)        rotate(var(--r, 0deg)); }
}

/* Back — very subtle slow creep */
@keyframes driftBack {
  0%   { transform: translate3d(0, 0, 0)       rotate(var(--r, 0deg)); }
  50%  { transform: translate3d(2px, -4px, 0)   rotate(calc(var(--r, 0deg) + 0.3deg)); }
  100% { transform: translate3d(0, 0, 0)        rotate(var(--r, 0deg)); }
}

@keyframes driftBackAlt {
  0%   { transform: translate3d(0, 0, 0)        rotate(var(--r, 0deg)); }
  50%  { transform: translate3d(-3px, -3px, 0)   rotate(calc(var(--r, 0deg) - 0.2deg)); }
  100% { transform: translate3d(0, 0, 0)         rotate(var(--r, 0deg)); }
}

/* ── Assign drift per layer ── */
/* Front layer — faster, wider */
.ap-1  { animation: posterIn 1s ease both, driftFront    18s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-2  { animation: posterIn 1s ease both, driftFrontAlt 20s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-3  { animation: posterIn 1s ease both, driftFront    22s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-4  { animation: posterIn 1s ease both, driftFrontAlt 19s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }

/* Mid layer — moderate */
.ap-5  { animation: posterIn 1s ease both, driftMid    26s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-6  { animation: posterIn 1s ease both, driftMidAlt 24s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-7  { animation: posterIn 1s ease both, driftMid    28s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-8  { animation: posterIn 1s ease both, driftMidAlt 25s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-9  { animation: posterIn 1s ease both, driftMid    27s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-10 { animation: posterIn 1s ease both, driftMidAlt 23s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }

/* Back layer — slowest, subtlest */
.ap-11 { animation: posterIn 1s ease both, driftBack    36s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-12 { animation: posterIn 1s ease both, driftBackAlt 40s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-13 { animation: posterIn 1s ease both, driftBack    38s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-14 { animation: posterIn 1s ease both, driftBackAlt 42s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-15 { animation: posterIn 1s ease both, driftBack    34s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }
.ap-16 { animation: posterIn 1s ease both, driftBackAlt 37s cubic-bezier(0.45,0,0.55,1) infinite; animation-delay: var(--d, 0s), var(--d, 0s); }

/* ══════════════════════════════════════════════════════════════
   Poster positions — Cinematic halo ring around login card
   3 depth tiers · elliptical distribution · 120px safe zone
   ══════════════════════════════════════════════════════════════ */

/* ── FRONT LAYER: Large (220–270px), sharp, high opacity, shadow ── */
.ap-1  { left: 8%;   top: 18%;    width: 260px; --op: 0.26; --r: -5deg;  filter: brightness(0.65);                                     z-index: 3; box-shadow: 0 12px 40px rgba(0,0,0,0.7); }
.ap-2  { right: 8%;  top: 22%;    width: 245px; --op: 0.24; --r: 4deg;   filter: brightness(0.6);                                      z-index: 3; box-shadow: 0 12px 40px rgba(0,0,0,0.7); }
.ap-3  { left: 12%;  bottom: 10%; width: 235px; --op: 0.22; --r: 6deg;   filter: brightness(0.58);                                     z-index: 3; box-shadow: 0 12px 40px rgba(0,0,0,0.7); }
.ap-4  { right: 10%; bottom: 14%; width: 250px; --op: 0.25; --r: -4deg;  filter: brightness(0.62);                                     z-index: 3; box-shadow: 0 12px 40px rgba(0,0,0,0.7); }

/* ── MID LAYER: Medium (160–210px), light blur, medium opacity ── */
.ap-5  { left: 22%;  top: 2%;     width: 190px; --op: 0.18; --r: -3deg;  filter: brightness(0.5) blur(1px);                            z-index: 2; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.ap-6  { right: 22%; top: 4%;     width: 175px; --op: 0.17; --r: 5deg;   filter: brightness(0.48) blur(1px);                           z-index: 2; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.ap-7  { left: 5%;   top: 50%;    width: 185px; --op: 0.16; --r: 3deg;   filter: brightness(0.46) blur(1px);                           z-index: 2; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.ap-8  { right: 5%;  top: 52%;    width: 170px; --op: 0.17; --r: -5deg;  filter: brightness(0.48) blur(1px);                           z-index: 2; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.ap-9  { left: 24%;  bottom: 2%;  width: 165px; --op: 0.16; --r: 4deg;   filter: brightness(0.45) blur(1px);                           z-index: 2; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }
.ap-10 { right: 24%; bottom: 3%;  width: 180px; --op: 0.18; --r: -3deg;  filter: brightness(0.5) blur(1px);                            z-index: 2; box-shadow: 0 8px 28px rgba(0,0,0,0.5); }

/* ── BACK LAYER: Small (120–150px), more blur, low opacity, slow ── */
.ap-11 { left: 16%;  top: 6%;     width: 130px; --op: 0.11; --r: -2deg;  filter: brightness(0.38) blur(2.5px);                         z-index: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.ap-12 { right: 16%; top: 8%;     width: 120px; --op: 0.10; --r: 3deg;   filter: brightness(0.35) blur(2.5px);                         z-index: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.ap-13 { left: 4%;   top: 4%;     width: 140px; --op: 0.12; --r: 5deg;   filter: brightness(0.4) blur(2.5px);                          z-index: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.ap-14 { right: 4%;  bottom: 4%;  width: 135px; --op: 0.11; --r: -4deg;  filter: brightness(0.36) blur(2.5px);                         z-index: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.ap-15 { left: 14%;  bottom: 4%;  width: 125px; --op: 0.10; --r: -3deg;  filter: brightness(0.34) blur(2.5px);                         z-index: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.ap-16 { right: 14%; top: 42%;    width: 145px; --op: 0.12; --r: 2deg;   filter: brightness(0.38) blur(2.5px);                         z-index: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

@media (max-width: 768px) {
  .auth-posters { display: none; }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 40px 24px 32px;
    border-radius: 16px;
  }
  .auth-logo-word {
    font-size: 34px;
  }
}

.app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 268px; min-width: 268px;
  background: linear-gradient(180deg, var(--surface2) 0%, var(--bg-sidebar) 55%, var(--bg) 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; z-index: 100;
  box-shadow: var(--shadow-sidebar);
}

.sidebar-logo { padding: 32px 24px 26px; border-bottom: 1px solid var(--border); }
.logo-word { font-family: 'Playfair Display', serif; font-size: 32px; font-weight: 900; letter-spacing: 0.12em; color: var(--text); display: block; }
.logo-sub { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-dim); letter-spacing: 0.2em; text-transform: uppercase; margin-top: 3px; }

.sidebar-section { padding: 20px 16px 16px; }
.sidebar-section-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--text-muted); padding: 0 8px; margin-bottom: 10px; }

.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); cursor: pointer; transition: all var(--transition); font-size: 16px; color: var(--text-dim); border: 1px solid transparent; user-select: none; }
.nav-item:hover { background: var(--surface2); color: var(--text); border-color: var(--border); }
.nav-item.active-vault    { background: var(--accent-dim);  color: var(--accent);  border-color: var(--accent-dim); }
.nav-item.active-watchsoon{ background: var(--blue-dim);    color: var(--blue);    border-color: rgba(92,155,224,0.2); }
.nav-item.active-explore  { background: var(--purple-dim);  color: var(--purple);  border-color: rgba(155,127,232,0.2); }

.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }
.nav-item .nav-count { margin-left: auto; font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-muted); background: var(--surface3); padding: 2px 8px; border-radius: 10px; }

/* ===== SIDEBAR COLLAPSIBLE BLOCKS ===== */
.sidebar-block {
  margin: 0 16px 14px;
  background: linear-gradient(180deg, var(--surface3) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.16);
}

#sections-block {
  margin-top: 24px;
}

.sidebar-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.sidebar-block-header:hover { background: var(--surface3); }

.sidebar-block-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-block-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.sidebar-block-chevron.open { transform: rotate(180deg); }

.sidebar-block-body {
  padding: 6px 8px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-block-body .nav-item {
  padding: 10px 12px;
}

/* API Key block */
.api-block {
  margin: 0 16px 16px;
  background: linear-gradient(180deg, var(--surface3) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.16);
}

.api-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.api-block-header:hover { background: var(--surface3); }

.api-block-title {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.api-status-dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(92,184,122,0.5); }

.api-block-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.api-block-chevron.open { transform: rotate(180deg); }

.api-block-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}

.api-block-body p { font-size: 12px; color: var(--text-dim); line-height: 1.6; margin: 10px 0 10px; }
.api-block-body a { color: var(--accent); font-size: 12px; }

.api-key-input-wrap { display: flex; gap: 6px; }
.api-key-input { flex: 1; background: var(--surface3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: 'DM Mono', monospace; font-size: 12px; padding: 8px 10px; outline: none; min-width: 0; }
.api-key-input:focus { border-color: var(--accent); }
.btn-save-key { background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius); padding: 8px 14px; font-size: 12px; font-weight: 500; cursor: pointer; font-family: 'DM Mono', monospace; white-space: nowrap; transition: all var(--transition); }
.btn-save-key:hover { background: var(--accent-soft); }
.key-status { font-family: 'DM Mono', monospace; font-size: 11px; margin-top: 8px; }
.key-status.ok { color: var(--green); }
.key-status.missing { color: var(--text-muted); }

/* ── Ollama settings ── */
.ollama-field-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--text-muted); margin: 10px 0 4px; }
.ollama-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-ollama-test { flex: 1; background: var(--surface3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-dim); font-family: 'DM Mono', monospace; font-size: 12px; padding: 8px 0; cursor: pointer; transition: all var(--transition); }
.btn-ollama-test:hover { border-color: var(--border-hover); color: var(--text); }
.ollama-setup-hint { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted); margin-top: 10px; line-height: 1.8; }
.ollama-setup-hint code { background: var(--surface3); border-radius: 3px; padding: 1px 5px; color: var(--accent); font-size: 10px; }

/* ── Ollama badge on AI page ── */
.ollama-badge { display: inline-flex; align-items: center; background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 4px; padding: 2px 7px; font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.08em; color: var(--accent); vertical-align: middle; }

.theme-toggle-block { display: flex; align-items: center; gap: 12px; padding: 12px 12px; margin: 8px 12px; background: var(--surface2); border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer; transition: all var(--transition); user-select: none; }
.theme-toggle-block:hover { background: var(--theme-hover-bg, var(--surface3)); border-color: var(--border-hover); }
.theme-toggle-block:hover .theme-icon { transform: scale(1.1); }
.theme-toggle-block:hover .theme-label { color: var(--text); }
.theme-icon { font-size: 18px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; transition: all var(--transition); flex-shrink: 0; }
.theme-label { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-dim); flex: 1; transition: color var(--transition); }

/* Dark mode: hovering previews light */
:root:not(.light-mode) { --theme-hover-bg: #e2dbd3; }
:root:not(.light-mode) .theme-toggle-block:hover .theme-label { color: #2a2622; }
:root:not(.light-mode) .theme-toggle-block:hover .theme-icon { filter: brightness(1.2); }
:root:not(.light-mode) .theme-toggle-block:hover { border-color: rgba(0,0,0,0.12); }

/* Light mode: hovering previews dark */
:root.light-mode { --theme-hover-bg: #1a1918; }
:root.light-mode .theme-toggle-block:hover .theme-label { color: #e8e4df; }
:root.light-mode .theme-toggle-block:hover { border-color: rgba(255,255,255,0.07); }

/* ===== THEME PICKER ===== */
.theme-group-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); margin: 14px 0 8px; }
.theme-group-label:first-child { margin-top: 0; }
.theme-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-picker.theme-picker-light { grid-template-columns: repeat(6, 1fr); }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 6px; border-radius: var(--radius); background: var(--surface2); border: 1px solid var(--border); cursor: pointer; transition: all var(--transition); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.theme-card:hover { border-color: var(--border-hover); color: var(--text); transform: translateY(-1px); }
.theme-card.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-dim); }
.theme-swatch { width: 100%; height: 22px; border-radius: 4px; flex-shrink: 0; }

.sidebar-data-actions { padding: 14px 24px 0; display: flex; gap: 10px; }
.btn-data-action { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-dim); font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.05em; padding: 10px 0; cursor: pointer; transition: all var(--transition); }
.btn-data-action:hover { background: var(--surface3); border-color: var(--border-hover); color: var(--text); }

.sidebar-stats { margin-top: auto; padding: 22px 24px; border-top: 1px solid var(--border); }
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--accent); }

/* ===== MAIN ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar { padding: 20px 40px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 20px; background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-topbar); }
.topbar-title { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; flex: 1; }

.search-wrap { position: relative; flex: 1; max-width: 440px; }
.search-input { width: 100%; background: linear-gradient(135deg, var(--surface3) 0%, var(--surface2) 100%); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 15px; padding: 11px 16px 11px 42px; outline: none; transition: all var(--transition); box-shadow: inset 0 1px 4px rgba(0,0,0,0.14); }
.search-input:focus { border-color: var(--accent); background: var(--surface2); box-shadow: 0 0 0 2px var(--accent-dim), inset 0 1px 4px rgba(0,0,0,0.1); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; pointer-events: none; }

.view-toggle { display: flex; background: linear-gradient(135deg, var(--surface3) 0%, var(--surface2) 100%); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.14); }
.view-btn { padding: 11px 15px; cursor: pointer; font-size: 15px; color: var(--text-dim); transition: all var(--transition); border: none; background: transparent; }
.view-btn.active { background: var(--surface3); color: var(--text); }

.btn-add { display: flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent) 100%); color: var(--bg); border: none; border-radius: var(--radius); padding: 12px 22px; font-size: 15px; font-weight: 500; cursor: pointer; transition: all var(--transition); white-space: nowrap; font-family: 'DM Sans', sans-serif; box-shadow: 0 2px 8px var(--accent-dim), inset 0 1px 0 rgba(255,255,255,0.14); }
.btn-add:hover { background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-soft) 100%); transform: translateY(-2px); box-shadow: 0 6px 24px var(--accent-glow); }

.btn-add-watchsoon { display: flex; align-items: center; gap: 8px; background: var(--blue); color: #fff; border: none; border-radius: var(--radius); padding: 12px 22px; font-size: 15px; font-weight: 500; cursor: pointer; transition: all var(--transition); white-space: nowrap; font-family: 'DM Sans', sans-serif; }
.btn-add-watchsoon:hover { background: #4a8fd4; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(92,155,224,0.4); }

.topbar-icon-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface3) 100%); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-dim); font-size: 18px; cursor: pointer; transition: all var(--transition);
  flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.topbar-icon-btn:hover { background: linear-gradient(135deg, var(--surface3) 0%, var(--surface2) 100%); border-color: var(--border-hover); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.22); }

.filter-bar { padding: 14px 40px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: linear-gradient(180deg, var(--surface) 0%, transparent 100%); }
.filter-chip {
  padding: 9px 18px; border-radius: 8px; font-size: 15px; font-weight: 400;
  cursor: pointer; border: 1px solid var(--border); background: linear-gradient(135deg, var(--surface2) 0%, var(--surface3) 100%);
  color: var(--text-dim); transition: all var(--transition);
  font-family: 'DM Sans', sans-serif; letter-spacing: 0.01em; box-shadow: 0 1px 3px rgba(0,0,0,0.14);
}
.filter-chip:hover { background: linear-gradient(135deg, var(--surface3) 0%, var(--surface2) 100%); border-color: var(--border-hover); color: var(--text); }
.filter-chip.active {
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(201,168,76,0.07) 100%); border-color: var(--accent-dim);
  color: var(--accent); font-weight: 500; box-shadow: 0 2px 8px var(--accent-dim);
}

/* Genre dropdown button when panel is open */
#genres-dropdown-btn.active {
  background: var(--purple-dim); border-color: rgba(155,127,232,0.35);
  color: var(--purple); font-weight: 500;
}
.filter-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* Chip count badge inside filter chips */
.chip-count {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted);
  background: var(--surface3); padding: 1px 7px; border-radius: 10px; margin-left: 6px;
  vertical-align: middle;
}
.filter-chip.active .chip-count { color: var(--accent); background: var(--accent-dim); }

/* Allow genre dropdown to overflow the filter bar */
.filter-bar { overflow: visible; position: relative; }

.content { padding: 36px 40px; flex: 1; }

/* ===== CARDS ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px; }

.card { background: linear-gradient(180deg, var(--surface2) 0%, var(--surface) 100%); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: all var(--transition); position: relative; animation: fadeUp 0.4s ease both; box-shadow: var(--shadow-card), inset 0 1px 0 var(--surface-shine); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.card:hover { border-color: var(--border-hover); transform: translateY(-5px); box-shadow: var(--shadow-card-hover), inset 0 1px 0 var(--surface-shine); }

.card-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--surface2); }
.card-poster-placeholder { width: 100%; aspect-ratio: 2/3; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--text-muted); }
.yt-thumb-wrap { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--surface2); position: relative; }
.yt-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.yt-play-badge { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 36px; height: 36px; background: rgba(0,0,0,0.7); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.podcast-thumb-wrap { width: 100%; aspect-ratio: 1/1; overflow: hidden; background: var(--surface2); position: relative; }
.podcast-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.podcast-mic-badge { position: absolute; bottom: 8px; right: 8px; width: 28px; height: 28px; background: rgba(180,79,227,0.85); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; backdrop-filter: blur(4px); }
.list-thumb-podcast { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.preview-poster-podcast { width: 80px; height: 80px; border-radius: 10px; object-fit: cover; }

.card-body { padding: 14px; }
.card-title { font-size: 15px; font-weight: 500; color: var(--text); line-height: 1.35; margin-bottom: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-muted); }

.card-type-badge { font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 7px; border-radius: 3px; position: absolute; top: 10px; left: 10px; backdrop-filter: blur(4px); }
.badge-movie   { background: var(--accent-dim);  color: var(--accent); }
.badge-tv      { background: rgba(92,155,224,0.25);  color: var(--blue); }
.badge-youtube { background: rgba(224,92,92,0.25);   color: var(--red); }
.badge-podcast { background: rgba(180,79,227,0.25);  color: #b44fe3; }

.card-rating { position: absolute; top: 10px; right: 10px; background: linear-gradient(135deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.72) 100%); border-radius: 5px; padding: 4px 8px; font-family: 'DM Mono', monospace; font-size: 10px; color: var(--accent); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; backdrop-filter: blur(6px); box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.card-rating-stars { font-size: 10px; letter-spacing: 0.5px; }
.card-rating-vals  { display: flex; align-items: center; gap: 4px; }
.card-rating-star-val  { color: var(--accent); }
.card-rating-overall   { color: var(--text-dim); font-size: 10px; }
.card-rating-sep       { color: var(--text-muted); font-size: 9px; }
.card-delete { position: absolute; bottom: 10px; right: 10px; width: 28px; height: 28px; background: rgba(0,0,0,0.75); border: 1px solid var(--border); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; opacity: 0; transition: opacity var(--transition); cursor: pointer; color: var(--red); }
.card:hover .card-delete { opacity: 1; }
.card-fav-badge { position: absolute; top: 10px; right: 10px; font-size: 13px; color: #e05c7a; line-height: 1; text-shadow: 0 1px 4px rgba(0,0,0,0.7); pointer-events: none; }

.card-watchsoon-btn { position: absolute; bottom: 10px; left: 10px; right: 10px; background: var(--blue); color: #fff; border: none; border-radius: 5px; padding: 6px 8px; font-size: 11px; font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif; opacity: 0; transition: opacity var(--transition); text-align: center; }
.card:hover .card-watchsoon-btn { opacity: 1; }

.watchsoon-badge { position: absolute; top: 10px; right: 10px; background: rgba(92,155,224,0.85); border-radius: 4px; padding: 3px 7px; font-family: 'DM Mono', monospace; font-size: 10px; color: #fff; letter-spacing: 0.1em; }

/* ===== LIST VIEW ===== */
.list-view { display: flex; flex-direction: column; gap: 10px; }
.list-item { background: linear-gradient(90deg, var(--surface2) 0%, var(--surface) 100%); border: 1px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; gap: 18px; padding: 14px 20px; cursor: pointer; transition: all var(--transition); animation: fadeUp 0.3s ease both; box-shadow: 0 1px 4px rgba(0,0,0,0.18), inset 0 1px 0 var(--surface-shine); }
.list-item:hover { border-color: var(--border-hover); background: linear-gradient(90deg, var(--surface3) 0%, var(--surface2) 100%); box-shadow: 0 4px 18px rgba(0,0,0,0.32), inset 0 1px 0 var(--surface-shine); }
.list-thumb { width: 46px; height: 68px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--surface2); }
.list-thumb-yt { width: 88px; height: 50px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--surface2); }
.list-info { flex: 1; min-width: 0; }
.list-title { font-size: 17px; font-weight: 500; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-details { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text-dim); display: flex; gap: 14px; flex-wrap: wrap; }
.list-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.star-rating { display: flex; gap: 2px; }
.star { font-size: 13px; cursor: pointer; transition: all var(--transition); color: var(--text-muted); }
.list-rating { display: flex; align-items: center; gap: 6px; font-family: 'DM Mono', monospace; font-size: 12px; white-space: nowrap; }
.list-rating-stars { color: var(--accent); letter-spacing: 0.5px; font-size: 12px; }
.list-rating-star-val  { color: var(--accent); }
.list-rating-sep       { color: var(--text-muted); }
.list-rating-overall   { color: var(--text-dim); }
.star.filled { color: var(--accent); }
.list-delete { width: 32px; height: 32px; background: transparent; border: 1px solid transparent; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; color: var(--text-muted); transition: all var(--transition); }
.list-delete:hover { border-color: var(--red); color: var(--red); background: rgba(224,92,92,0.1); }

.btn-watched-it { background: var(--blue); color: #fff; border: none; border-radius: var(--radius); padding: 10px 18px; font-size: 14px; font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif; white-space: nowrap; transition: all var(--transition); flex-shrink: 0; }
.btn-watched-it:hover { background: #4a8fd4; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 80px 40px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.empty-state .empty-icon { font-size: 60px; opacity: 0.2; }
.empty-title { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 700; color: var(--text-dim); }
.empty-sub { font-size: 14px; color: var(--text-muted); max-width: 320px; line-height: 1.65; }
.btn-empty-add { margin-top: 8px; background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius); padding: 12px 28px; font-size: 14px; font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all var(--transition); }
.btn-empty-add:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }

/* ===== EXPLORE ===== */
.explore-header { margin-bottom: 28px; }
.explore-hero-label { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--purple); margin-bottom: 10px; }
.explore-hero-title { font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 700; margin-bottom: 10px; }
.explore-hero-sub { font-size: 15px; color: var(--text-dim); line-height: 1.65; }

.explore-section { margin-bottom: 40px; }
.explore-section-header { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.explore-section-title { font-family: 'Playfair Display', serif; font-size: 21px; font-weight: 700; }
.explore-section-reason { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); }

.explore-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 18px; }

.explore-card { background: linear-gradient(180deg, var(--surface2) 0%, var(--surface) 100%); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition); animation: fadeUp 0.4s ease both; box-shadow: var(--shadow-card), inset 0 1px 0 var(--surface-shine); display: flex; flex-direction: column; }
.explore-card:hover { border-color: rgba(155,127,232,0.3); transform: translateY(-5px); box-shadow: var(--shadow-card-hover), inset 0 1px 0 var(--surface-shine); }

.explore-poster-wrap { position: relative; }
.explore-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--surface2); }
.explore-poster-placeholder { width: 100%; aspect-ratio: 2/3; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--text-muted); }
.btn-explore-dismiss { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; background: rgba(220,60,60,0.85); color: #fff; border: none; border-radius: 50%; font-size: 10px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s, background 0.15s; }
.explore-card:hover .btn-explore-dismiss { opacity: 1; }
.btn-explore-dismiss:hover { background: rgba(220,60,60,1); }
.explore-card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.explore-card-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.explore-card-meta { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.explore-card-rating { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); margin-bottom: 10px; }

.btn-save-watchsoon { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(155,127,232,0.3); border-radius: var(--radius); padding: 9px 4px; font-size: 11px; font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all var(--transition); }
.btn-save-watchsoon:hover { background: rgba(155,127,232,0.25); }
.btn-save-watchsoon.saved { background: var(--green-dim); color: var(--green); border-color: rgba(92,184,122,0.3); cursor: default; }
.explore-card-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; }
.explore-card-actions button { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-add-to-vault { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 4px; font-size: 11px; font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all var(--transition); }
.btn-add-to-vault:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.btn-add-to-vault.saved { background: var(--green-dim); color: var(--green); border-color: rgba(92,184,122,0.3); opacity: 0.6; cursor: default; }

.explore-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 0; color: var(--text-dim); font-size: 13px; }
.explore-no-vault { text-align: center; padding: 60px 40px; display: flex; flex-direction: column; align-items: center; gap: 12px; }

.explore-btn-row { display: flex; gap: 10px; margin-top: 14px; }
.explore-refresh { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); padding: 10px 18px; border-radius: var(--radius); cursor: pointer; font-size: 13px; font-family: 'DM Sans', sans-serif; transition: all var(--transition); }
.explore-refresh:hover { border-color: var(--purple); color: var(--purple); }
.explore-find-more { color: var(--accent); border-color: var(--accent-dim); }
.explore-find-more:hover { border-color: var(--accent); color: var(--accent-soft); }

/* ===== MODALS ===== */
.modal-overlay { position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.92) 100%); backdrop-filter: blur(10px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal { background: linear-gradient(180deg, var(--surface2) 0%, var(--surface) 28%, var(--surface) 100%); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 90%; max-width: 650px; height: 88vh; overflow-y: auto; animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1); display: flex; flex-direction: column; box-shadow: var(--shadow-modal), inset 0 1px 0 var(--surface-shine); }
@keyframes slideUp { from { transform: translateY(30px) scale(0.97); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.modal-header { padding: 26px 32px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: linear-gradient(180deg, var(--surface3) 0%, transparent 100%); }
.modal-title { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 700; }
.modal-close { width: 34px; height: 34px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 16px; color: var(--text-dim); display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.modal-close:hover { color: var(--text); border-color: var(--border-hover); }
.modal-body { padding: 28px 32px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.type-tabs { display: flex; gap: 10px; margin-bottom: 22px; }
.type-tab { flex: 1; padding: 13px; border-radius: var(--radius); border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; font-size: 15px; transition: all var(--transition); text-align: center; font-family: 'DM Sans', sans-serif; }
.type-tab:hover { border-color: var(--border-hover); color: var(--text); }
.type-tab.active { background: var(--accent-dim); border-color: var(--accent-dim); color: var(--accent); }

.search-results-dropdown { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 4px; max-height: 300px; overflow-y: auto; }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; transition: background var(--transition); border-bottom: 1px solid var(--border); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface3); }
.result-poster { width: 36px; height: 52px; object-fit: cover; border-radius: 3px; flex-shrink: 0; background: var(--surface3); }
.result-info { flex: 1; min-width: 0; }
.result-title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-dim); margin-top: 3px; }

.form-group { margin-bottom: 18px; }
.form-label { font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 7px; display: block; }
.form-input, .form-textarea { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 15px; padding: 12px 15px; outline: none; transition: all var(--transition); }
.form-input:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.preview-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 16px; margin-bottom: 18px; animation: fadeUp 0.3s ease; }
.preview-poster { width: 64px; height: 96px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--surface3); }
.preview-poster-yt { width: 110px; height: 62px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--surface3); align-self: flex-start; }
.preview-info { flex: 1; min-width: 0; }
.preview-title { font-size: 16px; font-weight: 500; margin-bottom: 5px; }
.preview-meta { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-dim); line-height: 1.65; }
.preview-plot { font-size: 14px; color: var(--text-dim); line-height: 1.55; margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.star-input { display: flex; gap: 4px; }
.star-input .star { font-size: 20px; cursor: pointer; color: var(--surface3); }
.star-input .star.filled { color: var(--accent); }

/* ===== STAR PICKER COMPONENT ===== */
.aspect-row > div { flex: 1; min-width: 0; }
.star-picker { display: flex; align-items: center; gap: 6px; }
.star-picker-stars { display: flex; gap: 4px; }
.star-picker-btn {
  background: none; border: none; padding: 0;
  font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--surface3);
  transition: color 0.1s, transform 0.1s;
  user-select: none;
}
.star-picker-btn:hover  { transform: scale(1.15); }
.star-picker-btn.filled { color: var(--accent); }
.star-picker-btn.hover  { color: var(--accent); }
.star-picker-val {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--accent); min-width: 18px; text-align: right;
}
.star-picker-val.empty { color: var(--text-muted); }

/* Rating modal sections */
.rating-section-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 16px 0 14px;
}
.rating-section-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 14px;
}
.aspect-row {
  display: flex; align-items: center; gap: 14px; margin-bottom: 12px;
}
.aspect-label {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-dim); width: 70px; flex-shrink: 0;
  letter-spacing: 0.05em;
}
.star-preview-live {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 14px;
  margin-top: 14px;
}
.star-preview-stars { font-size: 14px; color: var(--accent); letter-spacing: 1px; }
.star-preview-val { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--accent); }
.star-preview-sep { color: var(--text-muted); font-size: 11px; margin: 0 2px; }
.overall-rating-wrap { display: flex; align-items: center; gap: 10px; }
.overall-rating-input {
  width: 80px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 14px;
  padding: 8px 12px; outline: none; transition: all var(--transition);
  text-align: center;
}
.overall-rating-input:focus { border-color: var(--accent); }
.overall-rating-hint { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted); }

.modal-footer { padding: 18px 32px 26px; display: flex; gap: 12px; justify-content: flex-end; }
.btn-cancel { background: transparent; border: 1px solid var(--border); color: var(--text-dim); padding: 12px 24px; border-radius: var(--radius); cursor: pointer; font-size: 15px; font-family: 'DM Sans', sans-serif; transition: all var(--transition); }
.btn-cancel:hover { border-color: var(--border-hover); color: var(--text); }
.btn-save { background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent) 100%); color: var(--bg); border: none; padding: 12px 28px; border-radius: var(--radius); cursor: pointer; font-size: 15px; font-weight: 500; font-family: 'DM Sans', sans-serif; transition: all var(--transition); box-shadow: 0 2px 8px var(--accent-dim), inset 0 1px 0 rgba(255,255,255,0.12); }
.btn-save:hover { background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-soft) 100%); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-save:disabled { opacity: 0.4; cursor: not-allowed; }

/* Detail modal */
.detail-modal { max-width: 700px; }
.detail-hero { display: flex; gap: 26px; margin-bottom: 22px; }
.detail-poster { width: 130px; min-width: 130px; height: 194px; object-fit: cover; border-radius: var(--radius); background: var(--surface2); }
.detail-poster-yt { width: 190px; min-width: 190px; height: 107px; object-fit: cover; border-radius: var(--radius); background: var(--surface2); align-self: flex-start; }
.detail-info { flex: 1; }
.detail-title { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 700; line-height: 1.2; margin-bottom: 10px; }
.detail-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.detail-meta-tag { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text-dim); background: var(--surface2); border: 1px solid var(--border); padding: 5px 11px; border-radius: 3px; }
.detail-plot { font-size: 15px; color: var(--text-dim); line-height: 1.72; margin-bottom: 14px; }
.detail-actors { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text-muted); }
.detail-section-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; margin-top: 18px; }
.notes-area { font-size: 15px; color: var(--text-dim); line-height: 1.65; font-style: italic; padding: 14px 16px; background: var(--surface2); border-radius: var(--radius); border-left: 3px solid var(--accent); }

/* Detail modal rating display + edit */
.detail-rating-view { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.detail-rating-stars { font-size: 20px; color: var(--accent); letter-spacing: 1px; }
.detail-rating-starval { font-family: 'DM Mono', monospace; font-size: 16px; color: var(--accent); }
.detail-rating-sep { color: var(--text-muted); font-family: 'DM Mono', monospace; font-size: 14px; }
.detail-rating-overall { font-family: 'DM Mono', monospace; font-size: 16px; color: var(--text-dim); }
.detail-rating-unrated { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-muted); letter-spacing: 0.1em; }
.detail-edit-section { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 4px; }
.detail-edit-section .aspect-row { margin-bottom: 8px; }
.detail-edit-section .aspect-row:last-of-type { margin-bottom: 0; }
.btn-edit-rating { background: transparent; border: 1px solid var(--border); color: var(--text-dim); padding: 10px 20px; border-radius: var(--radius); cursor: pointer; font-size: 14px; font-family: 'DM Sans', sans-serif; transition: all var(--transition); }
.btn-edit-rating:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ===== AI PAGE ===== */
.active-ai { background: rgba(100,180,255,0.12) !important; color: #64b4ff !important; }
.ai-page { padding: 0 0 48px; }
.ai-header { margin-bottom: 28px; }

.ai-chat-panel { background: linear-gradient(180deg, var(--surface2) 0%, var(--surface) 65%); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 32px; box-shadow: var(--shadow-card), inset 0 1px 0 var(--surface-shine); }
.ai-messages { min-height: 120px; max-height: 340px; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.ai-welcome { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 0; text-align: center; }
.ai-welcome-icon { font-size: 28px; color: var(--accent); opacity: 0.6; }
.ai-welcome-text { font-size: 14px; color: var(--text-dim); }
.ai-suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.ai-chip { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); border-radius: 20px; padding: 6px 14px; font-size: 12px; cursor: pointer; transition: all var(--transition); font-family: 'DM Sans', sans-serif; }
.ai-chip:hover { border-color: rgba(100,180,255,0.4); color: #64b4ff; background: rgba(100,180,255,0.08); }

.ai-message { display: flex; }
.ai-message-user { justify-content: flex-end; }
.ai-message-system { justify-content: flex-start; }
.ai-message-bubble { max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.ai-message-user .ai-message-bubble { background: rgba(100,180,255,0.15); border: 1px solid rgba(100,180,255,0.25); color: #a8d8ff; border-radius: 12px 12px 2px 12px; }
.ai-message-system .ai-message-bubble { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); border-radius: 12px 12px 12px 2px; }

.ai-input-row { display: flex; gap: 0; border-top: 1px solid var(--border); }
.ai-input { flex: 1; background: transparent; border: none; padding: 16px 18px; font-size: 14px; color: var(--text); font-family: 'DM Sans', sans-serif; outline: none; }
.ai-input::placeholder { color: var(--text-muted); }
.ai-send-btn { background: rgba(100,180,255,0.12); border: none; border-left: 1px solid var(--border); color: #64b4ff; padding: 0 22px; font-size: 18px; cursor: pointer; transition: all var(--transition); display: flex; align-items: center; justify-content: center; min-width: 56px; }
.ai-send-btn:hover:not(:disabled) { background: rgba(100,180,255,0.2); }
.ai-send-btn:disabled { opacity: 0.4; cursor: default; }

.ai-chat-toolbar { display: flex; justify-content: flex-end; padding: 8px 14px 0; }
.ai-clear-btn { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: var(--radius); padding: 5px 12px; font-size: 12px; cursor: pointer; transition: all var(--transition); font-family: 'DM Sans', sans-serif; }
.ai-clear-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.ai-results-section { margin-top: 4px; }
.ai-results-label { font-family: 'Playfair Display', serif; font-size: 21px; font-weight: 700; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* Favourites */
.add-favorite-row { margin-top: 14px; }
.btn-favorite-toggle { width: 100%; background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: var(--radius); padding: 9px 14px; font-size: 13px; cursor: pointer; transition: all var(--transition); font-family: 'DM Sans', sans-serif; }
.btn-favorite-toggle:hover { border-color: rgba(220,60,100,0.4); color: #e05c7a; }
.btn-favorite-toggle.active { background: rgba(220,60,100,0.12); border-color: rgba(220,60,100,0.4); color: #e05c7a; }
.btn-detail-fav { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: var(--radius); padding: 10px 20px; font-size: 14px; cursor: pointer; transition: all var(--transition); font-family: 'DM Sans', sans-serif; }
.btn-detail-fav:hover { border-color: rgba(220,60,100,0.4); color: #e05c7a; }
.btn-detail-fav.active { background: rgba(220,60,100,0.12); border-color: rgba(220,60,100,0.4); color: #e05c7a; }

/* Spinner */
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; }
.spinner-purple { border-top-color: var(--purple); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: linear-gradient(135deg, var(--surface3) 0%, var(--surface2) 100%); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; font-size: 15px; color: var(--text); animation: slideInRight 0.3s ease, fadeOut 0.3s ease 4s forwards; display: flex; align-items: center; gap: 10px; max-width: 340px; box-shadow: 0 8px 32px rgba(0,0,0,0.42), 0 2px 8px rgba(0,0,0,0.2), inset 0 1px 0 var(--surface-shine); }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.blue    { border-left: 3px solid var(--blue); }
.toast-action { background: none; border: 1px solid var(--accent); border-radius: 3px; color: var(--accent); font-family: 'DM Mono', monospace; font-size: 10px; padding: 3px 8px; cursor: pointer; margin-left: auto; white-space: nowrap; transition: all var(--transition); }
.toast-action:hover { background: var(--accent-dim); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

.loading-results { padding: 20px; text-align: center; color: var(--text-dim); font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.no-results { padding: 20px; text-align: center; color: var(--text-muted); font-size: 14px; }
.watched-date { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text-muted); }

/* ===== GENRE DROPDOWN FILTER ===== */
.genre-dropdown-container { position: relative; }

.genre-dropdown-btn { position: relative; }

.genre-dropdown-count {
  display: inline-block; background: var(--purple); color: #fff;
  font-size: 9px; font-weight: 500; padding: 2px 6px; border-radius: 10px;
  margin-left: 6px; min-width: 18px; text-align: center;
}
.genre-dropdown-count:empty { display: none; }

.genre-dropdown-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 1001;
  background: linear-gradient(180deg, var(--surface3) 0%, var(--surface2) 100%); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 12px 42px rgba(0,0,0,0.48), 0 4px 12px rgba(0,0,0,0.22), inset 0 1px 0 var(--surface-shine);
  min-width: 240px; max-width: 320px; padding: 8px;
  animation: slideDown 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.genre-dropdown-list { max-height: 300px; overflow-y: auto; }

.genre-dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  cursor: pointer; border-radius: 4px; transition: all var(--transition);
  user-select: none; font-size: 14px; color: var(--text);
}
.genre-dropdown-item:hover { background: var(--surface3); }

.genre-dropdown-checkbox {
  width: 16px; height: 16px; border: 1px solid var(--border);
  border-radius: 3px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--transition);
  background: transparent;
}
.genre-dropdown-item.active .genre-dropdown-checkbox {
  background: var(--purple); border-color: var(--purple);
}
.genre-dropdown-checkbox::after {
  content: '✓'; font-size: 10px; font-weight: 700;
  color: #fff; opacity: 0;
}
.genre-dropdown-item.active .genre-dropdown-checkbox::after { opacity: 1; }

.genre-dropdown-label { flex: 1; }

.genre-dropdown-count-item {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); flex-shrink: 0;
}

/* Genre tags in explore */
.genre-tag { display: inline-block; font-family: 'DM Mono', monospace; font-size: 10px; padding: 3px 8px; border-radius: 3px; background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(155,127,232,0.2); margin-right: 10px; margin-bottom: 6px; }

/* Profile favorite genres chips */
.profile-chip-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; min-height: 32px; }
.profile-favorite-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--purple-dim); color: var(--purple);
  border: 1px solid rgba(155,127,232,0.3); border-radius: 16px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.profile-favorite-chip:hover { background: rgba(155,127,232,0.2); border-color: rgba(155,127,232,0.5); }
.profile-favorite-chip-remove { font-size: 12px; opacity: 0.7; cursor: pointer; }
.profile-favorite-chip-remove:hover { opacity: 1; }

/* ===== PROFILE ACCOUNT BLOCK ===== */
.profile-account-block {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.profile-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}
.profile-account-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.profile-account-value {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

/* ===== SIDEBAR CREDENTIALS BUTTON ===== */
.sidebar-creds-btn-wrap {
  padding: 8px 16px;
}
.sidebar-creds-btn {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.sidebar-creds-btn:hover {
  background: var(--surface3);
  border-color: var(--border-hover);
  color: var(--text);
}

/* ===== API CREDENTIALS MODAL ===== */
.cred-section {
  margin-bottom: 20px;
}
.cred-section:last-child { margin-bottom: 0; }
.cred-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.cred-row-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  flex-shrink: 0;
  margin-right: 12px;
}
.cred-row-value-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cred-row-value {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.cred-row-value.cred-not-set {
  color: var(--text-muted);
  font-style: italic;
}
.cred-btn {
  padding: 3px 8px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.cred-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== RATINGS DROPDOWN BLOCK ===== */
.ratings-block {
  margin: 0 16px 14px;
  background: linear-gradient(180deg, var(--surface3) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.16);
}
.ratings-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer;
  transition: background var(--transition);
}
.ratings-block-header:hover { background: var(--surface3); }
.ratings-block-title {
  font-family: 'DM Mono', monospace; font-size: 11px;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-dim); display: flex; align-items: center; gap: 8px;
}
.ratings-block-chevron {
  font-size: 10px; color: var(--text-muted);
  transition: transform var(--transition);
}
.ratings-block-chevron.open { transform: rotate(180deg); }
.ratings-block-body {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
/* Aspect category filter rows */
.aspect-filter-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.aspect-filter-row:last-of-type { margin-bottom: 0; }
.aspect-filter-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); letter-spacing: 0.08em;
  text-transform: uppercase; width: 56px; flex-shrink: 0;
}
.aspect-filter-stars {
  display: flex; gap: 2px; flex: 1;
}
.af-star-btn {
  background: none; border: none; padding: 0 1px;
  font-size: 16px; line-height: 1; cursor: pointer;
  color: var(--surface3); transition: color 0.1s, transform 0.1s;
  user-select: none;
}
.af-star-btn:hover { transform: scale(1.2); }
.af-star-btn.filled { color: var(--accent); }
.af-star-btn.hovered { color: var(--accent); }
.ratings-showing {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); padding-top: 8px; margin-top: 4px;
  border-top: 1px solid var(--border);
}
.ratings-showing span { color: var(--accent); }
.ratings-clear-btn {
  display: none; margin-left: 8px; padding: 1px 8px;
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer; transition: all 0.15s ease;
}
.ratings-clear-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ===== ANALYTICS NAV ===== */
.nav-item.active-analytics { background: var(--green-dim); color: var(--green); border-color: rgba(92,184,122,0.2); }

/* ===== ANALYTICS PAGE ===== */
.analytics-page { max-width: 100%; }

.analytics-overview {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 32px;
}
.analytics-stat-card {
  background: linear-gradient(145deg, var(--surface2) 0%, var(--surface) 100%); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px 20px; text-align: center; transition: all var(--transition);
  box-shadow: var(--shadow-card), inset 0 1px 0 var(--surface-shine);
}
.analytics-stat-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.44), inset 0 1px 0 var(--surface-shine); }
.analytics-stat-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.6; }
.analytics-stat-value { font-family: 'Playfair Display', serif; font-size: 36px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.analytics-stat-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); }

.analytics-section { margin-bottom: 32px; animation: fadeUp 0.4s ease both; }
.analytics-section-header {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.analytics-section-title { font-family: 'Playfair Display', serif; font-size: 21px; font-weight: 700; }
.analytics-section-sub { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); }

/* Horizontal bar chart rows */
.analytics-bar-list { display: flex; flex-direction: column; gap: 8px; }
.analytics-bar-row { display: flex; align-items: center; gap: 12px; }
.analytics-bar-label {
  width: 150px; flex-shrink: 0; font-size: 15px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.analytics-bar-track {
  flex: 1; height: 24px; background: var(--surface2); border-radius: 4px;
  overflow: hidden; position: relative;
}
.analytics-bar-fill {
  height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  display: flex; align-items: center; padding-left: 8px; min-width: 0;
}
.analytics-bar-fill.genre   { background: linear-gradient(90deg, var(--accent-soft) 0%, var(--accent) 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18); }
.analytics-bar-fill.director{ background: linear-gradient(90deg, #5a9de0 0%, #3d7fbe 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); }
.analytics-bar-fill.actor   { background: linear-gradient(90deg, var(--purple) 0%, #7a60c8 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); }
.analytics-bar-fill.aspect  { background: linear-gradient(90deg, #4eb87a 0%, #3a9460 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); }
.analytics-bar-fill.year    { background: linear-gradient(90deg, var(--accent-soft) 0%, var(--accent) 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18); }
.analytics-bar-fill.month   { background: linear-gradient(90deg, #5a9de0 0%, #3d7fbe 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); }
.analytics-bar-count {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-dim);
  flex-shrink: 0; width: 40px; text-align: right;
}

/* Two-column layout for side-by-side sections */
.analytics-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.analytics-two-col .analytics-section { margin-bottom: 0; }

/* You vs Critics */
.analytics-vs-row { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.analytics-vs-label { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; width: 64px; flex-shrink: 0; }
.analytics-vs-bar-track { flex: 1; height: 30px; background: var(--surface2); border-radius: 4px; overflow: hidden; position: relative; }
.analytics-vs-bar { height: 100%; border-radius: 4px; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.analytics-vs-bar.you    { background: linear-gradient(90deg, var(--accent-soft) 0%, var(--accent) 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18); }
.analytics-vs-bar.critic { background: linear-gradient(90deg, #5a9de0 0%, #3d7fbe 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); }
.analytics-vs-val { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500; }
.analytics-vs-bar.you .analytics-vs-val    { color: var(--accent); }
.analytics-vs-bar.critic .analytics-vs-val { color: var(--blue); }
.analytics-vs-verdict { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-dim); margin-top: 10px; font-style: italic; }

/* Top/Bottom rated titles */
.analytics-title-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: linear-gradient(90deg, var(--surface2) 0%, var(--surface) 100%); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 6px; transition: all var(--transition); box-shadow: 0 1px 4px rgba(0,0,0,0.16);
}
.analytics-title-row:hover { border-color: var(--border-hover); background: linear-gradient(90deg, var(--surface3) 0%, var(--surface2) 100%); box-shadow: 0 4px 14px rgba(0,0,0,0.26); }
.analytics-title-rank {
  font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700;
  color: var(--text-muted); width: 24px; text-align: center; flex-shrink: 0;
}
.analytics-title-poster { width: 32px; height: 48px; object-fit: cover; border-radius: 3px; flex-shrink: 0; background: var(--surface2); }
.analytics-title-info { flex: 1; min-width: 0; }
.analytics-title-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.analytics-title-meta { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.analytics-title-rating { font-family: 'DM Mono', monospace; font-size: 14px; color: var(--accent); flex-shrink: 0; }

/* Timeline (vertical bar chart) */
.analytics-timeline {
  display: flex; align-items: flex-end; gap: 4px; height: 120px;
  padding: 0 4px; border-bottom: 1px solid var(--border);
}
.analytics-timeline-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.analytics-timeline-bar {
  width: 100%; max-width: 32px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #5a9de0 0%, #2e6aaa 100%); border-bottom: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(90,157,224,0.22);
  transition: height 0.6s cubic-bezier(0.4,0,0.2,1); position: relative;
  min-height: 0;
}
.analytics-timeline-bar:hover { background: linear-gradient(180deg, #6aaae8 0%, #3a7cc0 100%); }
.analytics-timeline-bar-count {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-family: 'DM Mono', monospace; font-size: 9px; color: var(--text-dim);
}
.analytics-timeline-labels { display: flex; gap: 4px; padding: 6px 4px 0; }
.analytics-timeline-label {
  flex: 1; text-align: center; font-family: 'DM Mono', monospace;
  font-size: 8px; color: var(--text-muted); letter-spacing: 0.05em;
  max-width: 32px;
}

/* Empty analytics */
.analytics-empty { text-align: center; padding: 80px 40px; }
.analytics-empty .empty-icon { font-size: 48px; opacity: 0.2; margin-bottom: 16px; }
.analytics-empty .empty-title { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--text-dim); margin-bottom: 8px; }
.analytics-empty .empty-sub { font-size: 13px; color: var(--text-muted); }

/* ===== MOBILE HAMBURGER ===== */
.sidebar-toggle {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 200;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 20px; width: 40px; height: 40px; cursor: pointer;
  align-items: center; justify-content: center; transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--surface3); }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 150;
    transform: translateX(-100%); transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-overlay { display: block; }

  .topbar { padding: 16px 16px 16px 64px; gap: 8px; }
  .topbar-title { font-size: 18px; }
  .content-area { padding: 16px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

  .filter-bar { padding: 8px 16px; gap: 14px; flex-wrap: wrap; }
  .btn-add, .btn-add-watchsoon { font-size: 11px; padding: 7px 12px; }

  .analytics-two-col { grid-template-columns: 1fr; }
  .analytics-overview { grid-template-columns: repeat(2, 1fr); }

  /* Modals full-width on mobile */
  .modal-box, .detail-box { width: 95vw; max-width: 95vw; max-height: 90vh; }
}

/* ====================== APPEARANCE STUDIO ====================== */

.modal-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Section blocks */
.ap-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.ap-section:first-child { padding-top: 0; }
.ap-section:last-child { border-bottom: none; padding-bottom: 0; }

.ap-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Mode toggle chevron */
.theme-toggle-chevron {
  font-size: 20px;
  color: var(--text-muted);
  margin-left: auto;
  line-height: 1;
  transition: color var(--transition);
}
.theme-toggle-block:hover .theme-toggle-chevron { color: var(--accent); }

/* ====================== ACCENT PICKER ====================== */

.accent-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.accent-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 8px 10px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
  min-width: 52px;
}
.accent-swatch:hover {
  background: var(--surface3);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.accent-swatch.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.accent-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  transition: transform var(--transition), box-shadow var(--transition);
}
.accent-swatch:hover .accent-dot {
  transform: scale(1.14);
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
.accent-swatch.active .accent-dot {
  box-shadow: 0 0 0 2px var(--surface2), 0 0 0 4px var(--accent);
}

.accent-name {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--transition);
}
.accent-swatch.active .accent-name { color: var(--accent); }

/* ====================== SURFACE DEPTH PICKER ====================== */

.depth-picker {
  display: flex;
  gap: 8px;
}

.depth-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 10px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.depth-btn:hover {
  background: var(--surface3);
  border-color: var(--border-hover);
  color: var(--text);
  transform: translateY(-1px);
}
.depth-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

/* Depth visual previews */
.depth-preview {
  width: 38px;
  height: 24px;
  border-radius: 4px;
  display: block;
}
.depth-preview-flat {
  background: var(--surface3);
  border: 1px solid var(--border-hover);
  box-shadow: none;
}
.depth-preview-soft {
  background: var(--surface3);
  border: 1px solid var(--border);
  box-shadow: 0 3px 10px rgba(0,0,0,0.32);
}
.depth-preview-elevated {
  background: var(--surface3);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.58), 0 2px 6px rgba(0,0,0,0.36);
}

/* ====================== SURFACE DEPTH CSS VARS ====================== */

html[data-depth="flat"] {
  --shadow-card: none;
  --shadow-card-hover: 0 2px 10px rgba(0,0,0,0.18);
  --shadow-modal: 0 0 0 1px var(--border), 0 4px 20px rgba(0,0,0,0.22);
  --shadow-sidebar: none;
  --shadow-topbar: 0 1px 0 var(--border);
}

html[data-depth="elevated"] {
  --shadow-card: 0 6px 24px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-card-hover: 0 32px 80px rgba(0,0,0,0.85), 0 10px 32px rgba(0,0,0,0.5);
  --shadow-modal: 0 40px 120px rgba(0,0,0,0.92), 0 16px 48px rgba(0,0,0,0.55);
  --shadow-sidebar: 4px 0 48px rgba(0,0,0,0.55);
  --shadow-topbar: 0 1px 0 var(--border), 0 8px 36px rgba(0,0,0,0.3);
}
