:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #161f30;
  --ink: #e8edf6;
  --muted: #93a1bb;
  --line: #243044;
  --wealth: #3fd68b;
  --cost: #ff6b6b;
  --accent: #ffd23f;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #16203a 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: 28px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}
.hero h1 {
  font-size: clamp(28px, 6vw, 52px);
  line-height: 1.05;
  margin: 0 0 16px;
  font-weight: 800;
}
.hl {
  background: linear-gradient(120deg, var(--accent), #ff9f1c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(15px, 2.4vw, 18px);
  line-height: 1.5;
}
.sub strong { color: var(--ink); }

/* ---------- Verdict ---------- */
.verdict {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
  margin: 28px 0;
}
.verdict-loading { color: var(--muted); }
.verdict .lead { color: var(--muted); font-size: 15px; margin: 0 0 6px; }
.verdict .year {
  font-size: clamp(48px, 14vw, 104px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--accent), #ff9f1c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 4px 0 10px;
}
.verdict .tail { color: var(--ink); font-size: clamp(16px, 3vw, 22px); margin: 0; }
.verdict .tail b { color: var(--accent); }
/* Spelled-out totals can be very long; let them wrap instead of overflowing. */
.full { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.reserve-note {
  margin: 14px auto 0;
  max-width: 480px;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.reserve-note b { color: var(--ink); font-style: normal; }
.verdict.already .year,
.verdict.never .year { background: none; color: var(--cost); -webkit-text-fill-color: var(--cost); }
.verdict.already .year { color: var(--wealth); -webkit-text-fill-color: var(--wealth); }

/* ---------- Controls ---------- */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 8px 0 28px;
}
.control {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.control label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}
.control .val {
  color: var(--accent);
  font-weight: 800;
  margin-left: 4px;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
.money {
  display: flex;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}
.money .prefix { color: var(--muted); margin-right: 6px; }
.money input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  width: 100%;
  outline: none;
}
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.presets button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.presets button:hover { color: var(--ink); border-color: var(--accent); }
.presets button.active { background: var(--accent); color: #1a1300; border-color: var(--accent); font-weight: 700; }
select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
}

/* ---------- Chart ---------- */
.chart-card, .people-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
}
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.chart-head h2, .people-card h2 { font-size: 16px; margin: 0; font-weight: 700; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.key { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; }
.key::before {
  content: "";
  width: 12px; height: 12px;
  border-radius: 3px;
  margin-right: 6px;
}
.key.wealth::before { background: var(--wealth); }
.key.cost::before { background: var(--cost); }
.key.top::before { background: var(--wealth); }
.key.bottom::before { background: #5a9bff; }
canvas { width: 100%; height: auto; display: block; }
.chart-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.chart-note a { color: var(--accent); }
.chart-note b { color: var(--ink); font-weight: 600; }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat .k { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .v.green { color: var(--wealth); }
.stat .v.red { color: var(--cost); }

/* ---------- Comparisons ---------- */
.compare-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
}
.compare-card h2 { font-size: 16px; margin: 0 0 14px; font-weight: 700; }
.compare { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.compare li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.compare .big {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.compare b { color: var(--ink); }
.compare a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- People ---------- */
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.people { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.people li {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
}
.people .rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.people .nm { font-weight: 600; }
.people .co { color: var(--muted); font-size: 12px; }
.people .nw { font-weight: 700; color: var(--wealth); font-variant-numeric: tabular-nums; }
.people .gr { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.people-note { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.people-note a { color: var(--accent); }
.people-note code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }

/* ---------- Footer ---------- */
.footer { color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; margin-top: 8px; }
.footer a { color: var(--accent); }
.footer code { background: var(--panel); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); }
.fine { font-size: 12px; opacity: 0.7; margin-top: 8px; }

@media (max-width: 520px) {
  .people li { grid-template-columns: 20px 1fr auto; }
  .people .co { display: none; }
}
