:root {
  --bg: #f6f1e5; --bg-surface: #fffdf7; --text-primary: #1e1c15; --text-secondary: #5c5747;
  --text-muted: #8a8474; --border: #e2d9c4; --border-strong: #c9bfa4; --accent: #1d3a5f;
  --accent2: #4d7a3a; --oxide: #a34a2a; --focus: #1d3a5f; --map-bg: #ece5d2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191713; --bg-surface: #22201a; --text-primary: #ece7d8; --text-secondary: #b7b09c;
    --text-muted: #8a8474; --border: #3a362c; --border-strong: #57503d; --accent: #7aa8e0;
    --accent2: #8fb573; --oxide: #d08a6a; --focus: #7aa8e0; --map-bg: #22262b;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text-primary);
  font-family: Georgia, "Times New Roman", serif; line-height: 1.65; }
main { max-width: 46rem; margin: 0 auto; padding: 0 1rem 3rem; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0.4rem 0 0.8rem; max-width: 20ch; }
h2 { font-size: 1.45rem; margin: 2.8rem 0 0.8rem; line-height: 1.25; }
h3 { font-size: 1.08rem; margin: 1.7rem 0 0.5rem; }
p { margin: 0.7rem 0; }
a { color: var(--accent); }
.num, .mval, .vl, .toplist em, .bar-val, .rk, .rrank { font-variant-numeric: tabular-nums; }
.kicker { font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.8rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); margin: 1.2rem 0 0; }
.deck { font-size: 1.1rem; color: var(--text-secondary); }
.byline { font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.8rem; color: var(--text-muted); }
.note { font-size: 0.88rem; color: var(--text-secondary); }
.topbar { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 10; }
.topbar .brand { font-weight: bold; color: var(--text-primary); text-decoration: none;
  font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.9rem; white-space: nowrap; }
nav.rail { display: flex; gap: 0.9rem; overflow-x: auto; font-family: -apple-system, "Segoe UI", sans-serif;
  font-size: 0.85rem; }
nav.rail a { color: var(--text-secondary); text-decoration: none; white-space: nowrap; }
nav.rail a[aria-current="true"] { color: var(--text-primary); font-weight: bold; }
a.lang { font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.82rem; font-weight: bold;
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 0.15rem 0.5rem;
  text-decoration: none; color: var(--text-primary); white-space: nowrap; margin-left: auto; }
/* side dots: section jumps, desktop only */
.dots { display: none; }
@media (min-width: 1000px) {
  .dots { display: flex; flex-direction: column; gap: 0.75rem; position: fixed;
    right: 1.2rem; top: 50%; transform: translateY(-50%); z-index: 9; }
  .dots a { position: relative; width: 10px; height: 10px; border-radius: 50%;
    border: 1.5px solid var(--border-strong); background: transparent; padding: 0; }
  .dots a:hover { border-color: var(--accent); }
  .dots a[aria-current="true"] { background: var(--accent); border-color: var(--accent); }
  .dots a::after { content: attr(data-label); position: absolute; right: 1.2rem; top: 50%;
    transform: translateY(-50%); white-space: nowrap;
    font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.75rem;
    color: var(--text-secondary); background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: 6px; padding: 0.15rem 0.55rem;
    opacity: 0; pointer-events: none; transition: opacity 0.15s; }
  .dots a:hover::after, .dots a:focus-visible::after { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .dots a::after { transition: none; } }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* hero metric cards */
.mcards { display: grid; gap: 0.7rem; margin: 1.2rem 0 0.4rem; }
@media (min-width: 720px) { .mcards { grid-template-columns: 1fr 1fr 1fr; } }
.mcard { display: grid; gap: 0.1rem; text-align: left; cursor: pointer; color: var(--text-primary);
  background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 0.8rem 0.9rem; font-family: Georgia, serif; }
.mcard:hover { border-color: var(--accent); }
.mlabel { font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.75rem; font-weight: bold;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }
.mrank { font-size: 0.85rem; color: var(--oxide); font-weight: bold; }
.mname { font-size: 1.25rem; font-weight: bold; line-height: 1.2; }
.mval { font-size: 1.6rem; font-weight: bold; color: var(--accent); }
.mval small { font-size: 0.9rem; font-weight: normal; }
.msub { font-size: 0.8rem; color: var(--text-secondary); }
.cta { display: inline-block; font-family: -apple-system, "Segoe UI", sans-serif; font-weight: bold;
  font-size: 0.95rem; color: var(--bg); background: var(--text-primary); text-decoration: none;
  border-radius: 999px; padding: 0.55rem 1.2rem; }
button.cta { border: none; cursor: pointer; }
/* ranking controls */
.controls { position: sticky; top: 52px; background: var(--bg); padding: 0.6rem 0;
  border-bottom: 1px solid var(--border); z-index: 5; display: grid; gap: 0.5rem; }
.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg button { font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.85rem;
  padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--bg-surface); color: var(--text-primary); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text-primary); color: var(--bg);
  border-color: var(--text-primary); }
.search { display: grid; gap: 0.2rem; }
.search label { font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.8rem;
  color: var(--text-secondary); font-weight: bold; }
.search input { font-size: 1rem; padding: 0.5rem 0.7rem; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-primary);
  font-family: -apple-system, "Segoe UI", sans-serif; }
/* result card */
.result { border: 2px solid var(--text-primary); border-radius: 12px; padding: 0.9rem 1rem;
  margin: 0.8rem 0; background: var(--bg-surface); }
.result[hidden], .noresult[hidden] { display: none; }
.result h3 { margin: 0 0 0.3rem; font-size: 1.3rem; }
.rrow { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.25rem 0;
  border-top: 1px dashed var(--border); font-size: 0.95rem; }
.rrank { font-weight: bold; font-size: 1.05rem; }
.noresult { color: var(--text-secondary); }
.picklist { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.3rem; }
.picklist button { width: 100%; text-align: left; cursor: pointer;
  font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.9rem;
  color: var(--text-primary); background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 0.45rem 0.7rem; }
.picklist button:hover { border-color: var(--accent); }
.picklist small { color: var(--text-secondary); }
.linklike { background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); text-decoration: underline; font-size: 0.9rem;
  font-family: -apple-system, "Segoe UI", sans-serif; }
/* ranking list */
.ranking { list-style: none; padding: 0; margin: 0.8rem 0; }
.ranking li { display: grid; grid-template-columns: 3rem 1fr auto; gap: 0.1rem 0.7rem;
  padding: 0.45rem 0.2rem; border-bottom: 1px solid var(--border); align-items: baseline; }
.ranking li[hidden] { display: none; }
.ranking li.hit { background: var(--map-bg); border-radius: 6px; }
.rk { font-size: 1.05rem; font-weight: bold; color: var(--text-secondary); }
.nm { font-size: 1rem; }
.nm em { font-style: normal; font-size: 0.72rem; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 0.3rem; margin-left: 0.3rem;
  font-family: -apple-system, "Segoe UI", sans-serif; }
.ct { font-size: 0.8rem; color: var(--text-secondary); grid-column: 2;
  font-family: -apple-system, "Segoe UI", sans-serif; }
.vl { font-size: 1rem; font-weight: bold; grid-row: 1 / 3; grid-column: 3; text-align: right; }
.expand { font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.9rem; font-weight: bold;
  padding: 0.55rem 1.1rem; border-radius: 999px; border: 2px solid var(--text-primary);
  background: transparent; color: var(--text-primary); cursor: pointer; }
/* map */
.mapfig { margin: 1rem 0; }
.mapfig svg { width: 100%; height: auto; background: var(--map-bg); border-radius: 10px; }
.country { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.dot { fill: var(--text-muted); opacity: 0.55; cursor: pointer;
  stroke: transparent; stroke-width: 5; }
.dot.hot { fill: var(--oxide); opacity: 1; }
.dot:focus { outline: none; }
.dot:focus-visible { stroke: var(--oxide); }
.tip { position: fixed; z-index: 50; max-width: 15rem; pointer-events: none;
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 0.4rem 0.6rem; font-size: 0.85rem; line-height: 1.4;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.tip[hidden] { display: none; }
.tip small { color: var(--text-secondary); }
.mapfig figcaption { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.35rem; }
/* scale visual */
.nested { display: flex; justify-content: center; align-items: flex-end; gap: 1.2rem;
  margin: 1.2rem 0 3.2rem; }
.nested .sq { border: 2px solid var(--accent); background: rgba(29, 58, 95, 0.06);
  position: relative; flex: none; max-width: 100%; }
.nested .sq span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  font-size: 0.78rem; text-align: center; color: var(--text-secondary); white-space: nowrap;
  font-family: -apple-system, "Segoe UI", sans-serif; padding-top: 0.3rem; }
.strip { display: grid; gap: 0.3rem; margin: 1rem 0; }
.bar-row { display: grid; grid-template-columns: 7.5rem 1fr 3.2rem; gap: 0.5rem; align-items: center;
  font-size: 0.85rem; }
.bar-name { text-align: right; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.bar-track { background: var(--border); border-radius: 3px; height: 1rem; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar-val { font-variant-numeric: tabular-nums; }
/* top lists */
.toplist { list-style: none; padding: 0; margin: 0.8rem 0; }
.toplist li { display: grid; grid-template-columns: 1fr auto; gap: 0 0.7rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.toplist strong { font-size: 1rem; }
.toplist span { font-size: 0.82rem; color: var(--text-secondary); grid-column: 1;
  font-family: -apple-system, "Segoe UI", sans-serif; }
.toplist em { font-style: normal; font-weight: bold; grid-row: 1 / 3; grid-column: 2;
  align-self: center; font-variant-numeric: tabular-nums; }
/* key lists */
.keylist { list-style: none; padding: 0; margin: 1rem 0; }
.keylist li { padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.keylist strong { display: block; }
.keylist span { display: block; font-size: 0.95rem; }
/* abrud visual */
.abrud { display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin: 1.2rem 0; flex-wrap: wrap; }
.ab-side { text-align: center; max-width: 15rem; }
.ab-side .sq { border: 2px solid var(--accent); margin: 0 auto; }
.ab-side .sq.small { border-color: var(--text-muted); background: repeating-linear-gradient(
  45deg, transparent, transparent 6px, var(--border) 6px, var(--border) 8px); }
.ab-side .sq.big { background: rgba(29, 58, 95, 0.06); max-width: 100%; height: auto; aspect-ratio: 1; }
.ab-side p { font-size: 0.85rem; color: var(--text-secondary); }
.ab-side strong { font-size: 1.3rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.ab-arrow { font-size: 2rem; color: var(--oxide); }
/* faq */
details.faq { border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.9rem;
  margin: 0.6rem 0; background: var(--bg-surface); }
details.faq summary { cursor: pointer; font-weight: bold; }
details.faq p { font-size: 0.95rem; }
footer { border-top: 1px solid var(--border); padding: 1.2rem 1rem 2rem; text-align: center;
  font-family: -apple-system, "Segoe UI", sans-serif; font-size: 0.85rem; color: var(--text-secondary); }
footer a { color: var(--text-secondary); }
@media (max-width: 560px) {
  .nested { flex-direction: column; align-items: center; margin-bottom: 1rem; }
  .nested .sq { margin-bottom: 2.8rem; }
  .bar-row { grid-template-columns: 5.5rem 1fr 2.8rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
