/* ==============================================================
   Aurelia Matrix — Design System (styles.css)
   Dark-first, mystical, premium. Mobile-first · breakpoints 640/900/1180.
   Theme switching is driven ONLY by [data-theme] on <html> (no auto).
   Fonts: Cormorant Garamond (display) · Manrope (body) — loaded in HTML.
   ============================================================== */

/* ==============================================================
   1. DESIGN TOKENS
   ============================================================== */
:root {
  /* type */
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* geometry */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --maxw: 1180px;
  --pad-card: clamp(18px, 3vw, 26px);
  --gap-grid: clamp(14px, 2.4vw, 22px);

  /* motion */
  --dur: 0.25s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* fixed palette (theme-independent) */
  --c-chakra-1: #b9a7ff; /* crown  */
  --c-chakra-2: #8fa7ff; /* brow   */
  --c-chakra-3: #8fd4ff; /* throat */
  --c-chakra-4: #8fe0b0; /* heart  */
  --c-chakra-5: #ffe08f; /* solar  */
  --c-chakra-6: #ffab8f; /* sacral */
  --c-chakra-7: #ff8fa7; /* root   */
}

/* ---------- Dark theme (default; html carries data-theme="dark") ---------- */
:root,
html[data-theme="dark"] {
  color-scheme: dark;

  --bg0: #05070f;   /* midnight page background */
  --bg1: #0b0f1d;   /* raised surface           */
  --bg2: #111628;   /* highest surface          */
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(13, 17, 34, 0.55);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);

  --text: #e8e6f0;
  --muted: #9a97ad;
  --faint: #6f6d8e;

  --violet: #8b7cf7;
  --violet-2: #b3a7ff;
  --violet-dim: rgba(139, 124, 247, 0.16);
  --gold: #e3c27f;
  --gold-2: #f2dca8;
  --gold-dim: rgba(227, 194, 127, 0.14);
  --gold-ink: #1c1409; /* text placed on gold fills */

  --ok: #8fe0b0;
  --err: #ff9b9b;
  --info: #8fd4ff;

  --header-bg: rgba(6, 8, 18, 0.78);
  --backdrop: rgba(4, 5, 12, 0.66);

  --shadow-1: 0 4px 18px rgba(0, 0, 0, 0.25);
  --shadow-2: 0 14px 44px rgba(0, 0, 0, 0.4);
  --hover-shadow: 0 14px 34px rgba(0, 0, 0, 0.38), 0 0 26px rgba(139, 124, 247, 0.16);
  --glow-violet: 0 0 46px rgba(139, 124, 247, 0.22);
  --glow-gold: 0 0 38px rgba(227, 194, 127, 0.18);
}

/* ---------- Light theme — warm paper, readable, darkened accents ---------- */
html[data-theme="light"] {
  color-scheme: light;

  --bg0: #f4f1e9;
  --bg1: #fcfbf7;
  --bg2: #ffffff;
  --surface: rgba(30, 24, 66, 0.05);
  --surface-2: rgba(30, 24, 66, 0.09);
  --glass-bg: rgba(255, 255, 255, 0.62);
  --line: rgba(30, 24, 66, 0.14);
  --line-strong: rgba(30, 24, 66, 0.28);

  --text: #1d1935;
  --muted: #5a5578;
  --faint: #8b87a6;

  --violet: #5b48d6;
  --violet-2: #3d2fbe;
  --violet-dim: rgba(91, 72, 214, 0.1);
  --gold: #b8934e;
  --gold-2: #96712c;
  --gold-dim: rgba(184, 147, 78, 0.16);
  --gold-ink: #fff9ea;

  --ok: #1e7d4b;
  --err: #b23c33;
  --info: #1c6a9e;

  --header-bg: rgba(252, 250, 245, 0.85);
  --backdrop: rgba(30, 24, 66, 0.35);

  --shadow-1: 0 4px 16px rgba(30, 24, 70, 0.1);
  --shadow-2: 0 14px 40px rgba(30, 24, 70, 0.16);
  --hover-shadow: 0 14px 30px rgba(30, 24, 70, 0.14), 0 0 22px rgba(91, 72, 214, 0.1);
  --glow-violet: 0 0 40px rgba(91, 72, 214, 0.14);
  --glow-gold: 0 0 30px rgba(184, 147, 78, 0.14);
}

/* ==============================================================
   2. RESET / BASE
   ============================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 85% -8%, var(--violet-dim), transparent 62%),
    radial-gradient(900px 480px at -12% 22%, var(--gold-dim), transparent 58%),
    var(--bg0);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

#main { flex: 1 0 auto; }

img, svg, video { max-width: 100%; }
svg { display: inline-block; vertical-align: middle; }

h1, h2, h3, h4, .h1, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--text);
}
h1, .h1 { font-size: clamp(2.1rem, 5.4vw, 3.3rem); margin: 0 0 0.45em; }
h2, .h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); margin: 0 0 0.5em; }
h3, .h3 { font-size: clamp(1.25rem, 2.4vw, 1.55rem); margin: 0 0 0.4em; }
h4 { margin: 0 0 0.5em; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--gold); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--gold-2); }

ul, ol { padding-left: 1.25em; }
b, strong { font-weight: 700; }
code {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--violet-2);
}
pre { overflow-x: auto; }

hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

[hidden] { display: none !important; }

::selection { background: var(--violet); color: #ffffff; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Scrollbars: thin violet-gold ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--violet) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--violet), var(--gold));
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--gold); background-clip: padding-box; }

/* ==============================================================
   3. UTILITIES
   ============================================================== */
.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 28px);
}
.view {
  padding-block: clamp(20px, 4vw, 44px) clamp(28px, 5vw, 64px);
  animation: view-in 0.4s var(--ease);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.scroll-y { max-height: 24rem; overflow-y: auto; }

.skip {
  position: fixed;
  top: 12px; left: 16px;
  z-index: 500;
  transform: translateY(-220%);
  background: var(--gold);
  color: var(--gold-ink);
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--glow-gold);
  transition: transform var(--dur) var(--ease);
}
.skip:focus { transform: translateY(0); color: var(--gold-ink); }

.divider {
  border: 0;
  height: 1px;
  margin: 22px 0;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

/* ==============================================================
   4. TYPOGRAPHY HELPERS
   ============================================================== */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--gold);
  display: inline-block;
}

.lead {
  font-size: clamp(1.02rem, 1.7vw, 1.16rem);
  line-height: 1.7;
  color: var(--muted);
  max-width: 62ch;
}
.muted { color: var(--muted); }
.small { font-size: 0.84rem; }

.grad-text {
  background: linear-gradient(92deg, var(--gold) 0%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.gold-text { color: var(--gold); }

/* ==============================================================
   5. LAYOUT PRIMITIVES
   ============================================================== */
.section { margin-block: clamp(26px, 5vw, 52px); }

.grid { display: grid; gap: var(--gap-grid); }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--gap-grid); grid-template-columns: 1fr; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spaced { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.center { text-align: center; margin-inline: auto; }

/* ==============================================================
   6. HEADER / NAVIGATION
   ============================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); /* hairline */
}

.header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-block: 10px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 8px rgba(227, 194, 127, 0.35));
}
.brand-name {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.6vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-name em { font-style: italic; color: var(--gold); }

.primary-nav { display: none; align-items: center; gap: 4px; margin-left: 8px; }
.primary-nav > a,
.nav-more summary {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.primary-nav > a:hover,
.nav-more summary:hover { color: var(--text); background: var(--surface); }
.primary-nav > a[aria-current="page"] { color: var(--gold); }

.nav-more { position: relative; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--dur) var(--ease);
}
.nav-more[open] summary { color: var(--text); background: var(--surface); }
.nav-more[open] summary::after { transform: rotate(225deg) translateY(-2px); }

.more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  z-index: 40;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 8px;
  display: grid;
}
.more-menu a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.more-menu a:hover { color: var(--text); background: var(--surface-2); }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--gold); border-color: var(--line-strong); background: var(--surface-2); }

/* Beginner/Advanced sliding pill toggle */
.mode-toggle {
  display: none;
  position: relative;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--faint);
  padding: 5px 14px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.mode-toggle:hover { border-color: var(--line-strong); }
.mode-opt { transition: color var(--dur) var(--ease); }
.mode-knob {
  position: static;
  flex: 0 0 auto;
  width: 8px; height: 8px;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(227, 194, 127, 0.6);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.mode-toggle[aria-pressed="true"] { color: var(--muted); }
.mode-toggle[aria-pressed="true"] .mode-knob {
  background: var(--violet);
  box-shadow: 0 0 10px rgba(139, 124, 247, 0.65);
}
.mode-toggle[aria-pressed="false"] .mode-opt:first-child,
.mode-toggle[aria-pressed="true"] .mode-opt:last-child { color: var(--text); }

.nav-burger { display: inline-grid; }
.space-btn { display: none; }

.mobile-nav {
  border-top: 1px solid var(--line);
  background: var(--bg1);
  max-height: calc(100svh - 62px);
  overflow-y: auto;
}
.mobile-nav-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 18px;
  padding-block: 14px;
}
.mobile-nav a {
  padding: 10px 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px dashed var(--line);
  transition: color var(--dur) var(--ease);
}
.mobile-nav a:hover { color: var(--gold); }

/* ==============================================================
   7. BUTTONS
   ============================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease),
    background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled], .btn.disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary, .btn-violet {
  background: linear-gradient(135deg, var(--violet), var(--violet-2));
  color: #ffffff;
  box-shadow: var(--glow-violet);
}
.btn-primary:hover, .btn-violet:hover { color: #ffffff; box-shadow: 0 0 54px rgba(139, 124, 247, 0.35); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: var(--gold-ink);
  box-shadow: var(--glow-gold);
}
.btn-gold:hover { color: var(--gold-ink); box-shadow: 0 0 54px rgba(227, 194, 127, 0.32); }

.btn-ghost, .btn-outline {
  border-color: var(--line-strong);
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover, .btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-danger {
  border-color: rgba(255, 120, 120, 0.4);
  color: var(--err);
  background: rgba(255, 120, 120, 0.07);
}
.btn-danger:hover { color: #ffffff; background: var(--err); border-color: var(--err); }

.btn-sm { padding: 7px 14px; font-size: 0.84rem; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }

/* ==============================================================
   8. CARDS & SURFACES
   ============================================================== */
.card {
  background: linear-gradient(160deg, var(--surface), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--pad-card);
}
html[data-theme="light"] .card { background: linear-gradient(160deg, var(--bg2), var(--bg1)); }

.card-pad { padding: var(--pad-card); }

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 10px;
  color: var(--text);
}

.card-hover { transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card-hover:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 124, 247, 0.45);
  box-shadow: var(--hover-shadow);
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.card-gold {
  border-color: rgba(227, 194, 127, 0.35);
  background: linear-gradient(160deg, var(--gold-dim), transparent 70%);
}
.card-violet {
  border-color: rgba(139, 124, 247, 0.35);
  background: linear-gradient(160deg, var(--violet-dim), transparent 70%);
}

/* ---------- Badges / chips / tags ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border: 1px solid rgba(227, 194, 127, 0.4);
  border-radius: 99px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.badge-gold {
  border-color: rgba(227, 194, 127, 0.45);
  background: var(--gold-dim);
  color: var(--gold);
}
.badge-violet {
  border-color: rgba(139, 124, 247, 0.45);
  background: var(--violet-dim);
  color: var(--violet-2);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip-active, .chip.active, .chip[aria-pressed="true"] {
  color: var(--gold-ink);
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  border-color: transparent;
  box-shadow: var(--glow-gold);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ==============================================================
   9. FORMS
   ============================================================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 0.82rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }

.label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.input, .select, textarea.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg1);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.input::placeholder { color: var(--faint); }

textarea.input, .note-area {
  min-height: 72px;
  resize: vertical;
  line-height: 1.55;
}

select.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
select.select option { background: var(--bg1); color: var(--text); }

.hint { font-size: 0.78rem; color: var(--faint); }
.error-text, .field-error { font-size: 0.8rem; color: var(--err); font-weight: 600; }
.field-hint { color: var(--faint); font-size: 0.78rem; }
.input[aria-invalid="true"], .input.is-invalid { border-color: var(--err); box-shadow: 0 0 0 3px rgba(255, 120, 120, 0.14); }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 4px 14px; }
.form-grid .field { margin-bottom: 10px; }

/* segmented buttons */
.seg {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
}
.seg > button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 99px;
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.seg > button:hover { color: var(--text); }
.seg > button[aria-pressed="true"],
.seg > button.chip-active,
.seg > button.active {
  color: var(--gold-ink);
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  box-shadow: var(--glow-gold);
}

/* checkbox / consent */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--muted);
}
.checkbox-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  margin: 2px 0 0;
  accent-color: var(--gold);
  cursor: pointer;
}
.checkbox-row label { cursor: pointer; }

.consent-box {
  display: block;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.consent-box .checkbox-row { color: var(--text); }

/* range inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--violet-dim), var(--gold-dim)), var(--surface-2);
  border: 1px solid var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold));
  box-shadow: 0 0 10px rgba(227, 194, 127, 0.55);
  border: none;
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold));
  border: none;
  box-shadow: 0 0 10px rgba(227, 194, 127, 0.55);
}
input[type="range"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

/* search */
.search-input { position: relative; }
.search-input > .input, .search-input > input { padding-left: 42px; }
.search-input::before {
  content: "";
  position: absolute;
  left: 16px; top: 50%;
  width: 11px; height: 11px;
  border: 2px solid var(--faint);
  border-radius: 50%;
  transform: translateY(-60%);
  pointer-events: none;
}
.search-input::after {
  content: "";
  position: absolute;
  left: 25px; top: 52%;
  width: 7px; height: 2px;
  border-radius: 2px;
  background: var(--faint);
  transform: rotate(45deg);
  pointer-events: none;
}
input.search-input {
  border-radius: 99px;
  padding-left: 40px;
}

/* ==============================================================
   10. HERO
   ============================================================== */
.hero {
  position: relative;
  text-align: center;
  padding-block: clamp(28px, 6vw, 72px) clamp(16px, 3vw, 28px);
}
/* subtle radial magic glows */
.hero::before {
  content: "";
  position: absolute;
  top: -220px; left: 50%;
  width: 680px; height: 680px;
  max-width: 140vw;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--violet-dim), transparent 64%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -160px; right: -80px;
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--gold-dim), transparent 62%);
  opacity: 0.8;
  pointer-events: none;
}
.hero > * { position: relative; }

.hero-sub {
  max-width: 660px;
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.13rem);
}
.hero-actions, .hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 6px 0 26px;
}
.hero-badge-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 26px;
}
.hero h1 .gold-text { font-style: italic; }
.hero-stars {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-bottom: 22px;
  color: var(--gold);
  opacity: 0.9;
}
.hero-stars svg { width: 22px; height: 22px; }

.quick-calc { max-width: 560px; margin: 26px auto 0; text-align: left; }

/* ==============================================================
   11. STATS
   ============================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 12px;
  text-align: center;
}
.stat b, .stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--gold);
  margin-bottom: 4px;
}
.stat span, .stat small {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==============================================================
   12. CHART & REPORT
   ============================================================== */
.chart-wrap { position: relative; border-radius: var(--radius-lg); }
.chart-panel {
  background: linear-gradient(160deg, var(--surface), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--pad-card);
}
.chart-svg { display: block; width: 100%; height: auto; user-select: none; }
.chart-svg text { font-family: var(--font-body); }

.chart-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.chart-toolbar .spacer { flex: 1; }
.chart-scroll { overflow: auto; border-radius: var(--radius-lg); }
.chart-zoomer { transition: transform var(--dur) var(--ease); transform-origin: center center; }

.mchart { display: block; width: 100%; height: auto; user-select: none; }
.mchart text { font-family: var(--font-body); }
.mchart .node-hit { cursor: pointer; }
.mchart .node-circle { transition: r 0.15s ease, filter 0.15s ease; }
.mchart .node-hit:hover .node-circle { filter: drop-shadow(0 0 10px rgba(227, 194, 127, 0.8)); }
.mchart .node-hit.selected .node-ring { display: block; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}
.legend > * { display: inline-flex; align-items: center; gap: 7px; }
.legend > *::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
}
.legend .lg-core::before { background: var(--gold); }
.legend .lg-anc::before { background: var(--violet); }
.legend .lg-tail::before { background: #ff8fa7; }
.legend .lg-chan::before { background: var(--ok); }

/* report document */
.report { display: grid; gap: 18px; max-width: 860px; }
.report-section {
  background: linear-gradient(160deg, var(--surface), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-left: 3px solid rgba(227, 194, 127, 0.55);
  border-radius: var(--radius-lg);
  padding: var(--pad-card);
}
.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.report-head :is(h2, h3, h4) { margin: 0; }

.pos-block {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
}
.pos-block + .pos-block { border-top: 1px dashed var(--line); }

.pos-num {
  width: 58px; height: 58px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold));
  color: var(--gold-ink);
  box-shadow: var(--glow-gold);
}
.pos-num.pos-violet {
  background: radial-gradient(circle at 30% 30%, var(--violet-2), var(--violet));
  color: #ffffff;
  box-shadow: var(--glow-violet);
}

.pos-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 3px;
}
.pos-text {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.arcana-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--violet-dim);
  border: 1px solid rgba(139, 124, 247, 0.35);
  color: var(--violet-2);
  white-space: nowrap;
}
.arcana-chip b {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--gold);
}

/* legacy position panel pieces (kept for existing views) */
.pos-panel { position: static; }
.pos-panel-empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}
.pos-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pos-kicker {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}
.pos-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin: 0; }
.pos-meta { font-size: 0.8rem; color: var(--faint); margin-top: 2px; }
.pos-sections h4 {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 16px 0 6px;
  font-family: var(--font-body);
}
.pos-sections p { font-size: 0.92rem; color: var(--text); margin-bottom: 8px; }
.pos-sections ul { margin: 4px 0 10px; color: var(--muted); font-size: 0.88rem; }

.arc-ref {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  margin: 2px 4px 2px 0;
  border-radius: 99px;
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.78rem;
  border: 1px solid rgba(227, 194, 127, 0.3);
}
.arc-ref-lg { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }

/* arcana library (legacy view vocabulary) */
.arc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.arc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 18px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(170deg, var(--surface), transparent 80%);
  color: var(--text);
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.arc-card:hover {
  transform: translateY(-4px);
  border-color: rgba(227, 194, 127, 0.5);
  box-shadow: var(--glow-gold);
  color: var(--text);
}
.arc-card .arc-n { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--gold); line-height: 1; }
.arc-card .arc-name { font-weight: 700; font-size: 0.92rem; }
.arc-card .arc-kw { font-size: 0.72rem; color: var(--faint); line-height: 1.45; }
.arc-card .arc-sigil { width: 64px; height: 64px; }
.arc-detail-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.arc-detail-head .arc-sigil { width: 92px; height: 92px; flex: 0 0 auto; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-block: 16px; }
.kv { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.kv b {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin-bottom: 3px;
  font-weight: 700;
}
.kv span { font-size: 0.92rem; }

/* ==============================================================
   13. COMPATIBILITY SCORE
   ============================================================== */
.compat-score {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.score-ring {
  position: relative;
  width: clamp(96px, 16vw, 128px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--gold) calc(var(--score, 0) * 1%), var(--surface-2) 0);
  box-shadow: var(--glow-gold);
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--bg1);
}
.score-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 8; }
.score-ring .ring-track, .score-ring circle.track { stroke: var(--surface-2); }
.score-ring .ring-fill, .score-ring circle.fill { stroke: var(--gold); stroke-linecap: round; }
.score-num {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.compat-metric {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.compat-metric b {
  color: var(--gold);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.compat-metric p { margin: 6px 0 0; font-size: 0.86rem; color: var(--muted); }

.vs-row { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: stretch; margin-block: 18px; }
.vs-badge { align-self: center; text-align: center; font-family: var(--font-display); font-size: 1.6rem; color: var(--gold); }

.texture-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.texture-Fire { background: rgba(255, 140, 100, 0.16); color: #ffab8f; }
.texture-Water { background: rgba(120, 190, 255, 0.14); color: #8fd4ff; }
.texture-Air { background: rgba(190, 170, 255, 0.16); color: #b3a7ff; }
.texture-Earth { background: rgba(140, 220, 160, 0.14); color: #8fe0b0; }
html[data-theme="light"] .texture-Fire { color: #b34a1f; }
html[data-theme="light"] .texture-Water { color: #1c6a9e; }
html[data-theme="light"] .texture-Air { color: #5b48d6; }
html[data-theme="light"] .texture-Earth { color: #1e7d4b; }

/* ==============================================================
   14. TIMELINE
   ============================================================== */
.timeline {
  position: relative;
  margin: 8px 0;
  padding-left: 30px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), var(--violet));
  opacity: 0.35;
}
.timeline-item { position: relative; padding: 2px 0 22px; }
.timeline-item:last-child { padding-bottom: 4px; }

.tl-dot {
  position: absolute;
  left: -27px;
  top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-dim), 0 0 12px rgba(139, 124, 247, 0.5);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tl-year {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.tl-body {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-top: 4px;
  max-width: 62ch;
}

.tl-current {
  margin-inline: -12px;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--violet-dim), transparent 80%);
  border: 1px solid rgba(139, 124, 247, 0.35);
  box-shadow: var(--glow-violet);
}
.tl-current .tl-dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim), 0 0 14px rgba(227, 194, 127, 0.6);
}
.tl-current .tl-year { color: var(--gold); }
.tl-current .tl-body { color: var(--text); }

/* legacy horizontal timeline rail */
.tl-rail { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 14px; }
.tl-node {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 9px 6px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.15s var(--ease);
}
.tl-node:hover { color: var(--text); border-color: var(--line-strong); }
.tl-node.active {
  color: var(--gold-ink);
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  border-color: transparent;
}
.tl-node.past { opacity: 0.68; }
.tl-node.current { border-color: var(--violet); color: var(--violet-2); box-shadow: 0 0 0 3px var(--violet-dim); }
.tl-node .tl-arc { display: block; font-size: 0.72rem; opacity: 0.8; }
.tl-decades { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 20px; }

/* ==============================================================
   15. CHAKRAS
   ============================================================== */
.chakra-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.chakra-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--pad-card);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.chakra-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
  transform: translateY(-3px);
}
/* inline style="--chakra-color: <color>" drives the accent */
.chakra-card {
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--chakra-color, var(--violet)) 12%, transparent), transparent 72%),
    var(--surface);
}

.chakra-dot {
  width: 36px; height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), var(--chakra-color, var(--violet)) 62%);
  box-shadow: 0 0 16px var(--chakra-color, var(--violet));
}

.chakra-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--chakra-color, var(--gold)));
  box-shadow: 0 0 10px var(--chakra-color, rgba(227, 194, 127, 0.6));
  transition: width 0.6s var(--ease);
}

/* legacy chakra rows (kept for existing views) */
.chakra-col { display: flex; flex-direction: column-reverse; gap: 12px; max-width: 780px; margin-inline: auto; }
.chakra-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px 18px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.chakra-row:hover, .chakra-row.open { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.chakra-orb {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: #12101f;
  filter: saturate(1.1);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3), inset 0 0 18px rgba(255, 255, 255, 0.35);
}
.chakra-row h3 { margin: 0 0 2px; font-size: 1.2rem; }
.chakra-sub { color: var(--faint); font-size: 0.8rem; margin-bottom: 8px; }
.chakra-row .acc-body { padding: 0; }

/* ==============================================================
   16. ACCORDION
   ============================================================== */
.acc { display: grid; gap: 12px; }
.acc-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.acc-item[open], .acc-item.acc-open {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}

.acc-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px 18px;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.acc-btn::-webkit-details-marker { display: none; }
.acc-btn::after {
  content: "";
  margin-left: auto;
  flex: 0 0 auto;
  width: 9px; height: 9px;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg);
  transition: transform var(--dur) var(--ease);
}
.acc-item[open] .acc-btn::after,
.acc-item.acc-open .acc-btn::after { transform: rotate(225deg); }

.acc-body {
  display: none;
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 0.94rem;
}
.acc-item[open] > .acc-body,
.acc-item.acc-open > .acc-body { display: block; }
.acc-body h4 {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.86rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 14px 0 6px;
}

/* legacy details accordion (kept for existing views) */
.report-acc { display: grid; gap: 10px; }
details.acc {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
details.acc[open] { border-color: var(--line-strong); }
details.acc > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  list-style: none;
  user-select: none;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary .acc-ic {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--violet-dim);
  color: var(--violet-2);
  flex: 0 0 auto;
}
details.acc > summary .acc-ic svg { width: 17px; height: 17px; }
details.acc > summary .acc-chev { margin-left: auto; transition: transform var(--dur) var(--ease); color: var(--faint); }
details.acc[open] > summary .acc-chev { transform: rotate(180deg); }

/* ==============================================================
   17. TABLES / KBD / NOTES
   ============================================================== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  scrollbar-width: thin;
}
table.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.table th {
  color: var(--gold);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--surface);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface); }

.kbd {
  display: inline-block;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--muted);
  background: var(--surface);
}

.note {
  border: 1px solid rgba(139, 124, 247, 0.35);
  border-radius: var(--radius);
  background: var(--violet-dim);
  color: var(--text);
  padding: 13px 16px;
  font-size: 0.88rem;
  margin-block: 14px;
}
.note-gold, .disclaimer {
  border: 1px solid rgba(227, 194, 127, 0.3);
  border-radius: var(--radius);
  background: var(--gold-dim);
  color: var(--muted);
  padding: 13px 16px;
  font-size: 0.84rem;
  margin-block: 14px;
}
.note-gold b, .disclaimer b { color: var(--gold); }

/* ==============================================================
   18. STATES: empty / loading / spinner / reveal
   ============================================================== */
.empty-state, .empty {
  text-align: center;
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}
.empty-state .empty-ic, .empty .empty-ic { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--faint); }

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.spinner {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
.loading .spinner { width: 22px; height: 22px; border-width: 2px; }

.boot-splash {
  min-height: 55vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}
.boot-star {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 14px rgba(227, 194, 127, 0.55));
  animation: boot-pulse 1.8s ease-in-out infinite;
}

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.divider-star { display: flex; align-items: center; gap: 14px; color: var(--gold); margin-block: 8px; }
.divider-star::before, .divider-star::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong));
}
.divider-star::after { background: linear-gradient(90deg, var(--line-strong), transparent); }

/* ==============================================================
   19. TOASTS
   ============================================================== */
.toasts {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--bg2);
  color: var(--text);
  box-shadow: var(--shadow-2);
  font-size: 0.9rem;
  font-weight: 600;
  animation: toast-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.toast::before {
  content: "";
  flex: 0 0 auto;
  width: 8px; height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.toast.ok, .toast-ok { border-color: rgba(143, 224, 176, 0.5); }
.toast.ok::before, .toast-ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.toast.err, .toast-err { border-color: rgba(255, 155, 155, 0.5); }
.toast.err::before, .toast-err::before { background: var(--err); box-shadow: 0 0 8px var(--err); }
.toast.info, .toast-info { border-color: rgba(143, 212, 255, 0.5); }
.toast.info::before, .toast-info::before { background: var(--info); box-shadow: 0 0 8px var(--info); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: all 0.3s var(--ease); }

/* ==============================================================
   20. MODAL (native dialog)
   ============================================================== */
dialog.modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: min(560px, calc(100vw - 32px));
  width: 100%;
  color: var(--text);
}
dialog.modal::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
dialog.modal[open] { animation: modal-in 0.3s var(--ease); }
dialog.modal[open]::backdrop { animation: fade-in 0.3s var(--ease); }

.modal-card {
  position: relative;
  background: var(--bg1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: clamp(20px, 4vw, 30px);
  max-height: min(86vh, 720px);
  overflow-y: auto;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px;
  padding-right: 40px;
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.modal-close::before {
  content: "";
  width: 12px; height: 12px;
  background:
    linear-gradient(45deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%);
}
.modal-close:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* legacy modal innards (kept for existing views) */
.modal-inner { padding: 26px; }
.modal-steps { text-align: center; }
.modal-dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0 6px; }
.modal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.modal-dots i.on { background: var(--gold); }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ==============================================================
   21. FOOTER
   ============================================================== */
.site-footer {
  margin-top: auto;
  flex-shrink: 0;
  background: linear-gradient(180deg, transparent, rgba(139, 124, 247, 0.05));
  border-top: 1px solid var(--line);
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
  padding-block: 34px 18px;
}
.footer-brand .brand { margin-bottom: 4px; }
.footer-tag {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
  max-width: 340px;
  margin: 10px 0 0;
}
.footer-col { display: flex; flex-direction: column; gap: 9px; }
.footer-col h3 {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}
.footer-col a { color: var(--muted); font-size: 0.9rem; width: fit-content; }
.footer-col a:hover { color: var(--text); }
.footer-disclaimer {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-block: 16px 6px;
  color: var(--faint);
  font-size: 0.8rem;
  background: none;
  border-inline: none;
  border-bottom: none;
}
.footer-disclaimer p { margin: 0 0 6px; }
.footer-fine { opacity: 0.75; }

/* Source-package download button (footer) */
.pkg-dl {
  display: inline-block;
  margin: 4px 0 14px;
  text-decoration: none;
}
.pkg-dl[hidden] { display: none; }

/* ==============================================================
   22. NOSCRIPT / CRUMBS / PROSE / MISC LEGACY
   ============================================================== */
.noscript-note {
  max-width: 720px;
  margin: 48px auto;
  padding: 26px;
  border: 1px solid rgba(227, 194, 127, 0.4);
  border-radius: var(--radius-lg);
  background: var(--gold-dim);
}
.noscript-note h1 { font-size: 1.8rem; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--faint);
  margin-bottom: 20px;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--gold); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--text); font-weight: 600; }

.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.prose h3 { margin-top: 1.2em; }
.prose blockquote {
  border-left: 3px solid var(--gold);
  margin: 1.2em 0;
  padding: 4px 18px;
  color: var(--muted);
  font-style: italic;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-head p { margin: 0; color: var(--muted); }

.split { display: grid; grid-template-columns: 1fr; gap: clamp(16px, 3vw, 30px); align-items: start; }
.split-chart { grid-template-columns: 1fr; }

.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-calc .form-row { grid-template-columns: 1fr 1fr 1.4fr; }

.feature-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--violet-dim);
  color: var(--violet-2);
  margin-bottom: 14px;
  border: 1px solid rgba(139, 124, 247, 0.3);
}
.feature-icon.gold { background: var(--gold-dim); color: var(--gold); border-color: rgba(227, 194, 127, 0.3); }
.feature-icon svg { width: 22px; height: 22px; }

.step-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--gold);
  opacity: 0.85;
  line-height: 1;
  margin-bottom: 8px;
}

.saved-card { display: flex; flex-direction: column; gap: 10px; }
.saved-head { display: flex; align-items: center; gap: 10px; }
.saved-nums { display: flex; flex-wrap: wrap; gap: 6px; }
.saved-nums .n {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--violet-dim);
  color: var(--violet-2);
  border: 1px solid rgba(139, 124, 247, 0.3);
}
.saved-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.print-header { display: none; }

/* ==============================================================
   23. RESPONSIVE  (mobile-first: 640 / 900 / 1180)
   ============================================================== */
@media (min-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(4, 1fr); }
  .arc-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
  .tl-decades { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
  .chakra-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .mobile-nav-grid { grid-template-columns: 1fr 1fr; }
  .vs-row { grid-template-columns: 1fr auto 1fr; }
  .vs-badge { text-align: center; }

  .mode-toggle { display: inline-flex; }
  .space-btn { display: inline-flex; }

  .toasts {
    left: auto;
    right: 18px;
    width: min(360px, calc(100vw - 24px));
    align-items: flex-end;
    bottom: 18px;
  }

  .pos-panel { position: sticky; top: 84px; }
}

@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .split, .split-chart { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split-chart { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .chakra-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

  .primary-nav { display: flex; }
  .nav-burger { display: none; }
}

@media (min-width: 1180px) {
  .header-row { gap: 18px; }
  .chakra-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ==============================================================
   24. PRINT
   ============================================================== */
@media print {
  @page { margin: 14mm; }

  .site-header,
  .site-footer,
  .toasts,
  .mobile-nav,
  #mobileNav,
  .no-print,
  .skip,
  .noscript-note,
  .mode-toggle,
  .nav-burger,
  .icon-btn,
  .hero-actions,
  .hero-cta,
  .chart-toolbar,
  .backdrop {
    display: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  body { display: block; min-height: 0; background-attachment: scroll; }

  .card, .glass, .modal-card, .acc-item, details.acc,
  .report-section, .pos-num, .stat, .chakra-card {
    background: #ffffff !important;
    border-color: #dddddd !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .print-area { display: block !important; background: #ffffff; color: #000000; }
  .print-header { display: block !important; margin-bottom: 18px; }

  .grad-text {
    background: none !important;
    -webkit-text-fill-color: #000000 !important;
    color: #000000 !important;
  }
  .gold-text, .eyebrow, .pos-label, .badge { color: #000000 !important; border-color: #999999 !important; }
  .pos-num { color: #000000 !important; }

  a { color: #000000; text-decoration: underline; }

  .report-section, .pos-block, .timeline-item, .acc-item, details.acc, .chakra-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .h1, h1 { font-size: 22pt; }
  .h2, h2 { font-size: 17pt; }
  .h3, h3 { font-size: 14pt; }
  body { font-size: 11pt; }
}

/* ==============================================================
   25. REDUCED MOTION
   ============================================================== */
@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;
  }
  html { scroll-behavior: auto; }
  .boot-star, .spinner, .skeleton { animation: none; }
  .boot-star { opacity: 1; }
  .reveal { opacity: 1; transform: none; }
  .view { animation: none; }
  .card-hover:hover, .chakra-card:hover { transform: none; }
}

/* ==============================================================
   KEYFRAMES
   ============================================================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes boot-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.75; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes toast-in {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes shimmer { to { background-position: -200% 0; } }
