/* ---------------------------------------------------------------- tokens */
:root {
  --bg-0: #05060d;
  --bg-1: #0a0c1a;
  --bg-2: #101427;
  --panel: rgba(18, 22, 42, 0.62);
  --panel-solid: #12162a;
  --line: rgba(150, 165, 220, 0.16);
  --line-strong: rgba(160, 180, 240, 0.34);
  --ink: #e7ebfb;
  --ink-dim: #a3abcd;
  --ink-faint: #6d759b;
  --gold: #e8c47a;
  --gold-soft: rgba(232, 196, 122, 0.16);
  --violet: #9b8cf0;
  --cyan: #6fd8e0;
  --rose: #ff8a9c;
  --good: #6fe0b0;
  --warn: #ffb86b;
  --bad: #ff7a6b;
  --fire: #ff8a63;
  --earth: #8fd6a8;
  --air: #8fc2f0;
  --water: #9b9ff0;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --glyph: "Noto Sans Symbols 2", "Segoe UI Symbol", "Apple Symbols", "DejaVu Sans", var(--sans);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Deep-space backdrop: two nebular pools over a near-black field. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 700px at 18% 12%, rgba(96, 78, 190, 0.20), transparent 62%),
    radial-gradient(1000px 800px at 86% 88%, rgba(28, 108, 140, 0.18), transparent 66%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 60%);
  z-index: -2;
}

#starfield { position: fixed; inset: 0; z-index: -1; opacity: 0.55; }

/* ---------------------------------------------------------------- layout */
.app {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr) 360px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "head head head" "left stage right";
  gap: 16px;
  height: 100%;
  padding: 16px;
}

header.masthead {
  grid-area: head;
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.wordmark {
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: linear-gradient(96deg, var(--gold), #fff3d4 40%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  font-weight: 500;
}

.tagline { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.06em; }

.masthead .spacer { flex: 1; }

.clock {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-dim);
  display: flex;
  gap: 14px;
  align-items: center;
}
.clock b { color: var(--ink); font-weight: 500; }

.rail {
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}
.rail.left { grid-area: left; }
.rail.right { grid-area: right; }

.stage {
  grid-area: stage;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}
.stage-bar { flex: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.view-switch { flex: 0 1 420px; }

/* Holographic buttons either side of the view tabs. */
.hud-btn {
  width: auto; flex: none; display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #cffbff; padding: 7px 14px 7px 11px;
  background: linear-gradient(180deg, rgba(111, 243, 255, 0.14), rgba(111, 243, 255, 0.04));
  border: 1px solid rgba(111, 243, 255, 0.45); border-radius: 4px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow: 0 0 18px rgba(111, 243, 255, 0.18), inset 0 0 12px rgba(111, 243, 255, 0.08);
  text-shadow: 0 0 8px rgba(111, 243, 255, 0.6);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}
.hud-btn:hover, .hud-btn[aria-expanded="true"], .hud-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(111, 243, 255, 0.3), rgba(111, 243, 255, 0.1));
  border-color: #6ff3ff; color: #fff; box-shadow: 0 0 26px rgba(111, 243, 255, 0.4), inset 0 0 14px rgba(111, 243, 255, 0.18);
}
.hud-btn:focus-visible { outline: 2px solid #6ff3ff; outline-offset: 2px; }
.insights-btn .eye { width: 30px; height: 18px; overflow: visible; filter: drop-shadow(0 0 4px rgba(111, 243, 255, 0.9)); }
.eye .lid { fill: rgba(111, 243, 255, 0.08); stroke: #6ff3ff; stroke-width: 2; }
.eye .iris { fill: none; stroke: #ffc86b; stroke-width: 2; filter: drop-shadow(0 0 3px #ffc86b); }
.eye .pupil { fill: #e9fdff; transform-origin: 24px 14px; animation: gaze 6s ease-in-out infinite; }
.eye .glint { fill: #fff; }
@keyframes gaze { 0%, 70%, 100% { transform: translateX(0) scale(1); } 76% { transform: translateX(-3px) scale(0.9); } 84% { transform: translateX(3px) scale(0.9); } }
.icon-btn { padding: 7px 9px; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .fs-exit, .icon-btn[aria-pressed="true"] .fs-enter { display: none; }
.icon-btn[aria-pressed="true"] .fs-exit { display: inline; }

.hud-btn[hidden] { display: none; }

/* 3D full screen: just the scene and the time slider. */
/* Sits in the view's bottom-right corner, inside the HUD bracket. */
.sky-fs {
  position: absolute; bottom: 14px; right: 14px; z-index: 4; width: 42px; height: 42px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #cffbff; background: rgba(4, 20, 30, 0.6); border: 1px solid rgba(111, 243, 255, 0.45); border-radius: 6px;
  box-shadow: 0 0 14px rgba(111, 243, 255, 0.25); backdrop-filter: blur(6px);
}
.sky-fs:hover { background: rgba(111, 243, 255, 0.18); border-color: #6ff3ff; box-shadow: 0 0 22px rgba(111, 243, 255, 0.45); }
.sky-fs[hidden] { display: none; }
.sky-fs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(111, 243, 255, 0.8)); }

.sky-fs .fs-exit, .sky-fs[aria-pressed="true"] .fs-enter { display: none; }
.sky-fs[aria-pressed="true"] .fs-exit { display: inline; }
.stage.fs3d { background: #010208; padding: 10px; width: 100vw; height: 100vh; }
.stage.fs3d .stage-bar { display: none; }
.stage.fs3d .sky3d { border-radius: 8px; }

/* The Insights pop-up. */
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 0; background: rgba(1, 3, 10, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.2s ease-out; }
.modal-panel {
  position: relative; z-index: 1; width: min(1100px, 100%); max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(10, 18, 34, 0.96), rgba(6, 10, 22, 0.96));
  border: 1px solid rgba(111, 243, 255, 0.35); border-radius: 14px;
  box-shadow: 0 0 60px rgba(111, 243, 255, 0.15), 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: rise 0.25s ease-out; transition: opacity 0.2s;
}
.modal-panel.pending { opacity: 0.6; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid rgba(111, 243, 255, 0.18); }
.modal-head h2 { margin: 0; flex: 1; display: flex; align-items: baseline; gap: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: #cffbff; font-weight: 600; text-shadow: 0 0 8px rgba(111, 243, 255, 0.5); }
.modal-close { width: 34px; height: 34px; padding: 0; flex: none; border-radius: 50%; font-size: 14px; color: #cffbff; background: rgba(111, 243, 255, 0.08); border-color: rgba(111, 243, 255, 0.35); }
.modal-close:hover { background: rgba(111, 243, 255, 0.2); }
.modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 14px 20px 20px; columns: 2 380px; column-gap: 28px; }
.modal-body .ins-sec { break-inside: avoid; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.985); } }
@media (max-width: 600px) {
  .modal { padding: 0; }
  .modal-panel { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .hud-btn span { display: none; }
  .insights-btn { padding: 7px 9px; }
}
.view-area { position: relative; flex: 1; width: 100%; min-height: 0; display: grid; place-items: center; }

.sky3d { position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); transition: opacity 0.2s, filter 0.2s; }
.sky3d[hidden] { display: none; }
.sky3d canvas { display: block; touch-action: none; }
.sky3d.pending { opacity: 0.45; filter: saturate(0.5); }
.sky3d-tools { position: absolute; top: 12px; right: 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 62%; pointer-events: none; z-index: 3; }
.sky3d-tools > *, .sky3d-tools button { pointer-events: auto; }
.sky3d-tools span { display: flex; gap: 6px; }
.sky3d-tools button {
  width: auto; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 5px 10px;
  color: #bff8ff; background: rgba(4, 20, 30, 0.55); border: 1px solid rgba(111, 243, 255, 0.28); border-radius: 3px;
  backdrop-filter: blur(6px); clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.sky3d-tools button:hover { background: rgba(111, 243, 255, 0.14); border-color: rgba(111, 243, 255, 0.7); }
.sky3d-tools button[aria-pressed="true"] { color: #02131a; background: rgba(111, 243, 255, 0.78); border-color: #6ff3ff; box-shadow: 0 0 14px rgba(111, 243, 255, 0.45); }
.sky3d[data-mode="space"] .horizon-only, .sky3d[data-mode="horizon"] .space-only { display: none; }
.sky3d-hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px; margin: 0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(160, 240, 255, 0.5); pointer-events: none; z-index: 3; white-space: nowrap; }
.sky3d { background: #010208; border-color: rgba(111, 243, 255, 0.18); }

.sync-badge {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 20px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: #cffbff;
  background: rgba(4, 22, 32, 0.85); border: 1px solid rgba(111, 243, 255, 0.45); box-shadow: 0 0 12px rgba(111, 243, 255, 0.25);
  pointer-events: none;
}
.sync-badge[hidden] { display: none; }
.sync-badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
.sync-badge.retry { color: #ffd9a0; border-color: rgba(255, 184, 107, 0.6); box-shadow: 0 0 12px rgba(255, 184, 107, 0.25); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- 3D HUD */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 2; font-family: var(--mono); color: #bff8ff; }
.hud::after { /* scanlines */
  content: ""; position: absolute; inset: 0; opacity: 0.06;
  background: repeating-linear-gradient(0deg, rgba(160, 250, 255, 0.5) 0 1px, transparent 1px 3px);
}
.hud-corner { position: absolute; width: 26px; height: 26px; border: 0 solid rgba(111, 243, 255, 0.7); filter: drop-shadow(0 0 4px rgba(111, 243, 255, 0.8)); }
.hud-corner.tl { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; }
.hud-corner.tr { top: 8px; right: 8px; border-top-width: 2px; border-right-width: 2px; }
.hud-corner.bl { bottom: 8px; left: 8px; border-bottom-width: 2px; border-left-width: 2px; }
.hud-corner.br { bottom: 8px; right: 8px; border-bottom-width: 2px; border-right-width: 2px; }
.hud-read { position: absolute; left: 22px; text-shadow: 0 0 8px rgba(111, 243, 255, 0.55); }
.hud-title { top: 18px; font-size: 12px; letter-spacing: 0.32em; }
.hud-title b { color: #fff; font-weight: 600; }
.hud-title .hud-mode { color: #6ff3ff; margin-left: 8px; }
.hud-when { top: 40px; font-size: 11px; letter-spacing: 0.08em; color: #e8fbff; }
.hud-when span { color: rgba(191, 248, 255, 0.6); font-size: 10px; letter-spacing: 0.16em; }
.hud-stats { top: 84px; display: grid; gap: 3px; font-size: 11px; letter-spacing: 0.06em; padding-left: 10px; border-left: 2px solid rgba(111, 243, 255, 0.5); }
.hud-stats div { display: flex; gap: 10px; }
.hud-stats i { font-style: normal; width: 52px; color: rgba(111, 243, 255, 0.7); font-size: 9.5px; letter-spacing: 0.2em; }
.hud-tape { display: none; position: absolute; left: 50%; bottom: 34px; width: 420px; height: 30px; transform: translateX(-50%); overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); }
.hud-tape-strip { position: absolute; left: 210px; top: 0; height: 100%; }
.hud-tape-strip span { position: absolute; top: 0; height: 100%; font-size: 10px; letter-spacing: 0.1em; }
.hud-tape-strip span::before { content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 6px; background: rgba(111, 243, 255, 0.6); }
.hud-tape-strip span.M::before { height: 11px; background: #6ff3ff; }
.hud-tape-strip span.M { transform: translateX(-50%); padding-top: 13px; }
.hud-tape > i { position: absolute; left: 50%; top: 0; width: 2px; height: 14px; background: #ffc86b; box-shadow: 0 0 8px #ffc86b; transform: translateX(-50%); }
.hud-cross { display: none; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); opacity: 0.55;
  background: linear-gradient(#6ff3ff, #6ff3ff) center/1px 10px no-repeat, linear-gradient(90deg, #6ff3ff, #6ff3ff) center/10px 1px no-repeat;
  border: 1px solid rgba(111, 243, 255, 0.35); border-radius: 50%; }
.hud[data-mode="horizon"] .hud-tape, .hud[data-mode="horizon"] .hud-cross { display: block; }

.timeline { flex: none; width: min(100%, 760px); display: flex; align-items: center; gap: 8px; }
.timeline button { width: 38px; flex: none; }
.timeline select { width: 128px; flex: none; font-size: 12px; }
.timeline input[type="range"] { flex: 1; min-width: 80px; }
.timeline .note { flex: none; width: 170px; font-family: var(--mono); color: var(--ink-dim); text-align: right; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.card > h2 {
  margin: 0 0 12px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card > h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
.field:last-child { margin-bottom: 0; }
.field > label { font-size: 10.5px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-faint); }
.field .row { display: flex; gap: 7px; }
.field .row > * { min-width: 0; }

input, select, button, textarea {
  font: inherit;
  color: var(--ink);
  background: rgba(8, 11, 24, 0.72);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px;
  width: 100%;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(155, 140, 240, 0.16); }
select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%); background-position: right 12px center, right 7px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
input[type="range"] { padding: 0; background: none; border: none; accent-color: var(--violet); }

button {
  cursor: pointer;
  background: rgba(155, 140, 240, 0.10);
  border-color: rgba(155, 140, 240, 0.30);
  white-space: nowrap;
}
button:hover { background: rgba(155, 140, 240, 0.20); border-color: var(--violet); }
button.ghost { background: rgba(255, 255, 255, 0.03); border-color: var(--line); }
button.ghost:hover { background: rgba(255, 255, 255, 0.08); }
button.primary { background: linear-gradient(180deg, rgba(232, 196, 122, 0.24), rgba(232, 196, 122, 0.12)); border-color: rgba(232, 196, 122, 0.45); color: #ffeec4; }
button.primary:hover { background: rgba(232, 196, 122, 0.30); }
button[aria-pressed="true"] { background: rgba(111, 224, 176, 0.16); border-color: rgba(111, 224, 176, 0.48); color: #cffbe8; }

.btn-row { display: flex; gap: 7px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; font-size: 12px; padding: 7px 4px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: rgba(155, 140, 240, 0.22); color: #ede9ff; }

.date-row > #dayInput { flex: 0 0 52px; }
.date-row > #monthInput { flex: 1 1 64px; }
.date-row > #yearInput { flex: 1 1 70px; }
.date-row > #eraInput { flex: 0 0 62px; }
.time-row > input { flex: 0 0 52px; text-align: center; }
.time-row > .colon { align-self: center; color: var(--ink-faint); }
.time-row > select { flex: 1; }
/* Spinner arrows would cover the digits in these narrow fields. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
[aria-invalid="true"] { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(255, 122, 107, 0.14) !important; }
.note.warn { color: var(--warn); }

.place-search { position: relative; }
.place-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 4px;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 9px;
  max-height: 260px; overflow-y: auto; padding: 4px;
}
.place-results .note { padding: 6px 8px; }
.place-hit { display: block; width: 100%; text-align: left; border: none; background: transparent; border-radius: 6px; padding: 6px 8px; white-space: normal; }
.place-hit:hover, .place-hit:focus { background: rgba(155, 140, 240, 0.18); }
.place-hit span { color: var(--ink-faint); font-size: 11.5px; }

/* ---------------------------------------------------------------- wheel */
.wheel-wrap { position: relative; width: min(100%, calc(100vh - 190px)); aspect-ratio: 1; transition: opacity 0.2s, filter 0.2s; }
/* The drawn chart is not the answer to the current settings (yet): say so. */
.wheel-wrap.pending { opacity: 0.45; filter: saturate(0.5); }
.stage-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 360px;
  background: var(--panel-solid); border: 1px solid rgba(255, 184, 107, 0.5); color: var(--ink);
  padding: 12px 16px; border-radius: 12px; font-size: 13px; line-height: 1.5; text-align: center;
}
#wheel { width: 100%; height: 100%; overflow: visible; }
#wheel text { font-family: var(--glyph); user-select: none; }

.sign-sector { transition: opacity 0.2s; }
.tick-minor { stroke: rgba(160, 175, 225, 0.22); stroke-width: 1; }
.tick-major { stroke: rgba(180, 195, 245, 0.45); stroke-width: 1.2; }
.tick-ten { stroke: rgba(232, 196, 122, 0.55); stroke-width: 1.5; }
.ring { fill: none; stroke: var(--line); }
.ring-strong { fill: none; stroke: var(--line-strong); }

.house-cusp { stroke: rgba(150, 165, 220, 0.28); stroke-width: 1; stroke-dasharray: 3 4; }
.house-angle { stroke: rgba(232, 196, 122, 0.66); stroke-width: 1.8; }
.house-num { fill: var(--ink-faint); font-size: 12px; font-family: var(--mono); text-anchor: middle; dominant-baseline: central; }

.aspect-line { stroke-linecap: round; transition: opacity 0.18s, stroke-width 0.18s; }
.body-node { cursor: pointer; }
.body-glyph { text-anchor: middle; dominant-baseline: central; font-size: 21px; paint-order: stroke; stroke: rgba(5, 6, 13, 0.85); stroke-width: 3px; }
.body-degree { text-anchor: middle; dominant-baseline: central; font-size: 9.5px; font-family: var(--mono); fill: var(--ink-dim); }
.body-retro { text-anchor: middle; dominant-baseline: central; font-size: 9px; font-family: var(--mono); fill: var(--bad); }
.leader { stroke-width: 1; opacity: 0.5; }

.dimmed { opacity: 0.13 !important; }
.body-node.active .body-glyph { font-size: 25px; }

.hub-title { text-anchor: middle; font-family: var(--serif); fill: var(--ink); }
.hub-sub { text-anchor: middle; font-family: var(--mono); fill: var(--ink-faint); font-size: 10px; letter-spacing: 0.08em; }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font-weight: 600; font-size: 9.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-faint); padding: 0 6px 7px 0; border-bottom: 1px solid var(--line); }
td { padding: 5px 6px 5px 0; border-bottom: 1px solid rgba(150, 165, 220, 0.07); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background 0.12s; }
tbody tr:hover, tbody tr.active { background: rgba(155, 140, 240, 0.11); }
.num { font-family: var(--mono); text-align: right; }
.glyph-cell { font-family: var(--glyph); font-size: 16px; width: 22px; text-align: center; }
.con { font-size: 10.5px; color: var(--ink-dim); }
.retro { color: var(--bad); font-family: var(--mono); font-size: 10px; }
.dignity { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; padding: 1px 5px; border-radius: 5px; }
.dignity.rulership { background: rgba(111, 224, 176, 0.16); color: var(--good); }
.dignity.exaltation { background: rgba(232, 196, 122, 0.16); color: var(--gold); }
.dignity.detriment { background: rgba(255, 122, 107, 0.14); color: var(--bad); }
.dignity.fall { background: rgba(155, 140, 240, 0.16); color: var(--violet); }

.aspect-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid rgba(150, 165, 220, 0.07); cursor: pointer; font-size: 12px; }
.aspect-row:hover { background: rgba(155, 140, 240, 0.10); }
.aspect-row .g { font-family: var(--glyph); font-size: 15px; width: 18px; text-align: center; }
.aspect-row .orb { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.aspect-bar { height: 3px; border-radius: 2px; width: 34px; background: rgba(255,255,255,0.08); overflow: hidden; }
.aspect-bar > i { display: block; height: 100%; border-radius: 2px; }

/* ---------------------------------------------------------------- status */
.src { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; border-bottom: 1px solid rgba(150, 165, 220, 0.07); }
.src:last-child { border-bottom: none; }
.src .name { flex: 1; }
.src a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px dotted var(--line-strong); }
.src a:hover { color: var(--gold); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; }
.dot.ok { background: var(--good); color: var(--good); }
.dot.blocked, .dot.unparsed { background: var(--warn); color: var(--warn); }
.dot.error { background: var(--bad); color: var(--bad); }
.dot.skipped, .dot.idle, .dot.na { background: var(--ink-faint); color: transparent; box-shadow: none; }
.dot.pending { background: var(--cyan); color: var(--cyan); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.note { font-size: 11px; line-height: 1.55; color: var(--ink-faint); }
.note a { color: var(--ink-dim); }

.agree {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim);
  padding: 8px 10px; border-radius: 9px;
  background: rgba(111, 224, 176, 0.07); border: 1px solid rgba(111, 224, 176, 0.20);
  margin-bottom: 10px;
}
.agree b { font-size: 17px; color: var(--good); font-weight: 500; }

.delta-good { color: var(--good); }
.delta-mid { color: var(--warn); }
.delta-bad { color: var(--bad); }
.delta-na { color: var(--ink-faint); }

/* -------------------------------------------------------------- insights */
.ins-for { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; text-transform: none; color: var(--ink-dim); font-weight: 500; }
.ins-sec { padding: 4px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.ins-sec:last-child { border-bottom: none; margin-bottom: 0; }
.ins-sec h3 { margin: 4px 0 8px; font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--gold); letter-spacing: 0.02em; }
.ins-sec h4 { margin: 12px 0 5px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.ins-kv dd { text-align: right; }
.ins-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.ins-list li { padding: 4px 0; border-bottom: 1px solid rgba(150, 165, 220, 0.07); }
.ins-list .sub, .ins-sec .rel { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.ins-sec .rel { display: inline; margin-left: 4px; }
.ins-sec .g { font-family: var(--glyph); margin-right: 4px; }
.ins-table { font-size: 11.5px; }
.ins-table tbody tr { cursor: default; }
.ins-table td { padding: 4px 6px 4px 0; }
.ins-table .sgn { white-space: nowrap; }
.ins-table .match { color: var(--good); font-size: 10.5px; }
.ins-table .nomatch { color: var(--warn); font-size: 10.5px; }
.ins-sec .warn { color: var(--warn); }
.ins-sec .steps { display: block; font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.ins-sec .bal > div { text-transform: capitalize; }

/* ---------------------------------------------------------------- detail */
#detail { min-height: 96px; }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.detail-head .g { font-family: var(--glyph); font-size: 28px; }
.detail-head .n { font-family: var(--serif); font-size: 20px; letter-spacing: 0.02em; }
.detail-head .z { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--gold); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 11.5px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; font-family: var(--mono); text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.chip { font-size: 10.5px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--ink-dim); text-decoration: none; }
.chip:hover { border-color: var(--gold); color: var(--gold); }

.bal { display: flex; gap: 4px; margin-top: 4px; }
.bal > div { flex: 1; text-align: center; padding: 5px 0; border-radius: 7px; font-family: var(--mono); font-size: 11px; }
.bal .fire { background: rgba(255,138,99,0.13); color: var(--fire); }
.bal .earth { background: rgba(143,214,168,0.13); color: var(--earth); }
.bal .air { background: rgba(143,194,240,0.13); color: var(--air); }
.bal .water { background: rgba(155,159,240,0.13); color: var(--water); }
.bal .cardinal, .bal .fixed, .bal .mutable { background: rgba(255,255,255,0.05); color: var(--ink-dim); }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-solid); border: 1px solid var(--line-strong); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --------------------------------------------------------- responsive */
@media (max-width: 1400px) {
  .app { grid-template-columns: 264px minmax(0, 1fr) 320px; }
}
@media (max-width: 1100px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas: "head" "stage" "left" "right";
    height: auto;
  }
  .rail { overflow: visible; }
  .wheel-wrap { width: min(100%, 92vw); }
  .view-area { min-height: min(92vw, 640px); }
  .timeline .note { width: auto; }
  .sky3d-hint { display: none; }
  .hud-stats { display: none; }
  .sky3d-tools { max-width: 100%; left: 12px; right: 66px; top: auto; bottom: 12px; justify-content: flex-start; }   /* room for the corner full-screen button */
  body, html { height: auto; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(150, 165, 220, 0.18); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(150, 165, 220, 0.34); }
