:root {
  --paper: #f1e8d4;
  --paper-2: #f7f0e1;
  --ink: #2c2418;
  --ink-2: #5d5141;
  --muted: #8a7b64;
  --rule: #cdbf9f;
  --sea: #dfe4d6;
  --grat: rgb(70 92 98 / 0.22);
  --coast: #6e6150;
  --land-none: #e6dcc3;
  --cmp-a: #2f6c9e;
  --cmp-b: #c9792b;
  --cmp-same: #cfc4a8;
  --accent: #8c2f1f;
  --good: #4a6b3a;
  --bad: #9a3b2b;
  --t-F: #6a4a86;
  --t-V: #5e8a5c;
  --t-E: #8fae78;
  --t-O: #c3c486;
  --t-A: #d8b168;
  --t-W: #c98b5c;
  --t-R: #a85a4a;
  --t-N: #5a2c28;
  --seq-0: #f2e6c4;
  --seq-1: #cdd19c;
  --seq-2: #7ea27d;
  --seq-3: #2f5a50;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "EB Garamond", Georgia, serif;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #142029;
    --paper-2: #1a2833;
    --ink: #ece2c9;
    --ink-2: #c8bc9f;
    --muted: #93897a;
    --rule: #34444f;
    --sea: #0f1a22;
    --grat: rgb(236 226 201 / 0.09);
    --coast: #0c141a;
    --land-none: #26343e;
    --cmp-a: #5d9bd0;
    --cmp-b: #e0954a;
    --cmp-same: #3a4954;
    --accent: #e0a35f;
    --good: #9cc58a;
    --bad: #e38c78;
    --t-F: #a589c9;
    --t-V: #6fa36c;
    --t-E: #97b981;
    --t-O: #c2c47f;
    --t-A: #d9b064;
    --t-W: #cc8a58;
    --t-R: #b5604f;
    --t-N: #6e3530;
    --seq-0: #253641;
    --seq-1: #3f6560;
    --seq-2: #7ea883;
    --seq-3: #e3d9a8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[v-cloak] { display: none; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.5 var(--body);
  font-variant-numeric: lining-nums tabular-nums;
  background:
    radial-gradient(ellipse at 50% 0%, transparent 40%, rgb(90 60 20 / 0.08) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.27 0 0 0 0 0.15 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--paper);
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
small { color: var(--muted); }
b { font-weight: 600; }
.eyebrow { font-variant: all-small-caps; letter-spacing: 0.14em; font-size: 15px; color: var(--muted); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-style: italic; }
.x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 0 4px; }
.sw { display: inline-block; width: 12px; height: 12px; border: 1px solid rgb(0 0 0 / 0.25); margin-right: 7px; vertical-align: -1px; flex: none; }
.loading { padding: 80px; text-align: center; font-style: italic; color: var(--muted); }

/* Masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 32px 14px; border-bottom: 3px double var(--ink);
  position: sticky; top: 0; z-index: 25; background: var(--paper);
}
.masthead h1 {
  margin: 0; font: 600 34px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase;
}
.masthead nav { display: flex; gap: 8px; align-items: center; }
.adv-toggle { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-variant: all-small-caps; letter-spacing: 0.1em; font-size: 16px; cursor: pointer; }
.adv-toggle input { accent-color: var(--accent); }
.finder { position: relative; margin-top: 12px; }
.finder input { width: 100%; padding: 7px 10px; background: var(--paper); border: 1px solid var(--ink); font-size: 16px; }
.finder ul { position: absolute; left: 0; right: 0; bottom: 100%; margin: 0 0 4px; padding: 0; list-style: none; background: var(--paper-2); border: 1px solid var(--ink); text-align: left; z-index: 5; }
.finder li { display: flex; justify-content: space-between; padding: 5px 10px; cursor: pointer; }
.finder li:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.bloc { font-size: 13px; font-style: italic; color: var(--t-F); margin-right: 6px; }
.none { color: var(--muted); }
.masthead nav button {
  border: 1px solid var(--ink-2); background: transparent; padding: 4px 14px;
  font-variant: all-small-caps; letter-spacing: 0.1em; font-size: 16px;
}
.masthead nav button:hover { background: var(--ink); color: var(--paper); }

/* Hero map */
.hero { position: relative; padding: 18px 32px 8px; }
.stage-wrap { height: clamp(380px, calc(100vh - 150px), 820px); }
.stage {
  position: relative; width: 100%; height: 100%;
  border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 4px;
  background: var(--paper-2); overflow: hidden;
}
.stage.full {
  position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 30; border: 0; outline: 0;
  transition: clip-path 0.75s var(--ease);
}
.stage-inner { position: absolute; inset: 0; transform-origin: center; transition: transform 0.75s var(--ease); }
.stage.no-anim, .stage.no-anim .stage-inner { transition: none; }
.stage-inner > svg { display: block; width: 100%; height: 100%; transform-origin: 0 0; }
.stage-inner > svg.moving { will-change: transform; }
.stage.full .stage-inner > svg { cursor: grab; }
.sphere { fill: var(--sea); }
.graticule { fill: none; stroke: var(--grat); stroke-width: calc(0.5px / var(--k, 1)); }
.sphere-edge { fill: none; stroke: var(--ink); stroke-width: calc(1.1px / var(--k, 1)); pointer-events: none; }
.land {
  fill: var(--land-none); stroke: var(--coast); stroke-width: calc(0.3px / var(--k, 1));
  cursor: pointer; transition: fill 0.5s ease, opacity 0.3s;
}
.land.nodata { cursor: default; }
.outline { fill: none; pointer-events: none; }
.outline.hover { stroke: var(--ink); stroke-width: calc(1px / var(--k, 1)); }
.outline.home { stroke: var(--paper-2); stroke-width: calc(1.2px / var(--k, 1)); }
.home-mark { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.home-mark::before, .home-mark i {
  content: ""; position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--paper-2);
}
.home-mark i { background: none; border-color: var(--accent); animation: ping 1.8s ease-out infinite; }
.home-mark.a::before { background: var(--cmp-a); }
.home-mark.a i { border-color: var(--cmp-a); }
.home-mark.b::before { background: var(--cmp-b); }
.home-mark.b i { border-color: var(--cmp-b); }
@keyframes ping { from { transform: scale(0.6); opacity: 1; } to { transform: scale(3); opacity: 0; } }
.stage svg.compass {
  position: absolute; right: 18px; bottom: 14px; width: 84px; height: auto; color: var(--ink); opacity: 0.75; pointer-events: none;
  transform-origin: 0 0; transition: transform 0.75s var(--ease);
}
.stage.no-anim svg.compass { transition: none; }
.compass .ring { fill: none; stroke: currentColor; stroke-width: 0.7; }
.compass .dark polygon { fill: currentColor; }
.compass .lite polygon { fill: var(--paper-2); stroke: currentColor; stroke-width: 0.6; }
.compass text { font: 600 13px var(--display); fill: currentColor; text-anchor: middle; }
.stage.full svg.compass { right: auto; left: 22px; bottom: 22px; }

.cartouche {
  position: absolute; left: 52px; bottom: 30px; max-width: 290px; padding: 14px 18px 12px;
  background: color-mix(in oklab, var(--paper-2) 92%, transparent);
  border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 3px; text-align: center;
}
.cartouche h2 { margin: 2px 0 10px; font: 600 22px/1.15 var(--display); }
.cartouche p { margin: 8px 0 0; font-style: italic; font-size: 14px; color: var(--ink-2); }
.seq-scale i { display: block; height: 10px; border: 1px solid var(--ink); }
.seq-scale div { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* Section headings with ornamental rules */
.ornament { display: flex; align-items: center; gap: 18px; margin: 40px 0 22px; font: 600 26px var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.ornament::before, .ornament::after { content: ""; flex: 1; border-top: 3px double var(--ink-2); }
.ornament span::before, .ornament span::after { content: "❦"; font-size: 18px; color: var(--accent); margin: 0 12px; }

.notables, .distribution, .gazetteer { padding: 0 32px; max-width: 1280px; margin: 0 auto; }
.notable-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.notable {
  text-align: center; background: var(--paper-2); border: 1px solid var(--ink-2); outline: 1px solid var(--rule); outline-offset: 3px;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; transition: transform 0.25s var(--ease);
}
.notable:hover { transform: translateY(-3px); }
.n-name { font: 600 21px var(--display); }
.n-note { font-style: italic; font-size: 14px; color: var(--ink-2); }

/* Gazetteer */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters input.search, .filters select, .rule select {
  background: var(--paper-2); border: 1px solid var(--rule); padding: 6px 10px; border-radius: 0;
}
.filters .search { flex: 1 1 220px; }
.min { display: flex; align-items: center; gap: 8px; font-style: italic; }
input[type="range"] { accent-color: var(--accent); }
.rules { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0 4px; font-style: italic; }
.rule { display: inline-flex; gap: 4px; font-style: normal; }
.rule select { font-size: 15px; padding: 3px 6px; }
.table-meta { margin: 14px 0 6px; font-size: 14px; font-style: italic; color: var(--muted); }
.table-wrap { overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
table.gz { width: 100%; border-collapse: collapse; }
.gz th {
  text-align: left; padding: 8px 10px; font-weight: 500; font-variant: all-small-caps; letter-spacing: 0.1em;
  font-size: 16px; color: var(--ink-2); border-bottom: 1px solid var(--ink); cursor: pointer; white-space: nowrap;
}
.gz th.num { text-align: right; }
.gz th.sorted { color: var(--accent); }
.gz th .arrow { margin-left: 3px; }
.gz td { padding: 6px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.gz tbody tr { cursor: pointer; transition: background 0.15s; }
.gz tbody tr:hover { background: color-mix(in oklab, var(--accent) 7%, transparent); }
.num { text-align: right; }
.rk { color: var(--muted); }
.strong { font-weight: 600; font-size: 18px; }
.nation small { font-style: italic; margin-left: 4px; }
.flag { font-size: 20px; vertical-align: -2px; }
.flag.big { font-size: 46px; }
.comp { width: 26%; min-width: 180px; }
.delta small { display: block; font-size: 12px; font-style: italic; line-height: 1.1; }
.up { color: var(--good); }
.down { color: var(--bad); }
.compbar { display: flex; height: 9px; background: color-mix(in oklab, var(--rule) 40%, transparent); }
.compbar i { display: block; height: 100%; transition: width 0.4s var(--ease); }
.compbar.tall { height: 20px; border: 1px solid var(--ink); margin-bottom: 8px; }
.colophon { text-align: center; font-style: italic; font-size: 14px; color: var(--muted); margin: 26px 0 50px; }

/* Country plate */
.plate {
  position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(580px, 44vw); overflow-y: auto;
  background: var(--paper); border-left: 3px double var(--ink); padding: 22px 30px 50px;
  box-shadow: -18px 0 40px rgb(30 20 5 / 0.18);
  transform: translateX(104%); transition: transform 0.7s var(--ease); visibility: hidden;
}
.plate.open { transform: none; visibility: visible; }
.plate:not(.open) { transition: transform 0.45s ease-in, visibility 0s 0.45s; }
.plate > * { opacity: 0; transform: translateY(10px); transition: opacity 0.5s, transform 0.5s var(--ease); }
.plate.open > * { opacity: 1; transform: none; }
.plate.open > :nth-child(2) { transition-delay: 0.15s; }
.plate.open > :nth-child(3) { transition-delay: 0.22s; }
.plate.open > :nth-child(n + 4) { transition-delay: 0.3s; }
.sheet-handle { display: none; }
.plate-top { display: flex; justify-content: space-between; align-items: baseline; }
.plate-head { display: flex; align-items: center; gap: 16px; margin: 14px 0 6px; padding-bottom: 12px; border-bottom: 3px double var(--ink); }
.plate-head h2 { margin: 0; font: 600 40px/1.05 var(--display); }
.plate-head p { margin: 2px 0 0; font-style: italic; color: var(--ink-2); }
.score-line { display: flex; align-items: center; gap: 22px; margin: 14px 0 4px; flex-wrap: wrap; }
.big-score b { display: block; font: 600 56px/0.9 var(--display); }
.big-score span { font-variant: all-small-caps; letter-spacing: 0.14em; color: var(--muted); }
.ranks { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 18px; margin: 0; }
.ranks dt { font-variant: all-small-caps; letter-spacing: 0.1em; color: var(--muted); font-size: 14px; }
.ranks dd { margin: 0; font: 600 22px var(--display); }
.sec { font: 600 21px var(--display); letter-spacing: 0.06em; text-transform: uppercase; margin: 26px 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--ink-2); }
.comp-table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.comp-table td { padding: 3px 0; border-bottom: 1px dotted var(--rule); }
.comp-table td.num { padding-left: 14px; }
.comp-table .share { color: var(--muted); width: 48px; }
.lede { margin: 0 0 10px; }
.work-list { display: grid; gap: 3px; }
.work-row { display: grid; grid-template-columns: 1fr 74px 30% 56px; gap: 10px; align-items: center; font-size: 15.5px; padding: 1px 0; }
.work-row:hover { color: var(--accent); }
.plain-link { margin: 14px 0 0; font-style: italic; }
.work-head span { white-space: nowrap; }
.work-head, .work-head:hover { color: var(--ink-2); font-size: 13px; font-variant: all-small-caps; letter-spacing: 0.08em; }
.work-head .wbar { background: none; }
.gdp { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.wbar { height: 8px; background: color-mix(in oklab, var(--rule) 40%, transparent); }
.wbar i { display: block; height: 100%; background: var(--t-F); transition: width 0.4s var(--ease); }
.obs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.obs li { padding-left: 24px; position: relative; font-size: 16px; line-height: 1.5; }
.obs li::before { position: absolute; left: 0; top: 0; width: 16px; text-align: center; font-size: 14px; line-height: 24px; }
.obs li.good::before { content: "✦"; color: var(--good); }
.obs li.bad::before { content: "✕"; color: var(--bad); }
.obs li.fact::before { content: "◈"; color: var(--accent); }
.note { font-size: 14px; font-style: italic; color: var(--muted); margin-top: 18px; }

.cmp.up { color: var(--good); }
.cmp.down { color: var(--bad); }
.cmp.same { color: var(--muted); }
.tip .cmp { font-style: normal; }
.open-list:hover { border-color: var(--ink); }
.side-a { color: var(--cmp-a); }
.side-b { color: var(--cmp-b); }
.compare-entry { margin: 4px 0 12px; }
.compare-entry .picker { display: block; }
.compare-entry .picker input { width: 100%; }
.plate-head .compare-btn { margin-left: auto; align-self: center; white-space: nowrap; }
.compare-btn.active { background: var(--ink); color: var(--paper); }
.picker li.active, .finder li.active { background: color-mix(in oklab, var(--accent) 14%, transparent); }
.compare-btn, .vs-actions button { border: 1px solid var(--ink-2); background: transparent; padding: 4px 12px; font-variant: all-small-caps; letter-spacing: 0.1em; font-size: 16px; }
.compare-btn:hover, .vs-actions button:hover { background: var(--ink); color: var(--paper); }
.vs-head { flex-direction: column; align-items: flex-start; gap: 10px; }
.vs-head h2 { font-size: 32px; }
.vs-head em { font-size: 22px; color: var(--muted); margin: 0 4px; }
.vs-actions { display: flex; gap: 8px; }
.profile-share { margin: 10px 0 4px; }
.vs-table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.vs-table th, .vs-table td { padding: 5px 6px; border-bottom: 1px dotted var(--rule); text-align: right; font-weight: 400; }
.vs-table thead th { font-variant: all-small-caps; letter-spacing: 0.08em; font-size: 16px; border-bottom: 1px solid var(--ink); }
.vs-table tbody th { text-align: left; }
.vs-table small { display: block; color: var(--muted); font-size: 13px; }
.win { font-weight: 600; }
.tier-row th, .tier-row td { font-size: 15px; color: var(--ink-2); }
.vs-gaps { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0 4px; }
.vs-gaps h4 { margin: 4px 0 6px; font-variant: all-small-caps; letter-spacing: 0.08em; font-size: 16px; font-weight: 600; }
.vs-gaps ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.vs-gaps small { display: block; color: var(--muted); }
.cmp.side-a { color: var(--cmp-a); }
.cmp.side-b { color: var(--cmp-b); }
.open-list { margin-top: 12px; width: 100%; padding: 8px; border: 1px solid var(--ink-2); background: transparent; font-variant: all-small-caps; letter-spacing: 0.1em; font-size: 17px; }

.focus-pane {
  position: fixed; z-index: 36; top: 0; left: 0; bottom: 0; right: min(580px, 44vw);
  display: flex; flex-direction: column; pointer-events: none; opacity: 0; transition: opacity 0.4s;
}
.focus-pane.show { opacity: 1; transition-delay: 0.25s; }
.focus-pane.show > * { pointer-events: auto; }
.focus-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 10px 18px;
  background: var(--paper); border-bottom: 3px double var(--ink); box-shadow: 0 6px 18px rgb(30 20 5 / 0.12);
}
.view-toggle { display: flex; border: 1px solid var(--ink); }
.view-toggle button { border: 0; background: transparent; padding: 4px 16px; font-variant: all-small-caps; letter-spacing: 0.12em; font-size: 17px; }
.view-toggle button.active { background: var(--ink); color: var(--paper); }
.lg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.lg-title { font-variant: all-small-caps; letter-spacing: 0.12em; color: var(--muted); margin-right: 4px; }
.lg-row button { display: inline-flex; align-items: center; border: 1px solid transparent; background: none; padding: 1px 7px; font-size: 14.5px; transition: opacity 0.2s; }
.lg-row button:hover { border-color: var(--rule); }
.lg-row button.active { border-color: var(--ink); background: var(--paper-2); }
.lg-row button.faded { opacity: 0.45; }
.lg-row small { margin-left: 4px; }
.dest-view { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); padding: 14px 24px 0; }
.dest-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.dest-head h2 { margin: 0; font: 600 26px var(--display); }
.dest-head input { flex: 0 1 260px; background: var(--paper-2); border: 1px solid var(--rule); padding: 5px 10px; }
.dest-scroll { flex: 1; overflow-y: auto; border-top: 2px solid var(--ink); padding-bottom: 40px; }
.dest-table th { position: sticky; top: 0; background: var(--paper); }
.dest-table td.cmp { font-size: 18px; }

.ranking { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ranking > span:first-child { font-variant: all-small-caps; letter-spacing: 0.12em; color: var(--muted); margin-right: 4px; }
.ranking button { border: 1px solid var(--rule); background: transparent; padding: 3px 12px; font-size: 16px; }
.ranking button:hover { border-color: var(--ink); }
.info { position: relative; margin-left: 4px; cursor: help; color: var(--muted); font-size: 17px; outline: none; }
.info-pop {
  position: absolute; z-index: 80; top: 130%; right: -10px; width: min(420px, 86vw); display: none; flex-direction: column; gap: 8px;
  padding: 14px 16px; background: var(--paper-2); border: 1px solid var(--ink); box-shadow: 4px 4px 0 rgb(30 20 5 / 0.15);
  color: var(--ink); font-size: 15px; line-height: 1.4; text-align: left; font-variant: normal; letter-spacing: 0; cursor: default;
}
.info:hover .info-pop, .info:focus .info-pop, .info:focus-within .info-pop { display: flex; }
.info-pop em { font-style: normal; font-weight: 600; }
.masthead nav button.me { border-color: var(--accent); color: var(--accent); }
.masthead nav button.me:hover { background: var(--accent); color: var(--paper); }
.pp-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--ink); background: var(--paper-2); }
.pp-chip.hypo { border-style: dashed; color: var(--ink-2); }
.pp-chip .x { font-size: 20px; }
.picker { position: relative; flex: 1 1 200px; }
.picker input { width: 100%; padding: 5px 10px; background: var(--paper-2); border: 1px solid var(--rule); }
.picker ul { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none; background: var(--paper-2); border: 1px solid var(--ink); }
.picker li { padding: 4px 10px; cursor: pointer; }
.picker li:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.comp-table .gain { color: var(--good); width: 40px; }
.bar-note { margin: -2px 0 10px; }
.ranked-by { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0 12px; }
.ranked-by span { font-variant: all-small-caps; letter-spacing: 0.12em; color: var(--muted); margin-right: 4px; }
.ranked-by button { border: 1px solid var(--rule); background: transparent; padding: 2px 10px; font-size: 15px; }
.ranked-by button:hover { border-color: var(--ink); }
.ranked-by button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.standing { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-bottom: 14px; }
.standing .eyebrow { display: block; }
.standing b { font: 600 40px/1 var(--display); }
.standing p { margin: 2px 0 0; font-style: italic; color: var(--ink-2); font-size: 15px; }
.standing .up { color: var(--good); font-size: 18px; }
.contrib { padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--rule); }
.contrib.hypo { border-style: dashed; }
.contrib.active { border-color: var(--ink); background: var(--paper-2); }
.contrib-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.contrib-tiers { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; font-size: 15px; }
.contrib-tiers span { display: inline-flex; align-items: center; }
.contrib-list { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 14.5px; }
.contrib-list small { font-style: italic; margin-left: 5px; }
.recs { display: grid; gap: 2px; }
.rec { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 5px 0; border-bottom: 1px dotted var(--rule); }
.rec small { font-style: italic; }
.try { border: 1px solid var(--ink-2); background: transparent; padding: 1px 12px; font-variant: all-small-caps; letter-spacing: 0.1em; }
.try:hover { background: var(--ink); color: var(--paper); }
.ranking button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.tip {
  position: fixed; z-index: 60; pointer-events: none; display: grid; gap: 1px; min-width: 170px;
  padding: 7px 12px; background: var(--paper-2); border: 1px solid var(--ink); font-size: 15px;
  box-shadow: 3px 3px 0 rgb(30 20 5 / 0.15);
}
.tip span { font-style: italic; color: var(--ink-2); font-size: 14px; }

/* Drawers */
.scrim { position: fixed; inset: 0; z-index: 65; background: rgb(20 14 5 / 0.3); }
.drawer {
  position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(390px, 92vw); overflow-y: auto;
  background: var(--paper); border-right: 3px double var(--ink); padding: 18px 24px 40px;
  transform: translateX(-104%); transition: transform 0.5s var(--ease);
}
.drawer.right { left: auto; right: 0; width: min(560px, 94vw); border-right: 0; border-left: 3px double var(--ink); transform: translateX(104%); }
.drawer.open { transform: none; }
.drawer header { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px double var(--ink); padding-bottom: 8px; }
.drawer h2 { margin: 0; font: 600 26px var(--display); letter-spacing: 0.04em; }
.drawer section { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.drawer h3 { margin: 0 0 8px; font-variant: all-small-caps; letter-spacing: 0.14em; font-weight: 500; font-size: 17px; color: var(--ink-2); }
.drawer h4 { margin: 12px 0 4px; font-style: italic; font-weight: 400; }
.slider { display: grid; grid-template-columns: 1fr 110px 38px; gap: 8px; align-items: center; font-size: 15px; margin: 3px 0; }
.slider span { display: flex; align-items: center; }
.slider b { text-align: right; font-weight: 500; font-size: 14px; }
.slider input { width: 100%; }
.hint { margin: 2px 0 6px; font-size: 14px; font-style: italic; color: var(--muted); }
.method h3 { font: 600 20px var(--display); margin: 18px 0 4px; }
.method code { font-size: 14px; background: var(--paper-2); padding: 0 4px; }

.histo { margin: 0; }
.histo svg { display: block; width: 100%; height: auto; overflow: visible; }
.histo rect { cursor: pointer; }
.histo rect.eu, .histo .sw.eu { fill: var(--t-F); background: var(--t-F); }
.histo rect.bloc, .histo .sw.bloc { fill: var(--t-E); background: var(--t-E); }
.histo rect.none, .histo .sw.none { fill: var(--ink-2); background: var(--ink-2); opacity: .55; }
.histo rect:hover, .histo rect.focus { fill: var(--accent); opacity: 1; }
.histo .axis { stroke: var(--rule); vector-effect: non-scaling-stroke; }
.histo .tick { font-size: 10px; fill: var(--ink-2); text-anchor: middle; }
.histo figcaption { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.histo figcaption .sw { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.histo .hint { font-style: italic; }
.remember { display: flex; gap: 8px; align-items: center; margin: 14px 0 2px; font-size: 16px; }
@media (max-width: 860px) {
  body { font-size: 16px; }

  /* Header: title, full-width ranking switch, then actions */
  /* Header: title and ranking switch stay pinned; actions move to a footer bar */
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .masthead { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 10px 12px 8px; }
  .masthead h1 { font-size: 21px; }
  .ranking { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 4px; }
  .ranking > span:first-child { display: none; }
  .ranking button { padding: 5px 2px; font-size: 15px; }
  .masthead nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    background: var(--paper); border-top: 3px double var(--ink); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .masthead nav button { text-align: center; padding: 8px 4px; font-size: 15px; }
  body.full .masthead nav { display: none; }
  .adv-toggle, .masthead nav button.adjust { display: none; }
  .info { align-self: center; padding: 4px; }
  .info-pop { position: fixed; top: auto; left: 12px; right: 12px; width: auto; margin-top: 8px; max-height: 70vh; overflow-y: auto; }

  .hero, .notables, .distribution, .gazetteer { padding-left: 12px; padding-right: 12px; }
  .hero { padding-top: 12px; }
  .stage-wrap { height: 58vw; min-height: 220px; }
  .stage { outline-offset: 2px; }
  .cartouche { position: static; max-width: none; margin: 14px 0 0; padding: 12px 14px; }
  .cartouche h2 { font-size: 19px; }
  .stage svg.compass { width: 40px; right: 6px; bottom: 4px; }

  .ornament { font-size: 19px; gap: 10px; margin: 28px 0 14px; }
  .ornament span::before, .ornament span::after { font-size: 13px; margin: 0 6px; }

  /* Notable entries become a swipeable strip */
  .notable-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding: 4px 4px 10px; margin: 0 -12px; padding-left: 16px; }
  .notable { flex: 0 0 72%; scroll-snap-align: start; padding: 10px; }
  .n-name { font-size: 18px; }

  /* Ranking table: rank, passport, rights, change */
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .filters .search { grid-column: 1 / -1; }
  .table-meta { font-size: 13px; }
  .gz td, .gz th { padding: 6px 5px; }
  .gz th { font-size: 13px; white-space: normal; line-height: 1.1; }
  .gz .delta { width: 44px; }
  .gz td { white-space: normal; }
  .gz td.num, .gz td.rk { white-space: nowrap; }
  .gz .bloc { white-space: normal; }
  .nation .sub, .gz .cnt { display: none; }
  .nation b { font-size: 15.5px; }
  .bloc { margin-right: 0; }

  /* Country view: map on top, bottom sheet with a handle */
  .plate {
    top: auto; left: 0; width: 100%; height: var(--sheet-h, 62vh); border-left: 0; border-top: 3px double var(--ink);
    padding: 22px 16px 40px; transform: translateY(104%); transition: transform 0.6s var(--ease), height 0.4s var(--ease);
  }
  .sheet-dragging .plate, .sheet-dragging .focus-pane { transition: none; }
  .sheet-handle {
    display: block; position: sticky; top: -22px; margin: -22px -16px 4px; width: calc(100% + 32px); height: 34px;
    border: 0; background: var(--paper); z-index: 2; touch-action: none; cursor: grab;
  }
  .sheet-handle i { display: block; width: 44px; height: 5px; margin: 0 auto; border-radius: 3px; background: var(--rule); }
  .listing .plate { transform: translateY(104%); }
  .focus-pane { right: 0; bottom: var(--sheet-h, 62vh); transition: bottom 0.4s var(--ease), opacity 0.4s; }
  .listing .focus-pane { bottom: 0; }
  .focus-bar { gap: 6px 10px; padding: 8px 10px; }
  .view-toggle button { padding: 3px 12px; font-size: 15px; }
  .lg-row { gap: 2px; }
  .lg-row button { padding: 1px 5px; font-size: 13px; }
  .lg-row .sw { width: 10px; height: 10px; margin-right: 4px; }
  .lg-row small { margin-left: 3px; font-size: 11px; }
  .lg-title { display: none; }
  .focus-bar .lg-row:last-child { order: 1; }
  .focus-bar .lg-row:nth-child(2) { order: 2; flex-basis: 100%; }
  .dest-view { padding: 10px 12px 0; }
  .dest-head h2 { font-size: 19px; }
  .dest-head input { flex: 1 1 100%; }
  .col-region { display: none; }
  .dest-table td:nth-child(3) { white-space: nowrap; }
  .stage.full svg.compass { display: none; }
  .plate-head h2 { font-size: 32px; }
  .flag.big { font-size: 36px; }
  .big-score b { font-size: 44px; }
  .ranks { grid-template-columns: repeat(3, auto); gap: 2px 14px; }
  .ranks dd { font-size: 19px; }
  .work-row { grid-template-columns: 1fr 70px 46px; gap: 8px; }
  .work-row .wbar { display: none; }
  .standing b { font-size: 34px; }
  .rec { grid-template-columns: 1fr auto; }
  .rec small { grid-column: 1; grid-row: 2; }
  .rec .try { grid-row: 1 / span 2; grid-column: 2; }
  .drawer, .drawer.right { width: 100vw; }
}
