/* Reverie — Hebrew Dream Journal PWA
   © אופיר ברנס (Ofir Baranes) 2026
   Palette: midnight-pearl */

:root {
  --bg-deep: #0a0a1f;
  --bg-soft: #15152e;
  --bg-mid: #1f1f3a;
  --surface: rgba(196, 160, 170, 0.07);
  --surface-hi: rgba(196, 160, 170, 0.12);
  --surface-lo: rgba(244, 233, 225, 0.04);
  --border: rgba(244, 233, 225, 0.10);
  --border-hi: rgba(244, 233, 225, 0.18);

  --pearl: #f4e9e1;
  --pearl-dim: #d8ccc2;
  --silver: #c9d4e0;
  --silver-dim: #95a2b5;
  --twilight: #6b7794;
  --rose: #c4a0aa;
  --rose-bright: #e0b8c2;
  --cyan: #7ba8b8;
  --cyan-bright: #9cc8d5;
  --amber: #e8d5a2;
  --lavender: #b8a4ce;
  --petal: #f4c2c2;

  --grad-night: linear-gradient(165deg, #0d0d2a 0%, #1a1a3e 40%, #3a2638 100%);
  --grad-rose: linear-gradient(135deg, var(--rose) 0%, var(--lavender) 100%);
  --grad-cyan: linear-gradient(135deg, var(--cyan) 0%, var(--lavender) 100%);
  --grad-pearl: linear-gradient(135deg, var(--amber) 0%, var(--pearl) 100%);

  --shadow-glow: 0 8px 32px rgba(196, 160, 170, 0.18), 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 24px rgba(10, 10, 31, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 12px 40px rgba(10, 10, 31, 0.65), 0 4px 12px rgba(196, 160, 170, 0.12);

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 32px;

  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-soft: cubic-bezier(.22, .61, .36, 1);

  --font-headline: 'Frank Ruhl Libre', 'Heebo', serif;
  --font-body: 'Heebo', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-accent: 'Instrument Serif', 'Frank Ruhl Libre', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg-deep);
  color: var(--pearl);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(ellipse 80% 60% at 70% -10%, rgba(196, 160, 170, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 10% 30%, rgba(123, 168, 184, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(184, 164, 206, 0.12) 0%, transparent 60%),
    var(--grad-night);
  background-attachment: fixed;
  position: relative;
  padding-bottom: 100px;
}

/* Grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.6'/></svg>");
}

/* Floating ambient orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  animation: drift 24s ease-in-out infinite;
}
.orb-1 { width: 340px; height: 340px; background: var(--rose); top: -80px; left: -100px; }
.orb-2 { width: 280px; height: 280px; background: var(--cyan); top: 35%; right: -120px; animation-delay: -8s; }
.orb-3 { width: 220px; height: 220px; background: var(--lavender); bottom: 5%; left: 30%; animation-delay: -16s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.08); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

main, header, .container {
  position: relative;
  z-index: 2;
}

/* ============== TOP BAR ============== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 31, 0.65);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--grad-rose);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(196, 160, 170, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; stroke: var(--bg-deep); }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-title {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--pearl);
}
.brand-sub {
  font-family: var(--font-accent);
  font-size: 12px;
  font-style: italic;
  color: var(--rose-bright);
  margin-top: 2px;
  opacity: 0.85;
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--pearl);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
}
.icon-btn:hover { background: var(--surface-hi); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ============== HERO ============== */
.hero {
  position: relative;
  margin: 0 16px 16px;
  border-radius: var(--r-xl);
  overflow: hidden;
  min-height: 280px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  background: var(--bg-soft);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('hero_bg.png');
  background-size: cover;
  background-position: center;
  opacity: 0.85;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13, 13, 42, 0.1) 0%, rgba(13, 13, 42, 0.7) 70%, rgba(13, 13, 42, 0.92) 100%);
}

.hero-content {
  position: relative;
  padding: 32px 26px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 280px;
  justify-content: flex-end;
  z-index: 2;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--rose-bright);
  text-transform: uppercase;
  align-self: flex-start;
  padding: 6px 12px;
  background: rgba(196, 160, 170, 0.12);
  border: 1px solid rgba(196, 160, 170, 0.25);
  border-radius: 999px;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rose-bright);
  box-shadow: 0 0 8px var(--rose-bright);
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot { 50% { opacity: 0.4; transform: scale(0.7); } }

.hero-headline {
  font-family: var(--font-headline);
  font-size: 38px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--pearl);
  letter-spacing: -0.5px;
}
.hero-headline em {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  color: var(--rose-bright);
}

.hero-sub {
  font-size: 15px;
  color: var(--silver);
  line-height: 1.55;
  max-width: 460px;
}

.hero-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  align-self: flex-start;
  padding: 12px 22px;
  background: var(--pearl);
  color: var(--bg-deep);
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  box-shadow: 0 6px 20px rgba(244, 233, 225, 0.25);
}
.hero-cta:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(244, 233, 225, 0.35); }
.hero-cta:active { transform: translateY(-1px) scale(0.98); }
.hero-cta svg { width: 16px; height: 16px; stroke: var(--bg-deep); fill: none; stroke-width: 2.5; }

/* ============== STATS ROW ============== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-spring);
}
.stat-card:hover {
  background: var(--surface-hi);
  border-color: var(--border-hi);
  transform: translateY(-2px);
}
.stat-card .stat-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-hi);
  margin-bottom: 8px;
}
.stat-card .stat-icon svg { width: 16px; height: 16px; fill: none; stroke-width: 2; }
.stat-card .stat-icon.rose svg { stroke: var(--rose-bright); }
.stat-card .stat-icon.cyan svg { stroke: var(--cyan-bright); }
.stat-card .stat-icon.amber svg { stroke: var(--amber); }
.stat-card .stat-icon.lav svg { stroke: var(--lavender); }
.stat-card .stat-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  color: var(--pearl);
  line-height: 1;
  letter-spacing: -0.5px;
}
.stat-card .stat-label {
  font-size: 11px;
  color: var(--silver-dim);
  margin-top: 4px;
  letter-spacing: 0.3px;
}
.stat-card .stat-delta {
  font-size: 10px;
  font-family: var(--font-mono);
  margin-top: 2px;
}
.stat-card .stat-delta.up { color: var(--cyan-bright); }
.stat-card .stat-delta.down { color: var(--rose-bright); }

/* ============== TABS ============== */
.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin: 0 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1;
  min-width: max-content;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--silver-dim);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s var(--ease-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.tab svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.tab:hover { color: var(--pearl); }
.tab.active {
  background: linear-gradient(135deg, rgba(196, 160, 170, 0.25), rgba(184, 164, 206, 0.25));
  color: var(--pearl);
  box-shadow: 0 2px 8px rgba(196, 160, 170, 0.2);
}

/* ============== SECTION ============== */
.section {
  padding: 0 16px;
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 500;
  color: var(--pearl);
  letter-spacing: -0.3px;
}
.section-head h2 em {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--rose-bright);
}
.section-head .section-side {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--silver-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.panel + .panel { margin-top: 12px; }
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-headline);
  font-size: 15px;
  font-weight: 500;
  color: var(--pearl);
  margin-bottom: 14px;
}
.panel-title svg { width: 16px; height: 16px; stroke: var(--rose-bright); fill: none; stroke-width: 2; }

/* ============== CHARTS ============== */
.heatmap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-top: 4px;
}
.hm-week { display: flex; flex-direction: column; gap: 4px; }
.hm-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--surface-lo);
  border: 1px solid var(--border);
  transition: all 0.3s var(--ease-spring);
  cursor: pointer;
  position: relative;
}
.hm-cell:hover { transform: scale(1.3); z-index: 5; box-shadow: var(--shadow-glow); }
.hm-cell[data-v="1"] { background: rgba(196, 160, 170, 0.20); border-color: rgba(196, 160, 170, 0.35); }
.hm-cell[data-v="2"] { background: rgba(196, 160, 170, 0.40); border-color: rgba(196, 160, 170, 0.55); }
.hm-cell[data-v="3"] { background: rgba(196, 160, 170, 0.65); border-color: rgba(196, 160, 170, 0.80); }
.hm-cell[data-v="4"] { background: var(--rose); border-color: var(--rose-bright); }
.hm-cell[data-v="5"] { background: var(--rose-bright); border-color: var(--petal); box-shadow: 0 0 8px rgba(244, 194, 194, 0.4); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--silver-dim);
  letter-spacing: 0.5px;
}
.heatmap-legend .swatches { display: flex; gap: 3px; margin: 0 4px; }
.heatmap-legend .sw { width: 10px; height: 10px; border-radius: 3px; }

.sparkline-wrap {
  position: relative;
  padding: 8px 0 4px;
}
.sparkline-wrap svg { width: 100%; height: 90px; display: block; }
.spark-line { fill: none; stroke: var(--rose-bright); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: url(#sparkGrad); opacity: 0.6; }
.spark-dot { fill: var(--pearl); stroke: var(--rose-bright); stroke-width: 1.5; }
.spark-axis { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.spark-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--silver-dim);
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.donut-svg { width: 110px; height: 110px; flex-shrink: 0; }
.donut-center {
  fill: var(--pearl);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
}
.donut-center-label {
  fill: var(--silver-dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 1px;
}
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.donut-leg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--silver);
}
.donut-leg-row .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-leg-row .val { margin-right: auto; font-family: var(--font-mono); color: var(--pearl); }

/* ============== SYMBOL CLOUD ============== */
.symbol-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  min-height: 140px;
}
.sym-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.3s var(--ease-spring);
  cursor: pointer;
}
.sym-chip:hover {
  background: linear-gradient(135deg, rgba(196, 160, 170, 0.20), rgba(184, 164, 206, 0.20));
  border-color: var(--rose);
  transform: translateY(-2px);
}
.sym-chip .sym-glyph {
  font-family: var(--font-accent);
  color: var(--rose-bright);
}
.sym-chip .sym-name { color: var(--pearl); font-size: 13px; }
.sym-chip .sym-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--silver-dim);
  background: var(--surface-lo);
  padding: 2px 6px;
  border-radius: 6px;
}
.sym-chip.size-1 { font-size: 12px; }
.sym-chip.size-2 { font-size: 14px; }
.sym-chip.size-3 { font-size: 16px; padding: 10px 18px; }
.sym-chip.size-4 {
  font-size: 18px; padding: 12px 22px;
  background: linear-gradient(135deg, rgba(196, 160, 170, 0.18), rgba(184, 164, 206, 0.18));
  border-color: var(--rose);
}

/* ============== DREAM LIST ============== */
.dream-list { display: flex; flex-direction: column; gap: 10px; }

.dream-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  transition: all 0.3s var(--ease-spring);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.dream-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--rose);
  opacity: 0.6;
}
.dream-card.lucid::before { background: var(--lavender); opacity: 1; box-shadow: 0 0 12px var(--lavender); }
.dream-card.recurring::before { background: var(--cyan-bright); opacity: 1; }
.dream-card:hover {
  background: var(--surface-hi);
  transform: translateX(-4px);
  box-shadow: var(--shadow-lift);
}

.dream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.dream-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--silver-dim);
  letter-spacing: 0.5px;
}
.dream-vivid {
  display: flex;
  gap: 2px;
}
.vivid-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(244, 233, 225, 0.15);
}
.vivid-dot.on { background: var(--rose-bright); box-shadow: 0 0 4px var(--rose-bright); }

.dream-text {
  color: var(--pearl);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dream-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.dream-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: var(--surface-lo);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--silver);
}
.dream-tag.special {
  background: rgba(184, 164, 206, 0.18);
  border-color: var(--lavender);
  color: var(--lavender);
  font-family: var(--font-accent);
  font-style: italic;
}

/* ============== EMPTY STATE ============== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-state img { width: 180px; opacity: 0.85; }
.empty-state .e-title {
  font-family: var(--font-headline);
  font-size: 20px;
  color: var(--pearl);
}
.empty-state .e-title em {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--rose-bright);
}
.empty-state .e-sub {
  font-size: 13px;
  color: var(--silver-dim);
  max-width: 320px;
  line-height: 1.6;
}

/* ============== FAB ============== */
.fab {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  background: var(--grad-rose);
  color: var(--bg-deep);
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 36px rgba(196, 160, 170, 0.45), 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.35s var(--ease-spring);
}
.fab:hover { transform: translateX(-50%) translateY(-4px); box-shadow: 0 18px 48px rgba(196, 160, 170, 0.55); }
.fab:active { transform: translateX(-50%) scale(0.96); }
.fab svg { width: 18px; height: 18px; stroke: var(--bg-deep); fill: none; stroke-width: 2.5; }

/* ============== MODAL ============== */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 31, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s var(--ease-soft);
}
.modal-back.open { display: flex; opacity: 1; }
.modal {
  background: linear-gradient(155deg, var(--bg-soft) 0%, var(--bg-mid) 100%);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xl);
  padding: 24px;
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lift);
  position: relative;
  animation: modalIn 0.45s var(--ease-spring);
}
@keyframes modalIn {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-back::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 999px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-head h3 {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 500;
  color: var(--pearl);
}
.modal-head h3 em {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--rose-bright);
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--pearl);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
}
.modal-close:hover { background: var(--surface-hi); transform: rotate(90deg); }
.modal-close svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ============== FORM ============== */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 12px;
  color: var(--silver-dim);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--pearl);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: all 0.25s var(--ease-soft);
}
.field-textarea { min-height: 120px; resize: vertical; line-height: 1.55; font-family: var(--font-body); }
.field-input:focus, .field-textarea:focus, .field-select:focus {
  border-color: var(--rose);
  background: var(--surface-hi);
  box-shadow: 0 0 0 3px rgba(196, 160, 170, 0.15);
}
.field-input::placeholder, .field-textarea::placeholder { color: var(--twilight); }

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* Vividness slider */
.vivid-slider { display: flex; gap: 8px; align-items: center; }
.vivid-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s var(--ease-spring);
}
.vivid-btn:hover { background: var(--surface-hi); }
.vivid-btn.active {
  background: linear-gradient(135deg, rgba(196, 160, 170, 0.35), rgba(184, 164, 206, 0.35));
  border-color: var(--rose);
  transform: translateY(-2px);
}
.vivid-btn .vb-num {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--pearl);
}
.vivid-btn .vb-name {
  font-size: 10px;
  color: var(--silver-dim);
  margin-top: 2px;
}

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  min-height: 48px;
}
.tag-input-wrap input {
  flex: 1;
  min-width: 100px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--pearl);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px;
}
.tag-input-wrap .tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(196, 160, 170, 0.18);
  border: 1px solid var(--rose);
  border-radius: 999px;
  font-size: 12px;
  color: var(--pearl);
}
.tag-input-wrap .tag-chip .x {
  cursor: pointer;
  color: var(--rose-bright);
  font-size: 14px;
  line-height: 1;
}

.symbol-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.sym-pick {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 4px;
  cursor: pointer;
  text-align: center;
  font-size: 11px;
  color: var(--silver);
  transition: all 0.25s var(--ease-spring);
}
.sym-pick:hover { background: var(--surface-hi); }
.sym-pick.active {
  background: linear-gradient(135deg, rgba(123, 168, 184, 0.25), rgba(196, 160, 170, 0.25));
  border-color: var(--cyan);
  color: var(--pearl);
}

.toggles-row { display: flex; gap: 10px; }
.toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  color: var(--silver);
  font-size: 13px;
}
.toggle-btn:hover { background: var(--surface-hi); }
.toggle-btn .tb-icon {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--surface-lo);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.toggle-btn .tb-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.toggle-btn.active {
  background: linear-gradient(135deg, rgba(184, 164, 206, 0.25), rgba(123, 168, 184, 0.20));
  border-color: var(--lavender);
  color: var(--pearl);
}
.toggle-btn.active .tb-icon { background: rgba(184, 164, 206, 0.35); color: var(--lavender); }

/* Buttons */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background: var(--pearl);
  color: var(--bg-deep);
  box-shadow: 0 6px 20px rgba(244, 233, 225, 0.2);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(244, 233, 225, 0.3); }
.btn-ghost {
  background: var(--surface);
  color: var(--pearl);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-hi); }
.btn-block { width: 100%; justify-content: center; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.modal-actions .btn { flex: 1; justify-content: center; }

/* Dream detail */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.dm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--silver);
}
.dm-pill svg { width: 12px; height: 12px; stroke: var(--rose-bright); fill: none; stroke-width: 2; }
.detail-body {
  color: var(--pearl);
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  margin-bottom: 18px;
}
.detail-tags, .detail-syms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

/* About */
.about-section { margin-bottom: 16px; }
.about-section h4 {
  font-family: var(--font-headline);
  font-size: 16px;
  color: var(--rose-bright);
  margin-bottom: 8px;
}
.about-section p {
  font-size: 13px;
  color: var(--silver);
  line-height: 1.65;
}
.about-list { list-style: none; padding-right: 4px; }
.about-list li {
  font-size: 13px;
  color: var(--silver);
  padding: 4px 0;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.about-list li::before {
  content: '◦';
  color: var(--rose-bright);
  font-family: var(--font-accent);
  flex-shrink: 0;
}
.copyright {
  font-size: 11px;
  color: var(--twilight);
  text-align: center;
  margin-top: 18px;
  font-family: var(--font-accent);
  font-style: italic;
}

/* ============== TOAST ============== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--bg-mid);
  color: var(--pearl);
  border: 1px solid var(--rose);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s var(--ease-spring);
  box-shadow: var(--shadow-lift);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 14px; height: 14px; stroke: var(--rose-bright); fill: none; stroke-width: 2.5; }

/* ============== RESPONSIVE ============== */
@media (min-width: 540px) {
  .hero-headline { font-size: 44px; }
  .hero-content { padding: 40px 32px 32px; min-height: 320px; }
  .stat-card .stat-val { font-size: 28px; }
}
@media (min-width: 720px) {
  .topbar { padding: 18px 28px; }
  .hero { margin: 0 24px 24px; }
  .stats-row { padding: 0 24px; gap: 14px; }
  .tabs { margin: 0 24px 22px; }
  .section { padding: 0 24px; }
  .hero-headline { font-size: 50px; }
  .stats-row { grid-template-columns: repeat(4, 1fr); }
  body { padding-bottom: 120px; }
}
@media (max-width: 380px) {
  .hero-headline { font-size: 30px; }
  .stat-card .stat-val { font-size: 20px; }
  .symbol-picker { grid-template-columns: repeat(4, 1fr); }
}

/* hide views */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.4s var(--ease-soft); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
