:root {
  --bg: #07090f;
  --bg-2: #0d111b;
  --panel: rgba(16, 21, 34, 0.86);
  --line: rgba(148, 163, 196, 0.16);
  --text: #e6e9f2;
  --muted: #8b93a8;
  --accent: #f5c45e;
  --accent-2: #7cc4ff;
  --radius: 10px;
  --side: 330px;
  --note: 420px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 800px at 60% 40%, #111830 0%, var(--bg) 70%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent-2); }

/* -- top bar ---------------------------------------------------------------------- */
.top {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 15, 0.7); backdrop-filter: blur(8px);
}
.brand { font-weight: 700; letter-spacing: 0.18em; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.brand .mark { width: 28px; height: 28px; border-radius: 50%; }
.hero { display: block; width: calc(100% + 28px); margin: -12px -14px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.brand .sub { font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: 8px; font-size: 12px; }
.search { position: relative; flex: 0 1 300px; }
.search input {
  width: 100%; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); outline: none;
}
.search input:focus { border-color: var(--accent); }
.results {
  position: absolute; top: 38px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-height: 50vh; overflow: auto;
}
.results li { padding: 6px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.results li:hover, .results li.active { background: rgba(245, 196, 94, 0.12); }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; font-size: 12px; white-space: nowrap; color: var(--muted);
}
.chip[aria-pressed="true"] { color: var(--text); border-color: rgba(230, 233, 242, 0.35); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* -- layout ----------------------------------------------------------------------- */
.layout { position: relative; height: calc(100% - 53px); }
.stage { position: absolute; inset: 0; }
#graph { width: 100%; height: 100%; display: block; cursor: grab; }
#graph:active { cursor: grabbing; }

.panel-toggle {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font-size: 16px; line-height: 1;
}
.panel-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.panel-toggle .count {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: #111; font-size: 10px; font-weight: 700; line-height: 16px;
}
.panel-toggle .count:empty { display: none; }
.side-close { position: absolute; top: 6px; right: 8px; z-index: 1; background: none; border: 0; font-size: 20px; color: var(--muted); }
.side .tabs { padding-right: 30px; }
body:not(.side-open) .side { opacity: 0; transform: translateX(calc(-100% - 24px)); pointer-events: none; }
.side {
  position: absolute; z-index: 3; top: 12px; left: 12px; bottom: 64px; width: var(--side);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(10px);
}
.tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  flex: 1 0 auto; padding: 10px 7px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 12.5px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.pane { overflow: auto; padding: 12px 14px 16px; flex: 1; }
.pane h3 { margin: 14px 0 6px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.pane h3:first-child { margin-top: 0; }
.pane .empty { color: var(--muted); }
.item {
  display: flex; gap: 8px; align-items: baseline; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer;
}
.item:hover { background: rgba(255, 255, 255, 0.05); }
.item .meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.item .dot { transform: translateY(-1px); }
.q { padding: 8px 10px; margin: 6px 0; border: 1px dashed rgba(245, 196, 94, 0.35); border-radius: 8px; cursor: pointer; }
.q:hover { background: rgba(245, 196, 94, 0.06); }
.q small { display: block; color: var(--muted); }
.big { font-size: 28px; font-weight: 700; }
.kpis { display: flex; gap: 18px; margin-bottom: 4px; }
.kpis span { display: block; color: var(--muted); font-size: 12px; }

.tl { position: relative; margin-left: 6px; padding-left: 16px; border-left: 1px solid var(--line); }
.tl .year { margin: 12px 0 4px -16px; color: var(--accent); font-weight: 600; font-size: 12px; }
.tl .item::before {
  content: ""; position: absolute; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2);
  margin-top: 7px;
}

/* -- time slider ------------------------------------------------------------------ */
.time {
  position: absolute; z-index: 3; left: 16px; right: 16px; bottom: 14px;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(10px);
}
.time button { background: none; border: 0; color: var(--accent); width: 22px; }
.time input { flex: 1; accent-color: var(--accent); }
.side-open .time { left: calc(var(--side) + 28px); }
.reading .time { right: calc(var(--note) + 28px); }
#time-label { color: var(--muted); font-size: 12px; min-width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.legend {
  position: absolute; z-index: 2; right: 16px; top: 12px; color: var(--muted); font-size: 11.5px;
  display: grid; gap: 3px; text-align: right;
}

/* -- note panel ------------------------------------------------------------------- */
.note {
  position: absolute; z-index: 4; top: 12px; right: 12px; bottom: 12px; width: var(--note);
  overflow: auto; padding: 18px 20px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(12px);
}
.note .close { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 22px; color: var(--muted); }
.note h1 { font-size: 20px; margin: 0 28px 6px 0; line-height: 1.25; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.private { border-color: rgba(255, 122, 122, 0.5); color: #ff9a9a; }
.badge.inferred { border-style: dashed; border-color: rgba(245, 196, 94, 0.55); color: var(--accent); }
.note .content h2 { font-size: 14px; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.note .content img { max-width: 100%; border-radius: 8px; }
.note .content code { background: rgba(255, 255, 255, 0.06); padding: 1px 5px; border-radius: 4px; }
.note .content table { border-collapse: collapse; }
.note .content td, .note .content th { border: 1px solid var(--line); padding: 4px 8px; }
.note .content a.missing { color: var(--muted); text-decoration: none; cursor: default; }
.note .section { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.note .section h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.note .sources { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; word-break: break-word; }
.open-obsidian {
  display: inline-block; margin-top: 16px; padding: 7px 14px; border-radius: 999px; text-decoration: none;
  border: 1px solid rgba(124, 196, 255, 0.4);
}

/* -- phone ------------------------------------------------------------------------ */
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .search { flex: 1 1 auto; }
  .filters { width: 100%; }
  .layout { height: calc(100% - 92px); }
  .side { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 42%; border-radius: var(--radius) var(--radius) 0 0; }
  .time, .side-open .time { left: 16px; right: 16px; }
  .side-open .time { bottom: calc(42% + 10px); }
  body:not(.side-open) .side { transform: translateY(100%); }
  .legend { display: none; }
  .note { inset: 0; width: auto; border-radius: 0; }
  .reading .time { right: 16px; }
}


/* -- the wheel of Time: intro, welcome, chakra vyuha ---------------------------------- */
.intro {
  position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; padding-top: 12vh; text-align: center; cursor: pointer;
  background: radial-gradient(closest-side, rgba(7, 9, 15, 0.15), rgba(7, 9, 15, 0.75));
  transition: opacity 0.8s ease;
}
.intro.gone { opacity: 0; pointer-events: none; }
.intro p { margin: 0 16px 10px; max-width: 34em; opacity: 0; animation: rise 1.2s ease forwards; }
.intro .l1 { font-size: clamp(18px, 2.6vw, 28px); font-family: Georgia, "Times New Roman", serif; animation-delay: 0.2s; }
.intro .l2 { font-size: clamp(18px, 2.6vw, 28px); font-family: Georgia, "Times New Roman", serif; color: var(--accent); animation-delay: 1s; }
.intro .cite { color: var(--muted); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; animation-delay: 1.8s; }
.intro .skip { position: absolute; bottom: 80px; color: var(--muted); font-size: 12px; animation-delay: 2.6s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.welcome {
  position: absolute; z-index: 9; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  padding: 26px 26px 22px; background: rgba(13, 17, 27, 0.92); border: 1px solid rgba(245, 196, 94, 0.25);
  border-radius: 16px; backdrop-filter: blur(12px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: rise 0.6s ease;
}
.welcome .close { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 22px; color: var(--muted); }
.welcome h2 { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 26px; }
.welcome .lede { margin: 0 0 16px; color: var(--muted); }
.welcome h3 { margin: 18px 0 8px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.welcome .ask {
  width: 100%; text-align: left; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--muted);
}
.welcome .ask:hover { border-color: var(--accent); }
.starts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.starts button {
  text-align: left; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
.starts button:hover { border-color: rgba(245, 196, 94, 0.5); background: rgba(245, 196, 94, 0.06); }
.starts b { display: block; font-weight: 600; }
.starts span { display: block; color: var(--muted); font-size: 12px; }
.lives { display: flex; flex-wrap: wrap; gap: 6px; }
.lives .chip { color: var(--text); font-size: 13px; padding: 4px 12px; }
.lives .chip:hover { border-color: var(--accent); }
.explore {
  display: block; margin: 20px 0 0 auto; padding: 8px 18px; border-radius: 999px; border: 0;
  background: var(--accent); color: #111; font-weight: 600;
}
@media (max-width: 520px) { .starts { grid-template-columns: 1fr; } .welcome { padding: 20px 16px 16px; } }

.vyuha {
  position: absolute; z-index: 4; right: 16px; bottom: 70px; width: 240px; padding: 12px 14px;
  background: var(--panel); border: 1px solid rgba(245, 196, 94, 0.3); border-radius: var(--radius); backdrop-filter: blur(10px);
}
.reading .vyuha { right: calc(var(--note) + 28px); }
.vyuha svg { display: block; width: 150px; height: 150px; margin: 0 auto 6px; }
.vyuha .rings { fill: none; stroke: rgba(245, 196, 94, 0.7); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2000; stroke-dashoffset: 2000; }
.vyuha.show .rings { animation: draw-rings 2.4s ease forwards; }
.vyuha .trail { fill: none; stroke: none; }
.vyuha .hero-dot { fill: #fff; filter: drop-shadow(0 0 4px #f5c45e); }
.vyuha p { margin: 0; font-size: 12.5px; color: var(--muted); }
.vyuha p b { color: var(--text); }
.vyuha .cite { white-space: nowrap; }
.vyuha .close { position: absolute; top: 4px; right: 8px; background: none; border: 0; font-size: 18px; color: var(--muted); }
@keyframes draw-rings { to { stroke-dashoffset: 0; } }
@media (max-width: 760px) { .vyuha { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .intro p, .welcome { animation: none; opacity: 1; }
  .vyuha .rings { stroke-dashoffset: 0; animation: none !important; }
}

/* -- answers ------------------------------------------------------------------------- */
.search { flex-basis: 380px; }
.results li.answer { display: block; cursor: default; padding: 10px 12px; margin-bottom: 4px; border: 1px solid rgba(245, 196, 94, 0.3); background: rgba(245, 196, 94, 0.05); }
.results li.answer:hover { background: rgba(245, 196, 94, 0.05); }
.a-head { margin-bottom: 6px; line-height: 1.45; }
.a-row { padding: 2px 0; }
.a-link { background: none; border: 0; padding: 0; font-weight: 600; cursor: pointer; text-align: left; }
.a-link:hover { text-decoration: underline; }
.a-cite, .a-rel { color: var(--muted); font-size: 12px; }
.a-rel { font-size: 13px; }
.a-inf { margin-left: 6px; font-size: 11px; color: var(--accent); border: 1px dashed rgba(245, 196, 94, 0.5); border-radius: 4px; padding: 0 4px; }
.a-note { color: var(--muted); font-size: 12px; }
.a-weak { margin-top: 6px; color: var(--muted); font-size: 12px; }
.a-weak .a-link { font-weight: 400; }
.a-foot { margin-top: 8px; color: var(--muted); font-size: 11px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.examples button { padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--line); background: none; color: var(--muted); font-size: 12px; }
.examples button:hover { color: var(--text); border-color: var(--accent); }
.results { background: rgba(13, 17, 27, 0.97); }
