/* Livability Atlas. One column: intro, quiz, your results, map, ranking, details, settings. */

/* ---------- tokens ---------- */
:root {
  --bg: #f2f2f7;
  --panel: #ffffff;
  --fg: #1c1c1e;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --accent: #0f766e;
  --accent-fg: #ffffff;
  --tint: rgba(15, 118, 110, 0.12);
  --you: #7d5af0;
  --fill: rgba(118, 118, 128, 0.12);
  --chip-bg: #ececf1;
  --green: #34c759;
  --seg-on: #ffffff;
  --ocean: #cfe1ef;
  --land-stroke: #ffffff;
  --off: #eceae4;
  --halo: rgba(255, 255, 255, 0.92);
  --map-label: #6e6e73;
  --border-line: rgba(255, 255, 255, 0.95);
  --coast-line: rgba(55, 80, 105, 0.22);
  --display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, 'Segoe UI', Roboto, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #000000;
    --panel: #1c1c1e;
    --fg: #f5f5f7;
    --muted: #98989f;
    --line: #38383a;
    --accent: #3cc6b4;
    --accent-fg: #04221e;
    --tint: rgba(60, 198, 180, 0.18);
    --you: #a08cff;
    --fill: rgba(118, 118, 128, 0.24);
    --chip-bg: #2c2c2e;
    --green: #30d158;
    --seg-on: #636366;
    --ocean: #0e1a24;
    --land-stroke: #000000;
    --off: #2b2d31;
    --halo: rgba(16, 18, 22, 0.88);
    --map-label: #a1a1a6;
    --border-line: rgba(0, 0, 0, 0.6);
    --coast-line: rgba(255, 255, 255, 0.1);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #000000;
  --panel: #1c1c1e;
  --fg: #f5f5f7;
  --muted: #98989f;
  --line: #38383a;
  --accent: #3cc6b4;
  --accent-fg: #04221e;
  --tint: rgba(60, 198, 180, 0.18);
  --you: #a08cff;
  --fill: rgba(118, 118, 128, 0.24);
  --chip-bg: #2c2c2e;
  --green: #30d158;
  --seg-on: #636366;
  --ocean: #0e1a24;
  --land-stroke: #000000;
  --off: #2b2d31;
  --halo: rgba(16, 18, 22, 0.88);
  --map-label: #a1a1a6;
  --border-line: rgba(0, 0, 0, 0.6);
  --coast-line: rgba(255, 255, 255, 0.1);
  color-scheme: dark;
}

/* ---------- base ---------- */
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
}
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.02em;
}
h1 {
  font-size: clamp(30px, 7vw, 40px);
  line-height: 1.1;
}
h2 {
  font-size: clamp(20px, 4.5vw, 22px);
}
h3 {
  font-size: 15px;
}
p {
  margin: 0;
}
a {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* anything the page scrolls to lands below the sticky title bar */
section,
.panel,
[id] {
  scroll-margin-top: calc(72px + env(safe-area-inset-top, 0px));
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  margin: 0;
}

.eyebrow,
.lab {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.meta {
  color: var(--muted);
  font-size: 13.5px;
}
.mono {
  font-size: 12.5px;
}
.mono,
.sc,
.row .n,
.brow .v,
.calc,
.prof,
.wrow output,
.range output,
.pcard .sc2,
.tops li .s,
th {
  font-variant-numeric: tabular-nums;
}
.tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
}
.ic {
  display: inline-block;
  vertical-align: -2px;
  flex: none;
}

/* ---------- title bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-block: 10px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  margin-inline: calc(-1 * max(14px, env(safe-area-inset-left, 0px)));
  padding-inline: max(14px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line);
}
.brand {
  font-weight: 600;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}
/* the bar title appears once the big headline has scrolled away, so it's never shown twice */
body:not(.past-hero) .topbar .brand {
  opacity: 0;
}

/* ---------- controls ---------- */
button {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  background: var(--fill);
  border: 0;
  border-radius: 12px;
  padding: 8px 14px;
  cursor: pointer;
  min-height: 40px;
  transition:
    transform 0.12s,
    opacity 0.12s;
}
button:hover {
  opacity: 0.85;
}
button:active {
  transform: scale(0.97);
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button.primary {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
button.ghost {
  background: transparent;
  color: var(--accent);
  padding-inline: 6px;
}
button.chipbtn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13.5px;
  border-radius: 999px;
}
button.chipbtn[aria-pressed='true'] {
  background: var(--tint);
  color: var(--accent);
}
.linkbtn {
  min-height: 0;
  padding: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

select,
input[type='search'] {
  font: inherit;
  color: var(--fg);
  padding: 8px 10px;
  min-height: 40px;
  max-width: 100%;
}
select,
input[type='search'],
input[type='number'] {
  border: 0;
  background-color: var(--fill);
  border-radius: 10px;
  font-size: 16px;
}
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
select.langsel {
  width: auto;
  min-height: 34px;
  padding-block: 4px;
  padding-inline: 12px 28px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
}

/* sliders */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  background: transparent;
  accent-color: var(--accent);
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  margin-top: -11px;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.18),
    0 0 0 0.5px rgba(0, 0, 0, 0.06);
}
input[type='range']::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
}
input[type='range']::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}
.range {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range input {
  width: 160px;
  max-width: 50vw;
}
.range output {
  font-size: 13px;
  min-width: 24px;
}

/* segmented control */
.toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.seg {
  display: inline-flex;
  border-radius: 10px;
  padding: 2px;
  background: var(--fill);
}
.seg button {
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 8px;
  background: transparent;
}
.seg button[aria-pressed='true'] {
  background: var(--seg-on);
  font-weight: 600;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.12),
    0 3px 1px rgba(0, 0, 0, 0.04);
}

/* switches */
label.check {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
}
label.check span {
  flex: 1;
}
label.check input[type='checkbox'] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 31px;
  background: var(--fill);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
label.check input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.15),
    0 3px 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s;
}
label.check input[type='checkbox']:checked {
  background: var(--green);
}
label.check input[type='checkbox']:checked::after {
  transform: translateX(20px);
}

/* ---------- cards and disclosures ---------- */
.panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
details.box {
  background: var(--panel);
  border-radius: 18px;
}
details.box > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  min-height: 46px;
}
details.box > .inner {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
details.sub {
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--bg);
}
details.sub > summary {
  font-weight: 500;
  font-size: 14px;
}
details.sub > summary,
.gdet > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.gdet > summary {
  padding: 2px 0 4px;
  justify-content: flex-start;
}
.subin {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}
details.box > summary::-webkit-details-marker,
details.sub > summary::-webkit-details-marker,
.gdet > summary::-webkit-details-marker,
details.howread > summary::-webkit-details-marker {
  display: none;
}
/* chevrons */
details.box > summary::after {
  content: '';
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--muted);
  border-bottom: 2.5px solid var(--muted);
  transform: rotate(45deg);
  margin-top: -4px;
  transition: transform 0.2s;
}
details.box[open] > summary::after {
  transform: rotate(225deg);
  margin-top: 4px;
}
details.sub > summary::after,
.gdet > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex: none;
  margin-right: 4px;
}
details.sub[open] > summary::after,
.gdet[open] > summary::after {
  transform: rotate(45deg);
}

.toast {
  font-size: 13.5px;
  color: var(--accent);
  min-height: 1.2em;
}
.gtoast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  background: var(--fg);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  max-width: calc(100% - 32px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}
.gtoast button {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  min-height: 32px;
  padding: 2px 10px;
}

/* ---------- intro ---------- */
.hero {
  padding: 22px 20px;
  gap: 16px;
  align-items: center;
  text-align: center;
}
.hero .lede {
  color: var(--muted);
  font-size: 16px;
  max-width: 34em;
  margin-inline: auto;
}
.cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cta button {
  min-height: 46px;
  font-size: 15px;
  padding-inline: 18px;
}
.hero .cta {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
}
.hero .cta button {
  width: 100%;
  min-height: 50px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 14px;
}
.hero .cta #fullQuiz,
.hero .cta #retakeHero {
  background: transparent;
  color: var(--accent);
  min-height: 44px;
  font-weight: 500;
}

/* ---------- quiz: a centered card ---------- */
#quizPanel {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding: 28px 32px;
}
.qwrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#quizPanel .qwrap,
#quizPanel .opts,
#quizPanel .chips,
#quizPanel .field,
#quizPanel .qnav {
  width: 100%;
}
.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--chip-bg);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s;
}
.qtitle {
  font-family: var(--display);
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 600;
  line-height: 1.2;
}
#quizPanel .qtitle {
  font-size: clamp(22px, 4vw, 30px);
}
#quizPanel .qtitle,
#quizPanel .qsub,
#quizPanel .qtip {
  text-align: center;
  margin-inline: auto;
  max-width: 34em;
}
.qtip {
  font-style: italic;
}
.opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
#quizPanel .opts {
  grid-template-columns: 1fr;
}
.opt {
  text-align: left;
  min-height: 54px;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.opt[aria-pressed='true'] {
  border-color: var(--accent);
}
.opt .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: none;
}
.opt[aria-pressed='true'] .dot {
  border-color: var(--accent);
  background: var(--accent);
}
.qnav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
/* language and passport pickers (a language: tap for fluent, again for some, again for off) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
#quizPanel .chips {
  justify-content: center;
}
button.lchip {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--fill);
  border: 2px solid transparent;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
button.lchip.lv2 {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
button.lchip.lv1 {
  background: transparent;
  border-color: var(--accent);
}
button.lchip small {
  font-size: 11px;
  color: var(--muted);
}

/* place picker: search, Suggested, A–Z with a letter rail */
.hpbtn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: start;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
}
.hpbtn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hpbtn .ic {
  color: var(--muted);
}
.hpdlg {
  border: 0;
  padding: 0;
  border-radius: 16px;
  width: min(520px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 64px));
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.hpdlg[open] {
  display: flex;
  flex-direction: column;
}
.hpdlg::backdrop {
  background: rgba(0, 0, 0, 0.35);
}
.hptop {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.hptop input {
  flex: 1;
  min-height: 38px;
  padding: 0 12px;
}
.hpcancel {
  background: none;
  color: var(--accent);
  font-size: 16px;
  min-height: 38px;
  padding: 0 4px;
}
.hpbody {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}
.hplist {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 16px;
  -webkit-overflow-scrolling: touch;
}
.hphead {
  position: sticky;
  top: 0;
  margin: 0;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel);
  z-index: 1;
}
.hprow {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  text-align: start;
  padding: 10px 16px;
  background: none;
  border-radius: 0;
  min-height: 44px;
  font-size: 16px;
}
.hprow small {
  font-size: 12.5px;
  color: var(--muted);
}
.hprow:hover,
.hprow:focus-visible {
  background: var(--fill);
}
.hprow.on {
  color: var(--accent);
  font-weight: 600;
}
.hpempty {
  padding: 16px;
}
.hprail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 4px 4px 0;
  overflow: hidden;
}
.hprail button {
  background: none;
  padding: 0 4px;
  min-height: 0;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- your results ---------- */
.tops {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.tops .col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.tops ol {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tops li {
  font-size: 14.5px;
}
.tops li .s {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}

/* ---------- map ---------- */
.mapctl {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.mapbox {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--ocean);
}
#map {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-y;
  cursor: grab;
}
/* the city layer keeps the land layer's exact size, so cities can't drift off the land when the box grows */
#overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  overflow: hidden;
}
#overlay circle {
  pointer-events: auto;
  cursor: pointer;
}
#overlay circle.selring {
  pointer-events: none;
}
/* keyboard focus only (a tap must not leave a mark), and a stroke that stays 3 screen px when the map is zoomed */
#overlay circle:focus {
  outline: none;
}
#overlay circle:focus-visible {
  stroke: var(--accent);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}
.zoombtns {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}
.zoombtns button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  border-radius: 0;
}
.zoombtns button + button {
  border-top: 0.5px solid var(--line);
}
/* the zoom hint only appears when someone scrolls or drags the map the wrong way, then fades */
.maphint {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--panel);
  border-radius: 9px;
  padding: 4px 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.maphint.show {
  opacity: 1;
}
.maperr {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 16px;
  color: var(--muted);
  font-size: 13.5px;
}
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--panel);
  color: var(--fg);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  max-width: 250px;
  opacity: 0;
  transition: opacity 0.12s;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}
/* place sheet: name, verdict and score, one line, two actions */
.pcard {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: var(--panel);
  border-radius: 16px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.pcard .pchead {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pcard .nm {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
}
.pcard .pcx {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: none;
}
.pcard .pcrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pcard .sc2 {
  font-size: 15px;
  font-weight: 600;
}
.pcard .sc2 small {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 1px;
}
.pcard .pcwhy {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
}
.pcard .acts {
  margin: 4px 0 0;
  display: flex;
  gap: 8px;
  width: 100%;
}
.pcard .acts button {
  flex: 1;
  min-height: 40px;
  padding: 5px 10px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
}
.pcard .acts button.tinted {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--muted);
  align-items: center;
}
.sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.ramp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ramp span.bar {
  display: inline-block;
  width: 130px;
  height: 10px;
  border-radius: 5px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--chip-bg);
  white-space: nowrap;
}
.chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
/* verdict symbol; the svg is a block so Safari doesn't shift it by the text baseline */
.sym {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  padding: 0;
  font-size: 0;
  font-style: normal;
  line-height: 0;
  flex: none;
  overflow: hidden;
}
.chip i.sym {
  width: 16px;
  height: 16px;
}
.sym > svg.ic {
  display: block;
  margin: 0;
}
details.howread {
  font-size: 13.5px;
  color: var(--muted);
}
details.howread > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  list-style: none;
}

/* ---------- details and compare ---------- */
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
}
.grid2.one {
  grid-template-columns: minmax(0, 1fr);
}
.dhead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.big {
  font-family: var(--display);
  font-size: 40px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.big small {
  font-size: 15px;
  color: var(--muted);
  margin-left: 2px;
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brow {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 84px;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
}
.brow .v {
  font-size: 12px;
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
}
.brow.weak .lbl {
  font-weight: 500;
}
.track {
  height: 8px;
  border-radius: 4px;
  background: var(--chip-bg);
  overflow: hidden;
  position: relative;
}
.fill {
  display: block;
  height: 100%;
  border-radius: 4px;
}
.rbar {
  position: relative;
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: var(--line);
  min-width: 60px;
}
.rbar .rb {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 4px;
  opacity: 0.8;
}
.rbar .rt {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--fg);
  transform: translateX(-1px);
}
.rbar .cut {
  position: absolute;
  top: -2px;
  bottom: -2px;
  border-left: 1px dashed var(--muted);
  opacity: 0.7;
}
.drange {
  max-width: 360px;
}
.cmp {
  overflow-x: auto;
}
.cmpgrid {
  display: grid;
  gap: 6px 14px;
  align-items: center;
  font-size: 13.5px;
  min-width: 480px;
}
.cmpgrid .h {
  font-weight: 600;
  font-family: var(--display);
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
}
.cmpgrid .h button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}
.cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cell .track {
  flex: 1;
}

/* tables */
th {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.biastable {
  overflow-x: auto;
}
.biastable table {
  border-collapse: collapse;
  min-width: 620px;
  font-size: 13px;
  width: 100%;
}
.biastable th,
.biastable td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.biastable td:first-child {
  color: var(--fg);
  font-weight: 500;
}
.prof th {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  padding: 6px 2px;
}
.biastable th {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.prof td {
  padding: 4px 6px;
  font-size: 12px;
}
.prof td:first-child {
  white-space: nowrap;
}
.calc td,
.calc th {
  font-variant-numeric: tabular-nums;
}
.choices ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- ranking ---------- */
.rankhead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}
.list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--panel);
  border-radius: 18px;
  overflow: hidden;
}
.row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.3fr) 120px minmax(0, 1.5fr);
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  min-height: 58px;
  width: 100%;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid var(--line);
  border-radius: 0;
}
.row:last-child {
  border-bottom: 0;
}
.row:hover {
  background: var(--fill);
  opacity: 1;
}
.row.sel {
  background: var(--tint);
}
.row .n {
  color: var(--muted);
  font-size: 12.5px;
}
.row .why {
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rng {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.1;
}
.sc {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.sc .track {
  flex: 1;
}
.sc .sn {
  min-width: 30px;
}

/* ---------- priorities ---------- */
.box .inner.wgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 20px;
  align-items: start;
}
.wmain {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.live {
  position: sticky;
  top: 12px;
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg);
  font-size: 13.5px;
}
.live ol {
  margin: 6px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.live li span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.goal {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.goalh {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.goalrow label b {
  font-weight: 600;
}
.gdet .wrow {
  padding-left: 12px;
}
.wrow {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
}
.wrow input {
  width: 100%;
}
.wrow output {
  font-size: 12.5px;
  text-align: right;
  color: var(--muted);
}
.wrow .adw {
  position: absolute;
}
.mustgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 16px;
}
.minrow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 13.5px;
}
.minrow select {
  min-height: 32px;
  padding: 2px 6px;
}
.foot {
  color: var(--muted);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.foot p {
  max-width: 85ch;
}

/* ---------- right-to-left: text flows right to left, the map and numbers stay left to right ---------- */
[dir='rtl'] .mapbox,
[dir='rtl'] #mapbox,
[dir='rtl'] .mono,
[dir='rtl'] .biastable {
  direction: ltr;
}
[dir='rtl'] select {
  padding-right: 12px;
  padding-left: 30px;
  background-position: left 10px center;
}

/* ---------- narrow screens ---------- */
@media (max-width: 820px) {
  .grid2 {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .box .inner.wgrid {
    grid-template-columns: 1fr;
  }
  .live {
    position: static;
    order: -1;
  }
}
@media (max-width: 640px) {
  #mapSec {
    order: 1;
  }
  .after {
    order: 2;
  }
  /* region pills scroll in one row */
  #regions {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-inline: -16px;
    padding-inline: 16px;
  }
  #regions::-webkit-scrollbar {
    display: none;
  }
  #regions button {
    flex: none;
  }
}
@media (max-width: 600px) {
  .hero {
    padding: 18px 16px;
  }
  #quizPanel {
    padding: 20px 16px;
  }
  .row {
    grid-template-columns: 28px minmax(0, 1fr) 124px;
  }
  .row .why {
    grid-column: 2 / 4;
    white-space: normal;
  }
  .rbar {
    min-width: 40px;
  }
  .sc {
    gap: 6px;
  }
  .brow {
    grid-template-columns: 118px minmax(0, 1fr) 70px;
  }
  .brow .v {
    font-size: 11px;
  }
  .wrow {
    grid-template-columns: 120px minmax(0, 1fr) 46px;
  }
  .zoombtns button {
    width: 36px;
    height: 36px;
    min-height: 36px;
  }
  .pcard {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 0 8px 8px;
  }
  .pcard .acts #pcX {
    flex: 0 0 44px;
  }
  .hpdlg {
    width: 100vw;
    max-width: 100vw;
    height: calc(100vh - 40px);
    max-height: none;
    margin: 40px 0 0;
    border-radius: 16px 16px 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- print: the map, legend, ranking and details on white, no controls ---------- */
@media print {
  :root {
    --ocean: #e9f0f6;
    --halo: #fff;
  }
  body {
    background: #fff;
  }
  .topbar,
  .hero,
  #mapOpts,
  #regions,
  .zoombtns,
  #maphint,
  .howread,
  .pcard,
  #quizPanel,
  #resPanel .toggles,
  #more,
  #weightsBox,
  details.box:not([open]),
  button {
    display: none !important;
  }
  .panel,
  .mapbox,
  .list {
    border: 1px solid #ddd;
  }
  .mapbox {
    break-inside: avoid;
  }
}

/* end of the short quiz: two full-width choices */
.donenav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  margin: 18px auto 0;
}

/* quiz: the two home-base pickers side by side, and the data comparison under a question */
.homepair { display: flex; flex-wrap: wrap; gap: 12px; }
.homepair .field { flex: 1 1 200px; }
.qsub.qex { font-style: italic; }
/* quiz buttons stay on one row on a narrow phone: the "not sure" link wraps inside itself instead */
#quizPanel .qnav { flex-wrap: nowrap; }
#quizPanel .qnav .toggles { flex-wrap: nowrap; justify-content: flex-end; }
#qUnsure { white-space: normal; text-align: right; }

/* ---------- workspace: what matters (left) next to the map and ranking ---------- */
.work { display: flex; flex-direction: column; gap: 18px; }
.workmain { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ppanel { display: flex; flex-direction: column; gap: 12px; background: var(--panel); border-radius: 18px; padding: 18px 16px; }
.ppanel h2 { font-size: 19px; margin: 0; }
.phead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pclose { display: none; }
.pgrp { display: flex; flex-direction: column; gap: 8px; }
.pchips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip { min-height: 32px; padding: 4px 10px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.pchip[data-lv='1'] { background: var(--tint); color: var(--fg); border-color: transparent; }
.pchip[data-lv='2'] { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.pfoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
@media (min-width: 1180px) {
  .wrap { max-width: 1400px; }
  .wrap > :not(.work, .topbar) { width: 100%; max-width: 1120px; margin-inline: auto; }
  .work { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
  .ppanel { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
}
@media (max-width: 1179px) {
  .ppanel { position: fixed; inset: auto 0 0 0; z-index: 40; max-height: 78vh; overflow: auto; border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18); transform: translateY(105%); transition: transform 0.25s ease; visibility: hidden;
    padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .ppanel.open { transform: none; visibility: visible; }
  .pclose { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) { .ppanel { transition: none; } }

/* ---------- "Only show" pills ---------- */
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pgroup { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.pill { min-height: 34px; padding: 6px 12px; border: 0; border-radius: 0; background: transparent; font-size: 13.5px; color: var(--muted); }
.pill + .pill { border-inline-start: 1px solid var(--line); }
.pill[aria-pressed='true'] { background: var(--fg); color: var(--bg); }

/* ---------- ranking: rows with why-chips and hearts; the best match as a card ---------- */
.rw { position: relative; border-bottom: 0.5px solid var(--line); }
.rw:last-child { border-bottom: 0; }
.rw .row { border-bottom: 0; padding-inline-end: 52px; }
.rw.sel .row { background: var(--tint); }
.row { grid-template-columns: 40px minmax(0, 1fr) minmax(170px, 0.9fr); grid-template-areas: 'n nm sc' '. chips chips' '. why why'; row-gap: 6px; }
.row .n { grid-area: n; }
.row .nm { grid-area: nm; min-width: 0; }
.row .nm b { font-weight: 500; }
.row .nm .muted { font-size: 12.5px; }
.row .sc { grid-area: sc; }
.row .chips5 { grid-area: chips; }
.row .why { grid-area: why; }
.row .rbar { min-width: 110px; }
.chips5 { display: flex; flex-wrap: wrap; gap: 5px; }
.why5 { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 28%, transparent); color: var(--fg); }
.why5 b { font-weight: 600; }
.heart { position: absolute; top: 10px; inset-inline-end: 8px; min-height: 36px; min-width: 36px; padding: 0; border: 0;
  background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.heart:hover { color: var(--fg); background: var(--fill); }
.heart[aria-pressed='true'] { color: #d4334a; }
.heart[aria-pressed='true'] svg { fill: currentColor; }
.row.hero1 { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 20px 56px 20px 18px; min-height: 0; }
.hero1 .hname b { font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.1; }
.hero1 .hname .muted { font-size: 15px; }
.hero1 .hscore { display: inline-flex; align-items: center; gap: 8px; }
.hero1 .hscore .sn { font-size: 26px; font-weight: 600; }
.hero1 .rbar { height: 12px; min-width: 0; flex: none; width: 100%; }
.hero1 .why { white-space: normal; }
.top1 .heart { top: 16px; }
@media (max-width: 600px) {
  .rw .row { grid-template-columns: 30px minmax(0, 1fr) 100px; grid-template-areas: 'n nm sc' 'chips chips chips' 'why why why'; padding-inline-end: 44px; }
  .row .rbar { min-width: 36px; }
  .row .chips5 .why5:nth-child(n + 4) { display: none; }
  .heart { inset-inline-end: 4px; }
  .hero1 .hname b { font-size: 23px; }
}

/* ---------- the quiz is its own screen: nothing else on the page while it is open ---------- */
body:has(#quizPanel:not([hidden])) .wrap > :not(.topbar, #quizPanel),
body:has(#quizPanel:not([hidden])) .bar { display: none !important; }
body:has(#quizPanel:not([hidden])) #quizPanel { margin-top: 4vh; min-height: min(640px, 80vh); }
/* once there are results, the landing card steps aside: retake is in the results header */
body:has(#resPanel:not([hidden])) #start { display: none; }
/* feedback after each answer: the choice gets a check, "Got it" appears, the progress bar moves */
.progress span { transition: width 0.45s ease; }
.opt.chosen { background: var(--tint); border-color: var(--accent); }
.opt.chosen::after { content: '✓'; margin-inline-start: auto; color: var(--accent); font-weight: 700; }
.qgot { min-height: 1.4em; margin: 0; color: var(--accent); font-weight: 600; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .progress span { transition: none; } }

/* ---------- how scores are calculated: hidden unless switched on ---------- */
body:not(.adv) .calc-only,
body:not(.adv) .row .rbar { display: none !important; }
.listfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { white-space: nowrap; flex: none; }
@media (max-width: 640px) {
  /* each pill group scrolls sideways in one row instead of squeezing its words */
  .pgroup { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .pgroup::-webkit-scrollbar { display: none; }
}
#resPanel .toast:empty { display: none; }
/* the start-over button is deliberately quiet: last line of the method notes, behind the calculations switch */
.linkbtn.wipe { font-size: 12px; color: var(--muted); }
.linkbtn.wipe[data-armed] { color: #b3261e; }
/* trade-off round: two made-up cities side by side, then five answers from "definitely A" to "definitely B" */
.tpair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.tside { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.tside ul { margin: 0; padding-inline-start: 18px; font-size: 17px; font-weight: 600; line-height: 1.5; }
.tvs { align-self: center; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
#quizPanel .topts .opt { min-height: 44px; }
@media (max-width: 640px) { .tpair { grid-template-columns: 1fr; } .tvs { justify-self: center; } }
.tmoves { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; }
.tmove { margin: 0; }
.tmove.up b { color: var(--accent); }
.tmove.down b { color: var(--muted); }
/* fact sentences in a place's details */
.facts { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.facts li::before { display: inline-block; width: 1.3em; font-weight: 700; }
.facts li.good::before { content: '↑'; color: #1e8e3e; }
.facts li.bad::before { content: '↓'; color: #c5221f; }
/* "what would you miss most": one tap = matters most (filled, ★), a second = could live without (dashed, struck through) */
.tchips { justify-content: center; }
button.lchip.tchip.lv1 { border-style: dashed; border-color: var(--muted); color: var(--muted); background: transparent; }
button.lchip.tchip.lv1 > span { text-decoration: line-through; }
/* what the "not sure" answers could change, above the results */
.unsure { border-inline-start: 3px solid var(--accent); padding-inline-start: 10px; }
.unsure[hidden] { display: none; }
button.lchip.tchip { flex-wrap: wrap; justify-content: center; }
button.lchip.tchip.lv1 small { flex-basis: 100%; }

/* ---------- instant taps ---------- */
/* no double-tap-zoom wait, no grey flash; the pressed look comes from .tapped, set the moment a finger lands */
button, summary, select, .opt, .row, .pill, .lchip, .pchip, .hprow, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, .opt, .pill, .lchip, .pchip { transition: transform 0.08s, opacity 0.08s, background-color 0.08s; }
.tapped { filter: brightness(0.93); }
@media (prefers-color-scheme: dark) { .tapped { filter: brightness(1.25); } }
.progress span { transition: width 0.2s ease; }
/* the map area shows a wheel until the outlines arrive */
.mapbox.loading::after { content: ''; position: absolute; left: 50%; top: 50%; margin: -20px 0 0 -20px; box-sizing: border-box; pointer-events: none; }

/* ---------- tidier on phones ---------- */
@media (max-width: 640px) {
  /* results header: four actions in a 2 x 2 grid of equal buttons, not a column of links; the ranking is right below, so no jump link */
  /* ranking rows: name and country on one line, the reasons on one line you can swipe */
  .row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row .chips5 { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .row .chips5::-webkit-scrollbar { display: none; }
  .why5 { flex: none; white-space: nowrap; }
  .hero1 .chips5 { flex-wrap: wrap; }
  .rw .row { row-gap: 4px; padding-block: 10px; }
}

/* ---------- v59: a long list of answers (kinds of work) in two tidy columns; the stay-or-go tabs ---------- */
#quizPanel .opts.many { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#quizPanel .opts.many .opt { min-height: 48px; padding: 8px 12px; font-size: 14.5px; line-height: 1.25; }
@media (max-width: 380px) { #quizPanel .opts.many { grid-template-columns: 1fr; } }
.scopebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.scopebar .seg { flex-wrap: wrap; max-width: 100%; }
.scopebar .seg button { min-height: 38px; padding: 6px 14px; }
.scopebar .meta { flex-basis: 100%; margin: 0; }
@media print { .scopebar { display: none !important; } }
@media (max-width: 640px) { .scopebar .seg { display: flex; width: 100%; } .scopebar .seg button { flex: 1 1 auto; padding: 6px 8px; font-size: 14px; } }
/* v60: a one-tap suggestion on the passport question (the passport of the country you live in) */
.lchip.padd { border-style: dashed; color: var(--muted); }

/* ---------- v62: nothing is scored on screen before there is a take ---------- */
/* The map, the ranking, the details and every settings box come with the take (body.took: the quiz finished, a saved
   take, or a shared link). Until then the page is the first card and the quiz. */
body:not(.took) .work,
body:not(.took) details.after { display: none !important; }
body:not(.took) .hero { margin-top: 6vh; padding-block: 34px; }
/* an unmarked button at the foot of the page */
.pagefoot { display: flex; justify-content: flex-end; }
.pagefoot .quiet { width: 44px; height: 44px; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; opacity: 0; cursor: default; }
@media print { .pagefoot { display: none; } }

/* ---------- v63: compared with where you live now (place details) ---------- */
.vshome { display: flex; flex-direction: column; gap: 4px; }
.vshome .facts { margin-top: 2px; }
.vshome .facts li { padding-inline-start: 1.3em; text-indent: -1.3em; line-height: 1.4; }
.vshome .facts li.good::before { content: '+'; text-indent: 0; }
.vshome .facts li.bad::before { content: '−'; text-indent: 0; }
.vshome .facts li.same { color: var(--muted); }
.vshome .facts li.same::before { content: '≈'; text-indent: 0; font-weight: 400; }

/* ---------- v64: the answer first; the list beside the map; a place's details in the list's own column ---------- */
/* The title is a heading with two quiet actions, not a card of buttons: what comes first on the page is the list. */
.reshead { display: flex; flex-direction: column; gap: 8px; }
.resrow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 2px 14px; }
.resrow h2 { margin: 0; font-family: var(--display); font-size: 26px; line-height: 1.15; }
.resacts { display: flex; flex-wrap: wrap; gap: 0 4px; margin-inline: -6px; }
.resacts .ghost { min-height: 40px; font-size: 14px; }
.split { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
#rankSec, #mapSec, .listpane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.listpane[hidden] { display: none; }
@media (max-width: 640px) {
  #mapSec, .after { order: 0; }
  .resrow h2 { font-size: 23px; }
}
@media (min-width: 1180px) {
  .wrap { max-width: 1560px; }
  .work { grid-template-columns: 264px minmax(0, 1fr); }
  .split { display: grid; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); align-items: start; }
  /* the map stays in view while the list (or a place's details) scrolls beside it */
  #mapSec { position: sticky; top: 64px; }
}
/* above the list: cities or countries, a search box, and the filters folded under their name */
.listpane .rankhead { align-items: center; justify-content: flex-start; }
#rankmeta:empty { display: none; }
/* rows: number, name, score at the end of the line, then one line of why in words */
.rw .row:not(.hero1) { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: 'n nm sc' '. why why'; row-gap: 3px; align-items: center;
  padding-block: 12px; padding-inline: 14px 52px; min-height: 0; }
.row .sc { display: inline-flex; align-items: center; gap: 6px; justify-self: end; }
.row .sc .sn { font-weight: 600; font-variant-numeric: tabular-nums; }
body.adv .rw .row:not(.hero1) { grid-template-columns: 30px minmax(0, 1fr) minmax(150px, 0.8fr); }
body.adv .row .sc { justify-self: stretch; }
.row .n { font-variant-numeric: tabular-nums; }
.row .why { white-space: normal; overflow: visible; font-size: 13px; line-height: 1.35; }
.rw .row:not(.hero1) .why { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.row .why .why5 { white-space: normal; flex: 0 1 auto; color: var(--fg); }
.why5.pro { --c: #2f9e5b; }
.why5.con { --c: #cf3f3f; }
.capnote { flex-basis: 100%; }
@media (max-width: 640px) {
  .rw .row:not(.hero1) { grid-template-areas: 'n nm sc' 'why why why'; row-gap: 7px; }
}
.hero1 .why { color: var(--fg); font-size: 14.5px; line-height: 1.4; }
/* where the verdict changes, or the well-measured places end, the list says so */
.lgroup { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--fill); color: var(--muted); font-size: 12.5px;
  border-bottom: 0.5px solid var(--line); }
.lgroup .chip { background: transparent; padding: 0; color: var(--fg); font-weight: 600; font-size: 13px; }
/* a place's details: back to the list on the left, the place before and after on the right, always in reach */
.dnav { position: sticky; top: calc(54px + env(safe-area-inset-top, 0px)); z-index: 6; display: flex; justify-content: space-between; align-items: center;
  margin: -18px -18px 0; padding: 4px 8px; background: var(--panel); border-bottom: 0.5px solid var(--line); border-radius: 18px 18px 0 0; }
.dnav #dBack { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding-inline: 6px 12px; font-weight: 600; font-size: 15px; }
.dsteps { display: inline-flex; align-items: center; gap: 2px; }
.dstep { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; }
.dstep[disabled] { opacity: 0.25; }
[dir='rtl'] .dnav svg { transform: scaleX(-1); }
/* after the answer: how to make it more precise */
.sharpen { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 16px; }
.sharpen .meta { margin: 0; }
/* the name in the top bar is a button back to the top */
button.brand { background: none; border: 0; padding: 0; min-height: 0; color: inherit; cursor: pointer; text-align: start; }
/* quiz: on a phone the buttons stay in reach under a long question (30 languages), and Next looks like the next step */
@media (max-width: 640px) {
  #quizPanel .qnav { position: sticky; bottom: 0; z-index: 2; background: var(--panel); margin-inline: -4px; padding: 10px 4px max(10px, env(safe-area-inset-bottom)); }
}
/* thumb-sized targets on touch screens */
@media (pointer: coarse) {
  .langsel { min-height: 44px; }
  .seg button, .scopebar .seg button { min-height: 44px; }
  .pill, .filt > summary { min-height: 44px; }
  .pchip { min-height: 40px; padding-block: 8px; }
  .pclose { min-width: 44px; min-height: 44px; }
  .rankhead #search { min-height: 44px; }
}

/* ---------- v65: what the score is made of; see the place ---------- */
/* the 26 factors fold into eight lines; a line opens to its factors and the figures behind them */
.grps { display: flex; flex-direction: column; margin-top: 8px; }
.grps > .lab { margin-bottom: 4px; }
.grp { border-top: 1px solid var(--line); }
.grp:last-child { border-bottom: 1px solid var(--line); }
.grp > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; grid-template-areas: 'name v chev' 'bar bar bar'; gap: 6px 10px; align-items: center; padding: 10px 0 12px; cursor: pointer; list-style: none; }
.grp > summary .gname { grid-area: name; }
.grp > summary .track { grid-area: bar; }
.grp > summary .v { grid-area: v; }
.grp > summary > svg { grid-area: chev; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary > svg { color: var(--muted); transition: transform 0.15s; }
.grp[open] > summary > svg { transform: rotate(180deg); }
.grp > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.gname { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-width: 0; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.gname small { font-size: 12px; font-weight: 400; color: var(--muted); }
.grp > summary .v { font-size: 12px; text-align: end; color: var(--muted); white-space: nowrap; }
.grp.off > summary { opacity: 0.55; }
.gbody { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 14px; }
.gfig { display: flex; flex-direction: column; gap: 2px; margin: -2px 0 6px; padding-inline-start: 10px; border-inline-start: 2px solid var(--line); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
/* a photo, a real map and links out: all from other sites, all below the page's own answer */
.see { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.seephoto:empty { display: none; }
.photo { margin: 0; border-radius: 12px; overflow: hidden; background: var(--chip-bg); }
.photo img { display: block; width: 100%; height: 180px; object-fit: cover; }
.see figcaption { padding: 4px 8px; font-size: 11px; line-height: 1.35; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; overflow-wrap: anywhere; }
.see figcaption a { color: var(--muted); text-decoration: none; }
.see figcaption a:hover { text-decoration: underline; }
.mapfig { margin: 0; }
.mapfig[hidden] { display: none; }
.mapfig figcaption { visibility: hidden; }
.mapfig.on figcaption { visibility: visible; }
.rmap { height: 240px; border-radius: 12px 12px 0 0; overflow: hidden; background: var(--chip-bg); }
.links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.links:empty { display: none; }
.links a { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.links a:hover, .links a:focus-visible { border-color: var(--accent); }
.links a small { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links a b { font-size: 14px; font-weight: 600; line-height: 1.25; }
@media (max-width: 640px) {
  .photo img { height: 170px; }
  .rmap { height: 220px; }
}
.seenote { margin: 0; font-size: 11.5px; }

/* ---------- v66: one place for every control ---------- */
/* The panel: what to show, where, the "only show" filters, what matters. Left column on a wide screen; a sheet on a
   narrower one. */
.ctlsec, .filt, .prio { display: flex; flex-direction: column; gap: 8px; }
.ppanel > * + * { border-top: 1px solid var(--line); padding-top: 14px; }
.ppanel > .phead + *, .ppanel > [hidden] + *, .ppanel > .pdone { border-top: 0; padding-top: 0; }
.ppanel .seg { display: flex; flex-wrap: wrap; width: 100%; }
.ppanel .seg button { flex: 1 1 auto; min-height: 38px; }
.ppanel .scopebar { flex-direction: column; align-items: stretch; gap: 8px; }
.ppanel .scopebar .seg button { padding: 6px 10px; font-size: 14px; }
.ppanel .pills { margin: 0; gap: 8px; }
/* in the panel each filter is its own chip, so a row of them wraps instead of running off the side */
.ppanel .pgroup { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; border: 0; border-radius: 0; overflow: visible; }
.ppanel .pill { min-height: 32px; padding: 4px 10px; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; }
.ppanel .pill[aria-pressed='true'] { border-color: transparent; }
.pdone { display: none; }
.sheetbg { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, 0.35); }
.sheetbg[hidden] { display: none; }
/* The bar: find, Filters, list or map, cities or countries */
.bar { display: flex; flex-direction: column; gap: 8px; }
.barrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.searchhome { flex: 1 1 auto; min-width: 0; }
.searchbox { position: relative; display: flex; align-items: center; }
.searchbox .sico { position: absolute; left: 12px; display: inline-flex; color: var(--muted); pointer-events: none; }
[dir='rtl'] .searchbox .sico { left: auto; right: 12px; }
.searchbox input { width: 100%; min-height: 42px; padding: 6px 14px; padding-inline-start: 38px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--fg); font: inherit; font-size: 16px; }
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; }
.sugg { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; margin: 0; padding: 6px; list-style: none; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); max-height: min(60vh, 340px); overflow: auto; }
.sugg[hidden] { display: none; }
.sugg li { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.sugg li[aria-selected='true'], .sugg li[data-i]:hover { background: var(--tint); }
.sugg li.none { color: var(--muted); cursor: default; }
.sugg .snm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sugg .snm small { font-weight: 400; color: var(--muted); }
/* a town picked in the find box: its metro's details say so first (v71) */
#detail .via { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.ctlbtn { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; min-height: 42px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-weight: 600; white-space: nowrap; }
.ctlbtn b { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; }
.barrow .seg { display: flex; }
.barrow .seg button { min-height: 38px; }
#kindBar { margin-inline-start: auto; }
@media (min-width: 1180px) {
  .bar { display: none; }
  /* the find box sits on the map, as on most maps */
  .mapbox .searchbox { position: absolute; z-index: 5; top: 10px; left: 10px; width: min(300px, calc(100% - 76px)); }
  .mapbox .searchbox input { border-color: transparent; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16); }
  .mapbox .sugg { max-height: 300px; }
  /* the panel is a column here: tighter chips, so more of what matters shows without scrolling it */
  .ppanel .pills { gap: 6px; }
  .ppanel .pgroup { gap: 5px; }
  .ppanel .pill { min-height: 30px; padding: 3px 9px; font-size: 12.5px; }
}
@media (max-width: 1179px) {
  .bar { position: sticky; top: calc(54px + env(safe-area-inset-top, 0px)); z-index: 15; margin-inline: calc(-1 * max(14px, env(safe-area-inset-left, 0px)));
    padding: 8px max(14px, env(safe-area-inset-left, 0px)) 10px; background: var(--bg); border-bottom: 0.5px solid var(--line); }
  #kindHome { display: none; }
  .ppanel { max-height: 86vh; max-height: 86dvh; }
  .pdone { display: block; position: sticky; bottom: 0; z-index: 1; margin: 4px -16px 0; padding: 10px 16px 2px; background: var(--panel); box-shadow: 0 -8px 16px -10px rgba(0, 0, 0, 0.25); }
  .pdone button { width: 100%; min-height: 46px; }
  /* List or map, one at a time. The map that is not showing keeps its width (it measures itself) and takes no room. */
  .split { position: relative; }
  .split[data-pane='list'] #mapSec { position: absolute; top: 0; left: 0; right: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
  .split[data-pane='map'] { gap: 0; }
  .split[data-pane='map'] #listPane, .split[data-pane='map'] #mapSec > .rankhead { display: none; }
  /* A place's details open over the page, which stays where it was underneath */
  #detail:not([hidden]) { position: fixed; inset: 0; z-index: 45; margin: 0; border-radius: 0; overflow-y: auto; overscroll-behavior: contain;
    padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  #detail .dnav { top: -18px; border-radius: 0; padding-top: max(4px, env(safe-area-inset-top, 0px)); }
  body.place-open { overflow: hidden; }
}
@media print { .bar, .sheetbg { display: none !important; } }
/* the photo opens the article; the real map can take the whole screen */
.photo .pimg { display: block; }
.photo .pimg:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.rmctl button { display: flex; align-items: center; justify-content: center; color: #333; }
.mapfig.full { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; margin: 0; background: var(--bg); }
.mapfig.full .rmap { flex: 1 1 auto; height: auto; border-radius: 0; }
.mapfig.full figcaption { border-radius: 0; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
.mapfig.full .maplibregl-ctrl-top-right { top: env(safe-area-inset-top, 0px); }
body.map-full { overflow: hidden; }
