/* ============================================
   Phases — Midnight Pearl palette
   © אופיר ברנס · 2026
   ============================================ */

:root {
  /* core palette */
  --bg-0: #06051a;
  --bg-1: #0b0a1f;
  --bg-2: #131129;
  --bg-3: #1a1632;
  --surface-1: rgba(28, 24, 56, 0.55);
  --surface-2: rgba(40, 34, 72, 0.45);
  --surface-3: rgba(54, 46, 88, 0.4);

  /* pearl + rose accent */
  --pearl-1: #f8f1e8;
  --pearl-2: #e8dfd2;
  --pearl-3: #c6bcca;
  --pearl-4: #a8a4c0;

  --rose-1: #f3d0d8;
  --rose-2: #d4a5b8;
  --rose-3: #a87a8c;
  --rose-4: #6d4f5d;

  /* deep night */
  --night-1: #0d0a22;
  --night-2: #1a1632;
  --night-3: #2a2348;

  /* semantic */
  --text-1: #f5efe6;
  --text-2: #c6bcca;
  --text-3: #8a8499;
  --text-4: #5a5572;

  --line: rgba(212, 165, 184, 0.18);
  --line-strong: rgba(212, 165, 184, 0.32);

  /* gradients */
  --grad-hero: linear-gradient(180deg, rgba(11,10,31,0) 0%, rgba(11,10,31,0.55) 55%, rgba(11,10,31,0.95) 100%);
  --grad-rose: linear-gradient(135deg, #d4a5b8, #a87a8c 55%, #6d4f5d);
  --grad-pearl: linear-gradient(135deg, #f8f1e8, #c6bcca);

  /* fonts */
  --ff-serif: "Frank Ruhl Libre", "Heebo", serif;
  --ff-instrument: "Instrument Serif", serif;
  --ff-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ff-body: "Heebo", system-ui, sans-serif;

  /* shape */
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;

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

  /* energy gradient stops (0..1) */
  --e0: #2a2348;
  --e25: #4a3a5c;
  --e50: #a87a8c;
  --e75: #d4a5b8;
  --e100: #f3d0d8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff-body);
  background: radial-gradient(140% 80% at 70% -10%, #1a1632 0%, var(--bg-0) 55%, var(--bg-0) 100%);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
  padding-bottom: 92px;
  font-weight: 400;
  letter-spacing: -0.005em;
}

button { font-family: inherit; cursor: pointer; }
.serif { font-family: var(--ff-instrument); font-style: italic; font-weight: 400; }
.serif-display { font-family: var(--ff-serif); font-weight: 500; }

/* ============ Ambient ============ */
.ambient {
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  mix-blend-mode: screen;
}
.orb-a {
  top: -15%; right: -10%;
  width: 460px; height: 460px;
  background: radial-gradient(circle, #d4a5b8 0%, #6d4f5d 50%, transparent 70%);
  animation: orb-drift-a 22s ease-in-out infinite alternate;
}
.orb-b {
  bottom: -10%; left: -15%;
  width: 520px; height: 520px;
  background: radial-gradient(circle, #4a3a5c 0%, #2a2348 55%, transparent 75%);
  animation: orb-drift-b 28s ease-in-out infinite alternate;
}
.orb-c {
  top: 35%; left: 40%;
  width: 320px; height: 320px;
  background: radial-gradient(circle, #f8f1e8 0%, transparent 65%);
  opacity: 0.12;
  animation: orb-drift-c 30s ease-in-out infinite alternate;
}
@keyframes orb-drift-a { from { transform: translate(0,0); } to { transform: translate(-40px, 30px); } }
@keyframes orb-drift-b { from { transform: translate(0,0); } to { transform: translate(50px, -20px); } }
@keyframes orb-drift-c { from { transform: translate(0,0); } to { transform: translate(-30px, -40px); } }

.grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.92 0 0 0 0 0.85 0 0 0 0.16 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.4;
  mix-blend-mode: overlay;
}

/* ============ Top bar ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(6,5,26,0.92) 0%, rgba(6,5,26,0.7) 70%, rgba(6,5,26,0) 100%);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 38px; height: 38px; filter: drop-shadow(0 4px 16px rgba(212,165,184,0.3)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--ff-serif); font-size: 18px; font-weight: 700; letter-spacing: 0.5px; color: var(--pearl-1); }
.brand-sub { font-family: var(--ff-instrument); font-style: italic; font-size: 11px; color: var(--rose-2); letter-spacing: 0.4px; }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--pearl-2);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s var(--ease-spring), border-color 0.25s, background 0.25s, color 0.25s;
  backdrop-filter: blur(10px);
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--line-strong); color: var(--rose-1); }
.icon-btn:active { transform: translateY(0) scale(0.95); }

/* ============ View visibility ============ */
.view { padding: 0 18px; max-width: 720px; margin: 0 auto; }
.view-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 4px 18px;
}
.view-head h2 { font-family: var(--ff-serif); font-size: 28px; font-weight: 700; margin: 0; }
.view-head h2 .serif { font-family: var(--ff-instrument); }

/* ============ Hero ============ */
.hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-top: 6px;
  min-height: 380px;
  isolation: isolate;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.7), 0 0 0 1px var(--line) inset;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  filter: saturate(1.05);
}
.hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,10,31,0.05) 0%, rgba(11,10,31,0.55) 60%, rgba(6,5,26,0.95) 100%),
    linear-gradient(270deg, rgba(11,10,31,0) 35%, rgba(11,10,31,0.7) 100%);
}
.hero-content {
  position: relative;
  padding: 30px 26px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.kicker {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--rose-2);
  text-transform: uppercase;
}
.hero-title {
  margin: 8px 0 4px;
  display: flex; flex-direction: column;
  line-height: 1;
}
.hero-line-1 {
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: clamp(22px, 5vw, 30px);
  color: var(--pearl-3);
  font-weight: 400;
  margin-bottom: 2px;
}
.hero-line-2 {
  font-family: var(--ff-serif);
  font-size: clamp(36px, 9vw, 56px);
  font-weight: 700;
  color: var(--pearl-1);
  letter-spacing: -0.01em;
  text-shadow: 0 4px 30px rgba(212,165,184,0.2);
}
.hero-sub {
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 15px;
  color: var(--pearl-3);
  max-width: 360px;
  margin: 0;
  line-height: 1.5;
}
.moon-display {
  position: relative;
  display: flex; align-items: center; gap: 24px;
  margin-top: 4px;
}
#moon-svg {
  flex-shrink: 0;
  filter: drop-shadow(0 0 40px rgba(212,165,184,0.25));
}
.moon-stats { display: flex; flex-direction: column; gap: 14px; }
.moon-stat { display: flex; flex-direction: column; }
.ms-num {
  font-family: var(--ff-mono);
  font-size: 32px;
  font-weight: 300;
  color: var(--pearl-1);
  letter-spacing: -0.02em;
  line-height: 1;
}
.ms-lab {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-top: 4px;
}

/* ============ KPI strip ============ */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0 4px;
}
.kpi-card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 10px 12px;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.4s var(--ease-spring), border-color 0.25s;
  overflow: hidden;
}
.kpi-card::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--rose-2), transparent);
  opacity: 0.5;
}
.kpi-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.kpi-num {
  display: block;
  font-family: var(--ff-mono);
  font-size: 22px;
  font-weight: 300;
  color: var(--pearl-1);
  letter-spacing: -0.02em;
}
.kpi-lab {
  display: block;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-top: 4px;
}
.kpi-icon {
  position: absolute;
  top: 8px; left: 8px;
  width: 14px; height: 14px;
  color: var(--rose-3);
  opacity: 0.4;
}

/* ============ Panels ============ */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 22px 24px;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  margin-top: 14px;
  box-shadow: 0 8px 30px -10px rgba(0,0,0,0.4);
}
.panel-head { margin-bottom: 16px; }
.panel-head h2 {
  font-family: var(--ff-serif);
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--pearl-1);
  letter-spacing: -0.01em;
}
.panel-head h2 .serif { color: var(--rose-2); padding-left: 4px; }
.panel-sub {
  font-size: 13px;
  color: var(--text-3);
  margin: 0;
  line-height: 1.45;
}
.panel-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (min-width: 720px) {
  .panel-row { grid-template-columns: 1fr 1fr; }
  .panel-row .panel { margin-top: 0; }
}

/* ============ Log card ============ */
.panel-log { padding: 24px 22px 22px; }
.log-grid { display: flex; flex-direction: column; gap: 14px; }

.slider-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 12px;
}
.slider-row label {
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 15px;
  color: var(--pearl-3);
}
.slider-wrap {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  position: relative;
  z-index: 2;
  margin: 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--grad-pearl);
  border: 1.5px solid var(--rose-2);
  box-shadow: 0 0 0 3px rgba(212,165,184,0.15), 0 4px 12px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.25s var(--ease-spring);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--pearl-1);
  border: 1.5px solid var(--rose-2);
  box-shadow: 0 0 0 3px rgba(212,165,184,0.15), 0 4px 12px rgba(0,0,0,0.4);
  cursor: pointer;
}
.slider-track {
  position: absolute;
  left: 11px; right: 11px;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 4px;
  background: var(--bg-3);
  overflow: hidden;
  z-index: 1;
}
.slider-fill {
  height: 100%;
  background: var(--grad-rose);
  width: 50%;
  transition: width 0.3s var(--ease-soft);
}
.slider-out {
  font-family: var(--ff-mono);
  font-size: 16px;
  font-weight: 400;
  color: var(--pearl-1);
  text-align: center;
}

.tags-row { display: flex; flex-direction: column; gap: 8px; }
.tags-row label, .note-row label {
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 14px;
  color: var(--pearl-3);
}
.tag-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 400;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
  transition: all 0.25s var(--ease-spring);
}
.tag:hover { transform: translateY(-1px); border-color: var(--rose-3); color: var(--pearl-2); }
.tag.active {
  background: var(--grad-rose);
  color: var(--bg-0);
  border-color: transparent;
  font-weight: 500;
}

.note-row { display: flex; flex-direction: column; gap: 6px; }
.note-row textarea {
  font-family: var(--ff-body);
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: var(--text-1);
  resize: vertical;
  min-height: 56px;
  transition: border-color 0.25s;
}
.note-row textarea:focus {
  outline: none;
  border-color: var(--rose-3);
  box-shadow: 0 0 0 3px rgba(212,165,184,0.15);
}

.btn-primary {
  position: relative;
  padding: 14px 22px;
  border-radius: 999px;
  border: none;
  background: var(--grad-rose);
  color: var(--bg-0);
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.35s var(--ease-spring), box-shadow 0.25s;
  box-shadow: 0 10px 30px -8px rgba(212,165,184,0.4), 0 0 0 0 transparent;
  margin-top: 6px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -8px rgba(212,165,184,0.55); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-ghost {
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--pearl-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.25s, transform 0.3s var(--ease-spring);
}
.btn-ghost:hover { border-color: var(--rose-3); transform: translateY(-1px); }
.btn-danger {
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(220,100,120,0.4);
  background: rgba(150,40,60,0.18);
  color: #f3a5b3;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-danger:hover { background: rgba(180,50,70,0.3); }

.save-hint {
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 13px;
  color: var(--rose-2);
  margin: 0;
  text-align: center;
  min-height: 18px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.3s var(--ease-spring);
}
.save-hint.visible { opacity: 1; transform: translateY(0); }

/* ============ Insight card ============ */
.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.insight-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--grad-rose);
  color: var(--bg-0);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.insight-body { flex: 1; }
.insight-headline {
  font-family: var(--ff-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--pearl-1);
  margin: 0 0 4px;
  line-height: 1.3;
}
.insight-detail {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}

/* ============ Sparkline ============ */
.sparkline-wrap { padding: 6px 0 0; }
#sparkline-svg { width: 100%; height: 120px; display: block; }
.spark-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.leg { display: flex; align-items: center; gap: 6px; }
.leg i {
  width: 14px; height: 2px; border-radius: 2px;
  display: inline-block;
}
.leg-e i { background: var(--rose-2); }
.leg-s i { background: var(--pearl-3); }

/* ============ Phase wheel ============ */
.panel-wheel { padding-bottom: 28px; }
.wheel-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
}
@media (min-width: 540px) {
  .wheel-wrap { grid-template-columns: 1fr 1fr; }
}
#phase-wheel { width: 100%; max-width: 320px; height: auto; display: block; margin: 0 auto; }
.wheel-legend {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: 6px;
}
.wheel-legend li {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 0;
}
.wheel-legend li.current {
  color: var(--pearl-1);
  font-weight: 500;
}
.wheel-legend .wl-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line);
}
.wheel-legend .wl-avg {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--rose-2);
  letter-spacing: 0.05em;
}

/* ============ Calendar ============ */
.view-calendar { padding-top: 6px; }
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 0 4px 6px;
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-1);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.cal-cell {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--bg-3);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s var(--ease-spring), background 0.25s;
  border: 1px solid transparent;
}
.cal-cell:hover { transform: scale(1.04); border-color: var(--rose-3); }
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.empty:hover { transform: none; border-color: transparent; }
.cal-cell.today { border-color: var(--rose-2); box-shadow: 0 0 0 1px var(--rose-2) inset; }
.cal-cell .cc-phase {
  width: 16px; height: 16px;
  border-radius: 50%;
  margin-bottom: 4px;
  position: relative;
  overflow: hidden;
  background: var(--night-1);
  border: 1px solid var(--text-4);
}
.cal-cell .cc-phase::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pearl-2);
  border-radius: 50%;
  clip-path: inset(0 0 0 0);
}
.cal-cell .cc-num {
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--text-2);
}
.cal-cell.has-entry .cc-num { color: var(--pearl-1); font-weight: 500; }
.cal-cell .cc-bar {
  position: absolute;
  bottom: 4px; left: 6px; right: 6px;
  height: 3px;
  border-radius: 3px;
  background: var(--bg-3);
}
.cal-hint {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin: 12px 4px;
  line-height: 1.5;
}

/* ============ History ============ */
.history-filter select {
  font-family: var(--ff-body);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--pearl-2);
}
.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  transition: transform 0.3s var(--ease-spring), border-color 0.25s;
}
.history-item:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.history-item .hi-moon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--night-1);
  border: 1px solid var(--text-4);
  position: relative;
  overflow: hidden;
}
.history-item .hi-moon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pearl-2);
  border-radius: 50%;
}
.hi-info { display: flex; flex-direction: column; gap: 2px; }
.hi-date { font-family: var(--ff-mono); font-size: 12px; color: var(--text-3); }
.hi-phase {
  font-family: var(--ff-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--pearl-1);
}
.hi-tags {
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 12px;
  color: var(--rose-2);
  margin-top: 2px;
}
.hi-energy {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 4px;
}
.hi-energy .he-num {
  font-family: var(--ff-mono);
  font-size: 18px;
  font-weight: 300;
  color: var(--pearl-1);
}
.hi-energy .he-lab {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text-3);
  text-transform: uppercase;
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 15px;
}
.empty-state svg { margin-bottom: 14px; opacity: 0.7; }

/* ============ Settings ============ */
.settings-group {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 18px 20px;
  margin-bottom: 12px;
}
.settings-group h3 {
  font-family: var(--ff-serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--pearl-1);
}
.settings-help {
  font-size: 12px;
  color: var(--text-3);
  margin: 0 0 12px;
  line-height: 1.45;
}
.seg-control {
  display: flex;
  background: var(--bg-3);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.seg-control button {
  flex: 1;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  border-radius: 999px;
  transition: background 0.3s var(--ease-soft), color 0.25s;
}
.seg-control button.active {
  background: var(--grad-rose);
  color: var(--bg-0);
  font-weight: 500;
}
.settings-row { display: flex; gap: 8px; flex-wrap: wrap; }
.date-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--pearl-1);
  font-family: var(--ff-mono);
  font-size: 13px;
  color-scheme: dark;
}
.footer-note {
  text-align: center;
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 12px;
  color: var(--text-3);
  padding: 24px 0 8px;
}

/* ============ Modals ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 5, 26, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: modal-fade 0.3s var(--ease-soft);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: linear-gradient(180deg, rgba(26,22,50,0.95), rgba(11,10,31,0.95));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 28px 24px 24px;
  max-width: 420px;
  width: 100%;
  position: relative;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7);
  animation: modal-pop 0.4s var(--ease-spring);
}
@keyframes modal-pop { from { transform: scale(0.92) translateY(8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-close {
  position: absolute;
  top: 12px; left: 12px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--pearl-2);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s var(--ease-spring), background 0.25s;
}
.modal-close:hover { transform: rotate(90deg); background: var(--rose-4); color: var(--pearl-1); }
.modal-logo { width: 56px; height: 56px; margin-bottom: 8px; filter: drop-shadow(0 6px 20px rgba(212,165,184,0.3)); }
.modal-card h2 { font-size: 26px; margin: 0 0 4px; color: var(--pearl-1); }
.modal-tag {
  font-family: var(--ff-instrument);
  font-style: italic;
  color: var(--rose-2);
  font-size: 14px;
  margin: 0 0 14px;
}
.modal-card p { font-size: 14px; color: var(--text-2); line-height: 1.55; margin: 0 0 12px; }
.modal-list {
  list-style: none;
  padding: 0; margin: 14px 0;
  display: flex; flex-direction: column; gap: 6px;
}
.modal-list li {
  font-size: 13px;
  color: var(--text-2);
  padding-right: 18px;
  position: relative;
}
.modal-list li::before {
  content: "";
  position: absolute;
  right: 0; top: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--rose-2);
}
.modal-credit {
  font-family: var(--ff-instrument);
  font-style: italic;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 14px !important;
}
.modal-date {
  font-family: var(--ff-mono);
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 4px;
  letter-spacing: 0.05em;
}
.modal-phase {
  font-family: var(--ff-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--pearl-1);
  margin: 0 0 16px;
}
.modal-day-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.md-stat {
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 12px;
}
.md-stat-lab {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--text-3);
  text-transform: uppercase;
}
.md-stat-num {
  font-family: var(--ff-mono);
  font-size: 22px;
  color: var(--pearl-1);
  font-weight: 300;
  margin-top: 4px;
  display: block;
}
.modal-day-actions {
  display: flex; gap: 8px;
  justify-content: space-between;
}

/* ============ Bottom nav ============ */
.bottom-nav {
  position: fixed;
  bottom: 12px; left: 12px; right: 12px;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 80px 1fr 1fr;
  align-items: center;
  background: rgba(11, 10, 31, 0.78);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  z-index: 100;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.7);
}
.nav-btn {
  background: transparent;
  border: none;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--text-3);
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: color 0.25s, transform 0.3s var(--ease-spring);
}
.nav-btn.active { color: var(--rose-1); }
.nav-btn:hover { transform: translateY(-2px); color: var(--pearl-1); }
.nav-fab {
  position: relative;
  height: 64px;
}
.fab-orb {
  position: absolute;
  top: -16px; left: 50%;
  transform: translateX(-50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--grad-rose);
  display: flex; align-items: center; justify-content: center;
  color: var(--bg-0);
  box-shadow: 0 14px 30px -8px rgba(212,165,184,0.6), 0 0 0 4px rgba(11,10,31,0.4);
  transition: transform 0.4s var(--ease-spring);
}
.nav-fab:hover .fab-orb { transform: translateX(-50%) scale(1.08) rotate(45deg); }

/* ============ Responsive ============ */
@media (max-width: 540px) {
  .slider-row { grid-template-columns: 90px 1fr 36px; gap: 8px; }
  .kpi-strip { gap: 6px; }
  .kpi-num { font-size: 18px; }
  .moon-display { flex-direction: column; align-items: flex-start; gap: 12px; }
  .moon-stats { flex-direction: row; gap: 28px; }
}
@media (max-width: 380px) {
  .view { padding: 0 12px; }
  .hero-content { padding: 22px 18px 22px; }
  .panel { padding: 18px 16px 20px; }
}

/* tiny utility */
[hidden] { display: none !important; }
