/* Light is the default and the fallback for JS-disabled visitors, so it's
 * defined on :root rather than gated behind a class. Dark applies only via
 * [data-theme="dark"], set by theme.js before first paint to avoid a flash. */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #eef1f5;
  --line: #dde2e8;
  --text: #16202b;
  --muted: #5b6b7d;
  /* faint/accent/amber were WCAG failures as text: faint 2.7-2.9:1 against
   * the surfaces it actually sits on (panel2, bg), accent 3.2-3.4:1 as inline
   * link text, amber 3.1-3.3:1 as the "cost of choosing wrong" stat colour —
   * all under the 4.5:1 AA minimum for normal text. Values below are solved
   * to clear 4.5:1 on every surface each one is used against (verified with
   * the WCAG relative-luminance formula, not eyeballed); darkening amber and
   * accent only ever *raises* contrast for the white/dark text sitting on
   * them as backgrounds elsewhere, so this has no downside there. */
  --faint: #606f80;
  --accent: #008474;
  --accent-dim: #0c7d70;
  --amber: #9e6c00;
  --good: #1f9d55;
  --warn: #d1392b;
  --radius: 10px;
  --grid: #e3e7ec;
  --contrast: #16202b;
  --shadow: rgba(20, 30, 40, .16);
  --shadow-strong: rgba(20, 30, 40, .22);
}

:root[data-theme="dark"] {
  --bg: #0b1015;
  --panel: #131a22;
  --panel-2: #1a232d;
  --line: #253140;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --faint: #62738a;
  --accent: #2dd4bf;
  --accent-dim: #14766b;
  --amber: #fbbf24;
  --good: #4ade80;
  --warn: #f87171;
  --grid: #1e2833;
  --contrast: #ffffff;
  --shadow: rgba(0, 0, 0, .45);
  --shadow-strong: rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 32px 20px 64px; }

header h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
header p { margin: 0 0 28px; color: var(--muted); max-width: 64ch; }

/* ---------- site nav ---------- */

.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.nav .brand {
  color: var(--text); text-decoration: none;
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
}
.nav .brand:hover { color: var(--accent); }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--muted); text-decoration: none;
  font-size: 13px; padding: 5px 11px; border-radius: 999px;
}
.nav-links a:hover { color: var(--text); background: var(--panel); }
.nav-links a[aria-current="page"] {
  color: var(--accent); background: rgba(45, 212, 191, .1);
}

.lang-select {
  flex: none; width: auto;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 12.5px; padding: 5px 9px; border-radius: 999px;
  cursor: pointer;
}
.lang-select:hover { border-color: var(--accent-dim); }
.lang-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lang-notice {
  margin: -14px 0 26px; font-size: 11.5px; color: var(--faint); text-align: right;
}

.theme-toggle {
  flex: none; position: relative;
  width: 40px; height: 24px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent-dim); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.theme-toggle::before {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  transition: transform .15s ease;
}
:root[data-theme="dark"] .theme-toggle::before { transform: translateX(16px); }

.theme-toggle .tt-icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 11px; line-height: 1; color: var(--faint); pointer-events: none;
}
.theme-toggle .tt-sun { left: 5px; }
.theme-toggle .tt-moon { right: 5px; }

/* ---------- content pages (FAQ, About) ---------- */

/* Fills the same 1280px envelope as the calculator's .wrap, rather than
 * floating as a narrow column with dead space on both sides — these pages
 * should read as part of the same site, not a bolted-on blog. Paragraph text
 * still gets its own reading-width cap below, just not the whole container. */
.page { max-width: 1280px; }
.page-back { margin-top: 22px; font-size: 13px; }
.page-back a { color: var(--muted); text-decoration: none; }
.page-back a:hover { color: var(--accent); }

/* max-width sits on the paragraphs, not .prose itself: about.html combines
 * class="panel prose" on one element, so a cap on .prose would shrink the
 * whole card to reading width instead of just the text inside it. */
.prose { font-size: 15px; line-height: 1.75; color: var(--muted); }
.prose p { margin: 0 0 16px; max-width: 68ch; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--accent); }

/* Photo circle linking to the YouTube channel */
.me { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }

.avatar {
  position: relative; display: block; flex: none;
  width: 112px; height: 112px; border-radius: 50%;
}
.avatar img {
  display: block; width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
  border: 2px solid var(--line);
  transition: border-color .15s, transform .15s;
}
.avatar:hover img { border-color: #ff3b3b; transform: scale(1.03); }
.avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Small play badge so the circle reads as a link to video, not just a photo */
.avatar .play {
  position: absolute; right: 2px; bottom: 2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: #f00; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; padding-left: 3px;
  border: 3px solid var(--panel);
}

.me-txt strong { display: block; font-size: 16.5px; color: var(--text); letter-spacing: -0.01em; }
.me-txt a { font-size: 13px; color: var(--muted); text-decoration: none; }
.me-txt a:hover { color: #ff3b3b; }

/* Buy me a coffee */
.bmc-wrap { margin-top: 22px; }
/* .prose a { color: var(--accent) } outranks a plain .bmc selector on
 * specificity (two classes beat one), so the button rendered in teal instead
 * of the intended near-black — bad contrast on the amber background in
 * either theme. .prose .bmc matches .prose a's specificity and wins on
 * source order. */
.prose .bmc {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--amber); color: #1a1206;
  font-size: 14.5px; font-weight: 600; text-decoration: none;
  padding: 11px 20px; border-radius: 8px;
  transition: transform .12s, box-shadow .12s;
}
.bmc:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(251, 191, 36, .25);
}
.bmc-cup { font-size: 17px; }

/* Pointer from the calculator to the FAQ */
.see-also {
  margin-top: 20px; padding: 14px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13.5px; color: var(--muted);
}
.see-also a { color: var(--accent); text-decoration: none; white-space: nowrap; }
.see-also a:hover { text-decoration: underline; }

.layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }

/* ---------- panels & fields ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.panel + .panel { margin-top: 16px; }

.panel h2 {
  margin: 0 0 18px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); font-weight: 600;
}

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }

.field-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 7px; gap: 10px;
}
.field label { font-size: 13px; color: var(--muted); }

.numwrap { display: flex; align-items: baseline; gap: 5px; }
.numwrap .cur { font-size: 10.5px; color: var(--faint); letter-spacing: 0.04em; }

input[type="number"] {
  width: 104px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit; font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
input[type="number"]:focus { outline: none; border-color: var(--accent-dim); }

select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 9px;
  font: inherit; font-size: 13px;
}
select:focus { outline: none; border-color: var(--accent-dim); }

input[type="range"] {
  width: 100%; -webkit-appearance: none; appearance: none;
  background: transparent; height: 18px; margin: 0; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--panel-2); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); margin-top: -5px; border: none;
}
input[type="range"]::-moz-range-track { height: 4px; background: var(--panel-2); border-radius: 2px; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: none; }

.seg { display: flex; gap: 4px; background: var(--panel-2); padding: 3px; border-radius: 7px; }
.seg button {
  flex: 1; background: transparent; border: none; color: var(--muted);
  font: inherit; font-size: 12.5px; padding: 6px 4px; border-radius: 5px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent-dim); color: #eafffb; }

.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check span { font-size: 13px; color: var(--muted); }

.hint {
  font-size: 11.5px; color: var(--faint); margin-top: 8px; line-height: 1.55;
  padding: 9px 11px; background: var(--panel-2); border-radius: 7px;
  border-left: 2px solid var(--accent-dim);
}
.hint em { color: var(--muted); font-style: normal; font-weight: 600; }

/* The ? beside each label. Kept small and quiet — it should be findable
   without competing with the control it sits next to. */
.lbl-wrap { display: inline-flex; align-items: center; gap: 6px; }

.help {
  flex: none; width: 15px; height: 15px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--faint);
  font: inherit; font-size: 10px; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .12s, border-color .12s;
}
.help:hover { border-color: var(--accent-dim); color: var(--accent); }
.help.on { border-color: var(--accent); color: var(--accent); background: rgba(45,212,191,.1); }
.help:focus-visible { outline: 2px solid var(--accent-dim); outline-offset: 2px; }

/* Checkbox rows need the ? outside the <label>, so they get their own flex row. */
.check-row { display: flex; align-items: flex-start; gap: 8px; }
.check-row .check { flex: 1; }
.check-row .help { margin-top: 2px; }

.field.last { margin-bottom: 0; }

/* The derived life-expectancy line under the sex selector. */
.life-note {
  margin-top: 8px; font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.life-note strong { color: var(--accent); font-weight: 600; }

/* A slider whose value is shown as a label rather than an editable box. */
.lbl-val {
  font-size: 12.5px; color: var(--accent);
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}

/* Whichever of withdrawal-rate / death-age the current mode ignores. */
.field.inert { opacity: .35; pointer-events: none; }
.field.inert .lbl-val { color: var(--faint); }

.panel h2 .count {
  float: right; text-transform: none; letter-spacing: 0;
  font-size: 11px; color: var(--faint); font-weight: 400;
}

.fx-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--faint); }
.fx-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.fx-dot.live { background: var(--good); }
.fx-dot.cached { background: var(--accent); }
.fx-dot.offline { background: var(--amber); }
.fx-dot.loading { background: var(--faint); animation: fxpulse 1s ease-in-out infinite; }
@keyframes fxpulse { 0%,100% { opacity: .3 } 50% { opacity: 1 } }
.fx-refresh {
  margin-left: auto; background: none; border: none; color: var(--faint);
  font: inherit; font-size: 11.5px; text-decoration: underline; cursor: pointer; padding: 0;
}
.fx-refresh:hover { color: var(--accent); }
.fx-refresh[disabled] { opacity: .4; cursor: default; text-decoration: none; }

.reset {
  margin-top: 22px; width: 100%; background: transparent;
  border: 1px solid var(--line); color: var(--muted);
  padding: 8px; border-radius: 6px; font: inherit; font-size: 13px; cursor: pointer;
}
.reset:hover { border-color: var(--accent-dim); color: var(--text); }

/* ---------- summary ---------- */

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.stat .v { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat .v.accent { color: var(--accent); }
.stat .v.amber { color: var(--amber); }

/* ---------- chart ---------- */

.chart-wrap { position: relative; }
.chart-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-bar .grow { flex: 1; }
.chart-bar select { width: auto; min-width: 190px; }
.chart-bar .lbl { font-size: 12px; color: var(--muted); }

.zoombtns { display: flex; gap: 5px; }
.zoombtns button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  width: 30px; height: 30px; border-radius: 6px; font: inherit; font-size: 14px; cursor: pointer;
}
.zoombtns button.wide { width: auto; padding: 0 11px; font-size: 12.5px; }
.zoombtns button:hover { border-color: var(--accent-dim); color: var(--text); }

#chart { width: 100%; height: 420px; display: block; cursor: grab; touch-action: none; }
#chart.grabbing { cursor: grabbing; }

#chart .grid { stroke: var(--grid); stroke-width: 1; }
#chart .tick { fill: var(--faint); font-size: 10.5px; }
#chart .axis-label { fill: var(--muted); font-size: 11.5px; }
#chart .dot { cursor: pointer; opacity: 0.85; stroke: var(--panel); stroke-width: 1.5; transition: opacity .12s; }
#chart .dot:hover { opacity: 1; }
#chart .dot.sel { stroke: var(--contrast); stroke-width: 2.5; opacity: 1; }
#chart .dot:focus { outline: none; stroke: var(--contrast); stroke-width: 2.5; }
#chart .dot-label { fill: var(--muted); font-size: 10.5px; pointer-events: none; }
#chart .dot-label.sel { fill: var(--contrast); font-size: 12px; font-weight: 600; }

.tip {
  position: absolute; display: none; pointer-events: none;
  background: #0d1319; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; width: 218px; z-index: 5;
  box-shadow: 0 8px 24px var(--shadow);
}
.tip .t-city { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.tip .t-line { font-size: 11.5px; color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend .lg i, .chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.chart-note { font-size: 11.5px; color: var(--faint); margin-top: 10px; }
.axis-hint { margin: -4px 0 10px; }

/* ---------- home vs ideal ---------- */

.compare { margin-bottom: 20px; }

.cmp-picks { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cmp-picks select { flex: 1; min-width: 0; }
.cmp-picks .vs { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; flex: none; }

.cmp-empty { color: var(--muted); font-size: 13px; line-height: 1.6; }

.cmp-head, .cmp-row {
  display: grid; grid-template-columns: 150px 1fr 1fr; gap: 14px; align-items: baseline;
}
.cmp-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); align-items: end; }
.cmp-head .cmp-a, .cmp-head .cmp-b { font-size: 14.5px; font-weight: 600; }

.tag {
  display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  padding: 2px 7px; border-radius: 999px; font-weight: 600; margin-bottom: 5px;
}
.tag.home { background: rgba(148,163,184,.22); color: var(--muted); }
.tag.ideal { background: rgba(45,212,191,.15); color: var(--accent); }

.cmp-headline {
  margin: 14px 0 6px; padding: 11px 13px;
  background: var(--panel-2); border-radius: 8px;
  font-size: 13.5px; line-height: 1.55; color: var(--muted);
}
.cmp-headline strong { color: var(--accent); font-weight: 600; }

.cmp-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cmp-row:last-of-type { border-bottom: none; }
.cmp-k { font-size: 12.5px; color: var(--muted); }
.cmp-a, .cmp-b { font-size: 14px; font-variant-numeric: tabular-nums; }
.cmp-b { color: var(--accent); }

.cmp-note {
  grid-column: 1 / -1; font-size: 12px; color: var(--faint);
  margin: -4px 0 8px; padding-left: 164px;
}

#chart .dot.pin-home  { stroke: var(--muted); stroke-width: 2.5; opacity: 1; }
#chart .dot.pin-ideal { stroke: var(--accent); stroke-width: 2.5; opacity: 1; }
#chart .dot-label.pin { fill: var(--text); font-size: 11.5px; font-weight: 600; }

/* ---------- how to read the chart ---------- */

.explain {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.explain h3 {
  margin: 0 0 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 600;
}
.explain p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.explain p:last-child { margin-bottom: 0; }
.explain strong { color: var(--text); font-weight: 600; }
.explain .explain-note { color: var(--faint); font-size: 12px; }

/* ---------- city popup ---------- */

/* Fixed rather than absolute so it can escape the panel's overflow and sit
   wherever the cursor is, including over the chart itself. */
.popup {
  position: fixed;
  display: none;
  z-index: 40;
  width: min(760px, calc(100vw - 32px));
  max-height: min(82vh, 780px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 18px 50px var(--shadow-strong);
}

/* ---------- city detail ---------- */

.detail { margin-top: 16px; }

.detail-empty {
  display: flex; align-items: center; gap: 14px;
  color: var(--muted); font-size: 13.5px; padding: 6px 2px;
}
.detail-empty .de-icon { font-size: 22px; }

.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.d-city { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.d-flag { font-size: 22px; }
.d-country { color: var(--muted); font-size: 13px; margin-top: 2px; }
.d-close {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1;
}
.d-close:hover { border-color: var(--warn); color: var(--warn); }

.d-money {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 16px 0 4px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.dm-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 5px; }
.dm-v { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dm-v.accent { color: var(--accent); }

.d-grid { margin-top: 4px; }

/* Two newspaper columns rather than one long scroll.
 *
 * A label column beside the value was self-defeating: widening the popup to
 * 620px and putting the labels back left the prose exactly 407px, the same
 * as before. The width has to go into the text, not into a gutter. Flowing
 * the facts into two columns spends it properly — each column sits near 350px
 * (~55 characters, comfortable) and the popup is half as tall, so it stops
 * scrolling entirely on a normal screen. */
.d-grid { column-count: 2; column-gap: 28px; }
.d-row {
  break-inside: avoid; -webkit-column-break-inside: avoid;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.d-k {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 5px;
}
.d-v { font-size: 14px; line-height: 1.55; }
.d-sub { font-size: 13px; color: var(--faint); margin-top: 5px; line-height: 1.62; }

.meter { display: inline-block; width: 60px; height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-left: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- filters ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: 12.5px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--accent-dim); background: rgba(45,212,191,.09); color: var(--accent); }
.chip[aria-pressed="false"] i { opacity: .3; }

/* ---------- results table ---------- */

.results { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.row {
  display: grid;
  grid-template-columns: 32px minmax(150px, 1.6fr) 104px 104px minmax(120px, 1.4fr) 74px;
  gap: 14px; align-items: center; padding: 12px 18px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--panel-2); }
.row.on { background: rgba(45,212,191,.07); box-shadow: inset 3px 0 0 var(--accent); }
.row:focus { outline: none; background: var(--panel-2); }

.row.head {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding-top: 11px; padding-bottom: 11px;
  background: var(--panel-2); cursor: default;
}
.row.head:hover { background: var(--panel-2); }
.row.head .num { text-align: right; }

.rank { color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.place .c { font-weight: 500; }
.place .r { font-size: 11.5px; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.num.dim { color: var(--muted); }

.barcell { display: flex; align-items: center; gap: 9px; }
.bar { flex: 1; height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.bar > i.mid { background: var(--amber); }
.bar > i.far { background: var(--warn); }
.yrs { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 46px; }

.age { text-align: right; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.age.now { color: var(--good); }
.age.never { font-size: 12.5px; font-weight: 400; color: var(--faint); }

.empty { padding: 40px 18px; text-align: center; color: var(--muted); }

/* ---------- sensitivity ---------- */

.sens table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sens th, .sens td {
  padding: 9px 12px; text-align: right;
  border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.sens th:first-child, .sens td:first-child { text-align: left; }
.sens th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.sens tr:last-child td { border-bottom: none; }

/* ---------- FAQ ----------
   Open articles, not accordions: on a dedicated page there is nothing to
   save space for, and hiding answers behind clicks just costs taps.

   .faq mirrors .panel's card treatment directly rather than adding the class
   in HTML — the About page's prose already sits in a .panel, so without this
   the FAQ was the one page with no card background, plain text floating on
   the page background while the calculator and About both read as panels. */

.faq {
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 22px;
}

.faq-item {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.faq-item:first-child { padding-top: 22px; }
.faq-item:last-child { border-bottom: none; padding-bottom: 22px; }

.faq-item h2 {
  margin: 0 0 12px;
  font-size: 20px; font-weight: 600; letter-spacing: -0.015em;
  color: var(--text); line-height: 1.35;
}

.faq-body {
  color: var(--muted); font-size: 14.5px; line-height: 1.75; max-width: 72ch;
}
.faq-body p { margin: 0 0 13px; }
.faq-body p:last-child { margin-bottom: 0; }
.faq-body strong { color: var(--text); font-weight: 600; }

@media (max-width: 980px) {
  .cmp-picks { flex-direction: column; align-items: stretch; }
  .cmp-head, .cmp-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cmp-head .cmp-k, .cmp-row .cmp-k { grid-column: 1 / -1; margin-bottom: 2px; }
  .cmp-note { padding-left: 0; }

  /* One column on a phone — two would be ~160px each, unreadable. */
  .popup { width: calc(100vw - 20px); max-height: 82vh; padding: 16px; }
  .popup .d-grid { column-count: 1; }
  .popup .d-money { grid-template-columns: repeat(3, 1fr); }
  .layout { grid-template-columns: 1fr; }
  .summary { grid-template-columns: 1fr; }
  .row { grid-template-columns: 24px 1fr 88px 64px; row-gap: 8px; }
  .row .barcell { grid-column: 1 / -1; }
  .row.head { display: none; }
  .d-money { grid-template-columns: 1fr; }
  .d-row { grid-template-columns: 1fr; gap: 4px; }
  #chart { height: 340px; }
}
