:root {
  color-scheme: dark;
  --bg: #0b0b13; --glow-1: rgba(124,93,205,0.14); --glow-2: rgba(216,162,74,0.05);
  --scrollbar: #262a3a; --scrollbar-hover: #343a4e; --border-6: #262a3a;
  --text: #e8e8f0; --text-2: #d8dae4; --text-3: #c6c9d6;
  --text-muted: #8f94a6; --text-muted-2: #b9bdcf;
  --text-faint: #5a5f70; --text-faint-2: #565b6e; --text-faint-3: #6f7488;
  --heading: #f2edf9; --heading-2: #efecf7; --heading-3: #f0eafc; --heading-4: #ece8f7; --brand: #ece4f7;
  --accent: #a78bfa; --accent-hover: #bda2fc; --accent-light: #c4b0fb;
  --accent-soft: #9d8bd0; --accent-soft-2: #b39ce8; --accent-soft-3: #b79cf5; --on-accent: #17102b;
  --accent-glow-1: rgba(167,139,250,0.30); --accent-glow-2: rgba(167,139,250,0.08);
  --accent-glow-3: rgba(167,139,250,0.09); --accent-glow-4: rgba(167,139,250,0.06);
  --accent-glow-5: rgba(167,139,250,0.35);
  --mono-muted: #9d94b8; --deg: #cfd3da; --house: #a7adc0; --badge-dot-off: #3a3f55;
  --err-bg: #1c1016; --err-border: #4d2536; --err-text: #e59aa9;
  --ok-bg: #0f1a14; --ok-border: #1f4530; --ok-text: #9ad6ae;
  --retro-bg: rgba(199,107,132,0.15); --retro-text: #d98aa3;
  --surface: #10121c; --surface-2: #12141f; --surface-3: #131522; --surface-4: #14161f;
  --surface-5: #15172480; --surface-6: #181327; --surface-7: #12101c; --surface-8: #171326;
  --surface-9: #171225; --surface-10: #1a1c26; --row-border: #191c28;
  --border: #1c1f2e; --border-2: #1b1e2b; --border-strong: #2b2f42; --border-4: #242738;
  --border-5: #1e2130; --border-7: #161927;
  --accent-border: #4b3a78; --accent-border-2: #3d3263; --hover-border: #3d4260;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3fa; --glow-1: rgba(124,93,205,0.10); --glow-2: rgba(216,162,74,0.07);
  --scrollbar: #d5cfe6; --scrollbar-hover: #bfb5d9; --border-6: #ddd6ec;
  --text: #262233; --text-2: #34304a; --text-3: #45405e;
  --text-muted: #615d78; --text-muted-2: #4f4a68;
  --text-faint: #8e89a5; --text-faint-2: #9691ab; --text-faint-3: #7d7894;
  --heading: #1d1930; --heading-2: #221d38; --heading-3: #241e3d; --heading-4: #2a2444; --brand: #241e3d;
  --accent: #7c5cd0; --accent-hover: #6d4cc2; --accent-light: #6d4cc2;
  --accent-soft: #7a63c9; --accent-soft-2: #7a63c9; --accent-soft-3: #7c5cd0; --on-accent: #ffffff;
  --accent-glow-1: rgba(124,92,208,0.22); --accent-glow-2: rgba(124,92,208,0.10);
  --accent-glow-3: rgba(124,92,208,0.12); --accent-glow-4: rgba(124,92,208,0.08);
  --accent-glow-5: rgba(124,92,208,0.25);
  --mono-muted: #6e6791; --deg: #45405e; --house: #615d78; --badge-dot-off: #c9c2de;
  --err-bg: #fdf1f3; --err-border: #efc4cd; --err-text: #b04a5e;
  --ok-bg: #eef7f1; --ok-border: #c2e4cc; --ok-text: #2e7d4f;
  --retro-bg: rgba(176,74,94,0.10); --retro-text: #a8506a;
  --surface: #ffffff; --surface-2: #f1edf9; --surface-3: #f4f1fb; --surface-4: #f8f6fd;
  --surface-5: #ffffff; --surface-6: #f3edfd; --surface-7: #faf8ff; --surface-8: #f4efff;
  --surface-9: #f6f0ff; --surface-10: #e9e5f2; --row-border: #ece8f4;
  --border: #e6e1f0; --border-2: #e2dcec; --border-strong: #d4cde6; --border-4: #dcd6ea;
  --border-5: #e0d9ee; --border-7: #e8e3f2;
  --accent-border: #c9b8f0; --accent-border-2: #d3c5f2; --hover-border: #b9aee0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
::selection { background: var(--accent-glow-1); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-6); border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }

@keyframes sn-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sn-spin { to { transform: rotate(360deg); } }
@keyframes dot-pulse { 0%,100% { opacity: 0.25; } 50% { opacity: 1; } }

.page {
  min-height: 100vh;
  background:
    radial-gradient(1000px 500px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(800px 400px at 5% 0%, var(--glow-2), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 24px 120px;
}

.wrap { max-width: 1000px; margin: 0 auto; }
.wrap-narrow { max-width: 680px; margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--border-2);
  margin-bottom: 40px;
}
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; }
.brand-name { font-family: 'Spectral', serif; font-weight: 500; font-size: 21px; letter-spacing: 0.01em; color: var(--brand); }
.brand-sub { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-faint-3); }
.brand-tag { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-email { font-size: 12px; color: var(--text-muted); }

.screen { animation: sn-fade 0.4s ease both; }
.hidden { display: none !important; }

/* ---- buttons ---- */
.btn-primary {
  margin-top: 6px; background: var(--accent); color: var(--on-accent); border: none; border-radius: 8px;
  padding: 15px; font-family: inherit; font-weight: 600; font-size: 15px; letter-spacing: 0.02em;
  cursor: pointer; transition: background .15s; width: 100%;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled {
  background: var(--surface-10); color: var(--text-faint); border: 1px solid var(--border-4); cursor: not-allowed;
}
.btn-ghost {
  background: var(--surface-5); color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 11px 16px; font-family: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  text-decoration: none; display: inline-block;
}
.btn-ghost:hover { border-color: var(--hover-border); color: var(--text); }

/* ---- forms ---- */
.form-card { max-width: 540px; margin: 36px auto 0; }
.form-card h1 {
  font-family: 'Spectral', serif; font-weight: 400; font-size: 34px; line-height: 1.15;
  margin: 0 0 10px; color: var(--heading); text-wrap: balance;
}
.lede { margin: 0 0 34px; color: var(--text-muted); font-size: 15px; line-height: 1.55; max-width: 46ch; }

.field-stack { display: flex; flex-direction: column; gap: 24px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }

.input, .textarea {
  background: var(--surface-4); border: 1px solid var(--border-strong); border-radius: 8px; padding: 13px 15px;
  color: var(--text); font-size: 15px; outline: none; width: 100%; font-family: inherit;
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus { border-color: var(--accent); }

.hint { margin: 2px 0 0; font-size: 12.5px; color: var(--text-faint); line-height: 1.5; }

.form-error {
  margin-top: 4px; padding: 12px 15px; border-radius: 8px; background: var(--err-bg);
  border: 1px solid var(--err-border); color: var(--err-text); font-size: 13.5px; line-height: 1.5;
}
.form-ok {
  margin-top: 4px; padding: 12px 15px; border-radius: 8px; background: var(--ok-bg);
  border: 1px solid var(--ok-border); color: var(--ok-text); font-size: 13.5px; line-height: 1.5;
}

/* ---- loading ---- */
.spinner {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border-4); border-top-color: var(--accent);
  animation: sn-spin 0.8s linear infinite;
}
.loading-box {
  max-width: 540px; margin: 90px auto 0; display: flex; flex-direction: column; align-items: center;
  gap: 20px; color: var(--text-muted); font-size: 14px;
}
.dot-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: dot-pulse 1s ease-in-out infinite; display: inline-block;
}

/* ---- landing ---- */
.hero { max-width: 660px; margin: 56px auto 72px; text-align: center; }
.hero .brand-tag { display: block; margin-bottom: 18px; }
.hero h1 {
  font-family: 'Spectral', serif; font-weight: 400; font-size: 40px; line-height: 1.2;
  margin: 0 0 20px; color: var(--heading); text-wrap: balance;
}
.hero h1 .accent { color: var(--accent-light); font-style: italic; }
.hero-lede { margin: 0 auto 30px; max-width: 52ch; text-align: center; }
.hero-cta { display: inline-block; width: auto; padding: 15px 30px; text-decoration: none; }
.hero .hint { text-align: center; }
.moon { font-size: 34px; display: block; margin-bottom: 10px; }

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 56px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 22px 20px;
}
.feature-icon {
  font-size: 20px; color: var(--accent-soft-3); margin-bottom: 12px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-glow-3); border-radius: 8px;
}
.feature-card h3 { font-family: 'Spectral', serif; font-weight: 500; font-size: 17px; margin: 0 0 8px; color: var(--heading-2); }
.feature-card p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 56px; }
.step { padding: 4px 2px; }
.step-num {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--on-accent); font-weight: 600;
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.step h3 { font-family: 'Spectral', serif; font-weight: 500; font-size: 16px; margin: 0 0 8px; color: var(--heading-2); }
.step p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); }

.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.section-num { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--accent); letter-spacing: 0.05em; }
.section-head h2 { font-family: 'Spectral', serif; font-weight: 500; font-size: 22px; margin: 0; color: var(--heading-2); }
.rule { flex: 1; height: 1px; background: var(--border-2); }
.section { margin-bottom: 60px; }

/* ---- pricing ---- */
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.price-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px 24px;
  display: flex; flex-direction: column; gap: 0;
}
.price-card.featured {
  border-color: var(--accent-border);
  background: linear-gradient(160deg, var(--surface-8) 0%, var(--surface) 65%);
  box-shadow: 0 0 0 1px var(--accent-glow-2), 0 24px 60px -30px var(--accent-glow-5);
}
.price-name { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.price-value { font-family: 'Spectral', serif; font-size: 38px; color: var(--heading); line-height: 1; }
.price-value small { font-size: 14px; color: var(--text-muted); font-family: 'IBM Plex Sans', sans-serif; }
.price-list { list-style: none; padding: 0; margin: 20px 0 24px; display: flex; flex-direction: column; gap: 10px; }
.price-list li { font-size: 13.5px; color: var(--text-muted-2); line-height: 1.45; padding-left: 22px; position: relative; }
.price-list li::before { content: "✦"; position: absolute; left: 0; color: var(--accent); font-size: 12px; }
.price-list li.off { color: var(--text-faint-2); }
.price-list li.off::before { content: "·"; color: var(--text-faint-2); }
.price-card .btn-primary, .price-card .btn-ghost { margin-top: auto; text-align: center; text-decoration: none; }
.price-badge {
  display: inline-block; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-light); border: 1px solid var(--accent-border); border-radius: 999px; padding: 4px 10px; margin-bottom: 14px;
  align-self: flex-start;
}

/* ---- FAQ ---- */
.faq details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 10px;
}
.faq summary {
  cursor: pointer; font-family: 'Spectral', serif; font-size: 16px; color: var(--heading-2); font-weight: 500;
}
.faq details p { margin: 12px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--text-muted); }

.cta-band { text-align: center; padding: 48px 20px; margin: 12px 0 40px; border-top: 1px solid var(--border-2); }
.cta-band h2 { font-family: 'Spectral', serif; font-weight: 500; font-size: 24px; margin: 0 0 20px; color: var(--heading-2); }
.cta-band-btn { display: inline-block; width: auto; padding: 15px 30px; text-decoration: none; }

.footer {
  border-top: 1px solid var(--border-2); padding-top: 24px; margin-top: 20px;
  font-size: 12px; color: var(--text-faint-2); line-height: 1.6; text-align: center;
}

/* ---- app: affirmation ---- */
.affirm-card {
  border: 1px solid var(--accent-border-2); border-radius: 14px;
  background: linear-gradient(160deg, var(--surface-6) 0%, var(--surface-7) 62%);
  padding: 26px 28px; margin-bottom: 40px;
  box-shadow: 0 0 0 1px var(--accent-glow-4), 0 24px 60px -30px var(--accent-glow-1);
}
.affirm-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.affirm-kicker span:last-child { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-soft); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.affirm-text { font-family: 'Spectral', serif; font-size: 21px; line-height: 1.55; color: var(--heading-3); font-style: italic; }

/* ---- app: dream result ---- */
.result-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 26px 28px; margin-bottom: 24px;
}
.result-card h2 { font-family: 'Spectral', serif; font-weight: 500; font-size: 20px; margin: 0 0 16px; color: var(--heading-2); }
.interp-prose {
  font-family: 'Spectral', serif; font-size: 16.5px; line-height: 1.75; color: var(--text-2);
  max-width: 68ch; white-space: pre-line;
}
.sym-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.sym-chip {
  border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 9px; padding: 9px 13px;
  font-size: 13px; color: var(--text-muted-2);
}
.sym-chip b { color: var(--accent-light); font-weight: 600; }
.advice {
  border-left: 2px solid var(--accent-border); padding: 10px 0 10px 16px; margin-top: 16px;
  color: var(--mono-muted); font-size: 14px; line-height: 1.65; font-style: italic;
}

/* ---- app: history ---- */
.history-item { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 12px; }
.history-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none;
  padding: 15px 18px; cursor: pointer; color: var(--text-3); font-family: inherit; font-size: 14px; text-align: left;
}
.history-toggle .caret { font-family: 'IBM Plex Mono', monospace; font-size: 14px; color: var(--accent); }
.history-date { color: var(--text-faint-2); font-size: 12px; margin-left: auto; white-space: nowrap; font-family: 'IBM Plex Mono', monospace; }
.history-body { padding: 0 18px 18px; border-top: 1px solid var(--border-7); }
.history-dream { color: var(--text-muted); font-size: 13.5px; line-height: 1.6; font-style: italic; margin: 14px 0; }

/* ---- misc ---- */
.notice {
  background: var(--surface-9); border: 1px solid var(--accent-border-2); border-radius: 8px; padding: 12px 16px;
  margin-bottom: 16px; font-size: 13px; color: var(--accent-soft-2); line-height: 1.5;
}
.credits-pill {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--accent-soft);
  border: 1px solid var(--accent-border-2); border-radius: 999px; padding: 5px 12px;
}
.premium-pill {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--on-accent);
  background: var(--accent); border-radius: 999px; padding: 5px 12px; font-weight: 600;
}
.interp-loading {
  display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 14px; padding: 6px 0;
}
.interp-error {
  padding: 12px 15px; border-radius: 8px; background: var(--err-bg); border: 1px solid var(--err-border);
  color: var(--err-text); font-size: 13.5px; line-height: 1.5;
}

@media (max-width: 720px) {
  .feature-grid, .steps, .price-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
}

/* ---- astro section ---- */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.check-row {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-faint);
  cursor: pointer; margin-top: 2px;
}
.check-row input { accent-color: var(--accent); }

.dasha-line { font-family: 'Spectral', serif; font-size: 22px; color: var(--heading-3); line-height: 1.3; }
.dasha-sub { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--accent-soft); margin-top: 8px; }

.badges { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.badge {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 9px;
  border: 1px solid var(--border-4); background: var(--surface-2);
}
.badge.active { border-color: var(--accent-border); background: var(--accent-glow-2); }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--badge-dot-off); flex: none; }
.badge.active .badge-dot { background: var(--accent-soft-3); }
.badge-text { display: flex; flex-direction: column; line-height: 1.3; }
.badge-title { font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.badge.active .badge-title { color: var(--accent-light); }
.badge-detail { font-size: 12px; color: var(--text-faint-3); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border-5); border-radius: 10px; }
.astro-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.astro-table thead tr { background: var(--surface-3); }
.astro-table th {
  font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint-3); font-weight: 600;
  border-bottom: 1px solid var(--border-6); padding: 11px 16px;
}
.astro-table th.al, .astro-table td.al { text-align: left; }
.astro-table th.ar, .astro-table td.ar { text-align: right; }
.astro-table th.ac, .astro-table td.ac { text-align: center; }
.astro-table td { padding: 11px 16px; border-bottom: 1px solid var(--row-border); white-space: nowrap; }
.astro-table tbody tr:hover { background: var(--surface-4); }
.astro-table .deg { font-family: 'IBM Plex Mono', monospace; color: var(--deg); font-variant-numeric: tabular-nums; }
.astro-table .house { font-family: 'IBM Plex Mono', monospace; color: var(--house); }
.astro-table .planet { color: var(--heading-4); font-weight: 500; }
.astro-table .muted { color: var(--text-faint-3); font-size: 12.5px; }
.retro-badge {
  display: inline-block; min-width: 22px; padding: 2px 7px; border-radius: 5px;
  background: var(--retro-bg); color: var(--retro-text); font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; font-weight: 600; margin-left: 8px;
}

@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ---- theme toggle ---- */
.theme-toggle {
  background: var(--surface-5); border: 1px solid var(--border-strong); border-radius: 8px;
  width: 38px; height: 38px; cursor: pointer; font-size: 15px; color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  transition: border-color .15s, color .15s; flex: none;
}
.theme-toggle:hover { border-color: var(--hover-border); color: var(--text); }
