@import url('https://fonts.googleapis.com/css2?family=Spectral:wght@400;600;700&family=Space+Grotesk:wght@400;500;600&family=Noto+Serif:wght@400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap');

:root {
  --ink: #1d1510;
  --paper: #f7ead2;
  --ember: #ffb783;
  --ember-deep: #fb8e32;
  --night: #161311;
  --smoke: rgba(255, 255, 255, 0.08);
  --glow: rgba(255, 183, 131, 0.35);
  --gold: #e9c349;
  --shadow: rgba(10, 4, 2, 0.4);
  --gutter: clamp(16px, 5vw, 80px);
  --theme-bg: radial-gradient(circle at 20% 15%, #3b1b11 0%, #161311 55%, #0a0706 100%);
  --ambient-a: rgba(255, 183, 131, 0.20);
  --ambient-b: rgba(233, 195, 73, 0.14);
  --ambient-c: rgba(255, 181, 160, 0.12);
  --ui-font: 'Space Grotesk', sans-serif;
  --title-font: 'Playfair Display', serif;
  --editor-font: 'Noto Serif', 'Spectral', serif;

  /* Theme UI tokens — Stitch "Digital Hearth" defaults (Campfire). */
  --theme-accent: #ffb783;
  --theme-accent-2: #fb8e32;
  --theme-accent-soft: rgba(255, 183, 131, 0.20);
  --theme-accent-soft-2: rgba(255, 183, 131, 0.36);
  --theme-accent-text: #4f2500;
  --theme-secondary: #e9c349;
  --theme-tertiary: #ffb5a0;
  --theme-surface: #161311;
  --theme-surface-container: #231f1d;
  --theme-panel-bg: rgba(46, 41, 39, 0.60);
  --theme-panel-bg-2: rgba(35, 31, 29, 0.85);
  --theme-panel-border: rgba(86, 67, 52, 0.15);
  --theme-hover-bg: rgba(255, 183, 131, 0.08);
  --theme-focus: rgba(255, 183, 131, 0.55);
  --theme-scroll-thumb: rgba(255, 183, 131, 0.38);
  --theme-scroll-thumb-hover: rgba(255, 183, 131, 0.58);
  --book-cover: #6f3f24;
  --heat-0: rgba(255, 255, 255, 0.07);
  --heat-1: rgba(255, 183, 131, 0.25);
  --heat-2: rgba(251, 142, 50, 0.45);
  --heat-3: rgba(233, 195, 73, 0.65);
  --heat-4: rgba(255, 95, 25, 0.9);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Spectral', serif;
  color: #fbeedc;
  background: var(--theme-bg);
  position: relative;
  overflow-x: hidden;
  isolation: isolate;
}

::selection {
  background: var(--theme-accent-soft);
}

input,
textarea {
  caret-color: var(--theme-accent);
}

button:focus-visible,
.btn:focus-visible,
.tool-btn:focus-visible,
.share-mode-btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--theme-focus);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(10, 7, 6, 0.35) 100%),
    linear-gradient(180deg, rgba(10, 5, 3, 0.2) 0%, transparent 34%, rgba(10, 5, 3, 0.18) 100%);
}

.ambient-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, var(--ambient-a), transparent 55%),
    radial-gradient(circle at 80% 30%, var(--ambient-b), transparent 60%),
    radial-gradient(circle at 30% 80%, var(--ambient-c), transparent 55%);
  pointer-events: none;
  z-index: -5;
  animation: emberPulse 8s ease-in-out infinite;
}

.pulse-highlight {
  animation: pulseHighlight 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 var(--theme-focus);
}

@keyframes pulseHighlight {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 0 10px 4px var(--theme-focus); }
  100% { transform: scale(1); }
}

.ember-field-canvas,
.fire-band-canvas,
.water-canvas,
.wind-canvas,
.earth-canvas,
.ice-canvas,
.storm-canvas,
.space-canvas,
.garden-canvas,
.cherry-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -3;
}

.fire-band-canvas {
  bottom: 0 !important;
  top: auto !important;
  height: 280px !important;
}

.ember-field-canvas {
  z-index: -2;
}

body[data-theme="campfire"] .ember-field-canvas,
body[data-theme="campfire"] .fire-band-canvas {
  display: none;
}

body[data-theme="campfire"] .fire-band-canvas {
  display: block;
}

body[data-theme="campfire"] .water-canvas,
body[data-theme="campfire"] .wind-canvas,
body[data-theme="campfire"] .earth-canvas,
body[data-theme="campfire"] .ice-canvas,
body[data-theme="campfire"] .storm-canvas,
body[data-theme="campfire"] .space-canvas,
body[data-theme="campfire"] .garden-canvas,
body[data-theme="campfire"] .cherry-canvas {
  display: none;
}

body[data-theme="water"] .ember-field-canvas,
body[data-theme="water"] .fire-band-canvas,
body[data-theme="water"] .wind-canvas,
body[data-theme="water"] .earth-canvas,
body[data-theme="water"] .ice-canvas,
body[data-theme="water"] .storm-canvas,
body[data-theme="water"] .space-canvas,
body[data-theme="water"] .garden-canvas,
body[data-theme="water"] .cherry-canvas {
  display: none;
}

body[data-theme="wind"] .ember-field-canvas,
body[data-theme="wind"] .fire-band-canvas,
body[data-theme="wind"] .water-canvas,
body[data-theme="wind"] .earth-canvas,
body[data-theme="wind"] .ice-canvas,
body[data-theme="wind"] .storm-canvas,
body[data-theme="wind"] .space-canvas,
body[data-theme="wind"] .garden-canvas,
body[data-theme="wind"] .cherry-canvas {
  display: none;
}

body[data-theme="earth"] .ember-field-canvas,
body[data-theme="earth"] .fire-band-canvas,
body[data-theme="earth"] .water-canvas,
body[data-theme="earth"] .wind-canvas,
body[data-theme="earth"] .ice-canvas,
body[data-theme="earth"] .storm-canvas,
body[data-theme="earth"] .space-canvas,
body[data-theme="earth"] .garden-canvas,
body[data-theme="earth"] .cherry-canvas {
  display: none;
}

body[data-theme="ice"] .ember-field-canvas,
body[data-theme="ice"] .fire-band-canvas,
body[data-theme="ice"] .water-canvas,
body[data-theme="ice"] .wind-canvas,
body[data-theme="ice"] .earth-canvas,
body[data-theme="ice"] .storm-canvas,
body[data-theme="ice"] .space-canvas,
body[data-theme="ice"] .garden-canvas,
body[data-theme="ice"] .cherry-canvas {
  display: none;
}

body[data-theme="storm"] .ember-field-canvas,
body[data-theme="storm"] .fire-band-canvas,
body[data-theme="storm"] .water-canvas,
body[data-theme="storm"] .wind-canvas,
body[data-theme="storm"] .earth-canvas,
body[data-theme="storm"] .ice-canvas,
body[data-theme="storm"] .space-canvas,
body[data-theme="storm"] .garden-canvas,
body[data-theme="storm"] .cherry-canvas {
  display: none;
}

body[data-theme="space"] .ember-field-canvas,
body[data-theme="space"] .fire-band-canvas,
body[data-theme="space"] .water-canvas,
body[data-theme="space"] .wind-canvas,
body[data-theme="space"] .earth-canvas,
body[data-theme="space"] .ice-canvas,
body[data-theme="space"] .storm-canvas,
body[data-theme="space"] .garden-canvas,
body[data-theme="space"] .cherry-canvas {
  display: none;
}

body[data-theme="garden"] .ember-field-canvas,
body[data-theme="garden"] .fire-band-canvas,
body[data-theme="garden"] .water-canvas,
body[data-theme="garden"] .wind-canvas,
body[data-theme="garden"] .earth-canvas,
body[data-theme="garden"] .ice-canvas,
body[data-theme="garden"] .storm-canvas,
body[data-theme="garden"] .space-canvas,
body[data-theme="garden"] .cherry-canvas {
  display: none;
}

body[data-theme-preview="campfire"] {
  --theme-bg: radial-gradient(circle at 20% 15%, #3b1b11 0%, #161311 55%, #0a0706 100%);
  --ambient-a: rgba(255, 183, 131, 0.22);
  --ambient-b: rgba(233, 195, 73, 0.16);
  --ambient-c: rgba(255, 181, 160, 0.12);
  --theme-accent: #ffb783;
  --theme-accent-2: #fb8e32;
  --theme-accent-soft: rgba(255, 183, 131, 0.20);
  --theme-accent-soft-2: rgba(255, 183, 131, 0.36);
  --theme-accent-text: #4f2500;
  --theme-focus: rgba(255, 183, 131, 0.55);
  --theme-scroll-thumb: rgba(255, 183, 131, 0.38);
  --theme-scroll-thumb-hover: rgba(255, 183, 131, 0.58);
  --book-cover: #6f3f24;
  --heat-1: rgba(255, 183, 131, 0.25);
  --heat-2: rgba(251, 142, 50, 0.45);
  --heat-3: rgba(233, 195, 73, 0.65);
  --heat-4: rgba(255, 95, 25, 0.9);
}

body[data-theme-preview="water"] {
  --theme-bg: radial-gradient(circle at 25% 20%, #1a4568 0%, #0d2542 56%, #071525 100%);
  --ambient-a: rgba(89, 188, 238, 0.24);
  --ambient-b: rgba(66, 165, 230, 0.18);
  --ambient-c: rgba(120, 210, 255, 0.12);
  --theme-accent: #59bcee;
  --theme-accent-2: #3a9dd4;
  --theme-accent-soft: rgba(89, 188, 238, 0.22);
  --theme-accent-soft-2: rgba(89, 188, 238, 0.38);
  --theme-accent-text: #071525;
  --theme-focus: rgba(89, 188, 238, 0.55);
  --theme-scroll-thumb: rgba(89, 188, 238, 0.42);
  --theme-scroll-thumb-hover: rgba(89, 188, 238, 0.62);
  --book-cover: #1e4a5e;
  --heat-1: rgba(103, 191, 236, 0.22);
  --heat-2: rgba(86, 153, 220, 0.42);
  --heat-3: rgba(103, 191, 236, 0.64);
  --heat-4: rgba(103, 191, 236, 0.88);
}

body[data-theme-preview="wind"] {
  --theme-bg: radial-gradient(circle at 30% 20%, #3d4f60 0%, #1e2d3a 55%, #101820 100%);
  --ambient-a: rgba(173, 217, 242, 0.22);
  --ambient-b: rgba(140, 190, 225, 0.16);
  --ambient-c: rgba(200, 230, 250, 0.12);
  --theme-accent: #add9f2;
  --theme-accent-2: #7ab8e0;
  --theme-accent-soft: rgba(173, 217, 242, 0.18);
  --theme-accent-soft-2: rgba(173, 217, 242, 0.30);
  --theme-accent-text: #0a1520;
  --theme-focus: rgba(173, 217, 242, 0.50);
  --theme-scroll-thumb: rgba(173, 217, 242, 0.36);
  --theme-scroll-thumb-hover: rgba(173, 217, 242, 0.56);
  --book-cover: #3d4e5c;
  --heat-1: rgba(198, 232, 255, 0.18);
  --heat-2: rgba(124, 182, 228, 0.36);
  --heat-3: rgba(198, 232, 255, 0.58);
  --heat-4: rgba(198, 232, 255, 0.8);
  --editor-font: 'Space Grotesk', sans-serif;
}

body[data-theme-preview="earth"] {
  --theme-bg: radial-gradient(circle at 25% 20%, #46362a 0%, #2a1f18 56%, #181210 100%);
  --ambient-a: rgba(164, 130, 91, 0.24);
  --ambient-b: rgba(140, 110, 75, 0.18);
  --ambient-c: rgba(190, 165, 120, 0.12);
  --theme-accent: #8bc476;
  --theme-accent-2: #a89060;
  --theme-accent-soft: rgba(139, 196, 118, 0.22);
  --theme-accent-soft-2: rgba(139, 196, 118, 0.36);
  --theme-accent-text: #0a1510;
  --theme-focus: rgba(139, 196, 118, 0.55);
  --theme-scroll-thumb: rgba(139, 196, 118, 0.40);
  --theme-scroll-thumb-hover: rgba(139, 196, 118, 0.60);
  --book-cover: #584838;
  --heat-1: rgba(132, 190, 108, 0.2);
  --heat-2: rgba(132, 190, 108, 0.4);
  --heat-3: rgba(132, 190, 108, 0.62);
  --heat-4: rgba(132, 190, 108, 0.86);
}

body[data-theme-preview="ice"] {
  --theme-bg: radial-gradient(circle at 30% 15%, #2f4a5e 0%, #1a2f40 57%, #0f1a24 100%);
  --ambient-a: rgba(184, 227, 247, 0.26);
  --ambient-b: rgba(140, 205, 240, 0.18);
  --ambient-c: rgba(220, 248, 255, 0.12);
  --theme-accent: #b8e3f7;
  --theme-accent-2: #7cc0e8;
  --theme-accent-soft: rgba(184, 227, 247, 0.20);
  --theme-accent-soft-2: rgba(184, 227, 247, 0.34);
  --theme-accent-text: #0b1620;
  --theme-focus: rgba(184, 227, 247, 0.55);
  --theme-scroll-thumb: rgba(184, 227, 247, 0.38);
  --theme-scroll-thumb-hover: rgba(184, 227, 247, 0.58);
  --book-cover: #344e62;
  --heat-1: rgba(210, 244, 255, 0.18);
  --heat-2: rgba(130, 195, 235, 0.36);
  --heat-3: rgba(210, 244, 255, 0.58);
  --heat-4: rgba(210, 244, 255, 0.82);
  --editor-font: 'Space Grotesk', sans-serif;
}

body[data-theme-preview="storm"] {
  --theme-bg: radial-gradient(circle at 20% 20%, #322d4a 0%, #1a1730 56%, #0e0c1a 100%);
  --ambient-a: rgba(124, 154, 255, 0.24);
  --ambient-b: rgba(100, 120, 210, 0.18);
  --ambient-c: rgba(170, 185, 255, 0.12);
  --theme-accent: #7c9aff;
  --theme-accent-2: #5a6fd4;
  --theme-accent-soft: rgba(124, 154, 255, 0.22);
  --theme-accent-soft-2: rgba(124, 154, 255, 0.38);
  --theme-accent-text: #0b0e18;
  --theme-focus: rgba(124, 154, 255, 0.55);
  --theme-scroll-thumb: rgba(124, 154, 255, 0.42);
  --theme-scroll-thumb-hover: rgba(124, 154, 255, 0.62);
  --book-cover: #2a2840;
  --heat-1: rgba(125, 147, 255, 0.2);
  --heat-2: rgba(125, 147, 255, 0.4);
  --heat-3: rgba(125, 147, 255, 0.62);
  --heat-4: rgba(125, 147, 255, 0.86);
  --editor-font: 'Space Grotesk', sans-serif;
}

body[data-theme-preview="space"] {
  --theme-bg: radial-gradient(circle at 25% 15%, #23224a 0%, #141338 54%, #090918 100%);
  --ambient-a: rgba(160, 141, 245, 0.24);
  --ambient-b: rgba(110, 150, 250, 0.16);
  --ambient-c: rgba(200, 210, 255, 0.10);
  --theme-accent: #a08df5;
  --theme-accent-2: #6e96fa;
  --theme-accent-soft: rgba(160, 141, 245, 0.24);
  --theme-accent-soft-2: rgba(160, 141, 245, 0.40);
  --theme-accent-text: #0c0a18;
  --theme-focus: rgba(160, 141, 245, 0.55);
  --theme-scroll-thumb: rgba(160, 141, 245, 0.42);
  --theme-scroll-thumb-hover: rgba(160, 141, 245, 0.62);
  --book-cover: #2a204e;
  --heat-1: rgba(143, 120, 220, 0.2);
  --heat-2: rgba(101, 148, 242, 0.36);
  --heat-3: rgba(143, 120, 220, 0.62);
  --heat-4: rgba(143, 120, 220, 0.86);
}

body[data-theme-preview="garden"] {
  --theme-bg: radial-gradient(circle at 25% 20%, #244838 0%, #162c22 56%, #0c1812 100%);
  --ambient-a: rgba(140, 218, 151, 0.24);
  --ambient-b: rgba(100, 185, 135, 0.18);
  --ambient-c: rgba(190, 240, 195, 0.12);
  --theme-accent: #8cda97;
  --theme-accent-2: #60b97f;
  --theme-accent-soft: rgba(140, 218, 151, 0.22);
  --theme-accent-soft-2: rgba(140, 218, 151, 0.38);
  --theme-accent-text: #0a1810;
  --theme-focus: rgba(140, 218, 151, 0.55);
  --theme-scroll-thumb: rgba(140, 218, 151, 0.40);
  --theme-scroll-thumb-hover: rgba(140, 218, 151, 0.60);
  --book-cover: #264a38;
  --heat-1: rgba(119, 204, 139, 0.2);
  --heat-2: rgba(119, 204, 139, 0.4);
  --heat-3: rgba(119, 204, 139, 0.62);
  --heat-4: rgba(119, 204, 139, 0.86);
}

body[data-theme-preview="cherry"] {
  --theme-bg: radial-gradient(circle at 25% 20%, #4a1e28 0%, #2c1118 56%, #18080c 100%);
  --ambient-a: rgba(255, 182, 197, 0.24);
  --ambient-b: rgba(255, 150, 175, 0.18);
  --ambient-c: rgba(255, 228, 230, 0.12);
  --theme-accent: #ffb7c5;
  --theme-accent-2: #ff6fa3;
  --theme-accent-soft: rgba(255, 182, 197, 0.22);
  --theme-accent-soft-2: rgba(255, 182, 197, 0.38);
  --theme-accent-text: #2a0b14;
  --theme-focus: rgba(255, 182, 197, 0.55);
  --theme-scroll-thumb: rgba(255, 182, 197, 0.40);
  --theme-scroll-thumb-hover: rgba(255, 182, 197, 0.60);
  --book-cover: #5e2030;
  --heat-1: rgba(255, 182, 193, 0.2);
  --heat-2: rgba(255, 182, 193, 0.4);
  --heat-3: rgba(255, 182, 193, 0.62);
  --heat-4: rgba(255, 182, 193, 0.86);
}

body[data-theme-preview="campfire"] .theme-motion,
body[data-theme-preview="campfire"] .theme-particle-layer {
  display: none;
}

body[data-theme-preview="water"] .theme-motion,
body[data-theme-preview="wind"] .theme-motion,
body[data-theme-preview="earth"] .theme-motion,
body[data-theme-preview="ice"] .theme-motion,
body[data-theme-preview="storm"] .theme-motion,
body[data-theme-preview="space"] .theme-motion,
body[data-theme-preview="garden"] .theme-motion,
body[data-theme-preview="cherry"] .theme-motion {
  opacity: 1;
}

/* Theme preview on hover - higher specificity */
body[data-theme-preview="campfire"] .water-canvas,
body[data-theme-preview="campfire"] .wind-canvas,
body[data-theme-preview="campfire"] .earth-canvas,
body[data-theme-preview="campfire"] .ice-canvas,
body[data-theme-preview="campfire"] .storm-canvas,
body[data-theme-preview="campfire"] .space-canvas,
body[data-theme-preview="campfire"] .garden-canvas,
body[data-theme-preview="campfire"] .cherry-canvas {
  display: none !important;
}

body[data-theme-preview="water"] .ember-field-canvas,
body[data-theme-preview="water"] .fire-band-canvas,
body[data-theme-preview="water"] .wind-canvas,
body[data-theme-preview="water"] .earth-canvas,
body[data-theme-preview="water"] .ice-canvas,
body[data-theme-preview="water"] .storm-canvas,
body[data-theme-preview="water"] .space-canvas,
body[data-theme-preview="water"] .garden-canvas,
body[data-theme-preview="water"] .cherry-canvas {
  display: none !important;
}

body[data-theme-preview="wind"] .ember-field-canvas,
body[data-theme-preview="wind"] .fire-band-canvas,
body[data-theme-preview="wind"] .water-canvas,
body[data-theme-preview="wind"] .earth-canvas,
body[data-theme-preview="wind"] .ice-canvas,
body[data-theme-preview="wind"] .storm-canvas,
body[data-theme-preview="wind"] .space-canvas,
body[data-theme-preview="wind"] .garden-canvas,
body[data-theme-preview="wind"] .cherry-canvas {
  display: none !important;
}

body[data-theme-preview="earth"] .ember-field-canvas,
body[data-theme-preview="earth"] .fire-band-canvas,
body[data-theme-preview="earth"] .water-canvas,
body[data-theme-preview="earth"] .wind-canvas,
body[data-theme-preview="earth"] .ice-canvas,
body[data-theme-preview="earth"] .storm-canvas,
body[data-theme-preview="earth"] .space-canvas,
body[data-theme-preview="earth"] .garden-canvas,
body[data-theme-preview="earth"] .cherry-canvas {
  display: none !important;
}

body[data-theme-preview="ice"] .ember-field-canvas,
body[data-theme-preview="ice"] .fire-band-canvas,
body[data-theme-preview="ice"] .water-canvas,
body[data-theme-preview="ice"] .wind-canvas,
body[data-theme-preview="ice"] .earth-canvas,
body[data-theme-preview="ice"] .storm-canvas,
body[data-theme-preview="ice"] .space-canvas,
body[data-theme-preview="ice"] .garden-canvas,
body[data-theme-preview="ice"] .cherry-canvas {
  display: none !important;
}

body[data-theme-preview="storm"] .ember-field-canvas,
body[data-theme-preview="storm"] .fire-band-canvas,
body[data-theme-preview="storm"] .water-canvas,
body[data-theme-preview="storm"] .wind-canvas,
body[data-theme-preview="storm"] .earth-canvas,
body[data-theme-preview="storm"] .ice-canvas,
body[data-theme-preview="storm"] .space-canvas,
body[data-theme-preview="storm"] .garden-canvas,
body[data-theme-preview="storm"] .cherry-canvas {
  display: none !important;
}

body[data-theme-preview="space"] .ember-field-canvas,
body[data-theme-preview="space"] .fire-band-canvas,
body[data-theme-preview="space"] .water-canvas,
body[data-theme-preview="space"] .wind-canvas,
body[data-theme-preview="space"] .earth-canvas,
body[data-theme-preview="space"] .ice-canvas,
body[data-theme-preview="space"] .storm-canvas,
body[data-theme-preview="space"] .garden-canvas,
body[data-theme-preview="space"] .cherry-canvas {
  display: none !important;
}

body[data-theme-preview="garden"] .ember-field-canvas,
body[data-theme-preview="garden"] .fire-band-canvas,
body[data-theme-preview="garden"] .water-canvas,
body[data-theme-preview="garden"] .wind-canvas,
body[data-theme-preview="garden"] .earth-canvas,
body[data-theme-preview="garden"] .ice-canvas,
body[data-theme-preview="garden"] .storm-canvas,
body[data-theme-preview="garden"] .space-canvas,
body[data-theme-preview="garden"] .cherry-canvas {
  display: none !important;
}

/* Force display of correct canvas during preview */
body[data-theme-preview="campfire"] .fire-band-canvas,
body[data-theme-preview="water"] .water-canvas,
body[data-theme-preview="wind"] .wind-canvas,
body[data-theme-preview="earth"] .earth-canvas,
body[data-theme-preview="ice"] .ice-canvas,
body[data-theme-preview="storm"] .storm-canvas,
body[data-theme-preview="space"] .space-canvas,
body[data-theme-preview="garden"] .garden-canvas,
body[data-theme-preview="cherry"] .cherry-canvas {
  display: block !important;
}

body[data-theme-preview="cherry"] .ember-field-canvas,
body[data-theme-preview="cherry"] .fire-band-canvas,
body[data-theme-preview="cherry"] .water-canvas,
body[data-theme-preview="cherry"] .wind-canvas,
body[data-theme-preview="cherry"] .earth-canvas,
body[data-theme-preview="cherry"] .ice-canvas,
body[data-theme-preview="cherry"] .storm-canvas,
body[data-theme-preview="cherry"] .space-canvas,
body[data-theme-preview="cherry"] .garden-canvas {
  display: none !important;
}

.theme-motion,
.theme-particle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.theme-motion {
  z-index: -4;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.theme-particle-layer {
  z-index: -3;
  overflow: hidden;
}

.theme-particle {
  position: absolute;
  bottom: -15vh;
  border-radius: 999px;
  opacity: 0;
  animation: themeRise linear infinite;
}

body[data-theme="campfire"] .theme-motion,
body[data-theme="campfire"] .theme-particle-layer {
  display: none;
}

body[data-theme="water"] .theme-motion,
body[data-theme="wind"] .theme-motion,
body[data-theme="earth"] .theme-motion,
body[data-theme="ice"] .theme-motion,
body[data-theme="storm"] .theme-motion,
body[data-theme="space"] .theme-motion,
body[data-theme="garden"] .theme-motion,
body[data-theme="cherry"] .theme-motion {
  opacity: 1;
}

/* Water (Tide Whisper) — layered CSS waves for a professional look */
body[data-theme="water"] .theme-motion-a {
  position: fixed;
  inset: 0;
  overflow: hidden;
  opacity: 0.9;
  background: radial-gradient(circle at 30% 10%, rgba(160, 226, 255, 0.10), transparent 40%);
}

/* Two large layered waves that slide horizontally and gently rise/fall */
body[data-theme="water"] .theme-motion-a::before,
body[data-theme="water"] .theme-motion-a::after {
  content: "";
  position: absolute;
  left: -50%;
  width: 200%;
  bottom: -12%;
  height: 60%;
  border-radius: 45%;
  transform: translateX(0) translateY(0);
  will-change: transform, opacity;
}

body[data-theme="water"] .theme-motion-a::before {
  background: linear-gradient(180deg, rgba(80,160,220,0.20) 0%, rgba(70,140,200,0.16) 45%, rgba(60,120,180,0.12) 100%);
  filter: blur(18px);
  opacity: 0.92;
  animation: waveMoveLarge 12s linear infinite;
}

body[data-theme="water"] .theme-motion-a::after {
  background: linear-gradient(180deg, rgba(110,200,240,0.14) 0%, rgba(86,170,230,0.10) 40%, rgba(56,130,200,0.06) 100%);
  filter: blur(22px);
  opacity: 0.78;
  animation: waveMoveSmall 9s linear infinite reverse;
}

/* Subtle moving sheen layer for surface reflections */
body[data-theme="water"] .theme-motion-b {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 50%, rgba(255,255,255,0.04) 100%);
  opacity: 0.6;
  background-size: 300% 100%;
  animation: waterSheen 10s linear infinite;
}

/* Fine wave lines to improve visibility */
/* Two layered SVG wave lines that scroll horizontally to emulate tide lines */
body[data-theme="water"] .theme-motion-b::before,
body[data-theme="water"] .theme-motion-b::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  height: 22%;
  pointer-events: none;
  transform: translateZ(0);
  background-repeat: repeat-x;
  background-position: 0% 50%;
}

body[data-theme="water"] .theme-motion-b::before {
  /* larger, softer wave */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 60' preserveAspectRatio='none'><path d='M0 30 C100 0 200 60 300 30 C400 0 500 60 600 30' stroke='rgba(255,255,255,0.06)' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-size: 480px 60px;
  opacity: 0.9;
  filter: blur(0.6px) saturate(1.05);
  animation: tideLinesMove 12s linear infinite;
}

body[data-theme="water"] .theme-motion-b::after {
  /* finer, faster wave on top */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 40' preserveAspectRatio='none'><path d='M0 20 C75 0 150 40 225 20 C300 0 375 40 450 20 C525 0 600 40 675 20' stroke='rgba(255,255,255,0.04)' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-size: 360px 40px;
  opacity: 0.75;
  filter: blur(0.4px);
  animation: tideLinesMove 8s linear infinite reverse;
}

/* Water bubble style */
.water-bubble {
  position: absolute;
  bottom: -6%;
  border-radius: 50%;
  /* more transparent bubbles with subtle highlight; size will vary via JS */
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.08) 30%, rgba(255,255,255,0.02) 70%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 1px 6px rgba(80,170,230,0.03);
  opacity: 0;
  will-change: transform, opacity;
  animation-name: bubbleRise;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

/* Tide lines injected by JS for layered horizontal waves */
.tide-line {
  position: absolute;
  left: -50%;
  width: 200%;
  pointer-events: none;
  background-repeat: repeat-x;
  background-position: 0% 50%;
  transform: translateZ(0);
  mix-blend-mode: screen;
}

@keyframes tideLinesShift {
  0% { transform: translateX(0%); }
  100% { transform: translateX(50%); }
}

/* Fire sparks layer (for `campfire` and `earth` themes) */
.fire-spark-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  overflow: hidden;
}

.fire-spark {
  position: absolute;
  bottom: 6%;
  left: 50%;
  width: var(--size, 6px);
  height: var(--size, 6px);
  border-radius: 50%;
  /* sharp tiny spark look: bright core, little halo */
  background: radial-gradient(circle at 40% 35%, rgba(255,250,220,1) 0%, rgba(255,200,110,0.85) 28%, rgba(255,140,50,0.24) 55%, rgba(255,100,30,0.04) 80%);
  box-shadow: 0 0 8px rgba(255,180,100,0.12);
  opacity: 0;
  transform: translateX(0) translateY(0) scale(0.6);
  will-change: transform, opacity;
  animation: sparkRise var(--dur, 1600ms) linear forwards;
}

@keyframes sparkRise {
  0% { opacity: 1; transform: translateX(0) translateY(0) scale(0.7); }
  30% { opacity: 0.96; }
  70% { opacity: 0.5; }
  100% { opacity: 0; transform: translateX(var(--drift, 0px)) translateY(-120vh) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .fire-spark { animation: none !important; opacity: 0; }
}

body[data-theme="wind"] .theme-motion-a {
  background:
    linear-gradient(110deg, transparent 0 25%, rgba(220, 236, 255, 0.07) 35%, transparent 45%),
    linear-gradient(130deg, transparent 0 48%, rgba(198, 216, 238, 0.06) 58%, transparent 68%);
  animation: windDrift 11s linear infinite;
}

body[data-theme="wind"] .theme-motion-a::before,
body[data-theme="wind"] .theme-motion-a::after {
  content: "";
  position: absolute;
  inset: -18% -30%;
  border-radius: 999px;
  pointer-events: none;
  will-change: transform, opacity;
}

body[data-theme="wind"] .theme-motion-a::before {
  background:
    radial-gradient(circle at 30% 35%, rgba(226, 244, 255, 0.18), transparent 52%),
    radial-gradient(circle at 70% 60%, rgba(184, 218, 242, 0.14), transparent 55%);
  filter: blur(22px);
  opacity: 0.62;
  animation: windCloudDrift 18s ease-in-out infinite;
}

body[data-theme="wind"] .theme-motion-a::after {
  background:
    radial-gradient(circle at 40% 55%, rgba(255, 255, 255, 0.12), transparent 58%),
    radial-gradient(circle at 75% 30%, rgba(196, 232, 255, 0.1), transparent 60%);
  filter: blur(28px);
  opacity: 0.42;
  animation: windCloudDriftAlt 26s ease-in-out infinite;
}

body[data-theme="wind"] .theme-motion-b {
  background: repeating-linear-gradient(175deg, rgba(219, 232, 245, 0.03) 0 2px, transparent 2px 24px);
  animation: windDriftBack 15s linear infinite;
}

body[data-theme="wind"] .theme-motion-b {
  opacity: 0.85;
}

body[data-theme="earth"] .theme-motion-a {
  background:
    repeating-linear-gradient(28deg, rgba(171, 138, 92, 0.06) 0 3px, transparent 3px 14px),
    repeating-linear-gradient(-28deg, rgba(131, 105, 72, 0.05) 0 2px, transparent 2px 16px);
  animation: earthGrain 16s ease-in-out infinite;
}

body[data-theme="earth"] .theme-motion-b {
  background:
    radial-gradient(circle at left 80%, rgba(126, 167, 97, 0.18), transparent 24%),
    radial-gradient(circle at right 30%, rgba(118, 154, 87, 0.14), transparent 20%);
  opacity: 0.72;
}

body[data-theme="ice"] .theme-motion-a {
  background: 
    radial-gradient(circle at 50% 50%, rgba(179, 220, 244, 0.08) 0 30%, transparent 70%),
    radial-gradient(circle at 30% 30%, rgba(220, 248, 255, 0.06) 0 20%, transparent 50%);
  animation: iceGlow 15s ease-in-out infinite;
}

body[data-theme="ice"] .theme-motion-a::before,
body[data-theme="ice"] .theme-motion-a::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

body[data-theme="ice"] .theme-motion-a::before {
  background: radial-gradient(circle at 70% 70%, rgba(238, 252, 255, 0.05) 0 25%, transparent 60%);
  opacity: 0.6;
  filter: blur(20px);
  animation: iceAurora 18s ease-in-out infinite;
}

body[data-theme="ice"] .theme-motion-a::after {
  background: radial-gradient(circle at 20% 20%, rgba(220, 248, 255, 0.08) 0 25%, transparent 60%);
  opacity: 0.5;
  filter: blur(28px);
  animation: iceAurora 20s ease-in-out infinite;
}

body[data-theme="ice"] .theme-motion-b {
  background: radial-gradient(circle at 85% 20%, rgba(208, 240, 255, 0.22) 0 35%, transparent 70%);
  animation: iceGlow 12s ease-in-out infinite;
}

body[data-theme="ice"] .theme-motion-b::before {
  content: "";
  position: absolute;
  inset: -20% -20%;
  pointer-events: none;
  background:
    repeating-linear-gradient(135deg, rgba(235, 252, 255, 0.12) 0 3px, transparent 3px 32px),
    repeating-linear-gradient(45deg, rgba(220, 248, 255, 0.08) 0 2px, transparent 2px 28px);
  opacity: 0.6;
  filter: blur(16px);
  animation: iceGlitter 14s linear infinite;
}

body[data-theme="ice"] .theme-motion-b::after {
  content: "";
  position: absolute;
  inset: -35% -35%;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 40%, rgba(255, 255, 255, 0.20) 0 25%, transparent 55%),
    radial-gradient(circle at 80% 60%, rgba(205, 240, 255, 0.16) 0 30%, transparent 60%),
    radial-gradient(circle at 50% 20%, rgba(238, 252, 255, 0.14) 0 20%, transparent 50%);
  opacity: 0.45;
  filter: blur(36px);
  animation: iceAurora 20s ease-in-out infinite reverse;
}

body[data-theme="ice"] .theme-motion-c {
  opacity: 0.9;
}

body[data-theme="ice"] .theme-motion-c::before,
body[data-theme="ice"] .theme-motion-c::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

body[data-theme="ice"] .theme-motion-c::before {
  background:
    radial-gradient(circle at 20% 30%, rgba(235, 252, 255, 0.35) 0 60px, transparent 120px),
    radial-gradient(circle at 60% 70%, rgba(196, 232, 255, 0.30) 0 80px, transparent 160px),
    radial-gradient(circle at 80% 40%, rgba(255, 255, 255, 0.25) 0 50px, transparent 100px);
  background-size: 400px 400px, 500px 500px, 350px 350px;
  opacity: 0.7;
  filter: blur(2px);
  animation: iceFacetDrift 32s linear infinite;
}

body[data-theme="ice"] .theme-motion-c::after {
  background:
    linear-gradient(115deg, transparent 25%, rgba(255, 255, 255, 0.25) 40%, transparent 55%),
    linear-gradient(65deg, transparent 30%, rgba(200, 238, 255, 0.20) 45%, transparent 60%),
    radial-gradient(circle at 50% 50%, rgba(238, 252, 255, 0.16) 0 15%, transparent 40%);
  opacity: 0.35;
  filter: blur(16px);
  animation: iceFacetTwinkle 7s ease-in-out infinite;
}




body[data-theme="cherry"] .theme-motion-a {
  background: 
    radial-gradient(circle at 30% 30%, rgba(255, 182, 193, 0.12) 0 40%, transparent 70%),
    radial-gradient(circle at 70% 70%, rgba(255, 192, 203, 0.08) 0 30%, transparent 60%);
  animation: cherryGlow 18s ease-in-out infinite;
}

body[data-theme="cherry"] .theme-motion-a::before,
body[data-theme="cherry"] .theme-motion-a::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

body[data-theme="cherry"] .theme-motion-a::before {
  background: radial-gradient(circle at 60% 40%, rgba(255, 160, 180, 0.15) 0 35%, transparent 65%);
  opacity: 0.7;
  filter: blur(25px);
  animation: cherryAurora 20s ease-in-out infinite;
}

body[data-theme="cherry"] .theme-motion-a::after {
  background: radial-gradient(circle at 20% 80%, rgba(255, 200, 210, 0.10) 0 45%, transparent 75%);
  opacity: 0.5;
  filter: blur(30px);
  animation: cherryAurora 25s ease-in-out infinite reverse;
}

body[data-theme="cherry"] .theme-motion-b {
  background: radial-gradient(circle at 50% 50%, rgba(255, 182, 193, 0.06) 0 50%, transparent 80%);
  opacity: 0.8;
  animation: cherryDrift 30s linear infinite;
}

body[data-theme="cherry"] .theme-motion-b::before {
  content: "";
  position: absolute;
  inset: -20% -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 40% 30%, rgba(255, 192, 203, 0.08) 0 30%, transparent 60%),
    radial-gradient(circle at 60% 70%, rgba(255, 160, 180, 0.06) 0 25%, transparent 55%);
  opacity: 0.6;
  filter: blur(20px);
  animation: cherryPetal 12s ease-in-out infinite;
}

body[data-theme="cherry"] .theme-motion-b::after {
  display: none;
}

body[data-theme="cherry"] .theme-motion-c {
  opacity: 0.9;
}

body[data-theme="cherry"] .theme-motion-c::before,
body[data-theme="cherry"] .theme-motion-c::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

body[data-theme="cherry"] .theme-motion-c::before {
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 182, 193, 0.25) 0 80px, transparent 160px),
    radial-gradient(circle at 75% 75%, rgba(255, 192, 203, 0.20) 0 100px, transparent 200px),
    radial-gradient(circle at 50% 50%, rgba(255, 160, 180, 0.15) 0 60px, transparent 120px);
  background-size: 400px 400px, 500px 500px, 350px 350px;
  opacity: 0.6;
  filter: blur(2px);
  animation: cherryBlossom 35s linear infinite;
}

body[data-theme="cherry"] .theme-motion-c::after {
  background:
    linear-gradient(115deg, transparent 30%, rgba(255, 200, 210, 0.20) 45%, transparent 60%),
    linear-gradient(65deg, transparent 35%, rgba(255, 182, 193, 0.15) 50%, transparent 65%);
  opacity: 0.3;
  filter: blur(15px);
  animation: cherryTwinkle 8s ease-in-out infinite;
}

body[data-theme="storm"] .theme-motion-a {
  background:
    repeating-linear-gradient(170deg, rgba(176, 198, 255, 0.06) 0 2px, transparent 2px 20px),
    linear-gradient(180deg, rgba(23, 25, 52, 0.45), rgba(14, 14, 24, 0.2));
  animation: stormRain 5.8s linear infinite;
}

body[data-theme="storm"] .theme-motion-b {
  background: linear-gradient(120deg, transparent 45%, rgba(198, 212, 255, 0.38) 50%, transparent 56%);
  animation: lightningFlash 9s steps(1, end) infinite;
}

body[data-theme="storm"] .theme-motion-c {
  background: radial-gradient(circle at 50% 30%, rgba(150, 180, 220, 0.12) 0 40%, transparent 70%);
  opacity: 0.8;
  animation: stormGlow 12s ease-in-out infinite;
}

body[data-theme="space"] .theme-motion-a {
  background:
    radial-gradient(circle at 20% 30%, rgba(162, 190, 255, 0.2) 0 1px, transparent 1.8px),
    radial-gradient(circle at 68% 70%, rgba(198, 219, 255, 0.16) 0 1.2px, transparent 2px),
    radial-gradient(circle at 78% 20%, rgba(226, 236, 255, 0.14) 0 1px, transparent 1.8px);
  background-size: 220px 220px, 240px 240px, 260px 260px;
  animation: starDrift 38s linear infinite;
}

body[data-theme="space"] .theme-motion-b {
  background:
    radial-gradient(circle at 35% 25%, rgba(142, 132, 238, 0.2), transparent 30%),
    radial-gradient(circle at 72% 68%, rgba(88, 136, 224, 0.16), transparent 34%);
  animation: nebulaPulse 10s ease-in-out infinite;
}

body[data-theme="space"] .theme-motion-c {
  background: radial-gradient(circle at 60% 60%, rgba(120, 160, 220, 0.08) 0 50%, transparent 80%);
  opacity: 0.7;
  animation: spaceTwinkle 15s ease-in-out infinite;
}

body[data-theme="garden"] .theme-motion-a {
  background:
    radial-gradient(circle at 22% 90%, rgba(157, 225, 154, 0.2), transparent 25%),
    radial-gradient(circle at 83% 82%, rgba(196, 245, 179, 0.16), transparent 24%);
  animation: gardenGlow 8s ease-in-out infinite;
}

body[data-theme="garden"] .theme-motion-b {
  background: repeating-radial-gradient(circle at 10% 120%, rgba(205, 242, 176, 0.07) 0 10px, transparent 10px 44px);
  animation: gardenDrift 22s linear infinite;
}

body[data-theme="garden"] .theme-motion-c {
  background: radial-gradient(circle at 40% 40%, rgba(180, 220, 160, 0.1) 0 60%, transparent 90%);
  opacity: 0.8;
  animation: gardenPulse 18s ease-in-out infinite;
}

body[data-theme="water"][data-cycle="night"] {
  --theme-bg: radial-gradient(circle at top left, #0d2540 0%, #08172f 56%, #060f1d 100%);
}

body[data-theme="garden"][data-cycle="night"] {
  --theme-bg: radial-gradient(circle at top left, #193124 0%, #102016 56%, #0a130f 100%);
}

body[data-theme="space"][data-cycle="day"] {
  --theme-bg: radial-gradient(circle at top left, #29305e 0%, #191a34 54%, #0b0b19 100%);
}

@keyframes waterSweep {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    background-position: 0 0, 50% 120%;
  }
  50% {
    transform: translate3d(-3.5%, 2.5%, 0) scale(1.06);
    background-position: 0 0, 46% 116%;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    background-position: 0 0, 50% 120%;
  }
}

@keyframes waterSweepAlt {
  0% {
    transform: translate3d(0, 0, 0);
    background-position: 0% 0%;
  }
  50% {
    transform: translate3d(2.2%, -2.2%, 0);
    background-position: 60% 40%;
  }
  100% {
    transform: translate3d(0, 0, 0);
    background-position: 0% 0%;
  }
}

/* Wave animations for Tide (water) theme */
@keyframes waveMoveLarge {
  0% { transform: translateX(-30%) translateY(0); }
  50% { transform: translateX(30%) translateY(-6%); }
  100% { transform: translateX(-30%) translateY(0); }
}

@keyframes waveMoveSmall {
  0% { transform: translateX(-20%) translateY(0); }
  50% { transform: translateX(20%) translateY(-3%); }
  100% { transform: translateX(-20%) translateY(0); }
}

@keyframes waterSheen {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes waveLinesMove {
  0% { background-position: 0 0; }
  100% { background-position: 220% 0; }
}

@keyframes tideLinesMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes bubbleRise {
  0% { transform: translateY(0) scale(0.9); opacity: 0; }
  8% { opacity: 0.9; }
  85% { opacity: 0.6; }
  100% { transform: translateY(-140vh) scale(1.08); opacity: 0; }
}

@keyframes windDrift {
  0% { transform: translate3d(-8%, 0, 0); }
  100% { transform: translate3d(8%, 0, 0); }
}

@keyframes windDriftBack {
  0% { transform: translate3d(6%, 0, 0); }
  100% { transform: translate3d(-6%, 0, 0); }
}

@keyframes windCloudDrift {
  0%, 100% { transform: translate3d(-2%, -1%, 0) scale(1); }
  50% { transform: translate3d(2%, 1.5%, 0) scale(1.03); }
}

@keyframes windCloudDriftAlt {
  0%, 100% { transform: translate3d(2.5%, 1.5%, 0) scale(1.02); }
  50% { transform: translate3d(-2.5%, -1.25%, 0) scale(1); }
}

@keyframes earthGrain {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 0.82; }
}

@keyframes frostShift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-2%, 2%, 0); }
}

@keyframes iceGlow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.8; }
}

@keyframes iceSheen {
  0% { transform: translate3d(-10%, -4%, 0) rotate(-4deg); opacity: 0.3; }
  45% { opacity: 0.5; }
  100% { transform: translate3d(10%, 4%, 0) rotate(4deg); opacity: 0.35; }
}

@keyframes iceAurora {
  0%, 100% { transform: translate3d(-1.5%, 1.5%, 0) scale(1.01); opacity: 0.28; }
  50% { transform: translate3d(1.5%, -1.5%, 0) scale(1.03); opacity: 0.45; }
}

@keyframes iceGlitter {
  0% { transform: translate3d(-4%, 0, 0) rotate(0deg); opacity: 0.15; }
  50% { opacity: 0.35; }
  100% { transform: translate3d(4%, 0, 0) rotate(8deg); opacity: 0.15; }
}

@keyframes iceFacetDrift {
  0% { transform: translate3d(-2%, 1%, 0) scale(1); opacity: 0.3; }
  40% { opacity: 0.5; }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); opacity: 0.3; }
}

@keyframes iceFacetTwinkle {
  0%, 100% { transform: translate3d(-1.5%, 0, 0) rotate(-3deg); opacity: 0.06; }
  50% { transform: translate3d(1.5%, 0, 0) rotate(3deg); opacity: 0.2; }
}








@keyframes cherryGlow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1.0; }
}

@keyframes cherryAurora {
  0%, 100% { transform: translate3d(-2%, 2%, 0) scale(1.01); opacity: 0.6; }
  50% { transform: translate3d(2%, -2%, 0) scale(1.03); opacity: 0.8; }
}

@keyframes cherryDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-3%, 3%, 0); }
}

@keyframes cherryPetal {
  0%, 100% { transform: translate3d(-8%, -4%, 0) rotate(-8deg); opacity: 0.4; }
  50% { opacity: 0.7; }
  100% { transform: translate3d(8%, 4%, 0) rotate(8deg); opacity: 0.5; }
}

@keyframes cherryBlossom {
  0% { transform: translate3d(-2%, 1%, 0) scale(1); opacity: 0.4; }
  40% { opacity: 0.6; }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); opacity: 0.4; }
}

@keyframes cherryTwinkle {
  0%, 100% { transform: translate3d(-1.5%, 0, 0) rotate(-3deg); opacity: 0.1; }
  50% { transform: translate3d(1.5%, 0, 0) rotate(3deg); opacity: 0.25; }
}

@keyframes stormRain {
  0% { transform: translate3d(0, -2%, 0); }
  100% { transform: translate3d(-2%, 4%, 0); }
}

@keyframes lightningFlash {
  0%, 82%, 100% { opacity: 0; }
  84% { opacity: 0.8; }
  86% { opacity: 0.1; }
  88% { opacity: 0.68; }
}

@keyframes stormGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

@keyframes starDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(4%, -4%, 0); }
}

@keyframes nebulaPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

@keyframes spaceTwinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

@keyframes gardenGlow {
  0%, 100% { opacity: 0.54; }
  50% { opacity: 0.96; }
}

@keyframes gardenDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-3%, 3%, 0); }
}

@keyframes gardenPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

@keyframes themeRise {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 0.85;
  }
  100% {
    transform: translate3d(var(--drift-x, 0px), -120vh, 0) rotate(var(--spin, 0deg));
    opacity: 0;
  }
}

body[data-theme="water"] {
  --theme-bg: radial-gradient(circle at 25% 20%, #1a4568 0%, #0d2542 56%, #071525 100%);
  --ambient-a: rgba(89, 188, 238, 0.24);
  --ambient-b: rgba(66, 165, 230, 0.18);
  --ambient-c: rgba(120, 210, 255, 0.12);
  --theme-accent: #59bcee;
  --theme-accent-2: #3a9dd4;
  --theme-accent-soft: rgba(89, 188, 238, 0.22);
  --theme-accent-soft-2: rgba(89, 188, 238, 0.38);
  --theme-accent-text: #071525;
  --theme-focus: rgba(89, 188, 238, 0.55);
  --theme-scroll-thumb: rgba(89, 188, 238, 0.42);
  --theme-scroll-thumb-hover: rgba(89, 188, 238, 0.62);
  --book-cover: #1e4a5e;
  --heat-1: rgba(103, 191, 236, 0.22);
  --heat-2: rgba(86, 153, 220, 0.42);
  --heat-3: rgba(103, 191, 236, 0.64);
  --heat-4: rgba(103, 191, 236, 0.88);
}

body[data-theme="wind"] {
  --theme-bg: radial-gradient(circle at 30% 20%, #3d4f60 0%, #1e2d3a 55%, #101820 100%);
  --ambient-a: rgba(173, 217, 242, 0.22);
  --ambient-b: rgba(140, 190, 225, 0.16);
  --ambient-c: rgba(200, 230, 250, 0.12);
  --theme-accent: #add9f2;
  --theme-accent-2: #7ab8e0;
  --theme-accent-soft: rgba(173, 217, 242, 0.18);
  --theme-accent-soft-2: rgba(173, 217, 242, 0.30);
  --theme-accent-text: #0a1520;
  --theme-focus: rgba(173, 217, 242, 0.50);
  --theme-scroll-thumb: rgba(173, 217, 242, 0.36);
  --theme-scroll-thumb-hover: rgba(173, 217, 242, 0.56);
  --book-cover: #3d4e5c;
  --heat-1: rgba(198, 232, 255, 0.18);
  --heat-2: rgba(124, 182, 228, 0.36);
  --heat-3: rgba(198, 232, 255, 0.58);
  --heat-4: rgba(198, 232, 255, 0.8);
  --editor-font: 'Space Grotesk', sans-serif;
}

body[data-theme="wind"][data-cycle="night"] {
  --theme-bg: radial-gradient(circle at 18% 14%, #22384a 0%, #101c2a 56%, #070b12 100%);
  --ambient-a: rgba(140, 198, 242, 0.18);
  --ambient-b: rgba(98, 144, 196, 0.14);
  --ambient-c: rgba(174, 220, 255, 0.1);
}

body[data-theme="earth"] {
  --theme-bg: radial-gradient(circle at 25% 20%, #46362a 0%, #2a1f18 56%, #181210 100%);
  --ambient-a: rgba(164, 130, 91, 0.24);
  --ambient-b: rgba(140, 110, 75, 0.18);
  --ambient-c: rgba(190, 165, 120, 0.12);
  --theme-accent: #8bc476;
  --theme-accent-2: #a89060;
  --theme-accent-soft: rgba(139, 196, 118, 0.22);
  --theme-accent-soft-2: rgba(139, 196, 118, 0.36);
  --theme-accent-text: #0a1510;
  --theme-focus: rgba(139, 196, 118, 0.55);
  --theme-scroll-thumb: rgba(139, 196, 118, 0.40);
  --theme-scroll-thumb-hover: rgba(139, 196, 118, 0.60);
  --book-cover: #584838;
  --heat-1: rgba(132, 190, 108, 0.2);
  --heat-2: rgba(132, 190, 108, 0.4);
  --heat-3: rgba(132, 190, 108, 0.62);
  --heat-4: rgba(132, 190, 108, 0.86);
}

body[data-theme="ice"] {
  --theme-bg: radial-gradient(circle at 30% 15%, #2f4a5e 0%, #1a2f40 57%, #0f1a24 100%);
  --ambient-a: rgba(184, 227, 247, 0.26);
  --ambient-b: rgba(140, 205, 240, 0.18);
  --ambient-c: rgba(220, 248, 255, 0.12);
  --theme-accent: #b8e3f7;
  --theme-accent-2: #7cc0e8;
  --theme-accent-soft: rgba(184, 227, 247, 0.20);
  --theme-accent-soft-2: rgba(184, 227, 247, 0.34);
  --theme-accent-text: #0b1620;
  --theme-focus: rgba(184, 227, 247, 0.55);
  --theme-scroll-thumb: rgba(184, 227, 247, 0.38);
  --theme-scroll-thumb-hover: rgba(184, 227, 247, 0.58);
  --book-cover: #344e62;
  --heat-1: rgba(210, 244, 255, 0.18);
  --heat-2: rgba(130, 195, 235, 0.36);
  --heat-3: rgba(210, 244, 255, 0.58);
  --heat-4: rgba(210, 244, 255, 0.82);
  --editor-font: 'Space Grotesk', sans-serif;
}

body[data-theme="storm"] {
  --theme-bg: radial-gradient(circle at 20% 20%, #322d4a 0%, #1a1730 56%, #0e0c1a 100%);
  --ambient-a: rgba(124, 154, 255, 0.24);
  --ambient-b: rgba(100, 120, 210, 0.18);
  --ambient-c: rgba(170, 185, 255, 0.12);
  --theme-accent: #7c9aff;
  --theme-accent-2: #5a6fd4;
  --theme-accent-soft: rgba(124, 154, 255, 0.22);
  --theme-accent-soft-2: rgba(124, 154, 255, 0.38);
  --theme-accent-text: #0b0e18;
  --theme-focus: rgba(124, 154, 255, 0.55);
  --theme-scroll-thumb: rgba(124, 154, 255, 0.42);
  --theme-scroll-thumb-hover: rgba(124, 154, 255, 0.62);
  --book-cover: #2a2840;
  --heat-1: rgba(125, 147, 255, 0.2);
  --heat-2: rgba(125, 147, 255, 0.4);
  --heat-3: rgba(125, 147, 255, 0.62);
  --heat-4: rgba(125, 147, 255, 0.86);
  --editor-font: 'Space Grotesk', sans-serif;
}

body[data-theme="space"] {
  --theme-bg: radial-gradient(circle at 25% 15%, #23224a 0%, #141338 54%, #090918 100%);
  --ambient-a: rgba(160, 141, 245, 0.24);
  --ambient-b: rgba(110, 150, 250, 0.16);
  --ambient-c: rgba(200, 210, 255, 0.10);
  --theme-accent: #a08df5;
  --theme-accent-2: #6e96fa;
  --theme-accent-soft: rgba(160, 141, 245, 0.24);
  --theme-accent-soft-2: rgba(160, 141, 245, 0.40);
  --theme-accent-text: #0c0a18;
  --theme-focus: rgba(160, 141, 245, 0.55);
  --theme-scroll-thumb: rgba(160, 141, 245, 0.42);
  --theme-scroll-thumb-hover: rgba(160, 141, 245, 0.62);
  --book-cover: #2a204e;
  --heat-1: rgba(143, 120, 220, 0.2);
  --heat-2: rgba(101, 148, 242, 0.36);
  --heat-3: rgba(143, 120, 220, 0.62);
  --heat-4: rgba(143, 120, 220, 0.86);
}

body[data-theme="garden"] {
  --theme-bg: radial-gradient(circle at 25% 20%, #244838 0%, #162c22 56%, #0c1812 100%);
  --ambient-a: rgba(140, 218, 151, 0.24);
  --ambient-b: rgba(100, 185, 135, 0.18);
  --ambient-c: rgba(190, 240, 195, 0.12);
  --theme-accent: #8cda97;
  --theme-accent-2: #60b97f;
  --theme-accent-soft: rgba(140, 218, 151, 0.22);
  --theme-accent-soft-2: rgba(140, 218, 151, 0.38);
  --theme-accent-text: #0a1810;
  --theme-focus: rgba(140, 218, 151, 0.55);
  --theme-scroll-thumb: rgba(140, 218, 151, 0.40);
  --theme-scroll-thumb-hover: rgba(140, 218, 151, 0.60);
  --book-cover: #264a38;
  --heat-1: rgba(119, 204, 139, 0.2);
  --heat-2: rgba(119, 204, 139, 0.4);
  --heat-3: rgba(119, 204, 139, 0.62);
  --heat-4: rgba(119, 204, 139, 0.86);
}

body[data-theme="cherry"] {
  --theme-bg: radial-gradient(circle at top left, #3b1b20 0%, #251014 56%, #14080a 100%);
  --ambient-a: rgba(255, 182, 193, 0.2);
  --ambient-b: rgba(255, 192, 203, 0.16);
  --ambient-c: rgba(255, 228, 225, 0.1);
  --theme-accent: #ffb7c5;
  --theme-accent-2: #ff6fa3;
  --theme-accent-soft: rgba(255, 182, 193, 0.2);
  --theme-accent-soft-2: rgba(255, 182, 193, 0.34);
  --theme-accent-text: #2a0b12;
  --theme-focus: rgba(255, 182, 193, 0.55);
  --theme-scroll-thumb: rgba(255, 182, 193, 0.38);
  --theme-scroll-thumb-hover: rgba(255, 182, 193, 0.58);
  --book-cover: #5a1c2a;
  --heat-1: rgba(255, 182, 193, 0.2);
  --heat-2: rgba(255, 182, 193, 0.4);
  --heat-3: rgba(255, 182, 193, 0.62);
  --heat-4: rgba(255, 182, 193, 0.86);
}

body[data-theme="water"] .ember-field-canvas,
body[data-theme="water"] .fire-band-canvas,
body[data-theme="wind"] .ember-field-canvas,
body[data-theme="wind"] .fire-band-canvas,
body[data-theme="earth"] .ember-field-canvas,
body[data-theme="earth"] .fire-band-canvas,
body[data-theme="ice"] .ember-field-canvas,
body[data-theme="ice"] .fire-band-canvas,
body[data-theme="storm"] .ember-field-canvas,
body[data-theme="storm"] .fire-band-canvas,
body[data-theme="space"] .ember-field-canvas,
body[data-theme="space"] .fire-band-canvas,
body[data-theme="garden"] .ember-field-canvas,
body[data-theme="garden"] .fire-band-canvas {
  display: none !important;
}

body[data-theme="ice"] .ice-canvas,
body[data-theme="storm"] .storm-canvas,
body[data-theme="space"] .space-canvas,
body[data-theme="garden"] .garden-canvas,
body[data-theme="cherry"] .cherry-canvas {
  display: block;
}

body[data-theme="cherry"] .ember-field-canvas,
body[data-theme="cherry"] .fire-band-canvas,
body[data-theme="cherry"] .water-canvas,
body[data-theme="cherry"] .wind-canvas,
body[data-theme="cherry"] .earth-canvas,
body[data-theme="cherry"] .ice-canvas,
body[data-theme="cherry"] .storm-canvas,
body[data-theme="cherry"] .space-canvas,
body[data-theme="cherry"] .garden-canvas {
  display: none !important;
}

@keyframes emberPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.ember-field-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -4;
  opacity: 0.7;
  mix-blend-mode: normal;
}

.fire-band-canvas {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 240px;
  pointer-events: none;
  z-index: -4;
  opacity: 0.82;
  mix-blend-mode: normal;
}

.theme-particle.theme-water {
  width: var(--size, 5px);
  height: var(--size, 5px);
  background: radial-gradient(circle, rgba(204, 240, 255, 0.95), rgba(96, 191, 240, 0.25));
}

.theme-particle.theme-wind {
  width: calc(var(--size, 4px) * 3.5);
  height: max(1px, calc(var(--size, 4px) * 0.42));
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(224, 239, 252, 0.1), rgba(224, 239, 252, 0.9), rgba(224, 239, 252, 0.1));
}

.theme-particle.theme-earth {
  width: var(--size, 5px);
  height: var(--size, 5px);
  background: radial-gradient(circle, rgba(199, 173, 133, 0.84), rgba(136, 104, 69, 0.2));
}

.theme-particle.theme-ice {
  width: var(--size, 5px);
  height: var(--size, 5px);
  background: radial-gradient(circle, rgba(238, 252, 255, 0.95), rgba(156, 220, 248, 0.32));
  box-shadow: 0 0 6px rgba(181, 236, 255, 0.44);
}

.theme-particle.theme-storm {
  width: calc(var(--size, 5px) * 1.8);
  height: max(1px, calc(var(--size, 5px) * 0.52));
  background: linear-gradient(90deg, rgba(196, 212, 255, 0), rgba(196, 212, 255, 0.94), rgba(196, 212, 255, 0));
}

.theme-particle.theme-space {
  width: var(--size, 4px);
  height: var(--size, 4px);
  background: radial-gradient(circle, rgba(236, 243, 255, 1), rgba(153, 176, 242, 0.28));
  box-shadow: 0 0 8px rgba(165, 194, 255, 0.45);
}

.theme-particle.theme-garden {
  width: calc(var(--size, 5px) * 1.3);
  height: var(--size, 5px);
  border-radius: 100% 100% 70% 70%;
  background: linear-gradient(180deg, rgba(235, 255, 214, 0.95), rgba(140, 210, 132, 0.34));
}

.theme-particle.theme-cherry {
  width: var(--size, 5px);
  height: var(--size, 5px);
  background: radial-gradient(circle, rgba(255, 192, 203, 0.95), rgba(255, 105, 180, 0.25));
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px var(--gutter) 16px;
  position: sticky;
  top: 0;
  background: var(--theme-panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
  isolation: isolate;
  transform: translateZ(0);
}

.logo {
  font-family: var(--ui-font);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  gap: 16px;
  font-family: var(--ui-font);
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
  white-space: nowrap;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  color: #f6dbc2;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 18px;
  transition: all 0.2s ease;
}

.logo,
.nav-link,
.hero-text h1,
.hero-text p,
.eyebrow,
.status-bar,
.sidebar-header h3,
.auth-panel h2,
.auth-sub,
.settings h2,
.chat-title,
.chat-subtitle {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.58);
}

.nav-link:hover {
  background: var(--theme-hover-bg);
}

.nav-cta {
  background: var(--theme-accent-soft);
  border: 1px solid var(--theme-accent-soft-2);
}

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

.share-header input {
  width: 140px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
}

.page {
  padding: 28px var(--gutter) 80px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 36px;
  align-items: center;
  margin-top: 30px;
}

.home-guest-note {
  margin-bottom: 20px;
  padding: 8px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fbe7cf;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  width: fit-content;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.home-guest-note a {
  color: #fff6dc;
  font-weight: 600;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 3vw, 3.4rem);
  margin: 12px 0 12px;
}

.hero-text p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #f7dcc1;
}

.eyebrow {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #f8b57a;
}

.hero-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-meta {
  margin-top: 14px;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  max-width: 52ch;
}

.btn {
  font-family: var(--ui-font);
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--theme-accent), var(--theme-accent-2));
  color: var(--theme-accent-text);
  box-shadow: 0 10px 25px var(--theme-accent-soft);
  font-weight: 500;
}

.btn.primary:hover {
  box-shadow: 0 0 20px var(--theme-accent-soft-2), 0 10px 30px var(--theme-accent-soft);
}

.btn.ghost {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #eae0de;
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.25s ease;
}

.btn.ghost:hover {
  background: var(--theme-hover-bg);
  border-color: var(--theme-accent-soft-2);
  box-shadow: 0 0 12px var(--theme-accent-soft);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active:not(.disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: none;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

button {
  transition: transform 0.12s ease, filter 0.12s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.98);
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.campfire-card {
  width: min(360px, 90%);
  aspect-ratio: 4 / 5;
  background: linear-gradient(160deg, var(--theme-accent-soft), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--theme-panel-border);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.campfire-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, var(--theme-accent) 0%, var(--theme-accent-soft-2) 32%, transparent 70%);
  filter: blur(10px);
  animation: fireGlow 2.8s ease-in-out infinite;
  top: 44%;
  left: 50%;
}

.hero-symbol {
  position: absolute;
  bottom: 80px;
  left: 50%;
  width: min(270px, 84%);
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.35));
  animation: symbolFloat 3.6s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}

.campfire-text {
  position: absolute;
  bottom: 24px;
  left: 28px;
  right: 28px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1rem;
}

.campfire-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  margin-bottom: 10px;
}

.campfire-line {
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  margin-bottom: 8px;
}

.campfire-line.short {
  width: 65%;
}

@keyframes symbolFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

@keyframes fireGlow {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(0.95); }
  50% { opacity: 0.95; transform: translate(-50%, -50%) scale(1.06); }
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 48px;
}

.feature-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.feature-card h3 {
  margin: 0 0 8px;
  font-family: var(--ui-font);
}

.feature-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
}

.home-section {
  margin-top: 54px;
}

.home-section h2 {
  margin: 0 0 14px;
  font-family: var(--ui-font);
  font-size: 1.4rem;
}

.home-sub {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
  max-width: 75ch;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.home-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.home-card h3 {
  margin: 0 0 8px;
  font-family: var(--ui-font);
  font-size: 1.02rem;
}

.home-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.theme-pill {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-pill:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--theme-accent-soft-2);
}

.theme-name {
  font-family: var(--ui-font);
  font-weight: 600;
}

.theme-desc {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.74);
}

.security-card {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 900px;
}

.security-card h2 {
  margin: 0 0 10px;
}

.security-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.entry-sidebar {
  background: var(--theme-panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--theme-panel-border);
  height: fit-content;
  max-width: 320px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sidebar-actions .btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  min-width: 80px;
}

.entry-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.entry-item {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.entry-item:hover {
  background: var(--theme-hover-bg);
  border-color: var(--theme-panel-border);
}

.entry-item.active {
  border: 1px solid var(--theme-accent-soft-2);
  background: var(--theme-accent-soft);
  box-shadow: 0 0 12px var(--theme-accent-soft);
}

.book-area {
  position: relative;
  min-width: 0;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  color: #f7caa2;
}

.status-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.autosave-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-size: 0.75rem;
  color: #f7d1a9;
}

.autosave-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.autosave-track {
  width: 36px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  transition: background 0.2s ease;
}

.autosave-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f7ead2;
  transition: transform 0.2s ease;
}

.autosave-toggle input:checked + .autosave-track {
  background: var(--theme-accent-2);
}

.autosave-toggle input:checked + .autosave-track::after {
  transform: translateX(18px);
}

.autosave-label {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.02em;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.2);
  color: #f8ddbf;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  cursor: pointer;
}

.tool-btn:nth-of-type(2) {
  font-style: italic;
}

.tool-btn:nth-of-type(3) {
  text-decoration: underline;
}

.tool-btn.active {
  background: var(--theme-accent-soft);
  border-color: var(--theme-accent-soft-2);
  color: #fff4df;
}

.tool-size {
  margin-left: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  color: #f5cfa7;
}

.tool-select {
  min-width: 108px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(40, 22, 14, 0.92);
  color: #ffe9cc;
  padding: 0 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
}

.tool-select option {
  background: #f2e5cf;
  color: #2a1a11;
}

.book {
  position: relative;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 240, 205, 0.44), transparent 28%),
    radial-gradient(circle at 80% 18%, rgba(134, 84, 40, 0.18), transparent 34%),
    radial-gradient(circle at 30% 76%, rgba(118, 74, 36, 0.15), transparent 38%),
    radial-gradient(circle at 66% 58%, rgba(98, 62, 30, 0.11), transparent 40%),
    repeating-linear-gradient(43deg, rgba(108, 72, 38, 0.04) 0 2px, rgba(255, 246, 224, 0.02) 2px 5px),
    repeating-linear-gradient(-38deg, rgba(90, 58, 28, 0.03) 0 3px, rgba(255, 245, 220, 0.015) 3px 7px),
    linear-gradient(180deg, #f0e2c4 0%, #e8d4ad 46%, #dfc69b 100%);
  color: var(--ink);
  border-radius: 22px;
  padding: 34px;
  min-height: 680px;
  border: 12px solid var(--book-cover);
  box-shadow:
    0 28px 80px var(--shadow),
    inset 0 0 0 2px rgba(30, 14, 7, 0.45),
    inset 0 0 65px rgba(70, 40, 18, 0.24),
    inset 0 0 110px rgba(58, 31, 14, 0.14);
  overflow: hidden;
  width: 100%;
  perspective: 1200px;
  transition: border-color 0.35s ease;
}

.book::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  border: 1px solid rgba(80, 48, 24, 0.42);
  background:
    radial-gradient(circle at 12% 82%, rgba(120, 76, 38, 0.12), transparent 30%),
    radial-gradient(circle at 84% 24%, rgba(126, 78, 40, 0.1), transparent 30%),
    radial-gradient(circle at 48% 52%, rgba(92, 56, 28, 0.06), transparent 44%),
    repeating-linear-gradient(0deg, rgba(255, 244, 215, 0.02) 0 1px, rgba(95, 60, 30, 0.02) 1px 2px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 185, 0.28),
    inset 0 0 42px rgba(108, 64, 30, 0.26),
    inset 0 0 16px rgba(60, 34, 16, 0.18);
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

.book::after {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 50%;
  width: 16px;
  transform: translateX(-50%);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(54, 28, 14, 0.48), rgba(243, 208, 158, 0.28) 45%, rgba(54, 28, 14, 0.42));
  box-shadow:
    inset 0 0 10px rgba(35, 19, 10, 0.34),
    0 0 10px rgba(54, 28, 12, 0.14);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.page {
  position: relative;
  z-index: 1;
}

.page-title {
  width: 100%;
  font-size: 1.6rem;
  font-family: var(--title-font);
  font-weight: 600;
  letter-spacing: -0.01em;
  border: none;
  background: transparent;
  margin-bottom: 18px;
  color: var(--ink);
}

.page-content {
  width: 100%;
  min-height: 100%;
  height: 100%;
  border: none;
  background: transparent;
  font-family: var(--editor-font);
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  resize: none;
  overflow: hidden;
  padding-right: 12px;
  letter-spacing: 0.01em;
}

.page-scroll {
  min-height: 520px;
  max-height: 520px;
  overflow-y: scroll;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.page-title:focus,
.page-title:focus-visible,
.page-content:focus,
.page-content:focus-visible,
.page-title:active,
.page-content:active {
  outline: none;
  box-shadow: none;
  border-color: transparent;
}


.page-turn {
  position: absolute;
  top: auto;
  right: 0;
  left: auto;
  bottom: 0;
  width: 170px;
  height: 170px;
  background:
    linear-gradient(315deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.46) 45%, rgba(255, 255, 255, 0) 78%),
    linear-gradient(315deg, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0) 70%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.12);
  clip-path: polygon(100% 100%, 0 100%, 100% 0);
  transform-origin: bottom right;
  transform: none;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

.page-turn.turn-next {
  transform-origin: bottom right;
  animation: pageTurnNext 0.72s cubic-bezier(0.22, 0.69, 0.14, 0.99);
}

.page-turn.turn-prev {
  left: 0;
  right: auto;
  clip-path: polygon(0 100%, 100% 100%, 0 0);
  transform-origin: bottom left;
  animation: pageTurnPrev 0.72s cubic-bezier(0.22, 0.69, 0.14, 0.99);
}

@keyframes pageTurnNext {
  0% { transform: rotateY(0deg) translate(0, 0) scale(1); opacity: 0.9; }
  45% { transform: rotateY(-50deg) translate(-4px, -6px) scale(1.03); opacity: 0.6; }
  100% { transform: rotateY(-82deg) translate(-8px, -10px) scale(1.08); opacity: 0; }
}

@keyframes pageTurnPrev {
  0% { transform: rotateY(0deg) translate(0, 0) scale(1); opacity: 0.9; }
  45% { transform: rotateY(50deg) translate(4px, -6px) scale(1.03); opacity: 0.6; }
  100% { transform: rotateY(82deg) translate(8px, -10px) scale(1.08); opacity: 0; }
}

.page-controls {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

.story-image-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 10px;
}

.field-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  color: #f3d1b2;
}

.image-actions {
  display: grid;
  gap: 8px;
}

.story-image-panel input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
}

.share-panel {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.share-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-row input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
}

.share-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-mode-wrap {
  position: relative;
}

.share-mode-btn {
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: #f7d9bb;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
}

.share-mode-btn:focus {
  outline: 2px solid var(--theme-focus);
  outline-offset: 2px;
}

.share-mode-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 7, 6, 0.96);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.35);
  display: none;
  z-index: 10;
}

.share-mode-menu.open {
  display: grid;
  gap: 4px;
}

.share-mode-option {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #f7d9bb;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.share-mode-option:hover,
.share-mode-option:focus {
  background: var(--theme-accent-soft);
  border-color: var(--theme-accent-soft-2);
  outline: none;
}

.share-mode-option.is-active {
  background: var(--theme-accent-soft-2);
  border-color: var(--theme-accent-soft-2);
  color: #fff4df;
}


.public-story {
  width: 98vw;
  max-width: 1280px;
  margin: 0 auto;
}

.public-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.public-sidebar {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  height: fit-content;
}

.public-sidebar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  color: #f7caa2;
  margin-bottom: 10px;
}

.public-page-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.public-page-item {
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  color: #f6dbc0;
}

.public-page-item.is-active {
  border: 1px solid var(--theme-accent-soft-2);
  background: var(--theme-accent-soft);
}

.public-main {
  min-width: 0;
}

.public-story .book {
  padding: 42px;
  min-height: 70vh;
}

.public-page {
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 10px;
  scrollbar-width: thin;
}

.public-title {
  font-size: 1.8rem;
  margin-top: 0;
  font-family: 'Space Grotesk', sans-serif;
}

.public-content {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 1.05rem;
}

.public-controls {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.public-controls.is-hidden {
  display: none;
}

.public-page-count {
  margin-right: auto;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.6);
}

.public-meta {
  margin-top: 16px;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.55);
}

.public-mode {
  margin-left: 12px;
  font-size: 0.82rem;
  color: rgba(0, 0, 0, 0.5);
}

.public-notice {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.story-image-panel select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
}

.image-preview {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 10px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview img {
  max-width: 100%;
  border-radius: 10px;
}

.page-illustration {
  position: absolute;
  top: 60px;
  left: 20px;
  width: 250px;
  display: none;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  cursor: grab;
  z-index: 20;
}

.page-illustration:active {
  cursor: grabbing;
}

.page-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 14px;
  pointer-events: none;
}

.resize-handle {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 24px;
  height: 24px;
  cursor: nwse-resize;
  background: linear-gradient(-45deg, rgba(0, 0, 0, 0.3) 15%, transparent 60%);
  border-bottom-right-radius: 14px;
  z-index: 30;
  transition: opacity 0.2s;
}

.resize-handle:hover {
  background: linear-gradient(-45deg, rgba(0, 0, 0, 0.5) 15%, transparent 60%);
}

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 2, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.image-modal.open {
  display: flex;
}

.image-modal-card {
  position: relative;
  max-width: min(90vw, 960px);
  max-height: 90vh;
  background: rgba(20, 12, 10, 0.98);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.image-modal-card img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  border-radius: 12px;
}

.image-modal-close {
  position: absolute;
  right: 8px;
  top: 4px;
  background: transparent;
  border: none;
  color: #f3cda2;
  font-size: 1.5rem;
  cursor: pointer;
}

.image-placeholder {
  font-family: 'Space Grotesk', sans-serif;
  color: rgba(255, 255, 255, 0.6);
}

.image-placeholder.error {
  color: rgba(255, 190, 170, 0.9);
}

.auth-panel {
  max-width: 420px;
  margin: 30px auto;
  background: rgba(255, 255, 255, 0.05);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-panel h2 {
  margin-top: 0;
}

.auth-sub {
  color: #f3d1b2;
  margin-bottom: 16px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 42px;
}

.password-field input {
  display: block;
  width: 100%;
  height: 42px;
  box-sizing: border-box;
  padding-right: 54px;
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 1.2;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.72);
  color: #111;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.78rem;
  font-family: 'Space Grotesk', sans-serif;
  transition: background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.password-toggle:hover {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.82);
}

.password-toggle:active {
  transform: translateY(-50%);
}

.password-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.2);
}

.password-toggle svg {
  display: block;
  pointer-events: none;
}

.password-toggle .eye-slash {
  opacity: 0;
}

.password-field input[type="password"]::-ms-reveal,
.password-field input[type="password"]::-ms-clear {
  display: none;
}

.auth-error {
  background: rgba(255, 120, 80, 0.2);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.auth-info {
  background: rgba(120, 200, 255, 0.16);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.auth-footer {
  margin-top: 14px;
  font-family: 'Space Grotesk', sans-serif;
  color: #f3d1b2;
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-footer a,
.auth-footer a:visited {
  color: #f3c188;
  text-decoration-color: rgba(243, 193, 136, 0.6);
}

.auth-footer a:hover {
  color: #ffd7a8;
  text-decoration-color: rgba(255, 215, 168, 0.95);
}

.settings {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 28px;
}

.settings-card {
  background: rgba(255, 255, 255, 0.05);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.settings-subtitle {
  margin: 18px 0 10px;
  font-family: 'Space Grotesk', sans-serif;
}

.theme-form {
  display: grid;
  gap: 14px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.theme-tile {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-tile::after {
  content: "";
  position: absolute;
  inset: auto -20% -65% -20%;
  height: 90px;
  background: var(--tile-glow, rgba(255, 176, 116, 0.28));
  filter: blur(26px);
  opacity: 0.35;
  transform: translateY(16px);
  transition: opacity 0.25s ease;
}

.theme-tile input {
  display: none;
}

.theme-icon {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 233, 207, 0.9);
}

.theme-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.94rem;
  color: #f6d8b6;
}

.theme-desc {
  font-size: 0.78rem;
  color: rgba(246, 216, 182, 0.78);
}

.theme-progress {
  margin-top: 2px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.74rem;
  color: rgba(255, 228, 193, 0.86);
}

.theme-badge,
.theme-next {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
}

.theme-badge {
  color: #ffe7b8;
}

.theme-next {
  color: rgba(246, 216, 182, 0.62);
}

.theme-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 198, 146, 0.42);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.theme-tile:hover::after {
  opacity: 0.6;
}

.theme-tile:has(input:checked) {
  border-color: rgba(255, 176, 116, 0.72);
  background:
    radial-gradient(circle at top right, rgba(255, 204, 145, 0.28), transparent 38%),
    rgba(255, 157, 86, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 182, 118, 0.25);
}

.theme-campfire {
  --tile-glow: rgba(255, 145, 82, 0.44);
  background: linear-gradient(140deg, rgba(82, 32, 16, 0.58), rgba(42, 16, 10, 0.5));
}

.theme-water {
  --tile-glow: rgba(89, 188, 238, 0.42);
  background: linear-gradient(140deg, rgba(24, 73, 103, 0.62), rgba(14, 39, 67, 0.52));
}

.theme-wind {
  --tile-glow: rgba(173, 217, 242, 0.38);
  background: linear-gradient(140deg, rgba(72, 90, 106, 0.62), rgba(38, 52, 65, 0.52));
}

.theme-earth {
  --tile-glow: rgba(164, 130, 91, 0.42);
  background: linear-gradient(140deg, rgba(76, 55, 38, 0.62), rgba(46, 33, 24, 0.52));
}

.theme-ice {
  --tile-glow: rgba(184, 227, 247, 0.45);
  background: linear-gradient(140deg, rgba(44, 75, 96, 0.62), rgba(28, 47, 62, 0.52));
}

.theme-storm {
  --tile-glow: rgba(124, 154, 255, 0.42);
  background: linear-gradient(140deg, rgba(45, 43, 84, 0.62), rgba(28, 26, 54, 0.52));
}

.theme-space {
  --tile-glow: rgba(160, 141, 245, 0.42);
  background: linear-gradient(140deg, rgba(36, 38, 87, 0.62), rgba(22, 24, 53, 0.52));
}

.theme-garden {
  --tile-glow: rgba(140, 218, 151, 0.42);
  background: linear-gradient(140deg, rgba(34, 69, 50, 0.62), rgba(22, 43, 33, 0.52));
}

.theme-cherry {
  --tile-glow: rgba(255, 182, 193, 0.42);
  background: linear-gradient(140deg, rgba(89, 28, 40, 0.62), rgba(56, 14, 20, 0.52));
}

.theme-form .btn.primary {
  justify-self: start;
}

.activity-card {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.05);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.activity-sub {
  color: #f3d1b2;
  margin-top: 6px;
}

.heatmap-scroll {
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.heatmap,
#activityHeatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  gap: 4px;
  --columns: 52;
  width: max-content;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.heatmap-cell.empty {
  background: transparent;
}

.heatmap-cell.level-0 { background: var(--heat-0); }
.heatmap-cell.level-1 { background: var(--heat-1); }
.heatmap-cell.level-2 { background: var(--heat-2); }
.heatmap-cell.level-3 { background: var(--heat-3); }
.heatmap-cell.level-4 { background: var(--heat-4); }

.heatmap-legend {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  color: #f3cda2;
}

.legend-scale {
  display: flex;
  gap: 4px;
}

.chat-launch {
  position: fixed;
  right: 24px;
  bottom: 60px;
  background: linear-gradient(120deg, var(--theme-accent), var(--theme-accent-2));
  color: var(--theme-accent-text);
  padding: 12px 16px;
  border-radius: 999px;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  box-shadow: 0 12px 30px var(--theme-accent-soft-2);
  z-index: 20;
}

.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 86px;
  width: min(320px, 90vw);
  background: rgba(20, 12, 10, 0.96);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}

.chat-panel.open {
  display: flex;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-drag-handle {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  cursor: move;
}

.chat-drag-handle::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
}

.chat-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.chat-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

.chat-subtitle {
  font-size: 0.75rem;
  color: #f3cda2;
}

.chat-close {
  background: transparent;
  border: none;
  color: #f3cda2;
  font-size: 1.2rem;
  cursor: pointer;
}

.chat-messages {
  padding: 14px;
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.chat-resize-handle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  cursor: nwse-resize;
  box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.08);
}

.chat-resize-handle::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.4);
  border-bottom: 2px solid rgba(255, 255, 255, 0.4);
}

.chat-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  animation: chatRise 0.22s ease-out both;
}

.chat-bubble.user {
  background: rgba(255, 255, 255, 0.12);
  justify-self: end;
}

.chat-bubble.bot {
  background: rgba(255, 170, 90, 0.18);
  border: 1px solid rgba(255, 170, 90, 0.28);
}

body[data-theme="water"] .chat-bubble.bot {
  background: rgba(108, 194, 241, 0.2);
  border-color: rgba(128, 205, 247, 0.35);
  animation-name: chatWaveIn;
}

body[data-theme="wind"] .chat-bubble.bot {
  background: rgba(184, 213, 236, 0.2);
  border-color: rgba(194, 220, 240, 0.32);
  animation-name: chatWhooshIn;
}

body[data-theme="earth"] .chat-bubble.bot {
  background: rgba(169, 132, 88, 0.22);
  border-color: rgba(188, 152, 108, 0.34);
  animation-name: chatGrowIn;
}

body[data-theme="ice"] .chat-bubble.bot {
  background: rgba(184, 226, 247, 0.2);
  border-color: rgba(200, 237, 255, 0.34);
  animation-name: chatCrystalIn;
}

body[data-theme="storm"] .chat-bubble.bot {
  background: rgba(124, 145, 240, 0.26);
  border-color: rgba(151, 172, 252, 0.42);
  animation-name: chatLightningIn;
}

body[data-theme="space"] .chat-bubble.bot {
  background: rgba(125, 129, 225, 0.24);
  border-color: rgba(158, 169, 246, 0.38);
  animation-name: chatOrbitIn;
}

body[data-theme="garden"] .chat-bubble.bot {
  background: rgba(127, 193, 130, 0.2);
  border-color: rgba(151, 216, 155, 0.34);
  animation-name: chatBloomIn;
}

body[data-theme="cherry"] .chat-bubble.bot {
  background: rgba(255, 182, 193, 0.2);
  border-color: rgba(255, 200, 210, 0.34);
  animation-name: chatBloomIn;
}

@keyframes chatRise {
  0% { transform: translateY(8px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes chatWaveIn {
  0% { transform: translateX(-8px) translateY(6px); opacity: 0; }
  100% { transform: translateX(0) translateY(0); opacity: 1; }
}

@keyframes chatWhooshIn {
  0% { transform: translateX(10px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes chatGrowIn {
  0% { transform: scale(0.94); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes chatCrystalIn {
  0% { transform: scale(0.96) translateY(6px); opacity: 0; filter: blur(1px); }
  100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); }
}

@keyframes chatLightningIn {
  0% { opacity: 0; filter: brightness(1.4); }
  100% { opacity: 1; filter: brightness(1); }
}

@keyframes chatOrbitIn {
  0% { transform: rotate(-2deg) scale(0.96); opacity: 0; }
  100% { transform: rotate(0deg) scale(1); opacity: 1; }
}

@keyframes chatBloomIn {
  0% { transform: translateY(8px) scale(0.94); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
}

.chat-input button {
  background: linear-gradient(120deg, var(--theme-accent), var(--theme-accent-2));
  border: none;
  border-radius: 10px;
  color: var(--theme-accent-text);
  padding: 8px 12px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
}

.entry-list,
.public-page-list,
.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: var(--theme-scroll-thumb) transparent;
}

.entry-list::-webkit-scrollbar,
.public-page-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 12px;
}

.entry-list::-webkit-scrollbar-thumb,
.public-page-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--theme-scroll-thumb);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.entry-list::-webkit-scrollbar-thumb:hover,
.public-page-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--theme-scroll-thumb-hover);
  background-clip: content-box;
}

.entry-list::-webkit-scrollbar-track,
.public-page-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.page-scroll,
.public-page {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.35) rgba(255, 255, 255, 0.92);
}

.page-scroll::-webkit-scrollbar,
.public-page::-webkit-scrollbar {
  width: 12px;
}

.page-scroll::-webkit-scrollbar-track,
.public-page::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
}

.page-scroll::-webkit-scrollbar-thumb,
.public-page::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  background-clip: content-box;
}

.page-scroll::-webkit-scrollbar-thumb:hover,
.public-page::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.45);
  background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
  .book,
  .ambient-bg,
  .theme-motion,
  .chat-bubble,
  .hero-symbol,
  .campfire-glow {
    animation: none !important;
  }

  .ember-field-canvas,
  .fire-band-canvas,
  .theme-particle-layer {
    display: none;
  }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .entry-sidebar {
    order: 2;
  }

  .public-layout {
    grid-template-columns: 1fr;
  }

  .public-sidebar {
    order: 2;
  }

  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   PREMIUM UI/UX OVERHAUL v2.0 — "The Digital Hearth, Refined"
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Page-Load Cinematic Entrance ─── */
@keyframes pageEnterIn {
  0% {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.page-enter {
  animation: pageEnterIn 0.7s cubic-bezier(0.22, 0.68, 0, 1) both;
}

/* ─── Glassmorphic Sticky Header ─── */
.site-header {
  background: rgba(22, 19, 17, 0.55);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.25),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

/* Logo glow on hover */
.logo {
  position: relative;
  transition: text-shadow 0.3s ease;
  cursor: default;
}

.logo:hover {
  text-shadow:
    0 0 12px var(--theme-accent-soft-2),
    0 2px 10px rgba(0, 0, 0, 0.58);
}

/* Nav link animated underline glow */
.nav-link {
  position: relative;
  overflow: hidden;
}

.nav-link::after {
  display: none !important;
}

/* ─── Premium Feature Cards with Animated Gradient Borders ─── */
@property --card-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes cardBorderRotate {
  0% { --card-angle: 0deg; }
  100% { --card-angle: 360deg; }
}

.feature-card,
.home-card {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.35s cubic-bezier(0.22, 0.68, 0, 1);
  overflow: hidden;
}

.feature-card::before,
.home-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--card-angle),
    transparent 0%,
    var(--theme-accent-soft) 12%,
    var(--theme-accent-soft-2) 25%,
    transparent 38%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: cardBorderRotate 4s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.feature-card:hover::before,
.home-card:hover::before {
  opacity: 1;
}

.feature-card:hover,
.home-card:hover {
  background: rgba(255, 255, 255, 0.07);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 0 24px var(--theme-accent-soft);
  transform: translateY(-3px);
}

/* Staggered card entrance animations */
@keyframes cardSlideUp {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.feature-card,
.home-card,
.theme-pill {
  animation: cardSlideUp 0.55s cubic-bezier(0.22, 0.68, 0, 1) both;
}

.feature-card:nth-child(1), .home-card:nth-child(1), .theme-pill:nth-child(1) { animation-delay: 0.05s; }
.feature-card:nth-child(2), .home-card:nth-child(2), .theme-pill:nth-child(2) { animation-delay: 0.12s; }
.feature-card:nth-child(3), .home-card:nth-child(3), .theme-pill:nth-child(3) { animation-delay: 0.19s; }
.feature-card:nth-child(4), .home-card:nth-child(4), .theme-pill:nth-child(4) { animation-delay: 0.26s; }
.feature-card:nth-child(5), .home-card:nth-child(5), .theme-pill:nth-child(5) { animation-delay: 0.33s; }
.feature-card:nth-child(6), .home-card:nth-child(6), .theme-pill:nth-child(6) { animation-delay: 0.40s; }
.theme-pill:nth-child(7) { animation-delay: 0.47s; }
.theme-pill:nth-child(8) { animation-delay: 0.54s; }
.theme-pill:nth-child(9) { animation-delay: 0.61s; }

/* ─── Hero Section Enhancement ─── */
.hero-text h1 {
  background: linear-gradient(
    135deg,
    #fbeedc 0%,
    var(--theme-accent) 45%,
    var(--theme-tertiary, #ffb5a0) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}

.eyebrow {
  background: linear-gradient(90deg, var(--theme-accent), var(--theme-secondary, #e9c349));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 500;
}

.campfire-card {
  transition: transform 0.45s cubic-bezier(0.22, 0.68, 0, 1), box-shadow 0.45s ease;
}

.campfire-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.5),
    0 0 60px var(--theme-accent-soft);
}

/* ─── Premium Auth Panel ─── */
.auth-panel {
  background: rgba(35, 31, 29, 0.55);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 80px var(--theme-accent-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: pageEnterIn 0.5s cubic-bezier(0.22, 0.68, 0, 1) 0.15s both;
}

.auth-panel h2 {
  font-family: var(--title-font);
  font-size: 1.8rem;
  background: linear-gradient(135deg, #fbeedc, var(--theme-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Auth form inputs — editorial floating border style */
.auth-form input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--editor-font);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
}

.auth-form input:focus {
  border-color: var(--theme-accent-soft-2);
  box-shadow:
    0 0 0 3px var(--theme-accent-soft),
    0 4px 16px rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.35);
}

.auth-form .btn.primary {
  margin-top: 6px;
  font-size: 1rem;
  padding: 12px 24px;
  letter-spacing: 0.02em;
}

/* ─── Premium Button Shimmer Effect ─── */
@keyframes btnShimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

.btn.primary {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn.primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.18),
    transparent
  );
  transform: skewX(-20deg);
  transition: none;
  z-index: 2;
  pointer-events: none;
}

.btn.primary:hover::after {
  animation: btnShimmer 0.8s ease-in-out;
}

/* Enhanced ghost button glow */
.btn.ghost {
  transition: all 0.3s cubic-bezier(0.22, 0.68, 0, 1);
}

.btn.ghost:hover {
  background: var(--theme-hover-bg);
  border-color: var(--theme-accent-soft-2);
  box-shadow:
    0 0 16px var(--theme-accent-soft),
    0 4px 12px rgba(0, 0, 0, 0.15);
  text-shadow: 0 0 8px var(--theme-accent-soft);
}

/* ─── Enhanced Theme Tiles ─── */
@keyframes tileShimmer {
  0% { transform: translateX(-200%) rotate(-45deg); }
  100% { transform: translateX(200%) rotate(-45deg); }
}

.theme-tile {
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.22, 0.68, 0, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Shimmer sweep on hover */
.theme-tile::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.08) 48%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.08) 52%,
    transparent 60%
  );
  transform: translateX(-200%) rotate(-45deg);
  pointer-events: none;
  z-index: 1;
}

.theme-tile:hover::before {
  animation: tileShimmer 0.9s ease-in-out;
}

.theme-tile:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(255, 198, 146, 0.5);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.25),
    0 0 20px var(--tile-glow, rgba(255, 176, 116, 0.18));
}

.theme-tile:has(input:checked) {
  box-shadow:
    0 0 0 2px var(--theme-accent-soft-2),
    0 0 28px var(--tile-glow, rgba(255, 176, 116, 0.28)),
    0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ─── Settings Card Enhancement ─── */
.settings-card {
  background: rgba(35, 31, 29, 0.5);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ─── Activity Card Enhancement ─── */
.activity-card {
  background: rgba(35, 31, 29, 0.45);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ─── Heatmap Cell Enhancement ─── */
.heatmap-cell {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border-radius: 4px;
}

.heatmap-cell:hover {
  transform: scale(1.6);
  box-shadow: 0 0 8px var(--theme-accent-soft);
  z-index: 2;
  position: relative;
}

/* ─── Enhanced Security Card ─── */
@keyframes securityBorderGlow {
  0%, 100% { border-color: rgba(255, 255, 255, 0.08); }
  50% { border-color: var(--theme-accent-soft); }
}

.security-card {
  background: rgba(35, 31, 29, 0.45);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  animation: securityBorderGlow 6s ease-in-out infinite;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ─── Enhanced Chat Panel (Aura) ─── */
.chat-launch {
  transition: all 0.3s cubic-bezier(0.22, 0.68, 0, 1);
}

.chat-launch:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 16px 40px var(--theme-accent-soft-2),
    0 0 30px var(--theme-accent-soft);
}

.chat-panel {
  background: rgba(20, 12, 10, 0.88);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chat-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-input {
  background: rgba(0, 0, 0, 0.12);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-input input {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  transition: all 0.25s ease;
}

.chat-input input:focus {
  border-color: var(--theme-accent-soft-2);
  box-shadow: 0 0 12px var(--theme-accent-soft);
}

.chat-input button {
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px var(--theme-accent-soft);
}

.chat-input button:hover {
  box-shadow:
    0 4px 16px var(--theme-accent-soft-2),
    0 0 20px var(--theme-accent-soft);
  transform: translateY(-1px);
}

/* ─── Enhanced Sidebar ─── */
.entry-sidebar {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 0 40px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: box-shadow 0.35s ease;
}

.entry-item {
  transition: all 0.25s cubic-bezier(0.22, 0.68, 0, 1);
}

.entry-item:hover {
  transform: translateX(3px);
}

.entry-item.active {
  transform: translateX(4px);
}

/* ─── Enhanced Editor Toolbar ─── */
.editor-toolbar {
  background: rgba(35, 31, 29, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tool-btn {
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background: var(--theme-accent-soft);
  border-color: var(--theme-accent-soft-2);
  box-shadow: 0 0 10px var(--theme-accent-soft);
  transform: translateY(-1px);
}

/* ─── Enhanced Book Area ─── */
.book {
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.book:focus-within {
  box-shadow:
    0 32px 90px var(--shadow),
    0 0 40px var(--theme-accent-soft),
    inset 0 0 0 2px rgba(30, 14, 7, 0.45),
    inset 0 0 65px rgba(70, 40, 18, 0.24),
    inset 0 0 110px rgba(58, 31, 14, 0.14);
}

/* ─── Section Headings Enhancement ─── */
.home-section h2 {
  position: relative;
  display: inline-block;
}

.home-section h2::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--theme-accent), transparent);
  transition: width 0.4s ease;
}

.home-section:hover h2::after {
  width: 80px;
}

/* ─── Enhanced Scrollbar Tooltip (Heatmap) ─── */
.heatmap-cell[title]::before {
  font-family: var(--ui-font);
}

/* ─── Ambient Noise Texture (subtle grain overlay) ─── */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.018;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'><filter id='noise'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23noise)' opacity='1'/></svg>");
  mix-blend-mode: overlay;
}

/* ─── Home Guest Note Enhancement ─── */
.home-guest-note {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.home-guest-note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--theme-accent), var(--theme-accent-2));
  border-radius: 999px;
}

/* ─── Enhanced Theme Pill (on home page) ─── */
.theme-pill {
  transition: all 0.3s cubic-bezier(0.22, 0.68, 0, 1);
  position: relative;
  overflow: hidden;
}

.theme-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, var(--theme-accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-pill:hover::before {
  opacity: 1;
}

.theme-pill:hover {
  transform: translateY(-2px) scale(1.02);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--theme-accent-soft-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ─── Hero Meta Enhancement ─── */
.hero-meta {
  position: relative;
  padding-left: 14px;
}

.hero-meta::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--theme-accent-soft-2), transparent);
  border-radius: 999px;
}

/* ─── Smooth Theme Transition ─── */
body {
  transition: background 0.5s ease;
}

.ambient-bg {
  transition: background 0.5s ease;
}

/* ─── Enhanced Form Elements ─── */
.share-header input,
.story-image-panel input,
.share-row input {
  transition: all 0.25s ease;
}

.share-header input:focus,
.story-image-panel input:focus,
.share-row input:focus {
  border-color: var(--theme-accent-soft-2);
  box-shadow: 0 0 12px var(--theme-accent-soft);
}

/* ─── Image Preview Enhancement ─── */
.image-preview {
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.image-preview:hover {
  border-color: var(--theme-accent-soft);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ─── Enhanced Page Controls ─── */
.page-controls .btn {
  transition: all 0.25s cubic-bezier(0.22, 0.68, 0, 1);
}

.page-controls .btn:hover {
  transform: translateY(-2px) scale(1.02);
}

/* ─── Status Bar Enhancement ─── */
.status-bar {
  padding: 4px 0;
  transition: color 0.35s ease;
}

/* ─── Selection per Theme ─── */
body[data-theme="water"] ::selection { background: rgba(89, 188, 238, 0.3); }
body[data-theme="wind"] ::selection { background: rgba(173, 217, 242, 0.3); }
body[data-theme="earth"] ::selection { background: rgba(139, 196, 118, 0.3); }
body[data-theme="ice"] ::selection { background: rgba(184, 227, 247, 0.3); }
body[data-theme="storm"] ::selection { background: rgba(124, 154, 255, 0.3); }
body[data-theme="space"] ::selection { background: rgba(160, 141, 245, 0.3); }
body[data-theme="garden"] ::selection { background: rgba(140, 218, 151, 0.3); }
body[data-theme="cherry"] ::selection { background: rgba(255, 182, 197, 0.3); }

/* ─── Enhanced Modal ─── */
.image-modal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.image-modal-card {
  background: rgba(20, 12, 10, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ─── Password Toggle Enhancement ─── */
.password-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

.password-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--theme-accent-soft-2);
  color: var(--theme-accent);
}

/* ─── Share Mode Menu Enhancement ─── */
.share-mode-menu {
  background: rgba(15, 10, 8, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* ─── Accessible Focus Enhancement ─── */
*:focus-visible {
  outline: 2px solid var(--theme-accent-soft-2);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible,
.tool-btn:focus-visible,
.share-mode-btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--theme-focus), 0 0 16px var(--theme-accent-soft);
}

/* ─── Reduced Motion Override for Premium Animations ─── */
@media (prefers-reduced-motion: reduce) {
  .page-enter { animation: none !important; }
  .feature-card, .home-card, .theme-pill { animation: none !important; }
  .feature-card::before, .home-card::before { animation: none !important; }
  .theme-tile::before { animation: none !important; }
  .btn.primary::after { animation: none !important; }
  .nav-link::after { transition: none !important; }
  .security-card { animation: none !important; }
}

/* ─── Print Styles ─── */
@media print {
  .site-header,
  .chat-launch,
  .chat-panel,
  .ambient-bg,
  .theme-motion,
  .theme-particle-layer,
  .ember-field-canvas,
  .fire-band-canvas,
  canvas { display: none !important; }

  body { background: #fff !important; color: #000 !important; }
  .book { border: 1px solid #ccc !important; box-shadow: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   ELEMENTAL IMMERSION v3.0 — Mega UI/UX + Per-Theme Enhancement
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Global: Smooth Scroll ─── */
html {
  scroll-behavior: smooth;
}

/* ─── Hamburger Menu (Mobile) ─── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  z-index: 12;
  transition: all 0.3s ease;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--theme-accent);
  border-radius: 999px;
  transition: all 0.3s cubic-bezier(0.22, 0.68, 0, 1);
}

.hamburger.open .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger.open .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.hamburger:hover {
  border-color: var(--theme-accent-soft-2);
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links { display: none !important; }
}

/* ─── Mobile Drawer ─── */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.mobile-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100vh;
  background: rgba(22, 19, 17, 0.92);
  backdrop-filter: blur(32px) saturate(1.5);
  -webkit-backdrop-filter: blur(32px) saturate(1.5);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
  z-index: 99;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.22, 0.68, 0, 1);
  overflow-y: auto;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-drawer-logo {
  font-family: var(--ui-font);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--theme-accent);
}

.mobile-drawer-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mobile-drawer-close:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--theme-accent-soft-2);
  color: var(--theme-accent);
}

.mobile-drawer-links {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.mobile-nav-link {
  display: block;
  padding: 14px 16px;
  border-radius: 14px;
  color: #f6dbc2;
  text-decoration: none;
  font-family: var(--ui-font);
  font-size: 1rem;
  transition: all 0.25s ease;
}

.mobile-nav-link:hover {
  background: var(--theme-hover-bg);
  color: #fff;
  transform: translateX(4px);
}

.mobile-nav-logout {
  color: var(--theme-accent);
  opacity: 0.85;
}

.mobile-drawer-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 0;
}

.mobile-share-form {
  display: flex;
  gap: 8px;
  padding: 4px 0;
}

.mobile-share-form input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-family: var(--ui-font);
  font-size: 0.9rem;
}

.mobile-drawer-google {
  width: 100%;
  gap: 10px;
}

.mobile-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-theme-badge {
  font-family: var(--ui-font);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: capitalize;
}

/* Staggered entrance for drawer links */
.mobile-drawer.open .mobile-nav-link:nth-child(1) { animation: drawerLinkIn 0.35s cubic-bezier(0.22, 0.68, 0, 1) 0.05s both; }
.mobile-drawer.open .mobile-nav-link:nth-child(2) { animation: drawerLinkIn 0.35s cubic-bezier(0.22, 0.68, 0, 1) 0.1s both; }
.mobile-drawer.open .mobile-nav-link:nth-child(3) { animation: drawerLinkIn 0.35s cubic-bezier(0.22, 0.68, 0, 1) 0.15s both; }
.mobile-drawer.open .mobile-nav-link:nth-child(4) { animation: drawerLinkIn 0.35s cubic-bezier(0.22, 0.68, 0, 1) 0.2s both; }
.mobile-drawer.open .mobile-nav-link:nth-child(5) { animation: drawerLinkIn 0.35s cubic-bezier(0.22, 0.68, 0, 1) 0.25s both; }
.mobile-drawer.open .mobile-nav-link:nth-child(6) { animation: drawerLinkIn 0.35s cubic-bezier(0.22, 0.68, 0, 1) 0.3s both; }

@keyframes drawerLinkIn {
  0% { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ─── Logo as link ─── */
.logo {
  text-decoration: none;
  color: #fbeedc;
}

/* ─── Nav Google Button ─── */
.nav-google-btn {
  background: transparent !important;
  border: 1px solid var(--theme-accent) !important;
  color: var(--theme-accent) !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  font-family: var(--ui-font) !important;
  font-size: 0.85rem !important;
  gap: 8px;
  display: inline-flex !important;
  align-items: center;
}

.nav-google-btn:hover {
  background: var(--theme-accent-soft) !important;
}

/* ─── Logout link ─── */
.nav-link-logout {
  color: var(--theme-accent) !important;
  opacity: 0.85;
}
.nav-link-logout:hover {
  color: var(--theme-accent-text) !important;
  background: var(--theme-accent) !important;
  opacity: 1;
}

/* ─── Site Footer ─── */
.site-footer {
  margin-top: 60px;
  padding: 0 var(--gutter);
  position: relative;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--theme-accent-soft-2), transparent);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px 0 32px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-logo {
  font-family: var(--ui-font);
  font-weight: 600;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
}

.footer-tagline {
  font-family: var(--ui-font);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  font-family: var(--ui-font);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-theme-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ui-font);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
  text-transform: capitalize;
}

.footer-theme-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--theme-accent);
  box-shadow: 0 0 8px var(--theme-accent-soft);
  animation: footerDotPulse 3s ease-in-out infinite;
}

@keyframes footerDotPulse {
  0%, 100% { box-shadow: 0 0 8px var(--theme-accent-soft); }
  50% { box-shadow: 0 0 16px var(--theme-accent-soft-2); }
}

@media (max-width: 600px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ─── Feature Card Icons ─── */
.feature-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--theme-accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ─── Steps Section ─── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.step-card {
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.22, 0.68, 0, 1);
}

.step-card:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--theme-accent), var(--theme-accent-2));
  color: var(--theme-accent-text);
  font-family: var(--ui-font);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px var(--theme-accent-soft);
}

.step-card h3 {
  margin: 0 0 6px;
  font-family: var(--ui-font);
  font-size: 1rem;
}

.step-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  font-size: 0.92rem;
}

/* Stagger step cards */
.step-card:nth-child(1) { animation: cardSlideUp 0.55s cubic-bezier(0.22, 0.68, 0, 1) 0.05s both; }
.step-card:nth-child(2) { animation: cardSlideUp 0.55s cubic-bezier(0.22, 0.68, 0, 1) 0.12s both; }
.step-card:nth-child(3) { animation: cardSlideUp 0.55s cubic-bezier(0.22, 0.68, 0, 1) 0.19s both; }
.step-card:nth-child(4) { animation: cardSlideUp 0.55s cubic-bezier(0.22, 0.68, 0, 1) 0.26s both; }

/* ─── Theme Showcase Grid (home page pills with dots) ─── */
.theme-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.theme-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-color, var(--theme-accent));
  box-shadow: 0 0 10px var(--dot-color, var(--theme-accent));
  flex-shrink: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.theme-pill:hover .theme-dot {
  transform: scale(1.4);
  box-shadow: 0 0 18px var(--dot-color, var(--theme-accent));
}

.theme-showcase-grid .theme-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-showcase-grid .theme-name {
  flex: 1;
}

/* ─── Auth Panel Enhancements ─── */
.auth-panel-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--theme-accent), var(--theme-accent-2), transparent);
  border-radius: 20px 20px 0 0;
}

.auth-panel {
  position: relative;
  overflow: hidden;
}

.auth-panel-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-divider-text {
  font-family: var(--ui-font);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.google-auth-btn {
  width: 100%;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #f6dbc2 !important;
}

.google-auth-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.auth-footer-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 16px 0 12px;
}

.auth-form label {
  font-family: var(--ui-font);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: -4px;
}

/* ─── Profile Page ─── */
.profile-header-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  border-radius: 20px;
  background: rgba(35, 31, 29, 0.5);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  margin-bottom: 20px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--theme-accent), var(--theme-accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 20px var(--theme-accent-soft), 0 0 0 3px rgba(255, 255, 255, 0.08);
  position: relative;
}

.profile-avatar::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--theme-accent-soft-2);
  animation: avatarPulse 3s ease-in-out infinite;
}

@keyframes avatarPulse {
  0%, 100% { border-color: var(--theme-accent-soft); transform: scale(1); }
  50% { border-color: var(--theme-accent-soft-2); transform: scale(1.02); }
}

.profile-avatar-letter {
  font-family: var(--title-font);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--theme-accent-text);
}

.profile-header-info h2 {
  margin: 0 0 2px;
  font-family: var(--ui-font);
  font-size: 1.3rem;
}

.profile-email {
  margin: 0 0 8px;
  font-family: var(--ui-font);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

.profile-theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--theme-accent-soft);
  border: 1px solid var(--theme-accent-soft-2);
  font-family: var(--ui-font);
  font-size: 0.75rem;
  color: var(--theme-accent);
  text-transform: capitalize;
}

.profile-theme-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--theme-accent);
}

.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.profile-stat:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.profile-stat-icon {
  font-size: 1.4rem;
}

.profile-stat-value {
  font-family: var(--ui-font);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--theme-accent);
}

.profile-stat-label {
  font-family: var(--ui-font);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (max-width: 500px) {
  .profile-header-card {
    flex-direction: column;
    text-align: center;
  }
  .profile-stats-row {
    grid-template-columns: 1fr;
  }
}

/* ─── Theme Tile Enhancements (Settings) ─── */
.theme-tile-emoji {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.theme-color-dots {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.theme-cdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Per-theme color dots */
.theme-campfire .theme-cdot-1 { background: #ffb783; }
.theme-campfire .theme-cdot-2 { background: #fb8e32; }
.theme-campfire .theme-cdot-3 { background: #e9c349; }

.theme-water .theme-cdot-1 { background: #59bcee; }
.theme-water .theme-cdot-2 { background: #3a9dd4; }
.theme-water .theme-cdot-3 { background: #78d2ff; }

.theme-wind .theme-cdot-1 { background: #add9f2; }
.theme-wind .theme-cdot-2 { background: #7ab8e0; }
.theme-wind .theme-cdot-3 { background: #c8e6fa; }

.theme-earth .theme-cdot-1 { background: #8bc476; }
.theme-earth .theme-cdot-2 { background: #a89060; }
.theme-earth .theme-cdot-3 { background: #c4a67a; }

.theme-ice .theme-cdot-1 { background: #b8e3f7; }
.theme-ice .theme-cdot-2 { background: #7cc0e8; }
.theme-ice .theme-cdot-3 { background: #dcf8ff; }

.theme-storm .theme-cdot-1 { background: #7c9aff; }
.theme-storm .theme-cdot-2 { background: #5a6fd4; }
.theme-storm .theme-cdot-3 { background: #aab9ff; }

.theme-space .theme-cdot-1 { background: #a08df5; }
.theme-space .theme-cdot-2 { background: #6e96fa; }
.theme-space .theme-cdot-3 { background: #c8d2ff; }

.theme-garden .theme-cdot-1 { background: #8cda97; }
.theme-garden .theme-cdot-2 { background: #60b97f; }
.theme-garden .theme-cdot-3 { background: #bef0c5; }

.theme-cherry .theme-cdot-1 { background: #ffb7c5; }
.theme-cherry .theme-cdot-2 { background: #ff6fa3; }
.theme-cherry .theme-cdot-3 { background: #ffe4e6; }

.theme-active-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--ui-font);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--theme-accent);
  color: var(--theme-accent-text);
  z-index: 2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px var(--theme-accent-soft);
}

.settings-theme-hint {
  font-family: var(--ui-font);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 12px;
  font-style: italic;
}

/* ─── Selected Theme Tile Pulsing Glow ─── */
@keyframes selectedTileGlow {
  0%, 100% { box-shadow: 0 0 0 2px var(--theme-accent-soft), 0 0 20px var(--tile-glow, rgba(255, 176, 116, 0.2)); }
  50% { box-shadow: 0 0 0 3px var(--theme-accent-soft-2), 0 0 32px var(--tile-glow, rgba(255, 176, 116, 0.35)); }
}

.theme-tile:has(input:checked) {
  animation: selectedTileGlow 3s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════════
   PER-THEME VISUAL UPGRADES — Richer palettes & unique character
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── 🔥 CAMPFIRE (Ember Hearth) — Richer warm tones ─── */
body[data-theme="campfire"] {
  --theme-secondary: #e9c349;
  --theme-tertiary: #ffb5a0;
  --theme-surface-container: #2b2220;
  --theme-panel-bg: rgba(52, 38, 32, 0.65);
  --theme-panel-bg-2: rgba(40, 28, 22, 0.88);
}

body[data-theme="campfire"] .site-header {
  background: rgba(32, 22, 18, 0.6);
}

body[data-theme="campfire"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(255, 183, 131, 0.3), rgba(233, 195, 73, 0.2), transparent);
}

/* ─── 🌊 WATER (Tide Whisper) — Deeper ocean, teal shimmer ─── */
body[data-theme="water"] {
  --theme-secondary: #42a5e6;
  --theme-tertiary: #78d2ff;
  --theme-surface-container: #152e48;
  --theme-panel-bg: rgba(22, 52, 80, 0.65);
  --theme-panel-bg-2: rgba(14, 36, 58, 0.88);
  --theme-panel-border: rgba(89, 188, 238, 0.12);
  --theme-hover-bg: rgba(89, 188, 238, 0.08);
}

body[data-theme="water"] .site-header {
  background: rgba(10, 28, 48, 0.62);
}

body[data-theme="water"] .entry-sidebar {
  background: rgba(16, 42, 68, 0.6);
  border-color: rgba(89, 188, 238, 0.1);
}

body[data-theme="water"] .book {
  border-color: #1e5a7a;
  box-shadow:
    0 28px 80px rgba(0, 10, 30, 0.5),
    inset 0 0 0 2px rgba(10, 30, 60, 0.45),
    inset 0 0 65px rgba(20, 60, 100, 0.15),
    0 0 40px rgba(89, 188, 238, 0.06);
}

body[data-theme="water"] .chat-bubble.bot {
  background: rgba(89, 188, 238, 0.14);
  border-color: rgba(89, 188, 238, 0.25);
}

body[data-theme="water"] .eyebrow {
  background: linear-gradient(90deg, #59bcee, #78d2ff);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="water"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(89, 188, 238, 0.3), rgba(120, 210, 255, 0.2), transparent);
}

/* ─── 💨 WIND (Sky Drift) — Airy silver, cloud hints ─── */
body[data-theme="wind"] {
  --theme-secondary: #8cc2e4;
  --theme-tertiary: #c8e6fa;
  --theme-surface-container: #1e3040;
  --theme-panel-bg: rgba(38, 56, 72, 0.6);
  --theme-panel-bg-2: rgba(28, 42, 56, 0.85);
  --theme-panel-border: rgba(173, 217, 242, 0.1);
  --theme-hover-bg: rgba(173, 217, 242, 0.08);
}

body[data-theme="wind"] .site-header {
  background: rgba(18, 30, 40, 0.55);
}

body[data-theme="wind"] .entry-sidebar {
  background: rgba(30, 48, 64, 0.55);
  border-color: rgba(173, 217, 242, 0.08);
}

body[data-theme="wind"] .book {
  border-color: #4a6878;
}

body[data-theme="wind"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(173, 217, 242, 0.3), rgba(200, 230, 250, 0.2), transparent);
}

/* ─── 🌿 EARTH (Rootstone) — Rich soil, moss green, golden brown ─── */
body[data-theme="earth"] {
  --theme-secondary: #c4a67a;
  --theme-tertiary: #b8d4a0;
  --theme-surface-container: #2a2018;
  --theme-panel-bg: rgba(56, 44, 34, 0.6);
  --theme-panel-bg-2: rgba(42, 32, 24, 0.85);
  --theme-panel-border: rgba(139, 196, 118, 0.1);
  --theme-hover-bg: rgba(139, 196, 118, 0.08);
}

body[data-theme="earth"] .site-header {
  background: rgba(28, 20, 14, 0.6);
}

body[data-theme="earth"] .entry-sidebar {
  background: rgba(50, 38, 28, 0.6);
  border-color: rgba(139, 196, 118, 0.08);
}

body[data-theme="earth"] .book {
  border-color: #6a5440;
  box-shadow:
    0 28px 80px rgba(10, 6, 2, 0.5),
    inset 0 0 0 2px rgba(40, 24, 14, 0.45),
    inset 0 0 65px rgba(80, 50, 24, 0.18);
}

body[data-theme="earth"] .eyebrow {
  background: linear-gradient(90deg, #8bc476, #c4a67a);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="earth"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(139, 196, 118, 0.3), rgba(196, 166, 122, 0.2), transparent);
}

/* ─── ❄️ ICE (Crystal Frost) — Prismatic, crystalline shimmer ─── */
body[data-theme="ice"] {
  --theme-secondary: #a0d4f0;
  --theme-tertiary: #dcf8ff;
  --theme-surface-container: #1a3040;
  --theme-panel-bg: rgba(34, 58, 76, 0.6);
  --theme-panel-bg-2: rgba(24, 42, 58, 0.85);
  --theme-panel-border: rgba(184, 227, 247, 0.1);
  --theme-hover-bg: rgba(184, 227, 247, 0.08);
}

body[data-theme="ice"] .site-header {
  background: rgba(14, 26, 36, 0.6);
}

body[data-theme="ice"] .entry-sidebar {
  background: rgba(26, 48, 64, 0.55);
  border-color: rgba(184, 227, 247, 0.08);
}

body[data-theme="ice"] .book {
  border-color: #3a6882;
  box-shadow:
    0 28px 80px rgba(0, 10, 20, 0.5),
    inset 0 0 0 2px rgba(10, 30, 50, 0.4),
    inset 0 0 65px rgba(30, 70, 100, 0.12),
    0 0 50px rgba(184, 227, 247, 0.04);
}

body[data-theme="ice"] .eyebrow {
  background: linear-gradient(90deg, #b8e3f7, #dcf8ff);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="ice"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(184, 227, 247, 0.3), rgba(220, 248, 255, 0.2), transparent);
}

/* ─── ⚡ STORM (Volt Tempest) — Electric purple, brighter lightning ─── */
body[data-theme="storm"] {
  --theme-secondary: #9b6fd4;
  --theme-tertiary: #aab9ff;
  --theme-surface-container: #1e1a32;
  --theme-panel-bg: rgba(40, 36, 68, 0.6);
  --theme-panel-bg-2: rgba(28, 24, 50, 0.85);
  --theme-panel-border: rgba(124, 154, 255, 0.1);
  --theme-hover-bg: rgba(124, 154, 255, 0.08);
}

body[data-theme="storm"] .site-header {
  background: rgba(16, 14, 28, 0.62);
}

body[data-theme="storm"] .entry-sidebar {
  background: rgba(32, 28, 56, 0.6);
  border-color: rgba(124, 154, 255, 0.08);
}

body[data-theme="storm"] .book {
  border-color: #3a346a;
}

body[data-theme="storm"] .eyebrow {
  background: linear-gradient(90deg, #7c9aff, #aab9ff);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="storm"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(124, 154, 255, 0.3), rgba(155, 111, 212, 0.2), transparent);
}

/* Enhanced lightning flash — brighter, more dramatic */
body[data-theme="storm"] .theme-motion-b {
  background: linear-gradient(120deg, transparent 42%, rgba(198, 212, 255, 0.45) 50%, transparent 58%);
}

/* ─── 🌌 SPACE (Nebula Orbit) — Deeper cosmic, nebula pink ─── */
body[data-theme="space"] {
  --theme-secondary: #6e96fa;
  --theme-tertiary: #c8b0ff;
  --theme-surface-container: #161440;
  --theme-panel-bg: rgba(30, 28, 68, 0.6);
  --theme-panel-bg-2: rgba(20, 18, 50, 0.88);
  --theme-panel-border: rgba(160, 141, 245, 0.1);
  --theme-hover-bg: rgba(160, 141, 245, 0.08);
}

body[data-theme="space"] .site-header {
  background: rgba(12, 10, 24, 0.62);
}

body[data-theme="space"] .entry-sidebar {
  background: rgba(24, 20, 50, 0.6);
  border-color: rgba(160, 141, 245, 0.08);
}

body[data-theme="space"] .book {
  border-color: #34285e;
}

body[data-theme="space"] .eyebrow {
  background: linear-gradient(90deg, #a08df5, #c8b0ff);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="space"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(160, 141, 245, 0.3), rgba(110, 150, 250, 0.2), transparent);
}

/* ─── 🌸 GARDEN (Bloom Haven) — Lush green, floral pink accent ─── */
body[data-theme="garden"] {
  --theme-secondary: #60b97f;
  --theme-tertiary: #f0c6d0;
  --theme-surface-container: #162c22;
  --theme-panel-bg: rgba(30, 56, 42, 0.6);
  --theme-panel-bg-2: rgba(20, 40, 30, 0.85);
  --theme-panel-border: rgba(140, 218, 151, 0.1);
  --theme-hover-bg: rgba(140, 218, 151, 0.08);
}

body[data-theme="garden"] .site-header {
  background: rgba(12, 24, 18, 0.6);
}

body[data-theme="garden"] .entry-sidebar {
  background: rgba(24, 44, 34, 0.55);
  border-color: rgba(140, 218, 151, 0.08);
}

body[data-theme="garden"] .book {
  border-color: #2e5a42;
}

body[data-theme="garden"] .eyebrow {
  background: linear-gradient(90deg, #8cda97, #bef0c5);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="garden"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(140, 218, 151, 0.3), rgba(240, 198, 208, 0.15), transparent);
}

/* ─── 🌺 CHERRY (Sakura Drift) — Deeper rose, gold accents ─── */
body[data-theme="cherry"] {
  --theme-secondary: #ff6fa3;
  --theme-tertiary: #ffd4a8;
  --theme-surface-container: #2a1118;
  --theme-panel-bg: rgba(56, 24, 34, 0.6);
  --theme-panel-bg-2: rgba(40, 16, 22, 0.85);
  --theme-panel-border: rgba(255, 182, 197, 0.1);
  --theme-hover-bg: rgba(255, 182, 197, 0.08);
}

body[data-theme="cherry"] .site-header {
  background: rgba(24, 10, 14, 0.88);
}

body[data-theme="cherry"] .entry-sidebar {
  background: rgba(46, 20, 28, 0.6);
  border-color: rgba(255, 182, 197, 0.08);
}

body[data-theme="cherry"] .book {
  border-color: #6a2838;
  box-shadow:
    0 28px 80px rgba(10, 2, 4, 0.5),
    inset 0 0 0 2px rgba(40, 10, 16, 0.45),
    inset 0 0 65px rgba(80, 20, 30, 0.15),
    0 0 40px rgba(255, 182, 197, 0.04);
}

body[data-theme="cherry"] .eyebrow {
  background: linear-gradient(90deg, #ffb7c5, #ffd4a8);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="cherry"] .site-footer::before {
  background: linear-gradient(90deg, transparent, rgba(255, 182, 197, 0.3), rgba(255, 111, 163, 0.2), transparent);
}

/* ═══════════════════════════════════════════════════════════════════════
   PER-THEME: Header text-shadow, nav-link colors, body text
   ═══════════════════════════════════════════════════════════════════════ */

body[data-theme="water"] .nav-link { color: #c2e4f8; }
body[data-theme="wind"] .nav-link { color: #c8dff0; }
body[data-theme="earth"] .nav-link { color: #d8c8a8; }
body[data-theme="ice"] .nav-link { color: #c4e4f4; }
body[data-theme="storm"] .nav-link { color: #b8c4f0; }
body[data-theme="space"] .nav-link { color: #c0b8e8; }
body[data-theme="garden"] .nav-link { color: #b8dcc0; }
body[data-theme="cherry"] .nav-link { color: #f0c8d0; }

body[data-theme="water"] .status-bar { color: #8ac8e8; }
body[data-theme="wind"] .status-bar { color: #9cc0d8; }
body[data-theme="earth"] .status-bar { color: #b0a080; }
body[data-theme="ice"] .status-bar { color: #a0d0e8; }
body[data-theme="storm"] .status-bar { color: #98a8e0; }
body[data-theme="space"] .status-bar { color: #a098d8; }
body[data-theme="garden"] .status-bar { color: #90c098; }
body[data-theme="cherry"] .status-bar { color: #e0a0b0; }

/* ─── Per-Theme: Auth panel subtle background tints ─── */
body[data-theme="water"] .auth-panel { background: rgba(16, 38, 58, 0.55); }
body[data-theme="wind"] .auth-panel { background: rgba(24, 36, 48, 0.55); }
body[data-theme="earth"] .auth-panel { background: rgba(38, 28, 20, 0.55); }
body[data-theme="ice"] .auth-panel { background: rgba(20, 36, 48, 0.55); }
body[data-theme="storm"] .auth-panel { background: rgba(24, 20, 42, 0.55); }
body[data-theme="space"] .auth-panel { background: rgba(20, 18, 42, 0.55); }
body[data-theme="garden"] .auth-panel { background: rgba(18, 34, 26, 0.55); }
body[data-theme="cherry"] .auth-panel { background: rgba(36, 16, 22, 0.55); }

/* ─── Per-Theme: Profile avatar unique gradients ─── */
body[data-theme="water"] .profile-avatar { background: linear-gradient(135deg, #59bcee, #3a9dd4); }
body[data-theme="wind"] .profile-avatar { background: linear-gradient(135deg, #add9f2, #7ab8e0); }
body[data-theme="earth"] .profile-avatar { background: linear-gradient(135deg, #8bc476, #a89060); }
body[data-theme="ice"] .profile-avatar { background: linear-gradient(135deg, #b8e3f7, #7cc0e8); }
body[data-theme="storm"] .profile-avatar { background: linear-gradient(135deg, #7c9aff, #5a6fd4); }
body[data-theme="space"] .profile-avatar { background: linear-gradient(135deg, #a08df5, #6e96fa); }
body[data-theme="garden"] .profile-avatar { background: linear-gradient(135deg, #8cda97, #60b97f); }
body[data-theme="cherry"] .profile-avatar { background: linear-gradient(135deg, #ffb7c5, #ff6fa3); }

/* ─── Per-Theme: Mobile drawer tints ─── */
body[data-theme="water"] .mobile-drawer { background: rgba(10, 28, 48, 0.94); }
body[data-theme="wind"] .mobile-drawer { background: rgba(16, 26, 36, 0.94); }
body[data-theme="earth"] .mobile-drawer { background: rgba(24, 18, 12, 0.94); }
body[data-theme="ice"] .mobile-drawer { background: rgba(14, 26, 36, 0.94); }
body[data-theme="storm"] .mobile-drawer { background: rgba(14, 12, 26, 0.94); }
body[data-theme="space"] .mobile-drawer { background: rgba(12, 10, 24, 0.94); }
body[data-theme="garden"] .mobile-drawer { background: rgba(12, 24, 18, 0.94); }
body[data-theme="cherry"] .mobile-drawer { background: rgba(24, 10, 14, 0.94); }


/* ─── Enhanced Save Status Dot ─── */
@keyframes savePulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

#saveStatus::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--theme-accent);
  margin-right: 6px;
  vertical-align: middle;
  animation: savePulse 2s ease-in-out infinite;
}

/* ─── Enhanced Workspace Sidebar on Focus ─── */
.entry-sidebar:hover {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.25),
    0 0 48px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ─── Reduced Motion Overrides for New Animations ─── */
@media (prefers-reduced-motion: reduce) {
  .mobile-drawer { transition: none !important; }
  .mobile-drawer-overlay { transition: none !important; }
  .hamburger-line { transition: none !important; }
  .step-card { animation: none !important; }
  .theme-dot { transition: none !important; }
  .profile-avatar::after { animation: none !important; }
  .footer-theme-dot { animation: none !important; }
  .theme-tile:has(input:checked) { animation: none !important; }
  html { scroll-behavior: auto; }
}

.nav-link.active {
  background: var(--theme-hover-bg);
  box-shadow: inset 0 0 0 1px var(--theme-accent-soft-2);
}
.mobile-nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--theme-accent);
  padding-left: 17px;
}

/* ==========================================================================
   UI & Animation Enhancements (Smoothness & Tactile UI updates)
   ========================================================================== */

/* 1. Global Interactive Elements Smoothing */
.btn, .tool-btn, .nav-link, .home-card, .feature-card, .theme-tile, .chat-launch, .entry-item,
button, a {
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* 2. Tactile Hover states & Glassmorphism hints */
.btn:hover, .home-card:hover, .feature-card:hover, .theme-tile:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.15) !important;
}

.btn:active, .home-card:active, .feature-card:active, .theme-tile:active, .tool-btn:active, .chat-launch:active {
  transform: translateY(0) scale(0.98) !important;
}

/* 3. Inputs & Textareas Focus Glows */
textarea:focus, input:focus, .page-title:focus, .page-content:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--theme-accent-soft), 0 0 12px var(--theme-accent-soft-2) !important;
  transition: box-shadow 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
}
.page-title:focus, .page-content:focus {
  box-shadow: none !important; /* Keep editor clean */
}

/* 4. Glassmorphism for floating panels */
.chat-panel, .auth-panel, .mobile-drawer {
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  background-color: var(--theme-panel-bg) !important;
}

/* 5. Snappier existing keyframes over-ride */
@keyframes page-enter {
  0% { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes dropdown-enter {
  0% { opacity: 0; transform: translateY(-10px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   Mobile Interface Tweaks
   ========================================================================== */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .entry-sidebar {
    max-width: 100%;
    margin-bottom: 20px;
  }
  .entry-list {
    max-height: 220px;
  }
}

@media (max-width: 768px) {
  .chat-panel {
    width: calc(100vw - 32px) !important;
    max-width: none !important;
    height: 65vh !important;
    bottom: 20px !important;
    right: 16px !important;
    left: 16px !important;
  }
  
  .status-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .status-actions {
    align-self: flex-end;
  }
}
