:root {
  --bg: #050a0a;
  --text: #eef4f3;
  --muted: #8fa6a5;
  --faint: #5f7a79;
  --line: rgba(255, 255, 255, 0.09);
  --gold: #e2b155;
  --gold-hi: #f1c874;
  --green: #34d399;
  --amber: #f0b429;
  --red: #ef5350;
  --panel-top: rgba(26, 72, 74, 0.72);
  --panel-bottom: rgba(8, 24, 25, 0.86);
  --card: rgba(255, 255, 255, 0.035);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 720px at 14% 52%, rgba(24, 92, 92, 0.40), transparent 62%),
    radial-gradient(900px 600px at 88% 14%, rgba(14, 58, 60, 0.38), transparent 62%),
    radial-gradient(900px 520px at 62% 104%, rgba(10, 42, 44, 0.55), transparent 62%);
  background-attachment: fixed;
}

a { color: inherit; }
.icon { flex: none; }

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

/* ---------- Shell ---------- */
.app { max-width: 1360px; margin: 0 auto; padding: 0 32px 40px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 0;
}
.logo-link { display: block; margin-right: auto; }
.logo { display: block; height: 68px; width: auto; margin: -8px 0; }

.page { padding-top: 12px; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 760px;
  margin: 48px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.footer-note { margin: 0 0 14px; color: var(--faint); font-size: 0.8rem; line-height: 1.55; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  font-size: 0.8rem;
  color: var(--faint);
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--gold-hi); text-decoration: underline; }

/* ---------- Legal pages ---------- */
.legal { max-width: 820px; margin: 20px auto 0; padding: 40px 44px; }
.legal h1 { margin: 0; font-size: 2.2rem; font-weight: 300; letter-spacing: -0.01em; }
.legal-updated { margin: 6px 0 28px; color: var(--faint); font-size: 0.85rem; }
.legal h2 { margin: 28px 0 8px; font-size: 1.05rem; font-weight: 600; color: var(--gold-hi); }
.legal p, .legal li { color: #c3d3d2; font-size: 0.95rem; line-height: 1.65; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 12px; padding-left: 20px; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--gold-hi); }
.legal strong { color: var(--text); font-weight: 600; }

/* ---------- Glass ---------- */
.glass {
  background: linear-gradient(160deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- Search + buttons ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 20px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: var(--muted);
}
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(226, 177, 85, 0.15); }
.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  padding: 10px 0;
}
.search input::placeholder { color: var(--faint); }
.search input:focus-visible { outline: none; }
.search button {
  border: 0;
  border-radius: 999px;
  padding: 11px 24px;
  font: inherit;
  font-weight: 600;
  color: #1c1405;
  background: linear-gradient(180deg, var(--gold-hi), #d4a043);
  cursor: pointer;
}
.search button:hover { filter: brightness(1.08); }

.search-stack { position: relative; flex: 0 1 380px; }
.search-compact { padding: 4px 4px 4px 16px; }

/* sits just under the search bar without changing the top bar's height */
.related {
  position: absolute;
  top: calc(100% + 6px);
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}
.related span { color: var(--faint); }
.related a { color: var(--muted); text-decoration: none; font-weight: 500; }
.related a:hover { color: var(--gold-hi); }
.search-compact input { font-size: 0.95rem; padding: 7px 0; }
.search-compact button { padding: 8px 18px; }

.pill-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.pill-button:hover { background: rgba(255, 255, 255, 0.08); }

/* ---------- Homepage ---------- */
.page-home {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 56px;
  align-items: center;
  min-height: calc(100vh - 150px);
}
.page-home .site-footer { grid-column: 1 / -1; margin-top: 0; width: 100%; }

.eyebrow {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.home-copy h1 {
  margin: 0 0 18px;
  font-size: clamp(2.3rem, 4.2vw, 3.6rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.accent {
  white-space: nowrap;
  font-weight: 500;
  background: linear-gradient(90deg, var(--gold-hi), #f6dba0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle { margin: 0 0 34px; max-width: 34em; color: var(--muted); font-size: 1.1rem; }

.quick-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  color: var(--faint);
  font-size: 0.9rem;
}
.quick-links a {
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.quick-links a:hover { border-color: var(--gold); color: var(--gold-hi); }

/* ---------- Orb + fan graph ---------- */
.stage {
  --orb-rgb: 139, 108, 245;
  --orb-hi: #ded3ff;
  --orb-mid: #8b6cf5;
  --orb-lo: #35268a;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: center;
}
.stage.bias-bullish { --orb-rgb: 45, 212, 160; --orb-hi: #c4ffe9; --orb-mid: #2dd4a0; --orb-lo: #0a5c49; }
.stage.bias-bearish { --orb-rgb: 239, 83, 80; --orb-hi: #ffd0cc; --orb-mid: #ef5350; --orb-lo: #7a1c1c; }

.orb-wrap {
  position: relative;
  height: var(--stage-h);
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb-wrap::after { /* connector from the orb to the start of the fan */
  content: "";
  position: absolute;
  top: 50%;
  left: calc(50% + 58px);
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--orb-rgb), 0.75), rgba(226, 177, 85, 0.55));
}
.orb {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--orb-hi), var(--orb-mid) 46%, var(--orb-lo) 100%);
  box-shadow: 0 0 38px rgba(var(--orb-rgb), 0.55), inset -8px -10px 22px rgba(0, 0, 0, 0.35);
}
.orb::before { /* slowly rotating ring */
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 8%, rgba(var(--orb-rgb), 0.9) 18%, transparent 34%, rgba(var(--orb-rgb), 0.6) 58%, transparent 78%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: orb-spin 24s linear infinite;
}
.orb::after { /* soft halo */
  content: "";
  position: absolute;
  inset: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--orb-rgb), 0.16), transparent 66%);
  z-index: -1;
}
@keyframes orb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orb::before { animation: none; } }

.orb-caption {
  position: absolute;
  top: calc(50% + 80px);
  left: 0;
  right: 14px;
  text-align: center;
  line-height: 1.3;
}
.orb-caption strong { display: block; font-size: 1.15rem; font-weight: 600; }
.orb-caption span { display: block; font-size: 1.35rem; font-weight: 300; margin-top: 2px; }
.orb-caption small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

.fan {
  display: grid;
  grid-template-columns: clamp(60px, 9vw, 140px) minmax(0, 1fr);
  /* a fixed track keeps the SVG's aspect ratio from stretching the row */
  grid-template-rows: minmax(0, 1fr);
  height: calc(var(--rows) * 96px);
}
.fan-lines { width: 100%; height: 100%; min-height: 0; overflow: visible; }
.fan-line { fill: none; stroke-width: 1.2; stroke: rgba(226, 177, 85, 0.5); }
.fan-line-bullish { stroke: rgba(52, 211, 153, 0.6); }
.fan-line-bearish { stroke: rgba(239, 83, 80, 0.6); }

.fan-nodes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-rows: 96px;
}
.fan-node {
  position: relative;
  align-self: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  border-radius: 16px;
}
.node-dot {
  position: absolute;
  left: -5px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(226, 177, 85, 0.8);
}
.fan-node-bullish .node-dot { background: var(--green); box-shadow: 0 0 10px rgba(52, 211, 153, 0.8); }
.fan-node-bearish .node-dot { background: var(--red); box-shadow: 0 0 10px rgba(239, 83, 80, 0.8); }

.node-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(226, 177, 85, 0.45);
  color: var(--gold-hi);
  background: rgba(226, 177, 85, 0.07);
}
.node-body { flex: 1; min-width: 0; }
.node-label { display: block; font-weight: 600; font-size: 0.98rem; }
.node-detail { display: block; color: var(--muted); font-size: 0.82rem; line-height: 1.35; margin-top: 2px; }

.node-metric {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: none;
}
.node-value { font-size: 1.3rem; font-weight: 300; white-space: nowrap; }
.node-verdict { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.node-verdict-bullish { color: var(--green); }
.node-verdict-bearish { color: var(--red); }
.node-verdict-neutral { color: var(--amber); }

.segs { display: inline-flex; gap: 3px; }
.segs i { width: 16px; height: 5px; border-radius: 2px; opacity: 0.2; }
.segs i:nth-child(1) { background: var(--red); }
.segs i:nth-child(2) { background: var(--amber); }
.segs i:nth-child(3) { background: var(--green); }
.segs[data-v="bearish"] i:nth-child(1),
.segs[data-v="neutral"] i:nth-child(2),
.segs[data-v="bullish"] i:nth-child(3) { opacity: 1; box-shadow: 0 0 8px currentColor; }
.segs[data-v="bearish"] i:nth-child(1) { color: var(--red); }
.segs[data-v="neutral"] i:nth-child(2) { color: var(--amber); }
.segs[data-v="bullish"] i:nth-child(3) { color: var(--green); }

/* ---------- Stock page ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 48px;
  align-items: center;
}

.panel { padding: 28px; }
.panel-kicker { display: flex; align-items: center; gap: 12px; color: var(--gold-hi); font-size: 1.05rem; }
.panel-title { margin: 18px 0 20px; font-size: 1.9rem; font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; }
.panel-title span { font-weight: 300; }

.status-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}
.status-pill {
  flex: none;
  padding: 3px 14px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.8rem;
  font-weight: 600;
}
.status-bullish { color: var(--green); background: rgba(52, 211, 153, 0.1); }
.status-bearish { color: var(--red); background: rgba(239, 83, 80, 0.1); }
.status-mixed { color: var(--amber); background: rgba(240, 180, 41, 0.1); }
.status-text { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }

.score-card {
  margin-top: 14px;
  padding: 18px 20px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(120, 30, 34, 0.35), rgba(0, 0, 0, 0.35) 55%);
}
.bias-bullish.panel .score-card { background: linear-gradient(120deg, rgba(14, 92, 70, 0.4), rgba(0, 0, 0, 0.35) 55%); }
.bias-mixed.panel .score-card { background: linear-gradient(120deg, rgba(110, 82, 20, 0.4), rgba(0, 0, 0, 0.35) 55%); }
.score-label { font-size: 1.05rem; }
.score-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 6px; }
.score-value { font-size: 3.4rem; font-weight: 300; line-height: 1; letter-spacing: -0.02em; }
.score-value small { font-size: 1.8rem; font-weight: 300; margin-left: 2px; }
.score-delta { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 0.9rem; color: var(--muted); }
.score-delta.is-up { color: var(--green); }
.score-delta.is-down { color: var(--red); }
.score-delta span { color: var(--muted); }

.spark { flex: 1 1 0; min-width: 0; max-width: 200px; height: 56px; }
.spark .bar { stroke: rgba(255, 255, 255, 0.55); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 0.01 4.6; }
.spark .bar-last { stroke: var(--gold-hi); stroke-width: 2.6; stroke-linecap: round; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.tile-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(226, 177, 85, 0.45);
  color: var(--gold-hi);
}
.tile-value { margin-top: 12px; font-size: 1.7rem; font-weight: 300; line-height: 1.1; }
.tile-value.is-up { color: var(--green); }
.tile-value.is-down { color: var(--red); }
.tile-label { margin-top: 4px; color: var(--muted); font-size: 0.85rem; }

.analysis { margin-top: 22px; }
.analysis-kicker { display: flex; align-items: center; gap: 10px; color: var(--gold-hi); font-weight: 500; }
.analysis-box {
  margin-top: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
}
.analysis-box strong { display: block; font-size: 0.95rem; font-weight: 600; }
.analysis-box p { margin: 6px 0 0; color: var(--muted); font-size: 0.88rem; }

.error-box { max-width: 560px; margin: 40px auto 0; padding: 40px; text-align: center; }
.error-box h1 { margin: 0 0 10px; font-weight: 300; font-size: 2.2rem; }
.error-box p { margin: 0 0 24px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .panel { max-width: 640px; width: 100%; margin: 0 auto; }
  .page-home { grid-template-columns: minmax(0, 1fr); gap: 40px; min-height: 0; padding-top: 12px; }
}

@media (max-width: 720px) {
  .app { padding: 0 16px 32px; }
  .topbar { flex-wrap: wrap; gap: 14px; }
  .logo { height: 54px; }
  .search-stack { order: 3; flex: 1 1 100%; }
  .related { position: static; margin: 8px 0 0 16px; }
  .pill-button span { display: none; }
  .pill-button { padding: 10px; }

  .stage { grid-template-columns: minmax(0, 1fr); }
  .orb-wrap { height: auto; padding: 36px 0 84px; margin-bottom: 20px; }
  .orb-wrap::after { display: none; }
  .orb-caption { top: auto; bottom: 0; right: 0; }
  .fan { display: block; height: auto; }
  .fan-lines { display: none; }
  .fan-nodes { grid-auto-rows: auto; gap: 12px; }
  .node-dot { display: none; }
  .fan-node { flex-wrap: wrap; }
  .node-metric { width: 100%; grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .panel { padding: 22px; }
  .legal { padding: 26px 22px; }
  .score-value { font-size: 2.8rem; }
}
