/* ================================================================
   Musk V2 — Living Interface Design System
   Philosophy: Mesh gradient life, glassmorphism depth, mouse-reactive,
   segmented controls, visual storytelling. Not a form — an experience.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ================================================================
   CSS CUSTOM PROPERTIES (DEFAULTS — MIDNIGHT)
   ================================================================ */
:root {
  --mouse-x: 50%;
  --mouse-y: 50%;
  --mesh-speed: 20s;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --max-width: 520px;
  --nav-height: 52px;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

/* ================================================================
   THEME: MIDNIGHT — Deep dark + purple mesh + purple accent
   ================================================================ */
:root,
[data-theme="midnight"] {
  --bg-root: #08080C;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-inner: rgba(255, 255, 255, 0.02);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.06);
  --bg-segment: rgba(255, 255, 255, 0.04);
  --bg-segment-active: rgba(124, 108, 252, 0.15);
  --bg-password: rgba(255, 255, 255, 0.05);
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-drawer: rgba(18, 18, 24, 0.95);

  --accent: #7C6CFC;
  --accent-hover: #8B7CFD;
  --accent-glow: rgba(124, 108, 252, 0.35);
  --accent-subtle: rgba(124, 108, 252, 0.08);

  --text-primary: #EAEAF0;
  --text-secondary: #8E8EA0;
  --text-muted: #55556A;
  --text-placeholder: #55556A;

  --border-card: rgba(255, 255, 255, 0.06);
  --border-card-hover: rgba(255, 255, 255, 0.10);
  --border-input: rgba(255, 255, 255, 0.06);
  --border-input-focus: rgba(124, 108, 252, 0.4);
  --border-segment: rgba(255, 255, 255, 0.06);

  --mesh-1: rgba(124, 108, 252, 0.18);
  --mesh-2: rgba(99, 85, 224, 0.12);
  --mesh-3: rgba(139, 92, 246, 0.08);
  --mesh-4: rgba(168, 85, 247, 0.06);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(255, 255, 255, 0.08);

  --theme-color-meta: #08080C;
}

/* ================================================================
   THEME: STONE — Light warm + soft blue-purple mesh + purple accent
   ================================================================ */
[data-theme="stone"] {
  --bg-root: #F6F5F3;
  --bg-card: #ffffff;
  --bg-card-inner: #fafafa;
  --bg-input: rgba(0, 0, 0, 0.03);
  --bg-input-focus: rgba(0, 0, 0, 0.05);
  --bg-segment: rgba(0, 0, 0, 0.04);
  --bg-segment-active: rgba(124, 108, 252, 0.10);
  --bg-password: rgba(0, 0, 0, 0.04);
  --bg-overlay: rgba(0, 0, 0, 0.3);
  --bg-drawer: rgba(255, 255, 255, 0.95);

  --accent: #7C6CFC;
  --accent-hover: #6B5CEB;
  --accent-glow: rgba(124, 108, 252, 0.25);
  --accent-subtle: rgba(124, 108, 252, 0.06);

  --text-primary: #1A1A2E;
  --text-secondary: #6B6B80;
  --text-muted: #A0A0B0;
  --text-placeholder: #B0B0C0;

  --border-card: rgba(0, 0, 0, 0.06);
  --border-card-hover: rgba(0, 0, 0, 0.10);
  --border-input: rgba(0, 0, 0, 0.08);
  --border-input-focus: rgba(124, 108, 252, 0.35);
  --border-segment: rgba(0, 0, 0, 0.06);

  --mesh-1: rgba(124, 108, 252, 0.10);
  --mesh-2: rgba(99, 102, 241, 0.08);
  --mesh-3: rgba(168, 162, 255, 0.06);
  --mesh-4: rgba(196, 181, 253, 0.05);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(0, 0, 0, 0.06);

  --theme-color-meta: #F6F5F3;
}

/* ================================================================
   THEME: STEALTH — Pure black + green mesh + green accent
   ================================================================ */
[data-theme="stealth"] {
  --bg-root: #000000;
  --bg-card: rgba(255, 255, 255, 0.02);
  --bg-card-inner: rgba(255, 255, 255, 0.015);
  --bg-input: rgba(255, 255, 255, 0.03);
  --bg-input-focus: rgba(255, 255, 255, 0.05);
  --bg-segment: rgba(255, 255, 255, 0.03);
  --bg-segment-active: rgba(34, 197, 94, 0.12);
  --bg-password: rgba(255, 255, 255, 0.04);
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-drawer: rgba(10, 10, 10, 0.95);

  --accent: #22C55E;
  --accent-hover: #16A34A;
  --accent-glow: rgba(34, 197, 94, 0.30);
  --accent-subtle: rgba(34, 197, 94, 0.06);

  --text-primary: #E0E0E8;
  --text-secondary: #7A7A8A;
  --text-muted: #4A4A5A;
  --text-placeholder: #4A4A5A;

  --border-card: rgba(255, 255, 255, 0.05);
  --border-card-hover: rgba(255, 255, 255, 0.08);
  --border-input: rgba(255, 255, 255, 0.05);
  --border-input-focus: rgba(34, 197, 94, 0.35);
  --border-segment: rgba(255, 255, 255, 0.05);

  --mesh-1: rgba(34, 197, 94, 0.14);
  --mesh-2: rgba(16, 185, 129, 0.10);
  --mesh-3: rgba(52, 211, 153, 0.06);
  --mesh-4: rgba(74, 222, 128, 0.04);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(255, 255, 255, 0.06);

  --theme-color-meta: #000000;
}

/* ================================================================
   THEME: OCEAN — Deep sea blue + cyan mesh + blue accent
   ================================================================ */
[data-theme="ocean"] {
  --bg-root: #0c1220;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-inner: rgba(255, 255, 255, 0.02);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.06);
  --bg-segment: rgba(255, 255, 255, 0.04);
  --bg-segment-active: rgba(14, 165, 233, 0.15);
  --bg-password: rgba(255, 255, 255, 0.05);
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-drawer: rgba(12, 18, 32, 0.95);

  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-glow: rgba(14, 165, 233, 0.35);
  --accent-subtle: rgba(14, 165, 233, 0.08);

  --text-primary: #e0f2fe;
  --text-secondary: #7dd3fc;
  --text-muted: #475569;
  --text-placeholder: #475569;

  --border-card: rgba(255, 255, 255, 0.06);
  --border-card-hover: rgba(255, 255, 255, 0.10);
  --border-input: rgba(255, 255, 255, 0.06);
  --border-input-focus: rgba(14, 165, 233, 0.40);
  --border-segment: rgba(255, 255, 255, 0.06);

  --mesh-1: rgba(14, 165, 233, 0.18);
  --mesh-2: rgba(56, 189, 248, 0.12);
  --mesh-3: rgba(6, 182, 212, 0.08);
  --mesh-4: rgba(34, 211, 238, 0.06);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(255, 255, 255, 0.08);

  --theme-color-meta: #0c1220;
}

/* ================================================================
   THEME: EMBER — Dark red + amber mesh + orange accent
   ================================================================ */
[data-theme="ember"] {
  --bg-root: #1a0a0a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-inner: rgba(255, 255, 255, 0.02);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.06);
  --bg-segment: rgba(255, 255, 255, 0.04);
  --bg-segment-active: rgba(249, 115, 22, 0.15);
  --bg-password: rgba(255, 255, 255, 0.05);
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-drawer: rgba(26, 10, 10, 0.95);

  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.35);
  --accent-subtle: rgba(249, 115, 22, 0.08);

  --text-primary: #fef3c7;
  --text-secondary: #fdba74;
  --text-muted: #78350f;
  --text-placeholder: #78350f;

  --border-card: rgba(255, 255, 255, 0.06);
  --border-card-hover: rgba(255, 255, 255, 0.10);
  --border-input: rgba(255, 255, 255, 0.06);
  --border-input-focus: rgba(249, 115, 22, 0.40);
  --border-segment: rgba(255, 255, 255, 0.06);

  --mesh-1: rgba(249, 115, 22, 0.16);
  --mesh-2: rgba(234, 88, 12, 0.12);
  --mesh-3: rgba(251, 146, 60, 0.08);
  --mesh-4: rgba(253, 186, 116, 0.06);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(255, 255, 255, 0.08);

  --theme-color-meta: #1a0a0a;
}

/* ================================================================
   THEME: AURORA — Dark green + purple-cyan mesh + purple accent
   ================================================================ */
[data-theme="aurora"] {
  --bg-root: #0a0f0a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-inner: rgba(255, 255, 255, 0.02);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.06);
  --bg-segment: rgba(255, 255, 255, 0.04);
  --bg-segment-active: rgba(168, 85, 247, 0.15);
  --bg-password: rgba(255, 255, 255, 0.05);
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-drawer: rgba(10, 15, 10, 0.95);

  --accent: #a855f7;
  --accent-hover: #9333ea;
  --accent-glow: rgba(168, 85, 247, 0.35);
  --accent-subtle: rgba(168, 85, 247, 0.08);

  --text-primary: #f0fdf4;
  --text-secondary: #86efac;
  --text-muted: #365314;
  --text-placeholder: #365314;

  --border-card: rgba(255, 255, 255, 0.06);
  --border-card-hover: rgba(255, 255, 255, 0.10);
  --border-input: rgba(255, 255, 255, 0.06);
  --border-input-focus: rgba(168, 85, 247, 0.40);
  --border-segment: rgba(255, 255, 255, 0.06);

  --mesh-1: rgba(168, 85, 247, 0.16);
  --mesh-2: rgba(34, 211, 238, 0.12);
  --mesh-3: rgba(168, 85, 247, 0.08);
  --mesh-4: rgba(34, 211, 238, 0.06);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(255, 255, 255, 0.08);

  --theme-color-meta: #0a0f0a;
}

/* ================================================================
   THEME: SAKURA — Soft pink + rose mesh + pink accent
   ================================================================ */
[data-theme="sakura"] {
  --bg-root: #fdf2f8;
  --bg-card: #ffffff;
  --bg-card-inner: #fff5f7;
  --bg-input: rgba(236, 72, 153, 0.06);
  --bg-input-focus: rgba(236, 72, 153, 0.10);
  --bg-segment: rgba(236, 72, 153, 0.08);
  --bg-segment-active: rgba(236, 72, 153, 0.15);
  --bg-password: rgba(236, 72, 153, 0.08);
  --bg-overlay: rgba(253, 242, 248, 0.8);
  --bg-drawer: rgba(255, 255, 255, 0.95);

  --accent: #ec4899;
  --accent-hover: #db2777;
  --accent-glow: rgba(236, 72, 153, 0.3);
  --accent-subtle: rgba(236, 72, 153, 0.1);

  --text-primary: #831843;
  --text-secondary: #be185d;
  --text-muted: #f9a8d4;
  --text-placeholder: #f9a8d4;

  --border-card: rgba(236, 72, 153, 0.12);
  --border-card-hover: rgba(236, 72, 153, 0.2);
  --border-input: rgba(236, 72, 153, 0.15);
  --border-input-focus: rgba(236, 72, 153, 0.4);
  --border-segment: rgba(236, 72, 153, 0.12);

  --mesh-1: rgba(236, 72, 153, 0.15);
  --mesh-2: rgba(244, 114, 182, 0.1);
  --mesh-3: rgba(249, 168, 212, 0.08);
  --mesh-4: rgba(253, 242, 248, 0.2);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(236, 72, 153, 0.15);

  --theme-color-meta: #fdf2f8;
}

/* ================================================================
   THEME: SUNSET — Warm orange + red-orange mesh + orange accent
   ================================================================ */
[data-theme="sunset"] {
  --bg-root: #fff7ed;
  --bg-card: #ffffff;
  --bg-card-inner: #fff8f0;
  --bg-input: rgba(249, 115, 22, 0.06);
  --bg-input-focus: rgba(249, 115, 22, 0.10);
  --bg-segment: rgba(249, 115, 22, 0.08);
  --bg-segment-active: rgba(249, 115, 22, 0.15);
  --bg-password: rgba(249, 115, 22, 0.08);
  --bg-overlay: rgba(255, 247, 237, 0.8);
  --bg-drawer: rgba(255, 255, 255, 0.95);

  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-glow: rgba(249, 115, 22, 0.3);
  --accent-subtle: rgba(249, 115, 22, 0.1);

  --text-primary: #7c2d12;
  --text-secondary: #c2410c;
  --text-muted: #fdba74;
  --text-placeholder: #fdba74;

  --border-card: rgba(249, 115, 22, 0.12);
  --border-card-hover: rgba(249, 115, 22, 0.2);
  --border-input: rgba(249, 115, 22, 0.15);
  --border-input-focus: rgba(249, 115, 22, 0.4);
  --border-segment: rgba(249, 115, 22, 0.12);

  --mesh-1: rgba(249, 115, 22, 0.15);
  --mesh-2: rgba(239, 68, 68, 0.1);
  --mesh-3: rgba(251, 146, 60, 0.08);
  --mesh-4: rgba(254, 215, 170, 0.2);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(249, 115, 22, 0.15);

  --theme-color-meta: #fff7ed;
}

/* ================================================================
   THEME: MINT — Light mint + green mesh + green accent
   ================================================================ */
[data-theme="mint"] {
  --bg-root: #f0fdf4;
  --bg-card: #ffffff;
  --bg-card-inner: #f5fdf7;
  --bg-input: rgba(16, 185, 129, 0.06);
  --bg-input-focus: rgba(16, 185, 129, 0.10);
  --bg-segment: rgba(16, 185, 129, 0.08);
  --bg-segment-active: rgba(16, 185, 129, 0.15);
  --bg-password: rgba(16, 185, 129, 0.08);
  --bg-overlay: rgba(240, 253, 244, 0.8);
  --bg-drawer: rgba(255, 255, 255, 0.95);

  --accent: #10b981;
  --accent-hover: #059669;
  --accent-glow: rgba(16, 185, 129, 0.3);
  --accent-subtle: rgba(16, 185, 129, 0.1);

  --text-primary: #064e3b;
  --text-secondary: #047857;
  --text-muted: #6ee7b7;
  --text-placeholder: #6ee7b7;

  --border-card: rgba(16, 185, 129, 0.12);
  --border-card-hover: rgba(16, 185, 129, 0.2);
  --border-input: rgba(16, 185, 129, 0.15);
  --border-input-focus: rgba(16, 185, 129, 0.4);
  --border-segment: rgba(16, 185, 129, 0.12);

  --mesh-1: rgba(16, 185, 129, 0.15);
  --mesh-2: rgba(52, 211, 153, 0.1);
  --mesh-3: rgba(110, 231, 183, 0.08);
  --mesh-4: rgba(209, 250, 229, 0.2);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(16, 185, 129, 0.15);

  --theme-color-meta: #f0fdf4;
}

/* ================================================================
   THEME: GOLD — Dark luxury + gold mesh + gold accent
   ================================================================ */
[data-theme="gold"] {
  --bg-root: #0f0d08;
  --bg-card: rgba(212, 160, 23, 0.04);
  --bg-card-inner: rgba(212, 160, 23, 0.03);
  --bg-input: rgba(212, 160, 23, 0.05);
  --bg-input-focus: rgba(212, 160, 23, 0.08);
  --bg-segment: rgba(212, 160, 23, 0.05);
  --bg-segment-active: rgba(212, 160, 23, 0.15);
  --bg-password: rgba(212, 160, 23, 0.06);
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-drawer: rgba(15, 13, 8, 0.95);

  --accent: #d4a017;
  --accent-hover: #b8860b;
  --accent-glow: rgba(212, 160, 23, 0.35);
  --accent-subtle: rgba(212, 160, 23, 0.08);

  --text-primary: #f5e6c8;
  --text-secondary: #c4a35a;
  --text-muted: #6b5a2e;
  --text-placeholder: #6b5a2e;

  --border-card: rgba(212, 160, 23, 0.08);
  --border-card-hover: rgba(212, 160, 23, 0.15);
  --border-input: rgba(212, 160, 23, 0.08);
  --border-input-focus: rgba(212, 160, 23, 0.40);
  --border-segment: rgba(212, 160, 23, 0.08);

  --mesh-1: rgba(212, 160, 23, 0.18);
  --mesh-2: rgba(245, 215, 142, 0.12);
  --mesh-3: rgba(184, 134, 11, 0.08);
  --mesh-4: rgba(255, 223, 100, 0.05);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(212, 160, 23, 0.1);

  --theme-color-meta: #0f0d08;
}

/* ================================================================
   THEME: ROSEGOLD — Dark rose + rose gold mesh + rose gold accent
   ================================================================ */
[data-theme="rosegold"] {
  --bg-root: #120d10;
  --bg-card: rgba(183, 110, 121, 0.04);
  --bg-card-inner: rgba(183, 110, 121, 0.03);
  --bg-input: rgba(183, 110, 121, 0.05);
  --bg-input-focus: rgba(183, 110, 121, 0.08);
  --bg-segment: rgba(183, 110, 121, 0.05);
  --bg-segment-active: rgba(183, 110, 121, 0.15);
  --bg-password: rgba(183, 110, 121, 0.06);
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-drawer: rgba(18, 13, 16, 0.95);

  --accent: #b76e79;
  --accent-hover: #a05a65;
  --accent-glow: rgba(183, 110, 121, 0.35);
  --accent-subtle: rgba(183, 110, 121, 0.08);

  --text-primary: #f0dce0;
  --text-secondary: #c4899a;
  --text-muted: #6b4a52;
  --text-placeholder: #6b4a52;

  --border-card: rgba(183, 110, 121, 0.08);
  --border-card-hover: rgba(183, 110, 121, 0.15);
  --border-input: rgba(183, 110, 121, 0.08);
  --border-input-focus: rgba(183, 110, 121, 0.40);
  --border-segment: rgba(183, 110, 121, 0.08);

  --mesh-1: rgba(183, 110, 121, 0.18);
  --mesh-2: rgba(232, 180, 184, 0.12);
  --mesh-3: rgba(160, 90, 101, 0.08);
  --mesh-4: rgba(245, 200, 210, 0.05);

  --glass-blur: blur(40px) saturate(150%);
  --glass-border: rgba(183, 110, 121, 0.1);

  --theme-color-meta: #120d10;
}

/* ================================================================
   BASE RESET
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  font-family: var(--font);
  font-size: 16px;
  overflow-x: hidden;
}

body {
  background: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.6s cubic-bezier(0.25, 1, 0.5, 1),
              color 0.4s ease;
  overflow-x: hidden;
}

/* ================================================================
   ANIMATED MESH GRADIENT BACKGROUND — THE LIVING CANVAS
   ================================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      var(--mesh-1), transparent 40%),
    radial-gradient(500px circle at 20% 80%,
      var(--mesh-2), transparent 40%),
    radial-gradient(400px circle at 80% 20%,
      var(--mesh-3), transparent 40%),
    radial-gradient(350px circle at 60% 60%,
      var(--mesh-4), transparent 40%);
  animation: meshDrift var(--mesh-speed) ease-in-out infinite alternate;
  will-change: background;
}

/* Subtle noise overlay for texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

@keyframes meshDrift {
  0% {
    background-position:
      0% 0%,
      20% 80%,
      80% 20%,
      60% 60%;
  }
  33% {
    background-position:
      100% 100%,
      40% 60%,
      60% 80%,
      30% 30%;
  }
  66% {
    background-position:
      50% 50%,
      80% 40%,
      20% 60%,
      70% 80%;
  }
  100% {
    background-position:
      80% 20%,
      30% 90%,
      90% 10%,
      40% 40%;
  }
}

/* ================================================================
   APP CONTAINER
   ================================================================ */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
  padding: 0 20px;
}

/* ================================================================
   NAVIGATION BAR — Ultra minimal, transparent
   ================================================================ */
#navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding: 0 4px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.3s ease;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.nav-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: white;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.nav-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ================================================================
   MAIN CONTENT AREA
   ================================================================ */
#main {
  padding-top: 8px;
}

/* ================================================================
   PAGE SYSTEM
   ================================================================ */
.page {
  display: none;
  animation: pageIn 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.page.active {
  display: block;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================================================================
   HOME PAGE — Hero + Card layout (left-aligned, one-screen)
   ================================================================ */
#page-home {
  display: none;
}

#page-home.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0 8px 0;
  text-align: center;
}

.hero-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: white;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 4px 16px var(--accent-glow);
  animation: heroIconFloat 3s ease-in-out infinite;
}

@keyframes heroIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--text-primary);
  margin-top: 4px;
}

.hero p {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.3px;
  line-height: 1.5;
}

/* ================================================================
   GLASS CARD — True glassmorphism with edge glow
   ================================================================ */
.card,
.main-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.card:hover,
.main-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Subtle gradient edge glow on card */
.card::before,
.main-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    transparent 40%,
    transparent 60%,
    rgba(255, 255, 255, 0.03) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Inner ambient glow */
.card::after,
.main-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    300px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    var(--accent-subtle),
    transparent 40%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.card:hover::after,
.main-card:hover::after {
  opacity: 1;
}

/* ================================================================
   FORM GROUPS
   ================================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group + .form-group {
  margin-top: 20px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ================================================================
   CONTENT INPUT AREA — A "space", not a textarea
   ================================================================ */
.unified-input-area {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-lg);
  transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden;
}

.unified-input-area:focus-within {
  background: var(--bg-input-focus);
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle),
              0 0 20px var(--accent-subtle);
}

.unified-input-area textarea {
  width: 100%;
  min-height: 140px;
  padding: 24px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  resize: none;
}

.unified-input-area textarea::placeholder {
  color: var(--text-placeholder);
  font-size: 16px;
  text-align: center;
  display: block;
  padding-top: 32px;
}

.input-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 12px 12px;
}

.input-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
}

.input-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.input-action-btn svg {
  width: 14px;
  height: 14px;
}

/* ================================================================
   FILE PREVIEW
   ================================================================ */
.file-preview {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--border-card);
}

.file-preview-content img,
.file-preview-content video {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.file-preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.file-preview-remove:hover {
  background: rgba(220, 38, 38, 0.8);
}

/* ================================================================
   PASSWORD INPUT — Compact horizontal bar with lock icon
   ================================================================ */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-password);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  height: 44px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.password-wrapper:focus-within {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Lock icon on the left */
.password-wrapper::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  background: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.password-wrapper input {
  flex: 1;
  height: 100%;
  padding: 0 44px 0 42px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
}

.password-wrapper input::placeholder {
  color: var(--text-placeholder);
  font-size: 14px;
}

.toggle-pw {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  z-index: 1;
}

.toggle-pw:hover {
  color: var(--text-secondary);
  background: var(--accent-subtle);
}

.toggle-pw svg {
  width: 16px;
  height: 16px;
}

/* ================================================================
   STYLE SELECTOR — iOS Segmented Control
   ================================================================ */
.style-selector {
  position: relative;
  display: flex;
  background: var(--bg-segment);
  border: 1px solid var(--border-segment);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.style-btn {
  flex: 1;
  position: relative;
  z-index: 2;
  padding: 8px 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.style-btn span {
  position: relative;
  z-index: 2;
}

.style-btn:hover {
  color: var(--text-secondary);
}

.style-btn.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* Sliding background indicator */
.style-selector::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(25% - 2px);
  height: calc(100% - 6px);
  background: var(--bg-segment-active);
  border-radius: var(--radius-sm);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Position the sliding indicator based on active button */
.style-btn:nth-child(1).active ~ .style-selector::before,
.style-selector:has(.style-btn:nth-child(1).active)::before {
  transform: translateX(0);
}
.style-selector:has(.style-btn:nth-child(2).active)::before {
  transform: translateX(calc(100% + 2px));
}
.style-selector:has(.style-btn:nth-child(3).active)::before {
  transform: translateX(calc(200% + 4px));
}
.style-selector:has(.style-btn:nth-child(4).active)::before {
  transform: translateX(calc(300% + 6px));
}

.hidden-url-input {
  margin-top: 8px;
  width: 100%;
  height: 40px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

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

.hidden-url-input:focus {
  border-color: var(--border-input-focus);
}

/* ================================================================
   GENERATE BUTTON — Visual focal point with gradient glow
   ================================================================ */
.primary-btn,
#btn-generate {
  width: 100%;
  height: 52px;
  margin-top: 24px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow:
    0 2px 8px var(--accent-glow),
    0 0 20px var(--accent-subtle);
}

.primary-btn:hover,
#btn-generate:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 16px var(--accent-glow),
    0 0 30px var(--accent-glow);
}

.primary-btn:active,
#btn-generate:active {
  transform: translateY(0) scale(0.98);
}

/* Subtle shimmer animation on button */
.primary-btn::before,
#btn-generate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: btnShimmer 3s ease-in-out infinite;
}

@keyframes btnShimmer {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

/* Shield icon in button */
.btn-icon-shield {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

/* ================================================================
   RESULT PAGE
   ================================================================ */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

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

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.result-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.result-preview-box {
  padding: 20px;
  border-bottom: 1px solid var(--border-card);
  background: linear-gradient(180deg, var(--bg-card-inner) 0%, transparent 100%);
}

.result-link-area {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-link-area textarea {
  width: 100%;
  min-height: 80px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  resize: none;
  outline: none;
  line-height: 1.6;
  transition: all 0.3s ease;
}

.result-link-area textarea:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.share-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.share-btn svg {
  width: 16px;
  height: 16px;
}

/* ================================================================
   VIEW PAGE
   ================================================================ */
#page-view .page-header {
  justify-content: center;
  margin-bottom: 24px;
}

#page-view .page-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.cover-section {
  margin-bottom: 20px;
}

.cover-display {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-card);
}

.cover-display img {
  width: 100%;
  display: block;
}

.fake-text {
  padding: 24px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  margin-bottom: 20px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meta-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.meta-time {
  font-size: 13px;
  color: var(--text-muted);
}

.copyright-bar {
  text-align: center;
  padding: 20px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.copyright-bar:hover {
  border-color: var(--border-card-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.copyright-text {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.copyright-id {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 4px;
}

/* Unlock Panel */
.unlock-panel {
  margin-top: 24px;
  padding: 28px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: pageIn 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.unlock-panel::before {
  content: '🔒';
  font-size: 32px;
  text-align: center;
  margin-bottom: 4px;
}

.unlock-confirm-btn {
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.unlock-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.unlock-error,
.unlock-expiry {
  font-size: 13px;
  color: #ef4444;
  text-align: center;
  font-weight: 500;
}

.original-section {
  margin-top: 24px;
  padding: 24px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xl);
  animation: pageIn 0.4s ease;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.original-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
}

.original-image,
.original-video {
  width: 100%;
  border-radius: var(--radius-md);
}

/* ================================================================
   THEME PICKER — iOS-style bottom drawer
   ================================================================ */
.theme-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayIn 0.3s ease;
}

.theme-picker-panel {
  width: 100%;
  max-width: var(--max-width);
  padding: 12px 20px 32px;
  background: rgba(18, 18, 24, 0.95);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  animation: drawerSlideUp 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Drag handle bar */
.theme-picker-panel::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--text-muted);
  opacity: 0.4;
  border-radius: var(--radius-full);
  margin: 0 auto 20px;
}

.theme-picker-panel h3 {
  font-size: 17px;
  font-weight: 700;
  color: #e4e4e7;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  text-align: left;
}

.theme-option:hover {
  border-color: var(--border-card-hover);
  background: rgba(255, 255, 255, 0.08);
}

.theme-option.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  position: relative;
}

.theme-option.active .theme-swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
}

.theme-name {
  font-size: 15px;
  font-weight: 600;
  color: #e4e4e7;
  display: block;
}

.theme-desc {
  font-size: 12px;
  color: #71717a;
  display: block;
  margin-top: 2px;
}

.theme-close-btn {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: transparent;
  color: #a1a1aa;
  font-size: 15px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes drawerSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ================================================================
   TOAST
   ================================================================ */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--bg-drawer);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  animation: toastIn 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.hidden {
  display: none !important;
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */
@media (max-width: 380px) {
  #app {
    padding: 0 16px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .card,
  .main-card {
    padding: 20px;
  }

  .unified-input-area textarea {
    padding: 20px;
    min-height: 120px;
  }

  .style-btn {
    font-size: 12px;
    padding: 7px 2px;
  }
}

@media (min-width: 768px) {
  #app {
    padding-top: 20px;
  }

  .card,
  .main-card {
    padding: 28px;
  }

  .unified-input-area textarea {
    min-height: 160px;
  }
}

/* ================================================================
   PREFERS-REDUCED-MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body::before {
    animation: none;
  }

  .primary-btn::before,
  #btn-generate::before {
    animation: none;
  }
}

/* ================================================================
   SAFE AREA INSETS (for notched devices)
   ================================================================ */
@supports (padding-top: env(safe-area-inset-top)) {
  #navbar {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--nav-height) + env(safe-area-inset-top));
  }

  .theme-picker-panel {
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
  opacity: 0.3;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ================================================================
   AUTH MODAL — Login / Register overlay
   ================================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: overlayIn 0.3s ease;
  padding: 20px;
}

.auth-modal {
  width: 100%;
  max-width: 400px;
  background: var(--bg-drawer);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px 24px 24px;
  animation: authModalIn 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  position: relative;
  overflow: hidden;
}

@keyframes authModalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Ambient glow behind modal */
.auth-modal::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    var(--accent-subtle),
    transparent 40%
  );
  pointer-events: none;
  opacity: 0.5;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  z-index: 1;
}

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

.auth-header {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.auth-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Tab switcher — Login / Register / Phone */
.auth-tabs {
  display: flex;
  background: var(--bg-segment);
  border: 1px solid var(--border-segment);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.auth-tab {
  flex: 1;
  padding: 10px 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.25s ease;
  position: relative;
  z-index: 2;
}

.auth-tab.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* Sliding indicator */
.auth-tabs::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(33.333% - 2px);
  height: calc(100% - 6px);
  background: var(--bg-segment-active);
  border-radius: var(--radius-sm);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-tabs:has(.auth-tab:nth-child(1).active)::before { transform: translateX(0); }
.auth-tabs:has(.auth-tab:nth-child(2).active)::before { transform: translateX(calc(100% + 2px)); }
.auth-tabs:has(.auth-tab:nth-child(3).active)::before { transform: translateX(calc(200% + 4px)); }

/* Auth form content */
.auth-form {
  position: relative;
  z-index: 1;
}

.auth-form-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: pageIn 0.3s ease;
}

.auth-form-panel.active {
  display: flex;
}

.auth-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

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

.auth-input:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--bg-input-focus);
}

.auth-input-row {
  display: flex;
  gap: 8px;
}

.auth-input-row .auth-input {
  flex: 1;
}

.auth-sms-btn {
  flex-shrink: 0;
  width: 110px;
  height: 44px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.auth-sms-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.auth-sms-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.auth-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-submit-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 2px 8px var(--accent-glow);
  position: relative;
  overflow: hidden;
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.auth-submit-btn:active {
  transform: scale(0.98);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-submit-btn .btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-submit-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.auth-error {
  font-size: 13px;
  color: #ef4444;
  text-align: center;
  min-height: 18px;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-card);
}

/* OAuth buttons */
.auth-oauth-grid {
  display: flex;
  gap: 10px;
}

.auth-oauth-btn {
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-oauth-btn:hover {
  border-color: var(--border-card-hover);
  background: var(--accent-subtle);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.auth-oauth-btn:active {
  transform: scale(0.96);
}

.auth-oauth-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ================================================================
   USER AVATAR — Navbar user state
   ================================================================ */
.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.nav-user-avatar:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(1.05);
}

/* User dropdown menu */
.user-menu {
  position: absolute;
  top: calc(var(--nav-height) + 4px);
  right: 4px;
  width: 200px;
  background: var(--bg-drawer);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 8px;
  z-index: 200;
  animation: authModalIn 0.25s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.user-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-card);
  margin: 4px 0;
}

.user-menu-info {
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: 4px;
}

.user-menu-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-tier {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ================================================================
   SAFE AREA INSETS — Auth modal
   ================================================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .auth-modal {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* ================================================================
   RESPONSIVE — Auth modal
   ================================================================ */
@media (max-width: 380px) {
  .auth-modal {
    padding: 24px 20px 20px;
  }

  .auth-header h2 {
    font-size: 20px;
  }

  .auth-oauth-grid {
    flex-direction: column;
  }

  .auth-oauth-btn {
    height: 40px;
  }
}

@media (min-width: 768px) {
  .auth-modal {
    padding: 36px 32px 28px;
  }
}

/* ================================================================
   SELECTION STYLING
   ================================================================ */
::selection {
  background: var(--accent);
  color: white;
}

/* ================================================================
   CLIPBOARD HINT BAR
   ================================================================ */
.clipboard-hint {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: pageIn 0.3s ease;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.clipboard-hint:hover {
  border-color: var(--border-card-hover);
}

.clipboard-hint-content {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.clipboard-hint-content svg {
  flex-shrink: 0;
  color: var(--accent);
}

.clipboard-hint-content span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clipboard-hint-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.clipboard-use-btn {
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.clipboard-use-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.clipboard-use-btn:active {
  transform: scale(0.96);
}

.clipboard-dismiss-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.clipboard-dismiss-btn:hover {
  border-color: var(--border-card-hover);
  color: var(--text-secondary);
  background: var(--accent-subtle);
}

/* ================================================================
   SHARE BUTTON EXPAND (replaces old share-btn)
   ================================================================ */
.share-btn-expand {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.share-btn-expand:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.share-btn-expand:active {
  transform: scale(0.98);
}

.share-expand-arrow {
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  margin-left: 2px;
}

/* ================================================================
   SHARE PANEL — Glassmorphism card with grid layout
   ================================================================ */
.share-panel {
  padding: 20px;
  border-top: 1px solid var(--border-card);
  animation: sharePanelIn 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes sharePanelIn {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 600px;
    padding-top: 20px;
    padding-bottom: 20px;
  }
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 4px 10px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-card-inner);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.share-item:hover {
  background: var(--accent-subtle);
  border-color: var(--border-card-hover);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-subtle);
}

.share-item:active {
  transform: scale(0.94);
}

.share-item svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.share-item span {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
  white-space: nowrap;
}

/* ================================================================
   SHARE QR CODE SECTION
   ================================================================ */
.share-qr-section {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: pageIn 0.3s ease;
}

.share-qr-section canvas {
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-card);
}

.share-qr-section p {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ================================================================
   RESPONSIVE — Share panel adjustments
   ================================================================ */
@media (max-width: 380px) {
  .share-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .share-item {
    padding: 12px 4px 8px;
  }

  .clipboard-hint {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .clipboard-hint-content {
    justify-content: center;
  }

  .clipboard-hint-actions {
    justify-content: center;
  }
}

@media (min-width: 768px) {
  .share-grid {
    gap: 14px;
  }

  .share-item {
    padding: 16px 4px 12px;
  }
}

/* ================================================================
   SAFE AREA INSETS — Share panel & clipboard hint
   ================================================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .share-panel {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .clipboard-hint {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
}
