/* ==========================================================================
   FALISA — CELESTIAL EDITORIAL (MYSTICAL ASTRONOMICAL INTERFACE)
   Palette: Void #080613 · Cosmic #100A24 · Nebula #21133F · Astral #5B35B8
            Lavender #B9A0FF · Moonlight #E6DFFF · Starlight Cyan #8DDCFF
   Zero yellow/orange UI accents. Editorial manuscript & observatory layout.
   ========================================================================== */

:root {
  --void: #080613;
  --cosmic: #100A24;
  --nebula: #21133F;
  --astral: #5B35B8;
  --astral-bright: #7348DA;
  --lavender: #C3ADFF;
  --moonlight: #F2EEFF;
  --body-ink: #E2DBF9;
  --cyan: #8DDCFF;
  --rose: #E8A6F0;
  --muted: #C2B6E6;
  --dim: #A698D1;

  --surface: rgba(14, 9, 32, 0.78);
  --surface-elevated: rgba(22, 13, 46, 0.88);
  --surface-hover: rgba(33, 19, 63, 0.78);

  --hairline: rgba(185, 160, 255, 0.16);
  --hairline-strong: rgba(185, 160, 255, 0.34);
  --glow-astral: rgba(91, 53, 184, 0.36);
  --glow-lavender: rgba(185, 160, 255, 0.22);

  --radius-sm: 4px;
  --radius-md: 6px;

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Compatibility aliases */
  --background: var(--void);
  --foreground: var(--moonlight);
  --primary: var(--lavender);
  --card: var(--surface-elevated);
  --border: var(--hairline);
  --border-strong: var(--hairline-strong);
  --secondary: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: var(--moonlight);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.014em;
  color: var(--moonlight);
  margin: 0;
}

p {
  margin: 0;
  color: var(--body-ink);
}

a { color: inherit; text-decoration: none; }

/* Fixed Living WebGL + Mouse-Reactive Starfield Canvas */
#cosmic-webgl, #cosmic-stars {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
#cosmic-webgl { z-index: 0; opacity: 0.42; }
#cosmic-stars { z-index: 1; opacity: 0.72; }

/* Dark Cosmic Reading Scrim — Guarantees high text contrast over WebGL nebula */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 55% 15%, rgba(16, 10, 36, 0.56) 0%, rgba(8, 6, 19, 0.84) 72%, rgba(8, 6, 19, 0.94) 100%);
}

/* ================= APP SHELL ================= */
.app-shell {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100vh;
}

/* ================= OBSERVATORY SIDEBAR ================= */
.app-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: rgba(8, 6, 19, 0.84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}

.app-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 20px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 16px;
}
.app-brand img {
  max-height: 26px;
  width: auto;
  opacity: 0.96;
}
.brand-ephemeris {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.06em;
}

.nav-group-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--dim);
  padding: 16px 10px 6px;
  letter-spacing: 0.08em;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  border-left: 2px solid transparent;
  background: transparent;
  color: #BFB6E2;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  text-align: left;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.nav-btn svg {
  opacity: 0.65;
  flex-shrink: 0;
  transition: opacity 0.18s ease, color 0.18s ease;
}
.nav-btn:hover {
  background: rgba(185, 160, 255, 0.06);
  color: var(--moonlight);
}
.nav-btn:hover svg { opacity: 0.95; }

.nav-btn.active {
  background: linear-gradient(90deg, rgba(91, 53, 184, 0.24) 0%, rgba(91, 53, 184, 0.02) 100%);
  border-left-color: var(--lavender);
  color: var(--moonlight);
  font-weight: 600;
}
.nav-btn.active svg {
  opacity: 1;
  color: var(--lavender);
}

.nav-btn .badge-new,
.nav-btn .badge-prem {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(141, 220, 255, 0.08);
  color: var(--cyan);
  border: 1px solid rgba(141, 220, 255, 0.24);
}
.nav-btn .badge-prem {
  background: rgba(185, 160, 255, 0.10);
  color: var(--lavender);
  border-color: rgba(185, 160, 255, 0.28);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ================= MAIN CANVAS & TOPBAR ================= */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(8, 6, 19, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--hairline);
  padding: 13px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--moonlight);
  letter-spacing: 0.005em;
}
.topbar-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--moonlight);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: pointer;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.astro-coords {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  padding-right: 12px;
  border-right: 1px solid var(--hairline);
}

.pill-credit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: rgba(16, 10, 36, 0.65);
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--moonlight);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.pill-credit:hover {
  border-color: var(--lavender);
  color: var(--lavender);
}

.pill-premium {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--astral-bright) 0%, var(--astral) 100%);
  color: #F6F3FF;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid rgba(185, 160, 255, 0.36);
  cursor: pointer;
  transition: filter 0.18s ease, box-shadow 0.18s ease;
}
.pill-premium:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 20px var(--glow-astral);
}
.pill-premium.is-pro {
  background: rgba(91, 53, 184, 0.18);
  border-color: rgba(185, 160, 255, 0.36);
  color: var(--lavender);
  box-shadow: none;
}

.app-content {
  padding: 40px 44px 72px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

/* ================= EDITORIAL LAYOUT PRIMITIVES ================= */
.ed-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 32px;
}

.ed-kicker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--cyan);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ed-kicker .sep { color: var(--dim); }

.ed-display {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.8vw, 44px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--moonlight);
}
.ed-display em {
  font-style: italic;
  color: var(--lavender);
}

.ed-sub {
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.65;
}

.ed-section-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--moonlight);
  margin-bottom: 14px;
}

.ed-rule {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, var(--hairline-strong) 0%, var(--hairline) 65%, transparent 100%);
  margin: 34px 0;
  border: 0;
}

.ed-mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.ed-mono-cyan {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

/* Open Editorial Grids (Hairline-separated instead of heavy boxes) */
.ed-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr);
  gap: 44px;
  align-items: start;
}
.ed-split-equal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px;
  align-items: start;
}
.ed-col-rule {
  padding-left: 36px;
  border-left: 1px solid var(--hairline);
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* Architectural Folio Surface (used sparingly for forms / active tools, NOT nested) */
.ed-sheet {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline);
  padding: 28px 28px 32px;
}

/* Subtle fallback class for compatibility */
.f-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 24px;
}
.f-card-hover {
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}
.f-card-hover:hover {
  border-color: var(--lavender);
  background: var(--surface-hover);
}

/* ================= ASTRONOMICAL INDEX LIST (REPLACES GENERIC CARD GRIDS) ================= */
.ed-index-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 40px;
}

.ed-index-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 8px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, padding-left 0.18s ease;
}
.ed-index-item:hover {
  background: rgba(185, 160, 255, 0.05);
  border-bottom-color: var(--lavender);
  padding-left: 14px;
}
.ed-index-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  padding-top: 4px;
  min-width: 22px;
}
.ed-index-icon {
  color: var(--lavender);
  padding-top: 2px;
  opacity: 0.85;
  flex-shrink: 0;
}
.ed-index-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--moonlight);
  line-height: 1.2;
  margin-bottom: 3px;
}
.ed-index-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.ed-index-arrow {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--dim);
  padding-top: 3px;
  transition: transform 0.18s ease, color 0.18s ease;
}
.ed-index-item:hover .ed-index-arrow {
  color: var(--lavender);
  transform: translateX(3px);
}

/* ================= METADATA STRIP (ASTRONOMICAL KEY-VALUE) ================= */
.ed-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin-top: 22px;
}
.ed-meta-cell-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 4px;
}
.ed-meta-cell-val {
  font-size: 14px;
  font-weight: 500;
  color: var(--moonlight);
}

/* ================= CELESTIAL TELEMETRY / SCORE BARS ================= */
.score-row {
  margin-bottom: 16px;
}
.score-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  margin-bottom: 7px;
  color: #D9D2F7;
}
.score-head strong {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--lavender);
}
.score-track {
  height: 3px;
  background: rgba(185, 160, 255, 0.12);
  overflow: hidden;
}
.score-fill {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ================= CELESTIAL EDITORIAL MANUSCRIPT (TAROT / FORTUNE READING) ================= */
.ms-manuscript {
  margin-top: 32px;
  padding: 36px 38px 40px;
  background: linear-gradient(180deg, rgba(16, 10, 36, 0.72) 0%, rgba(10, 7, 24, 0.84) 100%);
  border-top: 1px solid var(--lavender);
  border-bottom: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
}

.ms-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--hairline);
}

.ms-folio-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.ms-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 500;
  line-height: 1.14;
  color: var(--moonlight);
  max-width: 24ch;
}

.ms-lead {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.56;
  color: var(--moonlight);
  max-width: 60ch;
  padding: 28px 0;
  border-bottom: 1px solid var(--hairline);
}

/* Radial Celestial Energy & Lunar Dial */
.ms-dial-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-left: 24px;
  border-left: 1px solid var(--hairline);
}
.ms-dial-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 126px;
}
.ms-dial-row-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
.ms-dial-row-val {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--moonlight);
  line-height: 1.15;
}

/* Symbol Ledger (Open editorial columns with unique SVG emblems) */
.ms-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--hairline);
}
.ms-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lavender);
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}
.ms-symbols-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 36px;
}
.ms-symbol-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 10px 12px;
  margin: -10px -12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: background 0.22s ease;
}
.ms-symbol-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(185, 160, 255, 0.10) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.ms-symbol-item:hover {
  background: rgba(91, 53, 184, 0.12);
}
.ms-symbol-item:hover::after {
  transform: translateX(120%);
}
.ms-emblem {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: radial-gradient(circle at 35% 30%, rgba(91, 53, 184, 0.42), rgba(14, 9, 32, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lavender);
  transition: border-color 0.22s ease, transform 0.25s ease;
}
.ms-symbol-item:hover .ms-emblem {
  border-color: var(--cyan);
  transform: scale(1.06);
}
.ms-symbol-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  color: var(--moonlight);
  line-height: 1.2;
  margin-bottom: 5px;
}
.ms-symbol-meaning {
  font-size: 14px;
  line-height: 1.68;
  color: var(--body-ink);
  max-width: 46ch;
}

/* Editorial Reading Chapters */
.ms-chapter-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--moonlight);
  margin-bottom: 10px;
}
.ms-chapter-prose {
  font-size: 14.5px;
  line-height: 1.74;
  color: #D5CDF5;
  max-width: 64ch;
}

/* Quiet Manuscript Guidance Callout */
.ms-guidance {
  border-left: 2px solid var(--lavender);
  padding: 6px 0 6px 22px;
  margin: 28px 0;
}
.ms-guidance-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 21px;
  line-height: 1.5;
  color: var(--moonlight);
  max-width: 58ch;
}
.ms-watchout {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--cyan);
}

.ms-notice {
  border-left: 2px solid var(--cyan);
  background: rgba(141, 220, 255, 0.06);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--moonlight);
  margin-bottom: 20px;
}

.ms-followup {
  padding-top: 26px;
}
.ms-followup-answer {
  border-left: 2px solid var(--astral-bright);
  padding: 12px 0 12px 18px;
}

/* ================= BUTTONS & CONTROLS ================= */
.btn-primary-f {
  background: linear-gradient(135deg, var(--astral-bright) 0%, var(--astral) 100%);
  color: #F6F3FF;
  border: 1px solid rgba(185, 160, 255, 0.42);
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.btn-primary-f:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 24px var(--glow-astral);
  transform: translateY(-1px);
}
.btn-primary-f:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-ghost-f {
  background: transparent;
  color: #CFC7EE;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.btn-ghost-f:hover {
  border-color: var(--lavender);
  color: var(--moonlight);
  background: rgba(185, 160, 255, 0.06);
}
.btn-ghost-f.active {
  background: rgba(91, 53, 184, 0.28);
  border-color: var(--lavender);
  color: var(--moonlight);
}

/* Form Inputs */
.f-input, .f-select, .f-textarea {
  width: 100%;
  background: rgba(8, 6, 19, 0.78);
  border: 1px solid var(--hairline-strong);
  color: var(--moonlight);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.f-input::placeholder, .f-textarea::placeholder { color: var(--dim); }
.f-input:focus, .f-select:focus, .f-textarea:focus {
  border-color: var(--lavender);
  box-shadow: 0 0 0 3px var(--glow-lavender);
}
.f-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.03em;
}

/* Upload Dropzone */
.upload-zone {
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  background: rgba(16, 10, 36, 0.45);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.upload-zone:hover {
  border-color: var(--lavender);
  background: rgba(91, 53, 184, 0.14);
}
.upload-preview {
  max-height: 132px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  display: none;
  margin-inline: auto;
  border: 1px solid var(--hairline-strong);
}

/* ================= CELESTIAL TAROT & KATINA DECK ================= */
.card-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}

.mystic-card {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  background: radial-gradient(circle at 50% 30%, rgba(33, 19, 63, 0.92), rgba(8, 6, 19, 0.96));
  border: 1px solid var(--hairline-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}
.mystic-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(185, 160, 255, 0.14);
  pointer-events: none;
}
.mystic-card:hover {
  transform: translateY(-5px);
  border-color: var(--lavender);
  box-shadow: 0 12px 28px rgba(91, 53, 184, 0.34);
}
.mystic-card.picked {
  background: radial-gradient(circle at 50% 25%, rgba(91, 53, 184, 0.72), rgba(16, 10, 36, 0.96));
  border-color: var(--lavender);
  box-shadow: 0 0 24px rgba(185, 160, 255, 0.28);
}
.mystic-card-num {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--dim);
  letter-spacing: 0.08em;
}
.mystic-card.picked .mystic-card-num { color: var(--cyan); }
.mystic-card-name {
  font-family: var(--font-display);
  font-size: 13.5px;
  line-height: 1.2;
  color: var(--muted);
}
.mystic-card.picked .mystic-card-name {
  color: var(--moonlight);
  font-weight: 600;
}

/* ================= ASTRONOMICAL EPHEMERIS TABLE ================= */
.ephem-table {
  width: 100%;
  border-collapse: collapse;
}
.ephem-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--dim);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline-strong);
}
.ephem-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
  color: var(--moonlight);
}
.ephem-table tr:hover td {
  background: rgba(185, 160, 255, 0.04);
}

/* ================= LOADER & TOAST ================= */
.loader-box {
  text-align: center;
  padding: 52px 20px;
}
.spinner-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--hairline-strong);
  border-top-color: var(--lavender);
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.view-fade { animation: viewFadeIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }

.toast-f {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(16, 10, 36, 0.95);
  border: 1px solid var(--lavender);
  color: var(--moonlight);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  z-index: 100;
  display: none;
  box-shadow: 0 12px 32px rgba(8, 6, 19, 0.72);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 980px) {
  .app-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    transition: left 0.22s ease;
  }
  .app-sidebar.open { left: 0; }
  .mobile-menu-btn { display: inline-flex; }
  .astro-coords { display: none; }
  .app-content { padding: 26px 20px 56px; }
  .app-topbar { padding: 12px 18px; }
  .ed-split, .ed-split-equal, .ed-index-grid, .ms-symbols-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .ed-col-rule {
    padding-left: 0;
    border-left: none;
    padding-top: 24px;
    border-top: 1px solid var(--hairline);
  }
  .ms-head { grid-template-columns: 1fr; }
  .ms-dial-wrap {
    padding-left: 0;
    border-left: none;
    padding-top: 18px;
    border-top: 1px solid var(--hairline);
  }
  .ms-manuscript { padding: 24px 20px; }
  .ed-meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar-meta { display: none; }
  .topbar-right { flex-wrap: nowrap; gap: 6px; }
  .pill-credit, .pill-premium { padding: 5px 10px; font-size: 11px; white-space: nowrap; }
}

/* Tiered Accessible Reduced Motion (WCAG 2.3.3 / C39) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ms-symbol-item::after { display: none; }
}
