/* ═══════════════════════════════════════════════════════════════════════════
   PRISMA · ALUZAR — 15 Aesthetic Worlds + Real-Time Audio-Reactive Engine
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Live Web Audio API Reactive Channels (0.00 -> 1.00) */
  --rx-bass: 0;
  --rx-mid: 0;
  --rx-high: 0;
  --rx-energy: 0;

  /* Safe areas for iPhone Notch / Dynamic Island & Home Indicator */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Default Theme Variables (1. Diablita Esmeralda) */
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Plus Jakarta Sans", -apple-system, sans-serif;
  --bg-1: #050908;
  --bg-2: #0a1713;
  --surface: rgba(12, 26, 21, 0.78);
  --surface-strong: rgba(10, 22, 18, 0.95);
  --text-main: #ecfdf5;
  --text-muted: #86efac;
  --text-dim: rgba(209, 250, 229, 0.58);
  --accent: #10b981;
  --accent-2: #e879f9;
  --border-subtle: rgba(16, 185, 129, 0.26);

  --user-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(6, 95, 70, 0.46));
  --user-text: #f0fdf4;
  --user-border: rgba(52, 211, 153, 0.45);
  --ai-bg: rgba(13, 25, 22, 0.82);
  --ai-text: #ecfdf5;
  --ai-border: rgba(232, 121, 249, 0.28);

  --bubble-radius-ai: 20px 20px 20px 5px;
  --bubble-radius-user: 20px 20px 5px 20px;
  --bubble-shadow: 0 6px 22px rgba(0, 0, 0, 0.34);
  --rx-glow-ai: rgba(16, 185, 129, 0.52);
  --rx-glow-user: rgba(232, 121, 249, 0.48);
  --rx-aura-1: rgba(16, 185, 129, 0.38);
  --rx-aura-2: rgba(217, 70, 239, 0.28);
  --composer-radius: 26px;
}

/* ─── 2. Cyberpunk Neo-Tokyo ─── */
html[data-theme="neotokyo"] {
  --font-body: "JetBrains Mono", monospace;
  --font-display: "Space Grotesk", sans-serif;
  --bg-1: #07060e;
  --bg-2: #120924;
  --surface: rgba(14, 11, 28, 0.86);
  --surface-strong: rgba(11, 9, 22, 0.96);
  --text-main: #f0f9ff;
  --text-muted: #00f0ff;
  --text-dim: rgba(165, 243, 252, 0.6);
  --accent: #00f0ff;
  --accent-2: #ff2a85;
  --border-subtle: rgba(0, 240, 255, 0.38);
  --user-bg: linear-gradient(135deg, rgba(255, 42, 133, 0.26), rgba(88, 28, 135, 0.5));
  --user-text: #fdf2f8;
  --user-border: #ff2a85;
  --ai-bg: rgba(8, 18, 32, 0.9);
  --ai-text: #e0f2fe;
  --ai-border: #00f0ff;
  --bubble-radius-ai: 2px 16px 2px 14px;
  --bubble-radius-user: 16px 2px 14px 2px;
  --bubble-shadow: 0 0 14px rgba(0, 240, 255, 0.16);
  --rx-glow-ai: rgba(0, 240, 255, 0.68);
  --rx-glow-user: rgba(255, 42, 133, 0.68);
  --rx-aura-1: rgba(0, 240, 255, 0.42);
  --rx-aura-2: rgba(255, 42, 133, 0.38);
  --composer-radius: 6px;
}

/* ─── 3. Carta Editorial / Papel Antiguo ─── */
html[data-theme="editorial"] {
  --font-body: "Cormorant Garamond", Georgia, serif;
  --font-display: "Cinzel", Georgia, serif;
  --bg-1: #f4ede0;
  --bg-2: #eadec9;
  --surface: rgba(251, 246, 236, 0.88);
  --surface-strong: #f9f3e6;
  --text-main: #261c14;
  --text-muted: #7c2d12;
  --text-dim: rgba(68, 49, 34, 0.65);
  --accent: #8b2635;
  --accent-2: #b4833e;
  --border-subtle: rgba(139, 98, 52, 0.32);
  --user-bg: #efe4ce;
  --user-text: #241911;
  --user-border: rgba(139, 38, 53, 0.42);
  --ai-bg: #fcf8ef;
  --ai-text: #1f1610;
  --ai-border: rgba(180, 131, 62, 0.55);
  --bubble-radius-ai: 4px;
  --bubble-radius-user: 4px;
  --bubble-shadow: 0 3px 12px rgba(68, 44, 18, 0.09);
  --rx-glow-ai: rgba(180, 131, 62, 0.55);
  --rx-glow-user: rgba(139, 38, 53, 0.45);
  --rx-aura-1: rgba(196, 138, 53, 0.34);
  --rx-aura-2: rgba(139, 38, 53, 0.24);
  --composer-radius: 8px;
}

/* ─── 4. Terminal Hacker CRT ─── */
html[data-theme="crt"] {
  --font-body: "JetBrains Mono", monospace;
  --font-display: "JetBrains Mono", monospace;
  --bg-1: #030904;
  --bg-2: #061409;
  --surface: rgba(5, 18, 8, 0.92);
  --surface-strong: #041107;
  --text-main: #4ade80;
  --text-muted: #86efac;
  --text-dim: rgba(74, 222, 128, 0.55);
  --accent: #22c55e;
  --accent-2: #facc15;
  --border-subtle: rgba(34, 197, 94, 0.42);
  --user-bg: rgba(20, 48, 26, 0.72);
  --user-text: #bbf7d0;
  --user-border: #4ade80;
  --ai-bg: rgba(4, 16, 7, 0.92);
  --ai-text: #4ade80;
  --ai-border: rgba(34, 197, 94, 0.6);
  --bubble-radius-ai: 0px;
  --bubble-radius-user: 0px;
  --bubble-shadow: 0 0 10px rgba(34, 197, 94, 0.18);
  --rx-glow-ai: rgba(34, 197, 94, 0.72);
  --rx-glow-user: rgba(250, 204, 21, 0.58);
  --rx-aura-1: rgba(34, 197, 94, 0.35);
  --rx-aura-2: rgba(163, 230, 53, 0.25);
  --composer-radius: 0px;
}

/* ─── 5. Terciopelo Carmesí ─── */
html[data-theme="carmesi"] {
  --font-body: "Cormorant Garamond", Georgia, serif;
  --font-display: "Cinzel", serif;
  --bg-1: #110408;
  --bg-2: #260711;
  --surface: rgba(34, 8, 17, 0.85);
  --surface-strong: rgba(26, 5, 12, 0.96);
  --text-main: #ffe4e6;
  --text-muted: #fda4af;
  --text-dim: rgba(254, 205, 211, 0.58);
  --accent: #e11d48;
  --accent-2: #eab308;
  --border-subtle: rgba(234, 179, 8, 0.34);
  --user-bg: linear-gradient(135deg, rgba(159, 18, 57, 0.6), rgba(76, 5, 25, 0.85));
  --user-text: #fff1f2;
  --user-border: rgba(251, 113, 133, 0.48);
  --ai-bg: rgba(28, 6, 13, 0.88);
  --ai-text: #ffe4e6;
  --ai-border: rgba(234, 179, 8, 0.45);
  --bubble-radius-ai: 18px 18px 18px 3px;
  --bubble-radius-user: 18px 18px 3px 18px;
  --bubble-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  --rx-glow-ai: rgba(225, 29, 72, 0.62);
  --rx-glow-user: rgba(234, 179, 8, 0.55);
  --rx-aura-1: rgba(225, 29, 72, 0.42);
  --rx-aura-2: rgba(234, 179, 8, 0.26);
  --composer-radius: 22px;
}

/* ─── 6. Cristal Líquido (iOS Luxury) ─── */
html[data-theme="cristal"] {
  --font-body: -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", sans-serif;
  --bg-1: #0c1222;
  --bg-2: #1d2646;
  --surface: rgba(255, 255, 255, 0.11);
  --surface-strong: rgba(18, 25, 46, 0.9);
  --text-main: #f8fafc;
  --text-muted: #bae6fd;
  --text-dim: rgba(226, 232, 240, 0.65);
  --accent: #38bdf8;
  --accent-2: #c084fc;
  --border-subtle: rgba(255, 255, 255, 0.25);
  --user-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.36), rgba(129, 140, 248, 0.38));
  --user-text: #ffffff;
  --user-border: rgba(255, 255, 255, 0.42);
  --ai-bg: rgba(255, 255, 255, 0.12);
  --ai-text: #f8fafc;
  --ai-border: rgba(255, 255, 255, 0.28);
  --bubble-radius-ai: 26px 26px 26px 8px;
  --bubble-radius-user: 26px 26px 8px 26px;
  --bubble-shadow: 0 10px 30px rgba(4, 9, 24, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  --rx-glow-ai: rgba(56, 189, 248, 0.58);
  --rx-glow-user: rgba(192, 132, 252, 0.58);
  --rx-aura-1: rgba(56, 189, 248, 0.42);
  --rx-aura-2: rgba(192, 132, 252, 0.4);
  --composer-radius: 30px;
}

/* ─── 7. Brutalista Suizo ─── */
html[data-theme="brutalista"] {
  --font-body: "Space Grotesk", sans-serif;
  --font-display: "Space Grotesk", sans-serif;
  --bg-1: #efece6;
  --bg-2: #e5e0d5;
  --surface: #f7f5f0;
  --surface-strong: #ffffff;
  --text-main: #111111;
  --text-muted: #ff4d00;
  --text-dim: rgba(17, 17, 17, 0.62);
  --accent: #ff4d00;
  --accent-2: #111111;
  --border-subtle: #111111;
  --user-bg: #d9f99d;
  --user-text: #111111;
  --user-border: #111111;
  --ai-bg: #ffffff;
  --ai-text: #111111;
  --ai-border: #111111;
  --bubble-radius-ai: 0px;
  --bubble-radius-user: 0px;
  --bubble-shadow: 4px 4px 0px #111111;
  --rx-glow-ai: rgba(255, 77, 0, 0.58);
  --rx-glow-user: rgba(37, 99, 235, 0.52);
  --rx-aura-1: rgba(255, 77, 0, 0.34);
  --rx-aura-2: rgba(163, 230, 53, 0.45);
  --composer-radius: 0px;
}

/* ─── 8. Tinta Japonesa (Sumi-e Minimal) ─── */
html[data-theme="sumie"] {
  --font-body: "Plus Jakarta Sans", sans-serif;
  --font-display: "Cormorant Garamond", serif;
  --bg-1: #f6f4ef;
  --bg-2: #ece8df;
  --surface: rgba(250, 249, 245, 0.9);
  --surface-strong: #fbfaf7;
  --text-main: #1c1917;
  --text-muted: #b91c1c;
  --text-dim: rgba(41, 37, 36, 0.56);
  --accent: #dc2626;
  --accent-2: #292524;
  --border-subtle: rgba(41, 37, 36, 0.18);
  --user-bg: rgba(231, 229, 228, 0.72);
  --user-text: #1c1917;
  --user-border: #292524;
  --ai-bg: rgba(255, 255, 255, 0.86);
  --ai-text: #1c1917;
  --ai-border: #dc2626;
  --bubble-radius-ai: 2px 12px 12px 2px;
  --bubble-radius-user: 12px 2px 2px 12px;
  --bubble-shadow: 0 2px 10px rgba(28, 25, 23, 0.06);
  --rx-glow-ai: rgba(220, 38, 38, 0.42);
  --rx-glow-user: rgba(41, 37, 36, 0.35);
  --rx-aura-1: rgba(220, 38, 38, 0.25);
  --rx-aura-2: rgba(120, 113, 108, 0.24);
  --composer-radius: 14px;
}

/* ─── 9. Bosque Nocturno (Cárpatos / Transilvania) ─── */
html[data-theme="bosque"] {
  --font-body: "Plus Jakarta Sans", sans-serif;
  --font-display: "Cinzel", serif;
  --bg-1: #060f0b;
  --bg-2: #0d2118;
  --surface: rgba(11, 28, 20, 0.84);
  --surface-strong: rgba(8, 21, 15, 0.96);
  --text-main: #e2f5ea;
  --text-muted: #6ee7b7;
  --text-dim: rgba(167, 243, 208, 0.56);
  --accent: #34d399;
  --accent-2: #a7f3d0;
  --border-subtle: rgba(52, 211, 153, 0.28);
  --user-bg: linear-gradient(145deg, rgba(20, 83, 45, 0.65), rgba(6, 78, 59, 0.65));
  --user-text: #ecfdf5;
  --user-border: rgba(110, 231, 183, 0.42);
  --ai-bg: rgba(9, 24, 18, 0.88);
  --ai-text: #d1fae5;
  --ai-border: rgba(52, 211, 153, 0.34);
  --bubble-radius-ai: 24px 8px 24px 6px;
  --bubble-radius-user: 8px 24px 6px 24px;
  --bubble-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --rx-glow-ai: rgba(52, 211, 153, 0.6);
  --rx-glow-user: rgba(163, 230, 53, 0.5);
  --rx-aura-1: rgba(16, 185, 129, 0.4);
  --rx-aura-2: rgba(45, 212, 191, 0.32);
  --composer-radius: 20px;
}

/* ─── 10. Vaporwave Plaza 1989 ─── */
html[data-theme="vaporwave"] {
  --font-body: "JetBrains Mono", monospace;
  --font-display: "Space Grotesk", sans-serif;
  --bg-1: #1c0b33;
  --bg-2: #3b1254;
  --surface: rgba(212, 208, 200, 0.94);
  --surface-strong: #d4d0c8;
  --text-main: #1a0933;
  --text-muted: #b8007a;
  --text-dim: rgba(26, 9, 51, 0.68);
  --accent: #ff4fd8;
  --accent-2: #00f5d4;
  --border-subtle: #ffffff;
  --user-bg: #c9f7f2;
  --user-text: #120624;
  --user-border: #ffffff;
  --ai-bg: #ece9d8;
  --ai-text: #120624;
  --ai-border: #ffffff;
  --bubble-radius-ai: 0px;
  --bubble-radius-user: 0px;
  --bubble-shadow: inset 1.5px 1.5px 0 #ffffff, inset -1.5px -1.5px 0 #5b4b73, 3px 3px 0 rgba(11, 3, 24, 0.55);
  --rx-glow-ai: rgba(255, 79, 216, 0.72);
  --rx-glow-user: rgba(0, 245, 212, 0.72);
  --rx-aura-1: rgba(255, 79, 216, 0.5);
  --rx-aura-2: rgba(0, 245, 212, 0.42);
  --composer-radius: 0px;
}

/* ─── 11. Noir Cinematográfico 35mm ─── */
html[data-theme="noir"] {
  --font-body: "Cormorant Garamond", Georgia, serif;
  --font-display: "Cinzel", serif;
  --bg-1: #080809;
  --bg-2: #161618;
  --surface: rgba(22, 22, 25, 0.88);
  --surface-strong: #121214;
  --text-main: #f4f4f5;
  --text-muted: #d4d4d8;
  --text-dim: rgba(161, 161, 170, 0.66);
  --accent: #e4e4e7;
  --accent-2: #a1a1aa;
  --border-subtle: rgba(228, 228, 231, 0.25);
  --user-bg: rgba(63, 63, 70, 0.55);
  --user-text: #fafafa;
  --user-border: rgba(244, 244, 245, 0.42);
  --ai-bg: rgba(18, 18, 20, 0.92);
  --ai-text: #e4e4e7;
  --ai-border: rgba(161, 161, 170, 0.35);
  --bubble-radius-ai: 6px;
  --bubble-radius-user: 6px;
  --bubble-shadow: 0 10px 28px rgba(0, 0, 0, 0.72);
  --rx-glow-ai: rgba(255, 255, 255, 0.48);
  --rx-glow-user: rgba(212, 212, 216, 0.45);
  --rx-aura-1: rgba(244, 244, 245, 0.26);
  --rx-aura-2: rgba(161, 161, 170, 0.22);
  --composer-radius: 8px;
}

/* ─── 12. Café Lluvioso Lo-Fi ─── */
html[data-theme="lofi"] {
  --font-body: "Quicksand", sans-serif;
  --font-display: "Quicksand", sans-serif;
  --bg-1: #19120e;
  --bg-2: #2b1d15;
  --surface: rgba(45, 31, 23, 0.88);
  --surface-strong: #261a13;
  --text-main: #fef3c7;
  --text-muted: #fbbf24;
  --text-dim: rgba(253, 230, 138, 0.6);
  --accent: #f59e0b;
  --accent-2: #fb923c;
  --border-subtle: rgba(245, 158, 11, 0.3);
  --user-bg: rgba(146, 64, 14, 0.48);
  --user-text: #fffbeb;
  --user-border: rgba(251, 191, 36, 0.42);
  --ai-bg: rgba(38, 26, 19, 0.9);
  --ai-text: #fef3c7;
  --ai-border: rgba(217, 119, 6, 0.36);
  --bubble-radius-ai: 22px 22px 22px 8px;
  --bubble-radius-user: 22px 22px 8px 22px;
  --bubble-shadow: 0 6px 20px rgba(10, 6, 3, 0.46);
  --rx-glow-ai: rgba(245, 158, 11, 0.56);
  --rx-glow-user: rgba(251, 146, 60, 0.56);
  --rx-aura-1: rgba(245, 158, 11, 0.36);
  --rx-aura-2: rgba(234, 88, 12, 0.28);
  --composer-radius: 24px;
}

/* ─── 13. Nebulosa / Galaxia Profunda ─── */
html[data-theme="galaxia"] {
  --font-body: "Plus Jakarta Sans", sans-serif;
  --font-display: "Space Grotesk", sans-serif;
  --bg-1: #040510;
  --bg-2: #0f1035;
  --surface: rgba(16, 18, 52, 0.8);
  --surface-strong: rgba(11, 12, 38, 0.95);
  --text-main: #eef2ff;
  --text-muted: #a5b4fc;
  --text-dim: rgba(199, 210, 254, 0.58);
  --accent: #818cf8;
  --accent-2: #f472b6;
  --border-subtle: rgba(129, 140, 248, 0.34);
  --user-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(168, 85, 247, 0.4));
  --user-text: #eef2ff;
  --user-border: rgba(165, 180, 252, 0.5);
  --ai-bg: rgba(14, 16, 46, 0.84);
  --ai-text: #e0e7ff;
  --ai-border: rgba(244, 114, 182, 0.35);
  --bubble-radius-ai: 24px 24px 24px 4px;
  --bubble-radius-user: 24px 24px 4px 24px;
  --bubble-shadow: 0 8px 26px rgba(3, 4, 18, 0.55);
  --rx-glow-ai: rgba(129, 140, 248, 0.65);
  --rx-glow-user: rgba(244, 114, 182, 0.62);
  --rx-aura-1: rgba(99, 102, 241, 0.45);
  --rx-aura-2: rgba(236, 72, 153, 0.36);
  --composer-radius: 28px;
}

/* ─── 14. Synthwave Outrun Arcade ─── */
html[data-theme="outrun"] {
  --font-body: "Space Grotesk", sans-serif;
  --font-display: "Space Grotesk", sans-serif;
  --bg-1: #0d0221;
  --bg-2: #240b36;
  --surface: rgba(22, 6, 44, 0.86);
  --surface-strong: #16052b;
  --text-main: #fff0f6;
  --text-muted: #ff71ce;
  --text-dim: rgba(255, 180, 226, 0.62);
  --accent: #ff2a85;
  --accent-2: #ffbe0b;
  --border-subtle: rgba(255, 42, 133, 0.48);
  --user-bg: rgba(58, 12, 163, 0.52);
  --user-text: #ffffff;
  --user-border: #01cdfe;
  --ai-bg: rgba(25, 6, 48, 0.9);
  --ai-text: #ffe5f1;
  --ai-border: #ff2a85;
  --bubble-radius-ai: 14px;
  --bubble-radius-user: 14px;
  --bubble-shadow: 0 0 16px rgba(255, 42, 133, 0.24);
  --rx-glow-ai: rgba(255, 42, 133, 0.75);
  --rx-glow-user: rgba(1, 205, 254, 0.72);
  --rx-aura-1: rgba(255, 42, 133, 0.48);
  --rx-aura-2: rgba(255, 190, 11, 0.38);
  --composer-radius: 16px;
}

/* ─── 15. Prisma Holográfico Y2K ─── */
html[data-theme="holoy2k"] {
  --font-body: "Quicksand", sans-serif;
  --font-display: "Space Grotesk", sans-serif;
  --bg-1: #eef6ff;
  --bg-2: #f9ecff;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --text-main: #1e1b4b;
  --text-muted: #9333ea;
  --text-dim: rgba(49, 46, 129, 0.62);
  --accent: #a855f7;
  --accent-2: #06b6d4;
  --border-subtle: rgba(168, 85, 247, 0.35);
  --user-bg: linear-gradient(135deg, rgba(224, 242, 254, 0.92), rgba(243, 232, 255, 0.92));
  --user-text: #1e1b4b;
  --user-border: rgba(6, 182, 212, 0.55);
  --ai-bg: rgba(255, 255, 255, 0.88);
  --ai-text: #1e1b4b;
  --ai-border: rgba(236, 72, 153, 0.48);
  --bubble-radius-ai: 26px;
  --bubble-radius-user: 26px;
  --bubble-shadow: 0 6px 20px rgba(147, 51, 234, 0.12), inset 0 2px 3px rgba(255, 255, 255, 0.9);
  --rx-glow-ai: rgba(236, 72, 153, 0.55);
  --rx-glow-user: rgba(6, 182, 212, 0.55);
  --rx-aura-1: rgba(236, 72, 153, 0.36);
  --rx-aura-2: rgba(6, 182, 212, 0.36);
  --composer-radius: 30px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE RESET & VIEWPORT SHELL
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-1);
  color: var(--text-main);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUDIO-REACTIVE MULTI-THEME BACKGROUND STAGE
   ═══════════════════════════════════════════════════════════════════════════ */

#bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(165deg, var(--bg-1) 0%, var(--bg-2) 100%);
  overflow: hidden;
  transition: background 0.35s ease;
}

#bg-pattern {
  position: absolute;
  inset: 0;
  opacity: calc(0.45 + var(--rx-mid) * 0.35);
  transition: opacity 0.12s linear;
}

/* Theme-specific background textures & architectural shaders */
html[data-theme="neotokyo"] #bg-pattern {
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 42, 133, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}

html[data-theme="crt"] #bg-pattern {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.36) 0px,
    rgba(0, 0, 0, 0.36) 1px,
    rgba(34, 197, 94, 0.05) 2px,
    rgba(34, 197, 94, 0.05) 3px
  );
}

html[data-theme="brutalista"] #bg-pattern {
  background-image: radial-gradient(#111111 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.16;
}

html[data-theme="editorial"] #bg-pattern,
html[data-theme="sumie"] #bg-pattern {
  background-image: radial-gradient(rgba(120, 88, 42, 0.08) 1px, transparent 0);
  background-size: 16px 16px;
}

html[data-theme="vaporwave"] #bg-pattern,
html[data-theme="outrun"] #bg-pattern {
  background:
    linear-gradient(to bottom, transparent 55%, rgba(255, 42, 133, 0.16) 100%),
    repeating-linear-gradient(90deg, rgba(255, 79, 216, 0.11) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(0deg, rgba(0, 245, 212, 0.09) 0 1px, transparent 1px 28px);
}

html[data-theme="galaxia"] #bg-pattern {
  background-image:
    radial-gradient(1.5px 1.5px at 18% 24%, #ffffff, transparent),
    radial-gradient(1px 1px at 72% 16%, #c7d2fe, transparent),
    radial-gradient(1.5px 1.5px at 42% 68%, #fbcfe8, transparent),
    radial-gradient(1px 1px at 86% 77%, #ffffff, transparent),
    radial-gradient(1.5px 1.5px at 12% 82%, #a5b4fc, transparent);
  background-size: 240px 240px;
}

html[data-theme="noir"] #bg-pattern {
  background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.78) 100%);
}

#bg-reactive-aura {
  position: absolute;
  inset: -18%;
  background:
    radial-gradient(circle at 22% 20%, var(--rx-aura-1) 0%, transparent 52%),
    radial-gradient(circle at 80% 78%, var(--rx-aura-2) 0%, transparent 54%);
  opacity: calc(0.28 + var(--rx-bass) * 0.65);
  transform: scale(calc(1 + var(--rx-bass) * 0.14));
  will-change: transform, opacity;
}

#bg-reactive-pulse {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 92vw;
  height: 92vw;
  max-width: 560px;
  max-height: 560px;
  transform: translate(-50%, -50%) scale(calc(0.82 + var(--rx-energy) * 0.42));
  border-radius: 50%;
  background: radial-gradient(circle, var(--rx-aura-1) 0%, transparent 68%);
  opacity: calc(var(--rx-energy) * 0.55);
  will-change: transform, opacity;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN APP LAYOUT (MINIMALIST & CLUTTER-FREE)
   ═══════════════════════════════════════════════════════════════════════════ */

#app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 780px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
}

/* ─── Top Header with Prisma's Framed Portrait ("marco bonito") ─── */
#chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: calc(10px + var(--safe-top)) 18px 10px 18px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 5;
}

#portrait-trigger {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
}

#portrait-frame {
  position: relative;
  width: 58px;
  height: 70px;
  padding: 3px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.35),
    0 0 calc(6px + var(--rx-bass) * 22px) var(--rx-glow-ai);
  transition: transform 0.2s ease, border-radius 0.3s ease;
}

#portrait-trigger:active #portrait-frame {
  transform: scale(0.95);
}

.portrait-pic,
#prisma-avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  border-radius: inherit;
}

.frame-ornament {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.34);
  pointer-events: none;
}

.portrait-win-bar {
  display: none;
}

/* 15 Distinct Portrait Frame Sculptures! */
html[data-theme="esmeralda"] #portrait-frame {
  border-radius: 18px 18px 22px 22px;
  background: conic-gradient(from 45deg, #10b981, #e879f9, #38bdf8, #fde047, #10b981);
}

html[data-theme="neotokyo"] #portrait-frame {
  border-radius: 0;
  clip-path: polygon(18% 0%, 100% 0%, 100% 82%, 82% 100%, 0% 100%, 0% 18%);
  background: linear-gradient(135deg, #00f0ff, #ff2a85);
}

html[data-theme="editorial"] #portrait-frame {
  width: 60px;
  height: 74px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(145deg, #d4af37, #7c531b, #e7c973);
  box-shadow: 0 3px 12px rgba(68, 44, 18, 0.28), inset 0 0 0 2px #fcf8ef;
}

html[data-theme="crt"] #portrait-frame {
  border-radius: 2px;
  background: #22c55e;
  padding: 2px;
}
html[data-theme="crt"] #prisma-avatar {
  filter: contrast(1.15) saturate(0.85) hue-rotate(15deg);
}

html[data-theme="carmesi"] #portrait-frame {
  border-radius: 34px 34px 8px 8px;
  padding: 3.5px;
  background: linear-gradient(160deg, #fde047, #b45309, #e11d48);
}

html[data-theme="cristal"] #portrait-frame {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, rgba(255,255,255,0.85), rgba(56,189,248,0.6), rgba(192,132,252,0.7));
}

html[data-theme="brutalista"] #portrait-frame {
  border-radius: 0;
  background: #111111;
  padding: 3px;
  box-shadow: 4px 4px 0 #ff4d00;
}

html[data-theme="sumie"] #portrait-frame {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #1c1917;
  padding: 2.5px;
}
html[data-theme="sumie"] .frame-ornament::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: 0;
  width: 11px;
  height: 11px;
  background: #dc2626;
  border-radius: 2px;
}

html[data-theme="bosque"] #portrait-frame {
  border-radius: 28px 10px 28px 10px;
  background: linear-gradient(145deg, #6ee7b7, #065f46, #a7f3d0);
}

html[data-theme="vaporwave"] #portrait-frame {
  width: 64px;
  height: 76px;
  border-radius: 0;
  padding: 14px 3px 3px 3px;
  background: #d4d0c8;
  box-shadow: inset 1.5px 1.5px 0 #fff, inset -1.5px -1.5px 0 #444;
}
html[data-theme="vaporwave"] .portrait-win-bar {
  display: block;
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  height: 11px;
  line-height: 11px;
  font-size: 7px;
  font-weight: 700;
  padding-left: 3px;
  color: #fff;
  background: linear-gradient(90deg, #000080, #ff4fd8);
}

html[data-theme="noir"] #portrait-frame {
  border-radius: 3px;
  padding: 3px;
  background: linear-gradient(135deg, #fafafa, #52525b, #d4d4d8);
}
html[data-theme="noir"] #prisma-avatar {
  filter: grayscale(0.88) contrast(1.18);
}

html[data-theme="lofi"] #portrait-frame {
  border-radius: 4px;
  padding: 4px 4px 11px 4px;
  background: #fef3c7;
  transform: rotate(-2.5deg);
}
html[data-theme="lofi"] .frame-ornament::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 7px;
  background: rgba(251, 191, 36, 0.55);
}

html[data-theme="galaxia"] #portrait-frame {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #f472b6, #38bdf8);
}
html[data-theme="galaxia"] .frame-ornament {
  inset: -6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(165, 180, 252, 0.55);
}

html[data-theme="outrun"] #portrait-frame {
  border-radius: 10px;
  background: linear-gradient(180deg, #01cdfe, #ff2a85, #ffbe0b);
}

html[data-theme="holoy2k"] #portrait-frame {
  border-radius: 22px;
  padding: 3.5px;
  background: linear-gradient(135deg, #ff9a9e, #fad0c4, #a1c4fd, #c2e9fb, #fbc2eb);
}

/* Header Text Meta */
.header-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.header-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.header-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6b7280;
}
.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.status-dot.cloud {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.radio-mini-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}
.radio-mini-wave i {
  display: block;
  width: 2.5px;
  background: var(--accent);
  border-radius: 2px;
}
.radio-mini-wave i:nth-child(1) {
  height: calc(3px + var(--rx-bass) * 9px);
}
.radio-mini-wave i:nth-child(2) {
  height: calc(4px + var(--rx-mid) * 8px);
}
.radio-mini-wave i:nth-child(3) {
  height: calc(3px + var(--rx-high) * 9px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MESSAGES AREA & AUDIO-REACTIVE BUBBLES (ALL 15 THEMES!)
   ═══════════════════════════════════════════════════════════════════════════ */

#messages-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 16px 14px 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

#messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-row {
  display: flex;
  width: 100%;
}
.msg-row.user {
  justify-content: flex-end;
}
.msg-row.assistant {
  justify-content: flex-start;
}

.msg-bubble {
  position: relative;
  max-width: 84%;
  padding: 11px 15px;
  font-size: 0.97rem;
  line-height: 1.48;
  word-wrap: break-word;
  overflow-wrap: break-word;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.25s ease, color 0.25s ease, border-radius 0.25s ease;
}

html[data-theme="editorial"] .msg-bubble,
html[data-theme="carmesi"] .msg-bubble,
html[data-theme="noir"] .msg-bubble {
  font-size: 1.09rem;
  line-height: 1.5;
}

.msg-row.assistant .msg-bubble {
  background: var(--ai-bg);
  color: var(--ai-text);
  border: 1px solid var(--ai-border);
  border-radius: var(--bubble-radius-ai);
  box-shadow:
    var(--bubble-shadow),
    0 0 calc(var(--rx-bass) * 22px) calc(var(--rx-energy) * 2px) var(--rx-glow-ai);
}

.msg-row.user .msg-bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border: 1px solid var(--user-border);
  border-radius: var(--bubble-radius-user);
  box-shadow:
    var(--bubble-shadow),
    0 0 calc(var(--rx-mid) * 20px) calc(var(--rx-energy) * 2px) var(--rx-glow-user);
}

/* Special per-theme bubble structural touches */
html[data-theme="brutalista"] .msg-bubble {
  border-width: 2.5px;
  backdrop-filter: none;
  transform: translateY(calc(var(--rx-bass) * -1.5px));
}

html[data-theme="sumie"] .msg-row.assistant .msg-bubble {
  border: none;
  border-left: 3px solid var(--ai-border);
}
html[data-theme="sumie"] .msg-row.user .msg-bubble {
  border: none;
  border-right: 3px solid var(--user-border);
}

html[data-theme="crt"] .msg-row.assistant .msg-bubble::before {
  content: "PRISMA > ";
  font-weight: 700;
  color: var(--accent-2);
}
html[data-theme="crt"] .msg-row.user .msg-bubble::before {
  content: "HOBYT > ";
  font-weight: 700;
  color: var(--accent);
}

.msg-text p {
  margin: 0 0 8px 0;
}
.msg-text p:last-child {
  margin-bottom: 0;
}
.msg-text pre {
  margin: 8px 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: #f8fafc;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  overflow-x: auto;
}
.msg-text code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.18);
}

.msg-media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.msg-media-img {
  max-width: 210px;
  max-height: 230px;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}
.msg-media-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(127, 127, 127, 0.16);
}

.msg-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.67rem;
  opacity: 0.62;
}

/* Typing / Brain Shift Indicator */
.typing-row {
  margin-top: 10px;
}
.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: var(--bubble-radius-ai);
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.typing-dots {
  display: inline-flex;
  gap: 3px;
}
.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: 0.2s; }
.typing-dots i:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM COMPOSER + MULTIMODAL CAMERA / VOICE RECORDING
   ═══════════════════════════════════════════════════════════════════════════ */

#composer-wrap {
  position: relative;
  flex-shrink: 0;
  padding: 8px 14px calc(10px + var(--safe-bottom)) 14px;
  background: linear-gradient(to top, var(--bg-1) 40%, transparent);
  z-index: 6;
}

.composer-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--composer-radius);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.25),
    0 0 calc(var(--rx-bass) * 14px) var(--rx-glow-ai);
}

html[data-theme="brutalista"] .composer-bar {
  border-width: 2.5px;
  box-shadow: 4px 4px 0 #111111;
}

#msg-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-body);
  /* 16px prevents iOS Safari auto-zoom on focus! */
  font-size: 16px;
  line-height: 1.38;
  max-height: 120px;
  padding: 7px 4px;
  resize: none;
}

#msg-input::placeholder {
  color: var(--text-dim);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.2s ease;
}
.icon-btn:active {
  transform: scale(0.92);
}

.attach-trigger {
  background: rgba(127, 127, 127, 0.15);
  color: var(--text-main);
}

.action-trigger {
  background: var(--accent);
  color: #ffffff;
}
html[data-theme="brutalista"] .icon-btn,
html[data-theme="crt"] .icon-btn,
html[data-theme="vaporwave"] .icon-btn {
  border-radius: 4px;
}
html[data-theme="noir"] .action-trigger {
  color: #09090b;
}

.action-trigger.mode-mic .ico-send { display: none; }
.action-trigger.mode-send .ico-mic { display: none; }

/* Staged Attachments Strip */
.staging-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 4px 10px 4px;
}
.staged-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  flex-shrink: 0;
}
.staged-thumb {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
}
.staged-remove {
  border: none;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
}

/* Attachment & Front/Rear Camera Popover */
.attach-popover {
  position: absolute;
  left: 14px;
  bottom: calc(64px + var(--safe-bottom));
  width: 235px;
  padding: 6px;
  border-radius: 18px;
  background: var(--surface-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.56);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
}
.attach-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.attach-opt:hover,
.attach-opt:active {
  background: rgba(127, 127, 127, 0.16);
}
.attach-ico {
  font-size: 1.1rem;
}

/* Voice Recording Bar */
.voice-rec-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: var(--surface-strong);
  border: 1px solid var(--accent);
  border-radius: var(--composer-radius);
}
.rec-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}
.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  animation: dotPulse 1s infinite;
}
.rec-cancel,
.rec-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-weight: 700;
}
.rec-cancel {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}
.rec-send {
  background: var(--accent);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DISCRETE RIGHT-EDGE RADIO HANDLE & SLIDE-OUT 30-STATION DRAWER
   ═══════════════════════════════════════════════════════════════════════════ */

#radio-edge-tab {
  position: fixed;
  right: 0;
  top: 46%;
  transform: translateY(-50%);
  width: 15px;
  height: 66px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  z-index: 15;
  transition: opacity 0.2s ease, width 0.2s ease;
}
#radio-edge-tab:hover,
#radio-edge-tab.playing {
  opacity: 0.92;
}
.edge-grip {
  width: 3px;
  height: 26px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 calc(var(--rx-bass) * 10px) var(--accent);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 25;
}

.radio-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(88vw, 360px);
  padding: calc(14px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)) 16px;
  background: var(--surface-strong);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translate3d(104%, 0, 0);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 30;
}
.radio-drawer.open {
  transform: translate3d(0, 0, 0);
}

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-kicker {
  display: block;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.drawer-title {
  margin: 2px 0 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.drawer-top-actions,
.sheet-header-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mini-pill-btn {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(127, 127, 127, 0.12);
  color: var(--text-main);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}
.drawer-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
}

.radio-player-card {
  padding: 12px;
  border-radius: 16px;
  background: rgba(127, 127, 127, 0.1);
  border: 1px solid var(--border-subtle);
}
#radio-spectrum {
  width: 100%;
  height: 42px;
  display: block;
  margin-bottom: 6px;
}
.np-name {
  font-weight: 700;
  font-size: 0.94rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-genre {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ctrl-btn.play-main {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.95rem;
}
#radio-vol {
  flex: 1;
  accent-color: var(--accent);
}

.genre-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-shrink: 0;
}
.genre-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.73rem;
  white-space: nowrap;
  cursor: pointer;
}
.genre-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.stations-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 2px;
}
.station-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(127, 127, 127, 0.07);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
}
.station-item:hover {
  border-color: var(--border-subtle);
}
.station-item.active {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.14);
}
.st-num {
  font-size: 0.7rem;
  opacity: 0.5;
  width: 18px;
  flex-shrink: 0;
}
.st-body {
  flex: 1;
  min-width: 0;
}
.st-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.st-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.st-state {
  font-size: 0.78rem;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   15 THEMES & DYNAMIC BRAIN BOTTOM SHEET + LIGHTBOX + LOCK SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

.style-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}

.sheet-card {
  width: 100%;
  max-width: 680px;
  max-height: 82dvh;
  padding: 18px 16px calc(18px + var(--safe-bottom)) 16px;
  border-radius: 24px 24px 0 0;
  background: var(--surface-strong);
  border-top: 1px solid var(--border-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.brain-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.brain-chip {
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(127, 127, 127, 0.08);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
}
.brain-chip strong {
  display: block;
  font-size: 0.82rem;
}
.brain-chip span {
  display: block;
  font-size: 0.69rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.brain-chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 400px) {
  .themes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.theme-card {
  padding: 10px;
  border-radius: 12px;
  border: 1.5px solid var(--border-subtle);
  background: rgba(127, 127, 127, 0.11);
  color: var(--text-main);
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.15s ease;
}
.theme-card:active {
  transform: scale(0.96);
}
.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.theme-swatches {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.theme-swatches i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
}
.theme-card-name {
  display: block;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-main);
}
.theme-card-vibe {
  display: block;
  font-size: 0.66rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
  cursor: zoom-out;
}
#lightbox-img {
  max-width: 94vw;
  max-height: 88dvh;
  border-radius: 14px;
  object-fit: contain;
}

/* Lock Screen */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #0d231c 0%, #050807 70%);
}
.lock-card {
  width: 100%;
  max-width: 320px;
  padding: 28px 22px;
  border-radius: 24px;
  background: rgba(12, 24, 20, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.35);
  text-align: center;
  color: #ecfdf5;
}
.lock-logo {
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.lock-title {
  margin: 12px 0 2px 0;
  font-size: 1.35rem;
}
.lock-sub {
  margin: 0 0 18px 0;
  font-size: 0.82rem;
  color: rgba(209, 250, 229, 0.65);
}
#lock-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#lock-pin-input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(5, 12, 10, 0.8);
  color: #fff;
  font-size: 16px;
  text-align: center;
  outline: none;
}
#lock-submit-btn {
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: #10b981;
  color: #04130e;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.lock-error {
  margin: 10px 0 0 0;
  font-size: 0.8rem;
  color: #f87171;
  min-height: 1.1em;
}
