:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #f0ebe1;
  --text: #1f1c17;
  --muted: #6b6457;
  --faint: #9a9284;
  --line: #e2dbcd;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e3ece7;
  --gold: #9a6a1f;
  --gold-soft: #f4e9d4;
  --link: #22584a;
  --row-hover: #f3eee4;
  --shadow: 0 1px 2px rgba(40, 32, 18, .06), 0 4px 16px rgba(40, 32, 18, .05);
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --surface: #1b1a16;
    --surface-2: #24221c;
    --text: #ece6da;
    --muted: #a69e8f;
    --faint: #7a7365;
    --line: #2f2c25;
    --accent: #7fb8a4;
    --accent-ink: #10201b;
    --accent-soft: #1f2e29;
    --gold: #d8a85a;
    --gold-soft: #2e2617;
    --link: #8cc7b2;
    --row-hover: #211f1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--sans);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 600 20px/1 var(--serif); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-size: 15px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); text-decoration: none; }
.search-form { margin-left: auto; position: relative; }
.search-form input {
  width: 220px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px;
}
.search-results {
  position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-width: 90vw; z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  list-style: none; margin: 0; padding: 6px; display: none;
}
.search-results.open { display: block; }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.search-results a:hover, .search-results a.active { background: var(--surface-2); text-decoration: none; }
.search-results small { color: var(--muted); white-space: nowrap; }

/* hero / intro */
.crumbs { font-size: 14px; color: var(--muted); margin: 20px 0 0; }
.crumbs a { color: var(--muted); }
h1 { font: 600 clamp(28px, 4.2vw, 40px)/1.15 var(--serif); letter-spacing: -.015em; margin: 14px 0 10px; }
h2 { font: 600 24px/1.25 var(--serif); margin: 36px 0 12px; }
h3 { font-size: 17px; margin: 24px 0 8px; }
.lede { font-size: 18px; max-width: 760px; color: var(--text); margin: 0 0 8px; }
.lede strong { font-weight: 600; }
.sub { color: var(--muted); max-width: 760px; margin: 0 0 18px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 150px; }
.stat b { display: block; font: 600 22px/1.2 var(--serif); }
.stat span { color: var(--muted); font-size: 13px; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--muted); background: var(--surface); }
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a[aria-current="page"]:hover { color: var(--accent-ink); }

/* ranking table */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; box-shadow: var(--shadow); }
table.rank { width: 100%; border-collapse: collapse; font-size: 15px; }
table.rank th {
  text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 12px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
table.rank td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.rank tr:last-child td { border-bottom: 0; }
table.rank tbody tr:hover { background: var(--row-hover); }
table.rank .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rank .r { color: var(--muted); width: 56px; font-variant-numeric: tabular-nums; }
table.rank .name a { color: var(--text); font-weight: 600; }
table.rank .name a:hover { color: var(--link); }
table.rank .name .meta { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
table.rank .age { font-weight: 600; }
table.rank .country { white-space: nowrap; }
table.rank .country a, table.rank .cat a { color: var(--muted); }
table.rank .cat { color: var(--muted); font-size: 14px; }
.flag { margin-right: 6px; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 4px;
  margin-left: 6px; vertical-align: 2px; letter-spacing: .02em;
}
.badge.v { background: var(--accent-soft); color: var(--accent); }
.badge.c { background: var(--gold-soft); color: var(--gold); }
.legend { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }
.legend .badge { margin-left: 0; margin-right: 4px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 8px; align-items: center; }
.pager a, .pager span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: var(--surface); }
.pager span.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pager span.gap { border: 0; background: none; color: var(--faint); }

/* cards / grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 12px 0 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--text); display: block; }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { display: block; font-weight: 600; }
.card span { color: var(--muted); font-size: 13px; }

/* entity page */
.entity-head { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; }
.age-block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 22px; text-align: center; box-shadow: var(--shadow); }
.age-block b { display: block; font: 600 44px/1 var(--serif); letter-spacing: -.02em; color: var(--accent); }
.age-block span { color: var(--muted); font-size: 14px; }
.facts { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.facts th, .facts td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.facts th { width: 200px; color: var(--muted); font-weight: 500; font-size: 14px; }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.note { background: var(--surface); border-left: 3px solid var(--accent); padding: 12px 16px; border-radius: 0 10px 10px 0; max-width: 760px; }
.warn { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 0 10px 10px 0; max-width: 760px; font-size: 15px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
ul.plain li span { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.prose { max-width: 760px; }
.prose li { margin: 4px 0; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.site-foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 28px 0 40px; color: var(--muted); font-size: 14px; background: var(--surface); }
.site-foot .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.site-foot a { color: var(--muted); }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot li { margin: 4px 0; }

@media (max-width: 760px) {
  .site-head .wrap { gap: 8px 12px; padding-top: 10px; }
  .nav { order: 3; width: 100%; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .nav::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 6px 8px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .tabs a { white-space: nowrap; }
  .search-form { order: 2; margin-left: 0; width: 100%; padding-bottom: 4px; }
  .search-form input { width: 100%; }
  table.rank .cat, table.rank .hide-sm { display: none; }
  table.rank td, table.rank th { padding: 10px 8px; }
  .cols { grid-template-columns: 1fr; }
  .site-foot .wrap { grid-template-columns: 1fr; }
  .facts th { width: 120px; }
  .age-block b { font-size: 36px; }
}
