/* ---------- Design tokens ---------- */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --text: #1f2430;
  --muted: #5f6675;
  --border: #e4ddd1;
  --accent: #d9572b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe5da;
  --teal: #1f7a74;
  --teal-soft: #d9efec;
  --good: #2f8a4c;
  --warn: #a8611a;
  --warn-soft: #fbecd9;
  --ring-track: #ece6dc;
  --shadow: 0 1px 2px rgba(31, 36, 48, 0.06), 0 6px 20px rgba(31, 36, 48, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --brand: "Instrument Serif", "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c;
    --surface: #1c1f27;
    --surface-2: #252935;
    --text: #eef0f4;
    --muted: #a3a9b7;
    --border: #323746;
    --accent: #f07a4f;
    --accent-ink: #1a0f0a;
    --accent-soft: #3b2219;
    --teal: #5cc4bb;
    --teal-soft: #173634;
    --good: #6bcf8a;
    --warn: #f0b072;
    --warn-soft: #3a2a17;
    --ring-track: #2c3140;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161c;
  --surface: #1c1f27;
  --surface-2: #252935;
  --text: #eef0f4;
  --muted: #a3a9b7;
  --border: #323746;
  --accent: #f07a4f;
  --accent-ink: #1a0f0a;
  --accent-soft: #3b2219;
  --teal: #5cc4bb;
  --teal-soft: #173634;
  --good: #6bcf8a;
  --warn: #f0b072;
  --warn-soft: #3a2a17;
  --ring-track: #2c3140;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 0.8em; }
a { color: var(--teal); text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

.container { max-width: 1120px; margin: 0 auto; padding-block: 24px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); outline: none; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 700; color: var(--accent); margin-bottom: 8px; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar__inner { max-width: 1120px; margin: 0 auto; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; margin-right: auto; }
.brand__mark { font-size: 1.4rem; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }
.brand__name { font-family: var(--brand); font-weight: 400; font-size: 1.6rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand__sub { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.92rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 0.72rem; padding: 0 7px; min-width: 20px; text-align: center; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; flex: none; }

@media (max-width: 560px) {
  .brand__mark, .brand__sub { display: none; }
  .brand__name { font-size: 1.15rem; white-space: normal; max-width: 6.5em; line-height: 0.95; }
  .tab { padding: 6px 10px; }
}

/* ---------- Buttons ---------- */
.btn { border: 1px solid transparent; border-radius: 999px; padding: 11px 20px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; transition: transform 0.08s ease, background 0.15s ease; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { padding: 6px 12px; font-size: 0.88rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; padding: 24px 0 8px; }
.hero__lead { font-size: 1.1rem; color: var(--muted); max-width: 52ch; }
.hero__art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero__tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 10px; text-align: center; box-shadow: var(--shadow); }
.hero__tile span { display: block; font-size: 1.8rem; }
.hero__tile small { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
button.hero__tile { font: inherit; color: inherit; cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease; }
button.hero__tile:hover { transform: translateY(-2px); border-color: var(--teal); }
button.hero__tile:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.tile-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 44px 12px 0; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 600; font-size: 0.9rem; }
.steps-preview { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px; color: var(--muted); font-size: 0.9rem; }
.steps-preview b { color: var(--text); }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } }

/* ---------- Wizard ---------- */
.wizard { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 28px; max-width: 860px; margin: 8px auto 0; }
.progress { display: flex; gap: 6px; margin-bottom: 22px; }
.progress__seg { flex: 1; height: 6px; border-radius: 999px; background: var(--ring-track); overflow: hidden; }
.progress__seg.is-done { background: var(--accent); }
.progress__seg.is-current { background: linear-gradient(90deg, var(--accent) 50%, var(--ring-track) 50%); }
.wizard__head { margin-bottom: 18px; }
.wizard__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; gap: 10px; flex-wrap: wrap; }
.field { margin-bottom: 22px; }
.field__label { font-weight: 700; margin-bottom: 10px; display: block; }
.field__hint { color: var(--muted); font-size: 0.9rem; font-weight: 400; }
@media (max-width: 560px) { .wizard { padding: 20px 16px; border-radius: 16px; } }

.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.choice-grid--wide { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.choice { position: relative; text-align: left; border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color 0.15s, background 0.15s; min-height: 64px; }
.choice:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.choice[aria-pressed="true"], .choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice__icon { font-size: 1.5rem; }
.choice__title { font-weight: 700; }
.choice__sub { font-size: 0.85rem; color: var(--muted); }
.choice__level { position: absolute; top: 10px; right: 10px; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.choice[data-level="1"] .choice__level { background: var(--teal); color: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 0.92rem; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.chip--exclude[aria-pressed="true"] { border-color: var(--muted); background: var(--surface-2); text-decoration: line-through; color: var(--muted); }

.select { width: 100%; max-width: 360px; padding: 11px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.input { width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }

/* ---------- Results ---------- */
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 18px; }
.summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.summary button { border: 1px dashed var(--border); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.summary button:hover { color: var(--text); border-style: solid; }

.section { margin-top: 34px; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.region-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.region-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.region-card[aria-pressed="true"] { border-color: var(--accent); outline: 2px solid var(--accent); }
.region-card__rank { font-family: var(--display); font-size: 1.2rem; color: var(--muted); width: 22px; flex: none; }
.region-card__name { font-weight: 700; line-height: 1.25; }
.region-card__sub { font-size: 0.8rem; color: var(--muted); }
.region-card .ring { margin-left: auto; }

.ring { --v: 0; --size: 50px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; background: conic-gradient(var(--accent) calc(var(--v) * 1%), var(--ring-track) 0); display: grid; place-items: center; }
.ring::before { content: ""; grid-area: 1 / 1; width: calc(var(--size) - 10px); height: calc(var(--size) - 10px); border-radius: 50%; background: var(--surface); }
.ring span { grid-area: 1 / 1; position: relative; font-weight: 700; font-size: 0.9rem; }
.ring--lg { --size: 64px; }
.ring--lg span { font-size: 1.1rem; }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
@media (max-width: 400px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card--top { border-color: var(--accent); }
.card__head { display: flex; gap: 12px; align-items: flex-start; }
.card__flag { font-size: 2.2rem; line-height: 1; }
.card__title { flex: 1; min-width: 0; }
.card__title h3 { margin: 0; }
.card__meta { font-size: 0.85rem; color: var(--muted); }
.card__blurb { color: var(--muted); font-size: 0.95rem; margin: 0; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); margin-left: 6px; vertical-align: middle; }

.reasons { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 0.9rem; }
.reasons li { display: flex; gap: 8px; }
.reasons li::before { content: "✓"; color: var(--good); font-weight: 700; }
.reasons li.warn::before { content: "!"; color: var(--warn); }
.reasons li.warn { color: var(--warn); }

.facts { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.82rem; }
.fact { background: var(--surface-2); border-radius: 8px; padding: 3px 8px; color: var(--muted); }
.fact b { color: var(--text); font-weight: 600; }

.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.months span { font-size: 0.62rem; text-align: center; padding: 3px 0; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.months span.is-best { background: var(--teal-soft); color: var(--teal); font-weight: 700; }
.months span.is-sel { outline: 2px solid var(--accent); outline-offset: -2px; }

.itinerary { border-top: 1px dashed var(--border); padding-top: 12px; }
.itinerary__title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.itinerary__bar { display: flex; border-radius: 10px; overflow: hidden; height: 34px; }
.itinerary__seg { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #fff; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; border: 0; cursor: pointer; }
.itinerary__seg:nth-child(1) { background: #d9572b; }
.itinerary__seg:nth-child(2) { background: #1f7a74; }
.itinerary__seg:nth-child(3) { background: #7a5ab8; }
.itinerary__seg:nth-child(4) { background: #b8862b; }
.itinerary__legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; }
.itinerary__legend li { display: flex; align-items: center; gap: 6px; }
.itinerary__legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.itinerary__legend button { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.itinerary__legend button:hover { text-decoration: underline; }
.itinerary__pair { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

.city-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
details.more { min-width: 0; }
.city-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.city-row__main { flex: 1; min-width: 0; border: 0; background: none; text-align: left; cursor: pointer; padding: 0; }
.city-row__name { font-weight: 600; display: block; }
.city-row__blurb { font-size: 0.8rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-chip { font-weight: 700; font-size: 0.82rem; padding: 2px 8px; border-radius: 999px; background: var(--surface); flex: none; }

.heart { border: 0; background: none; cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 4px; flex: none; color: var(--muted); }
.heart[aria-pressed="true"] { color: var(--accent); }

.card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

details.more summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--teal); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "▸ "; }
.chip__dist { font-weight: 500; font-size: 0.8rem; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.also-in__note { margin: -4px 0 8px; font-size: 0.82rem; color: var(--muted); }
.also-in__more { margin-top: 12px; display: inline-block; }
.also-in .chip[hidden] { display: none; }
.also-in .chip { text-align: left; }
:root { --micronation: #8a5a00; --micronation-soft: #f6ead2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --micronation: #f0c674; --micronation-soft: #3a2e14; } }
:root[data-theme="dark"] { --micronation: #f0c674; --micronation-soft: #3a2e14; }
.ptag--micronation { background: var(--micronation-soft); color: var(--micronation); }
:root { --geopark: #7a4b12; --geopark-soft: #f3e6d4; --biosphere: #2e6b2f; --biosphere-soft: #e1f0dc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --geopark: #e8b878; --geopark-soft: #3b2a14; --biosphere: #9fd49a; --biosphere-soft: #1d3a1f; } }
:root[data-theme="dark"] { --geopark: #e8b878; --geopark-soft: #3b2a14; --biosphere: #9fd49a; --biosphere-soft: #1d3a1f; }
.ptag--geopark { background: var(--geopark-soft); color: var(--geopark); }
.ptag--biosphere { background: var(--biosphere-soft); color: var(--biosphere); }
:root { --uninhabited: #5a5f6b; --uninhabited-soft: #e8e9ec; --expedition: #2f3f8f; --expedition-soft: #e3e7f7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --uninhabited: #c3c7d0; --uninhabited-soft: #2e323a; --expedition: #aab8f5; --expedition-soft: #222b55; } }
:root[data-theme="dark"] { --uninhabited: #c3c7d0; --uninhabited-soft: #2e323a; --expedition: #aab8f5; --expedition-soft: #222b55; }
.ptag--uninhabited { background: var(--uninhabited-soft); color: var(--uninhabited); }
.ptag--expedition { background: var(--expedition-soft); color: var(--expedition); }
:root { --noresidents: #6b4e2e; --noresidents-soft: #efe6da; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --noresidents: #dcc3a2; --noresidents-soft: #3a2f22; } }
:root[data-theme="dark"] { --noresidents: #dcc3a2; --noresidents-soft: #3a2f22; }
.ptag--no-residents { background: var(--noresidents-soft); color: var(--noresidents); }
.unesco-line .ptag { margin: 0 4px 0 0; }
.relations { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); line-height: 1.6; }
.relations .linkish { font-size: inherit; }
.terr-item:not(:last-of-type)::after { content: ", "; }
.terr-item[hidden] { display: none; }
.terr-more { margin-left: 6px; font-size: inherit; }
.places-toggle { margin-top: 12px; width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.places-toggle:hover { background: var(--surface); }
.places-toggle[aria-expanded="true"] { margin-bottom: 4px; }
details.more[open] summary::before { content: "▾ "; }
details.more > *:not(summary) { margin-top: 10px; }

.top-cities { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.city-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.city-card__main { flex: 1; min-width: 0; border: 0; background: none; text-align: left; cursor: pointer; padding: 0; }
.city-card__name { font-weight: 700; }
.city-card__sub { font-size: 0.82rem; color: var(--muted); }
.city-card .ring { --size: 44px; }

/* ---------- Tag bars ---------- */
.tagbars { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 0.85rem; }
.tagbar { height: 8px; border-radius: 999px; background: var(--ring-track); overflow: hidden; }
.tagbar span { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.tagbar.is-liked span { background: var(--accent); }

/* ---------- Explore ---------- */
.filters { display: grid; grid-template-columns: 2fr repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); position: sticky; top: 62px; z-index: 10; }
.filters label { font-size: 0.75rem; font-weight: 700; color: var(--muted); display: grid; gap: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.filters .select, .filters .input { max-width: none; padding: 9px 10px; }
.filters__clear { display: flex; align-items: end; }
.filters__clear .btn { width: 100%; padding: 9px 12px; }
.filters__clear .btn:disabled { opacity: 0.45; cursor: default; }
/* Desktop: Search keeps its column to itself, so the second row of filters starts
   under the first filter instead of under Search. */
@media (min-width: 861px) { .filters > label:first-child { grid-row: span 2; align-self: start; } }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; position: static; } .filters label:first-child, .filters__clear { grid-column: 1 / -1; } }
.region-block { margin-top: 30px; }
.region-block__head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.region-block__icon { font-size: 1.6rem; }
.empty { text-align: center; padding: 50px 16px; color: var(--muted); }
.empty__icon { font-size: 2.4rem; }

/* ---------- Shortlist ---------- */
.compare-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.compare { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 0.9rem; }
.compare th, .compare td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.compare thead th { background: var(--surface-2); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.compare tbody tr:last-child td { border-bottom: 0; }
.dots { letter-spacing: 1px; color: var(--accent); white-space: nowrap; }
.dots i { color: var(--ring-track); font-style: normal; }

/* ---------- Detail dialog ---------- */
.detail { border: 0; padding: 0; border-radius: 20px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.detail::backdrop { background: rgba(10, 12, 18, 0.55); }
.detail__body { padding: 24px; display: grid; gap: 16px; }
.detail__close { position: absolute; top: 12px; right: 12px; }
.detail__hero { display: flex; gap: 14px; align-items: center; padding-right: 40px; }
.detail__hero .card__flag { font-size: 2.8rem; }
.temps { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; align-items: end; height: 140px; }
.temps__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; }
.temps__bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--ring-track); min-height: 4px; }
.temps__col.is-best .temps__bar { background: var(--teal); }
.temps__col.is-sel .temps__bar { background: var(--accent); }
.temps__val { font-size: 0.6rem; line-height: 1.15; text-align: center; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.temps__m { font-size: 0.62rem; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Toast & footer ---------- */
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 30px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.footer { max-width: 1120px; margin: 0 auto; padding-block: 0 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); color: var(--muted); font-size: 0.82rem; text-align: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Compare table becomes stacked cards on phones. */
@media (max-width: 680px) {
  table.compare { min-width: 0; }
  .compare thead { display: none; }
  .compare, .compare tbody, .compare tr, .compare td { display: block; width: 100%; }
  .compare tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .compare tbody tr:last-child { border-bottom: 0; }
  .compare td { border: 0; padding: 2px 0; }
  .compare td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.8rem; }
  .compare td:last-child { position: absolute; top: 10px; right: 10px; width: auto; }
  .compare td .ring { --size: 40px; }
}

/* Band above the sticky header on phones with a notch. */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
.share-box { display: grid; gap: 6px; max-width: 640px; margin-top: -4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.footer__copy { margin: 1.5em 0 0; font-family: var(--brand); font-size: 1.125rem; color: var(--text); }
@media (max-width: 560px) { .temps__val .u { display: none; } }
.footer__copy a { color: inherit; text-decoration: none; }
.footer__copy a:hover { color: var(--accent); }
.kind { display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.kind--territory { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.kind--microstate { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.kind--micronation { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* UNESCO World Heritage label: UNESCO blue, defined as tokens for both themes. */
:root { --unesco: #0b5fa5; --unesco-soft: #e3effa; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --unesco: #8cc4f2; --unesco-soft: #16304a; } }
:root[data-theme="dark"] { --unesco: #8cc4f2; --unesco-soft: #16304a; }
.unesco { display: inline-block; font-family: var(--font); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; background: var(--unesco-soft); color: var(--unesco); white-space: nowrap; }
.unesco-line { margin: 0; font-size: 0.9rem; color: var(--muted); }
.unesco-line .unesco { margin: 0 4px 0 0; }
.unesco-line b { color: var(--text); font-weight: 600; }
.fact--unesco { background: var(--unesco-soft); color: var(--unesco); }
.itinerary__legend .unesco { margin-left: 0; }

/* Family and LGBTQ+ labels. */
:root { --family: #7a4bb0; --family-soft: #efe6f8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --family: #c9a6ee; --family-soft: #2c2140; } }
:root[data-theme="dark"] { --family: #c9a6ee; --family-soft: #2c2140; }
.family { display: inline-block; font-family: var(--font); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; background: var(--family-soft); color: var(--family); white-space: nowrap; }
.unesco-line .family { margin: 0 4px 0 0; }
.fact--family { background: var(--family-soft); color: var(--family); }
:root { --npark: #2f6b2a; --npark-soft: #e3f1df; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --npark: #9fd893; --npark-soft: #1f3320; } }
:root[data-theme="dark"] { --npark: #9fd893; --npark-soft: #1f3320; }
.npark { display: inline-block; font-family: var(--font); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; background: var(--npark-soft); color: var(--npark); white-space: nowrap; }
.unesco-line .npark { margin: 0 4px 0 0; }
.fact--lgbtq-welcoming { background: var(--teal-soft); color: var(--teal); }
.fact--lgbtq-mixed { background: var(--surface-2); color: var(--muted); }
.fact--lgbtq-caution { background: var(--warn-soft); color: var(--warn); }
.lgbtq-note { font-size: 0.88rem; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 4px; }
.lgbtq-note--welcoming { background: var(--teal-soft); }
.lgbtq-note--caution { background: var(--warn-soft); }
.lgbtq-note .muted { font-size: 0.8rem; }

/* Travel advisories: the strongest warning colour, kept on theme tokens. */
:root { --danger: #b3261e; --danger-soft: #fbe3e1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --danger: #f2a49d; --danger-soft: #3d1a18; } }
:root[data-theme="dark"] { --danger: #f2a49d; --danger-soft: #3d1a18; }
.fact--advisory-avoid { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.fact--advisory-reconsider { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.lgbtq-note.advisory-note--avoid { background: var(--danger-soft); }
.lgbtq-note.advisory-note--avoid b { color: var(--danger); }
.advisory-notice { margin: 0 0 14px; font-size: 0.88rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.linkish { border: 0; background: none; padding: 0; color: var(--teal); font-weight: 600; text-decoration: none; cursor: pointer; font-size: inherit; }

/* Add to Home Screen prompt: a card pinned to the bottom, clear of the phone's home bar. */
.install { position: fixed; z-index: 60; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); margin: 0 auto; max-width: 460px; display: flex; gap: 12px; align-items: flex-start; padding: 14px 40px 14px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22); transform: translateY(calc(100% + 24px)); opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease; }
.install.is-on { transform: none; opacity: 1; }
.install__icon { width: 48px; height: 48px; border-radius: 11px; flex: none; }
.install__text { min-width: 0; }
.install__text h2 { font-family: var(--font); font-size: 0.98rem; font-weight: 700; margin: 0 0 4px; letter-spacing: 0; }
.install__text p { margin: 0 0 10px; font-size: 0.88rem; color: var(--muted); }
.install__steps { margin: 4px 0 10px; padding-left: 18px; font-size: 0.88rem; color: var(--muted); display: grid; gap: 4px; }
.install__steps b, .install__text p b { color: var(--text); }
.install__share { width: 16px; height: 16px; vertical-align: -3px; color: var(--teal); }
.install__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.install__close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 0.8rem; }

/* Capital and financial-hub tags, and the key-facts block. */
.ptag { display: inline-block; font-family: var(--font); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; white-space: nowrap; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.keyfacts { margin: 0; display: grid; gap: 6px; font-size: 0.85rem; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.keyfacts div { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 8px; }
.keyfacts dt { color: var(--muted); font-weight: 600; }
.keyfacts dd { margin: 0; min-width: 0; }
@media (max-width: 420px) { .keyfacts div { grid-template-columns: 1fr; gap: 0; } }

/* The US and Canada span the full row in Explore, grouped by state or province. */
.card--wide { grid-column: 1 / -1; }
.area-summary { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.area-groups { columns: 3 240px; column-gap: 16px; }
.area-group { break-inside: avoid; margin-bottom: 12px; }
.area-group h4 { margin: 0 0 6px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }

/* What a search matched among parks and trails, capitals and financial hubs. */
.search-matches { margin: 0; padding: 10px 12px; display: grid; gap: 6px; border-radius: var(--radius-sm); border: 1.5px solid var(--accent); background: var(--accent-soft); font-size: 0.9rem; }
.search-matches ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.search-matches__detail { font-size: 0.8rem; color: var(--muted); }
.search-matches li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.search-matches__kind { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.search-matches .linkish { text-align: left; }
mark { background: var(--accent); color: var(--accent-ink); border-radius: 3px; padding: 0 2px; }

.shortlist-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.export-group { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.export-group__label { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-right: 2px; }

.to-top { position: fixed; z-index: 50; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--text); color: var(--bg); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
.to-top.is-on { opacity: 0.92; transform: none; pointer-events: auto; }
.to-top:hover, .to-top:focus-visible { opacity: 1; }
.to-top:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }
@media print { .to-top { display: none; } }

.map-menu { position: relative; }
.map-menu > summary { list-style: none; }
.map-menu > summary::-webkit-details-marker { display: none; }
.map-menu[open] > summary { background: var(--surface-2); }
.map-menu__list { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 200px; display: grid; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18); }
.map-menu__list a { padding: 10px 12px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 600; }
.map-menu__list a:hover, .map-menu__list a:focus-visible { background: var(--surface-2); }

.region-more { display: flex; margin: 16px auto 0; padding: 10px 22px; }
.region-more .muted { font-weight: 500; }
