/* Layout: a passport data page as the control panel, then a ranked grid of destination "visa stamps"
   or a world map; details and comparisons open in a dialog. */
:root {
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-2: #e3e9e7;
  --ink: #132221;
  --muted: #566664;
  --line: #cfd8d6;
  --accent: #0b5d66;
  --accent-ink: #ffffff;
  --guilloche: rgba(11, 93, 102, .07);
  --land: #d3dbd9;
  --ocean: #f6f9f8;

  --move: #12773a;  --move-bg: #e1f2e7;
  --perk: #6a3cbf;  --perk-bg: #ece5f8;
  --open: #1d64a8;  --open-bg: #e2edf8;
  --offer: #a35d00; --offer-bg: #f8ecd9;
  --blocked: #b42318; --blocked-bg: #fbe4e1;
  --home: #3d4a48;  --home-bg: #e6eaea;
  --v-free: #12773a; --v-eta: #4f9d5f; --v-voa: #8fb84a; --v-evisa: #d6a12b; --v-visa: #c2582b; --v-none: #8a1c13;
  --m-cost: #eda100; --m-safety: #2a78d6; --m-stab: #1baf7a; --m-fam: #e87ba4; --neg: #e34948; --neutral: #f0efec;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #4a3aa7;

  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1515; --surface: #152120; --surface-2: #1d2b2a; --ink: #e3ecea; --muted: #94a6a3;
    --line: #2a3a38; --accent: #5ec2cc; --accent-ink: #062224; --guilloche: rgba(94, 194, 204, .06);
    --land: #26302f; --ocean: #111b1a;
    --move: #5fd38a; --move-bg: #13301f; --perk: #b69aff; --perk-bg: #261d3d;
    --open: #73b2f0; --open-bg: #142a40; --offer: #f0ad4e; --offer-bg: #34260f;
    --blocked: #ff7a6b; --blocked-bg: #3a1714; --home: #c9d5d3; --home-bg: #1f2a29;
    --v-free: #4cc47b; --v-eta: #7fc98c; --v-voa: #b5d36a; --v-evisa: #e6b84a; --v-visa: #e27a4c; --v-none: #ff6b5b;
    --m-cost: #c98500; --m-safety: #3987e5; --m-stab: #199e70; --m-fam: #d55181; --neg: #e66767; --neutral: #383835;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #9085e9;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1515; --surface: #152120; --surface-2: #1d2b2a; --ink: #e3ecea; --muted: #94a6a3;
  --line: #2a3a38; --accent: #5ec2cc; --accent-ink: #062224; --guilloche: rgba(94, 194, 204, .06);
  --land: #26302f; --ocean: #111b1a;
  --move: #5fd38a; --move-bg: #13301f; --perk: #b69aff; --perk-bg: #261d3d;
  --open: #73b2f0; --open-bg: #142a40; --offer: #f0ad4e; --offer-bg: #34260f;
  --blocked: #ff7a6b; --blocked-bg: #3a1714; --home: #c9d5d3; --home-bg: #1f2a29;
  --v-free: #4cc47b; --v-eta: #7fc98c; --v-voa: #b5d36a; --v-evisa: #e6b84a; --v-visa: #e27a4c; --v-none: #ff6b5b;
  --m-cost: #c98500; --m-safety: #3987e5; --m-stab: #199e70; --m-fam: #d55181; --neg: #e66767; --neutral: #383835;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #9085e9;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 20px; }
@media (max-width: 480px) { .wrap { padding-inline: 16px; } }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.small { font-size: 12px; color: var(--muted); }
[hidden] { display: none !important; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 800; font-stretch: 125%; letter-spacing: .04em; font-size: 15px; text-transform: uppercase; }
.brand-mark { width: 26px; height: 32px; border-radius: 4px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 9px 6px; border: 2px solid var(--accent-ink); border-radius: 50%; }
.edition { font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .02em; }

/* Hero */
.hero { padding-block: 40px 24px; display: grid; gap: 28px; }
.hero > *, .pp-body > *, main > section { min-width: 0; }
.hero h1 { font-size: clamp(34px, 6vw, 64px); font-weight: 800; font-stretch: 112%; line-height: .98; letter-spacing: -.01em; max-width: 16ch; }
.hero p.lede { margin: 14px 0 0; max-width: 62ch; color: var(--muted); font-size: 17px; }

.passport {
  background: var(--surface);
  background-image:
    repeating-radial-gradient(circle at 85% 30%, var(--guilloche) 0 1px, transparent 1px 9px),
    repeating-radial-gradient(circle at 10% 110%, var(--guilloche) 0 1px, transparent 1px 11px);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.pp-body { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 28px; padding: 24px; }
@media (max-width: 860px) { .pp-body { grid-template-columns: minmax(0, 1fr); } }
.pp-label { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: block; margin-bottom: 6px; }
.pp-select-wrap { display: grid; gap: 14px; align-content: start; }
.pp-select {
  width: 100%; padding: 12px 40px 12px 14px; border-radius: 8px; border: 1.5px solid var(--ink); background-color: var(--surface);
  font-family: var(--f-display); font-weight: 700; font-size: 20px; font-stretch: 105%; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat;
}
.pp-select.small { font-size: 15px; padding-block: 8px; border-width: 1px; border-color: var(--line); font-weight: 600; }
.pp-hint { font-size: 13px; color: var(--muted); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); align-self: start; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 14px 16px; border-left: 1px solid var(--line); display: grid; gap: 2px; align-content: start; }
.stat:first-child { border-left: 0; }
@media (max-width: 640px) { .stat:nth-child(3) { border-left: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line); } }
.stat .n { font-family: var(--f-display); font-weight: 800; font-stretch: 118%; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .t { font-size: 13px; color: var(--muted); line-height: 1.3; }
.stat.move .n { color: var(--move); } .stat.perk .n { color: var(--perk); } .stat.open .n { color: var(--open); }
.mrz { background: var(--surface-2); border-top: 1px solid var(--line); padding: 12px 24px; font-family: var(--f-mono); font-size: clamp(10px, 1.6vw, 15px); letter-spacing: .14em; line-height: 1.6; white-space: pre; overflow-x: auto; color: var(--ink); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 10px 16px; font-family: var(--f-display); font-weight: 700; font-stretch: 105%; font-size: 16px; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Toolbar */
.toolbar { display: grid; gap: 12px; padding-block: 4px 18px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { flex: 1 1 220px; min-width: 0; }
.search input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.ctl { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ctl select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

details.prio { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.prio summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
details.prio summary::-webkit-details-marker { display: none; }
details.prio summary .sm { font-weight: 400; color: var(--muted); font-family: var(--f-mono); font-size: 12px; }
.sliders { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; padding: 4px 14px 16px; }
@media (max-width: 1000px) { .sliders { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .sliders { grid-template-columns: minmax(0, 1fr); } }
.slider label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; gap: 8px; }
.slider label span { font-family: var(--f-mono); font-weight: 400; color: var(--muted); }
.slider input { width: 100%; accent-color: var(--accent); }
.slider p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.resultline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; }
.resultline h2 { font-size: 22px; font-weight: 800; font-stretch: 110%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Grid of destinations */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding-bottom: 40px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--ink); transform: translateY(-2px); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
@media (prefers-reduced-motion: reduce) { .card, .card:hover { transition: none; transform: none; } }
.card-open { all: unset; box-sizing: border-box; display: grid; gap: 10px; align-content: start; width: 100%; padding: 14px 16px; cursor: pointer; border-radius: var(--radius); }
.card-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stamp { font-family: var(--f-mono); font-weight: 500; font-size: 13px; letter-spacing: .12em; border: 2px solid currentColor; border-radius: 5px; padding: 1px 6px 1px 8px; transform: rotate(-4deg); display: inline-block; }
.lvl-move { color: var(--move); } .lvl-perk { color: var(--perk); } .lvl-open { color: var(--open); } .lvl-offer { color: var(--offer); } .lvl-home { color: var(--home); } .lvl-blocked { color: var(--blocked); }
.rank { font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-right: 104px; }
.score { font-family: var(--f-display); font-weight: 800; font-stretch: 120%; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.card h3 { font-size: 19px; font-weight: 700; font-stretch: 105%; line-height: 1.15; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; width: fit-content; }
.pill.move { background: var(--move-bg); color: var(--move); } .pill.perk { background: var(--perk-bg); color: var(--perk); }
.pill.open { background: var(--open-bg); color: var(--open); } .pill.offer { background: var(--offer-bg); color: var(--offer); }
.pill.home { background: var(--home-bg); color: var(--home); } .pill.blocked { background: var(--blocked-bg); color: var(--blocked); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; border-top: 1px dashed var(--line); padding-top: 10px; }
.facts div { display: grid; }
.facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }
.meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meter { display: grid; gap: 3px; font-size: 11.5px; color: var(--muted); }
.meter .mt { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.meter .mf { height: 100%; background: var(--ink); opacity: .75; border-radius: 3px; }
.meter b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.visit { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.visit b { font-weight: 600; color: var(--ink); }
.cmp-btn { position: absolute; top: 12px; right: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 11.5px; padding: 3px 9px; cursor: pointer; color: var(--muted); }
.cmp-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Map */
.mapbox { position: relative; background: var(--ocean); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
#worldmap { display: block; width: 100%; height: auto; }
#worldmap path.c { stroke: var(--bg); stroke-width: .5; cursor: default; transition: opacity .15s; }
#worldmap path.c.idx { cursor: pointer; }
#worldmap path.c:hover { stroke: var(--ink); stroke-width: 1.2; }
#worldmap path.sphere { fill: var(--ocean); }
#worldmap path.dot { stroke: var(--surface); stroke-width: 1.5; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; max-width: 240px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); z-index: 2; }
.tip b { display: block; font-family: var(--f-display); font-stretch: 105%; }
.map-legend { padding-block: 12px 40px; }

/* Method */
.method { border-top: 1px solid var(--line); padding-block: 32px 96px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 760px) { .method { grid-template-columns: minmax(0, 1fr); } }
.method h2 { font-size: 20px; font-weight: 800; font-stretch: 110%; margin-bottom: 10px; }
.method p, .method li { color: var(--muted); font-size: 14px; max-width: 62ch; }
.method ul { padding-left: 18px; margin: 0; display: grid; gap: 6px; }
.method b { color: var(--ink); }

/* Compare tray */
.tray { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .08); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 5; }
.tray-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
.tray-items { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tray-items span { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 600; }
.tray-items button { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); padding: 0 4px; }
.tray-actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 8px 16px; font-weight: 600; cursor: pointer; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--ink); }
dialog.wide { width: min(1080px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 15, 15, .55); }
@media (max-width: 560px) { dialog, dialog.wide { width: 100vw; max-width: 100vw; max-height: 100%; height: 100%; margin: 0; border-radius: 0; } }
.dlg-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 20px; display: flex; gap: 14px; align-items: center; z-index: 1; }
.dlg-head .stamp { font-size: 16px; }
.dlg-head h2 { font-size: 26px; font-weight: 800; font-stretch: 112%; line-height: 1.05; }
.dlg-head .sub { font-size: 13px; color: var(--muted); }
.dlg-head .grow { flex: 1; min-width: 0; }
.close { border: 1px solid var(--line); background: var(--surface); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; flex: none; }
.dlg-body { padding: 20px; display: grid; gap: 22px; }
.sec h4 { margin: 0 0 8px; font-family: var(--f-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.yours { border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; }
.yours.move { background: var(--move-bg); } .yours.perk { background: var(--perk-bg); } .yours.open { background: var(--open-bg); }
.yours.offer { background: var(--offer-bg); } .yours.home { background: var(--home-bg); } .yours.blocked { background: var(--blocked-bg); }
.yours p { margin: 0; font-size: 14px; }
.yours ul { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.breakdown { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 36px; gap: 10px; align-items: center; font-size: 13px; }
@media (max-width: 480px) { .bar { grid-template-columns: 110px minmax(0, 1fr) 32px; } }
.bar .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar b { font-variant-numeric: tabular-nums; text-align: right; }
.routes { display: grid; border: 1px solid var(--line); border-radius: var(--radius); }
.route { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.route:first-child { border-top: 0; }
@media (max-width: 480px) { .route { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.kind { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; color: var(--muted); }
.kind.k-open { color: var(--open); }
.route b { display: block; font-size: 14.5px; }
.route span.d { font-size: 13.5px; color: var(--muted); }
.money { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); }
@media (max-width: 560px) { .money { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.money > div { padding: 12px 14px; border-left: 1px solid var(--line); min-width: 0; }
.money > div:first-child { border-left: 0; }
@media (max-width: 560px) { .money > div:nth-child(3) { border-left: 0; } .money > div:nth-child(n+3) { border-top: 1px solid var(--line); } }
.money .v { font-family: var(--f-display); font-weight: 800; font-stretch: 110%; font-size: 22px; font-variant-numeric: tabular-nums; }
.money .l { font-size: 12px; color: var(--muted); line-height: 1.3; }
.timeline { position: relative; height: 64px; margin: 6px 6px 0; }
.timeline .axis { position: absolute; left: 0; right: 0; top: 26px; height: 6px; background: var(--surface-2); border-radius: 3px; }
.timeline .seg { position: absolute; top: 26px; height: 6px; border-radius: 3px; }
.timeline .mk { position: absolute; top: 0; transform: translateX(-50%); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.timeline .mk::after { content: ""; position: absolute; left: 50%; top: 20px; width: 14px; height: 14px; border-radius: 50%; transform: translateX(-50%); border: 3px solid var(--surface); background: currentColor; }
.timeline .tick { position: absolute; top: 40px; font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); transform: translateX(-50%); }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; font-size: 14px; margin: 0; }
.meta dt { font-size: 12px; color: var(--muted); }
.meta dd { margin: 0; font-weight: 600; }
.meta dd.sub { font-weight: 400; font-size: 13px; color: var(--muted); }
.note { font-size: 13.5px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; margin: 0; }
.note.warn { border-left-color: var(--blocked); color: var(--ink); }
.src a { font-weight: 600; }

/* Compare table */
.cmp-wrap { overflow-x: auto; }
table.cmp { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 520px; }
table.cmp th, table.cmp td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.cmp thead th { font-family: var(--f-display); font-stretch: 108%; font-size: 18px; }
table.cmp tbody th { font-weight: 500; color: var(--muted); font-size: 13px; width: 170px; }
table.cmp td { font-variant-numeric: tabular-nums; }
table.cmp td.best { font-weight: 700; color: var(--move); }

/* ===== v3: flags, picker, life tiles, quality-of-life view ===== */
.flag { display: inline-block; width: 24px; height: 16px; border-radius: 3px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); vertical-align: middle; background: var(--surface-2); }
.flag.lg { width: 54px; height: 36px; border-radius: 5px; }
.flag.md { width: 33px; height: 22px; border-radius: 4px; transition: transform .2s; }
.flag.sm { width: 18px; height: 12px; border-radius: 2px; }

/* Passport picker */
.picker { position: relative; }
.pk-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; border: 1.5px solid var(--ink); background: var(--surface); cursor: pointer; text-align: left;
  font-family: var(--f-display); font-weight: 700; font-size: 20px; font-stretch: 105%; }
.pk-btn .pk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-btn::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg) translateY(-3px); flex: none; }
.picker.small .pk-btn { font-size: 15px; font-weight: 600; padding-block: 8px; border-width: 1px; border-color: var(--line); }
.pk-pop { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, .18); overflow: hidden; }
.pk-pop input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; background: var(--surface); outline: none; }
.pk-list { max-height: 300px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; }
.pk-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.pk-list li[aria-selected="true"] { background: var(--surface-2); }
.pk-list li.cur { font-weight: 700; }
.pk-list li .pk-code { margin-left: auto; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }

/* Cards, v3 */
.card { overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin: -14px -16px 0; padding: 12px 16px 10px; }
.card-head.move { background: var(--move-bg); } .card-head.perk { background: var(--perk-bg); } .card-head.open { background: var(--open-bg); }
.card-head.offer { background: var(--offer-bg); } .card-head.blocked { background: var(--blocked-bg); }
.card-head .stamp { font-size: 11.5px; }
.card-head .rank { margin-left: auto; margin-right: 96px; }
.card:hover .flag.md { transform: rotate(-6deg) scale(1.08); }
@media (prefers-reduced-motion: reduce) { .flag.md { transition: none; } .card:hover .flag.md { transform: none; } }
.life { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.lt { border-radius: 6px; padding: 6px 6px 7px; display: grid; gap: 1px; min-width: 0;
  background: color-mix(in oklab, var(--mh) var(--mix), var(--surface)); }
.lt .lk { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.lt .lv { font-family: var(--f-display); font-weight: 800; font-stretch: 108%; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.lt .lg { font-size: 11.5px; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 420px) { .life { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lt { padding: 7px 9px 8px; } .lt .lv { font-size: 17px; } }
@media (max-width: 640px) { .cmp-btn { padding: 7px 12px; font-size: 12.5px; top: 8px; right: 8px; } .chip, .chips button { min-height: 36px; } }
.m-cost { --mh: var(--m-cost); } .m-safety { --mh: var(--m-safety); } .m-stab { --mh: var(--m-stab); } .m-fam { --mh: var(--m-fam); }

/* Quality-of-life spotlight */
.spot { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
@media (max-width: 1000px) { .spot { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .spot { grid-template-columns: minmax(0, 1fr); } }
.board { border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line); background: color-mix(in oklab, var(--mh) 10%, var(--surface)); min-width: 0; }
.board h3 { font-size: 16px; font-weight: 800; font-stretch: 110%; display: flex; align-items: center; gap: 8px; }
.board h3 i { width: 10px; height: 10px; border-radius: 50%; background: var(--mh); }
.board p.small { margin: 2px 0 10px; }
.board ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li button { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 16px 22px minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; font-size: 13.5px; padding: 3px 4px; border-radius: 6px; }
.board li button:hover { background: color-mix(in oklab, var(--mh) 16%, var(--surface)); }
.board li button:focus-visible { outline: 2px solid var(--accent); }
.board .bn { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.board .bname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.board .bval { font-variant-numeric: tabular-nums; font-weight: 700; }
.board .bbar { grid-column: 3 / 5; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.board .bbar span { display: block; height: 100%; border-radius: 2px; background: var(--mh); }

/* Heat table */
.heat-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 40px; max-height: 76vh; }
table.heat { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; min-width: 1180px; }
table.heat th, table.heat td { padding: 7px 10px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
table.heat thead th { position: sticky; background: var(--surface); z-index: 2; font-weight: 600; font-size: 12px; }
table.heat thead tr.grp th { top: 0; height: 32px; font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; text-align: center; border-bottom: 3px solid var(--mh, var(--line)); }
table.heat thead tr.cols th { top: 32px; cursor: pointer; user-select: none; }
table.heat thead tr.cols th:hover { color: var(--accent); }
table.heat thead th[aria-sort="descending"]::after { content: " ↓"; }
table.heat thead th[aria-sort="ascending"]::after { content: " ↑"; }
table.heat th.cn, table.heat td.cn { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.heat thead th.cn { z-index: 3; }
table.heat td.cn button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
table.heat td.cn button:focus-visible { outline: 2px solid var(--accent); }
table.heat td.h { background: color-mix(in oklab, var(--mh) var(--mix), var(--surface)); }
table.heat td.na { color: var(--muted); }

/* Detail: budgets, governance, family */
.budget { display: grid; gap: 12px; }
.brow { display: grid; grid-template-columns: 130px minmax(0, 1fr) 80px; gap: 12px; align-items: center; font-size: 13px; }
@media (max-width: 520px) { .brow { grid-template-columns: 90px minmax(0, 1fr) 64px; } }
.brow b { text-align: right; font-family: var(--f-display); font-stretch: 108%; font-size: 17px; font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 2px; height: 22px; }
.stack span { height: 100%; min-width: 2px; }
.stack span:first-child { border-radius: 4px 0 0 4px; }
.stack span:last-child { border-radius: 0 4px 4px 0; }
.blegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.blegend span { display: inline-flex; gap: 6px; align-items: center; }
.blegend i { width: 10px; height: 10px; border-radius: 2px; }
.gov { display: grid; gap: 10px; }
.grow2 { display: grid; grid-template-columns: 170px minmax(0, 1fr) 52px; gap: 12px; align-items: center; font-size: 13px; }
@media (max-width: 520px) { .grow2 { grid-template-columns: 110px minmax(0, 1fr) 44px; } }
.grow2 b { text-align: right; font-variant-numeric: tabular-nums; }
.dv { position: relative; height: 12px; background: var(--neutral); border-radius: 6px; }
.dv::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--muted); opacity: .6; }
.dv span { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.dv-scale { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); margin-left: 182px; margin-right: 64px; }
@media (max-width: 520px) { .dv-scale { margin-left: 122px; margin-right: 56px; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.tile { border-radius: 10px; padding: 10px 12px; background: color-mix(in oklab, var(--mh) var(--mix, 14%), var(--surface)); min-width: 0; }
.tile .tk { font-size: 11.5px; color: var(--muted); }
.tile .tv { font-family: var(--f-display); font-weight: 800; font-stretch: 110%; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .tg { font-size: 12px; }
.headline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .headline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bar .fill { transition: width .6s cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) { .bar .fill { transition: none; } }

/* Map v3 */
.map-modes { margin-bottom: 8px; }
.grad { display: inline-flex; align-items: center; gap: 8px; }
.grad i { width: 160px !important; height: 10px !important; border-radius: 5px !important; }
.tip b { display: flex; align-items: center; gap: 6px; }
#map-hint { margin: 0 0 10px; }
