:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: #14272a;
  background: #eef3f2;
  font-synthesis: none;
  --accent: #0b6570;
  --accent-dark: #084850;
  --accent-soft: #dceff0;
  --ink-muted: #637477;
  --line: #d6dfde;
  --panel: #ffffff;
  --selected: #ffdf75;
  --history-text: #23383b;
  --history-panel-bg: rgb(255 255 255 / 78%);
  --history-panel-border: rgb(11 72 80 / 16%);
  --history-panel-radius: 12px;
  --history-panel-shadow: 0 8px 26px rgb(22 55 59 / 18%);
  --history-panel-backdrop: blur(7px);
  --history-button-bg: rgb(14 112 122 / 90%);
  --history-button-bg-hover: rgb(8 83 91 / 94%);
  --history-button-fg: #fff;
  --history-button-border: rgb(11 72 80 / 18%);
  --history-button-shadow: 0 4px 16px rgb(22 55 59 / 18%);
  --history-button-backdrop: blur(5px);
  --history-toggle-radius: 21px;
  --history-play-radius: 50%;
  --history-collapse-radius: 8px;
  --history-select-bg: rgb(255 255 255 / 86%);
  --history-select-border: #b8ccca;
  --history-select-radius: 7px;
  --history-track: #b8ccca;
  --history-indicator: var(--accent);
  --history-focus: #84d6dd;
  --map-control-bg: #fff;
  --map-control-bg-hover: #f2f7f6;
  --map-control-border: rgb(11 72 80 / 16%);
  --map-control-radius: 9px;
  --map-control-shadow: 0 4px 16px rgb(22 55 59 / 14%);
}

* {
  box-sizing: border-box;
}


.page-standby {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  opacity: 1;
  visibility: visible;
  background: rgb(238 243 242 / 88%);
  backdrop-filter: blur(3px);
  transition:
    opacity 160ms ease,
    visibility 160ms ease;
}
.page-standby.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.page-standby-card {
  min-width: min(22rem, calc(100vw - 3rem));
  padding: 1.05rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--accent-dark);
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 18px 55px rgb(19 54 59 / 18%);
  font-size: .9rem;
  font-weight: 750;
}
.page-standby-spinner {
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 1.55rem;
  border: 3px solid rgb(11 101 112 / 20%);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: page-standby-spin .72s linear infinite;
}
@keyframes page-standby-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .page-standby {
    transition: none;
  }
  .page-standby-spinner {
    animation: none;
    border-color: rgb(11 101 112 / 25%);
    border-top-color: var(--accent);
  }
}

html,
body,
.app-shell {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.16em;
}

a:hover {
  color: #0a7985;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(410px, 500px) minmax(0, 1fr);
}

.ranking-panel {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--panel);
  box-shadow: 8px 0 24px rgb(19 54 59 / 14%);
}

.ranking-header {
  padding: 24px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.subtitle {
  margin-bottom: 18px;
  color: var(--ink-muted);
}

.category-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: #edf1f0;
}

.category-button {
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  color: #4d5e60;
  background: transparent;
  cursor: pointer;
}

.category-button:hover {
  color: var(--accent-dark);
  background: rgb(255 255 255 / 65%);
}

.category-button.is-active {
  color: #fff;
  font-weight: 700;
  background: var(--accent);
  box-shadow: 0 2px 7px rgb(11 101 112 / 22%);
}

.category-button:focus-visible,
.city-link:focus-visible,
th button:focus-visible {
  outline: 3px solid #84d6dd;
  outline-offset: 2px;
}

.status {
  min-height: 1.3em;
  margin: 12px 2px 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.status.is-error {
  color: #a32c24;
  font-weight: 650;
}

.ranking-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.city-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.city-table th,
.city-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e7eceb;
  text-align: right;
  vertical-align: middle;
}

.city-table th:first-child,
.city-table td:first-child {
  padding-left: 20px;
}

.city-table th:last-child,
.city-table td:last-child {
  padding-right: 20px;
}

.city-table .column-city {
  text-align: left;
}

.city-table thead {
  position: sticky;
  z-index: 1;
  top: 0;
  color: #4b5b5d;
  background: #f4f7f6;
  box-shadow: 0 1px var(--line);
}

.city-table th {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 0.74rem;
  font-weight: 400;
}

.city-table th.is-header-bold {
  font-weight: 700;
}

.city-table th button {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0;
  border: 0;
  color: inherit;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: inherit;
}

.city-table th button::after {
  width: 1em;
  color: #819092;
  content: "⇅";
  font-size: 1em;
  font-weight: 800;
  line-height: 1;
  opacity: 0.55;
}

.city-table th button:hover::after {
  color: var(--accent);
  opacity: 1;
}

.city-table th button.is-active {
  padding: 3px 5px;
  margin: -3px -5px;
  border-radius: 4px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: inherit;
}

.city-table th button[data-sort-direction="asc"]::after {
  color: var(--accent);
  content: "▲";
  opacity: 1;
}

.city-table th button[data-sort-direction="desc"]::after {
  color: var(--accent);
  content: "▼";
  opacity: 1;
}

.city-table tbody tr {
  transition: background-color 120ms ease;
}

.city-table tbody tr:hover {
  background: #f1f8f8;
}

.city-table tbody tr.is-active {
  background: var(--selected);
}

.city-table td {
  font-size: 0.87rem;
}

.city-table .column-rank {
  color: #778587;
}

.city-table .is-rank-metric {
  font-weight: 750;
}

.city-link {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px dashed #82999c;
  color: #163c41;
  background: none;
  cursor: pointer;
  font-weight: 680;
  text-align: left;
}

.about {
  padding: 30px 24px 44px;
  color: #4c5d60;
  font-size: 0.9rem;
  line-height: 1.55;
}

.about h2 {
  margin-bottom: 10px;
  color: #23383b;
  font-size: 1.2rem;
}

.map-panel,
#map {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.map-panel {
  background: #dce6e4;
}

.geometry-timeline {
  position: absolute;
  z-index: 3;
  left: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  color: var(--history-text);
}

.geometry-timeline[hidden] {
  display: none;
}

.geometry-timeline-toggle,
.geometry-timeline-play,
.geometry-timeline-collapse {
  display: grid;
  place-items: center;
  border: 1px solid var(--history-button-border);
  color: var(--history-button-fg);
  background: var(--history-button-bg);
  cursor: pointer;
  line-height: 1;
  box-shadow: var(--history-button-shadow);
  backdrop-filter: var(--history-button-backdrop);
}

.geometry-timeline-toggle {
  width: auto;
  min-width: 42px;
  height: 42px;
  padding: 0 12px 0 10px;
  grid-template-columns: 16px auto;
  gap: 8px;
  border-radius: var(--history-toggle-radius);
  font-size: .74rem;
  font-weight: 800;
  white-space: nowrap;
}

.geometry-timeline-toggle-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
}

.geometry-timeline-toggle-icon::before {
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--history-button-fg);
  content: "";
  transform: translateX(1px);
}

.geometry-timeline-toggle-state {
  line-height: 1;
}

.geometry-timeline[data-collapsed="false"] .geometry-timeline-toggle {
  display: none;
}

.geometry-timeline[data-collapsed="true"] .geometry-timeline-bar {
  display: none;
}

.geometry-timeline-bar {
  width: min(760px, calc(100% - 28px));
  min-height: 46px;
  display: grid;
  grid-template-columns: 38px auto auto minmax(180px, 1fr) 32px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--history-panel-border);
  border-radius: var(--history-panel-radius);
  color: var(--history-text);
  background: var(--history-panel-bg);
  box-shadow: var(--history-panel-shadow);
  backdrop-filter: var(--history-panel-backdrop);
}

.geometry-timeline-play {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--history-play-radius);
  font-size: .9rem;
}

.geometry-timeline-collapse {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--history-collapse-radius);
  font-size: 1.2rem;
}

.geometry-timeline-toggle:hover,
.geometry-timeline-play:hover,
.geometry-timeline-collapse:hover {
  background: var(--history-button-bg-hover);
}

.geometry-timeline-speed-label {
  margin: 0;
}

.geometry-timeline-speed-label select {
  min-width: 74px;
  padding: 5px 7px;
  border: 1px solid var(--history-select-border);
  border-radius: var(--history-select-radius);
  color: var(--history-text);
  background: var(--history-select-bg);
  font: inherit;
  font-size: .75rem;
}

.geometry-timeline-date {
  min-width: 72px;
  color: var(--accent-dark);
  font-size: .76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.geometry-timeline input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: var(--history-indicator);
  cursor: pointer;
}

.geometry-timeline input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: var(--history-track);
}

.geometry-timeline input[type="range"]::-webkit-slider-thumb {
  margin-top: -5px;
  border-color: var(--history-indicator);
  background: var(--history-indicator);
}

.geometry-timeline input[type="range"]::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--history-track);
}

.geometry-timeline input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--history-indicator);
}

.geometry-timeline input[type="range"]::-moz-range-thumb {
  border-color: var(--history-indicator);
  background: var(--history-indicator);
}

.geometry-timeline-toggle:focus-visible,
.geometry-timeline-play:focus-visible,
.geometry-timeline-collapse:focus-visible,
.geometry-timeline-speed-label select:focus-visible,
.geometry-timeline input[type="range"]:focus-visible {
  outline: 3px solid #84d6dd;
  outline-offset: 2px;
}

.map-message {
  position: absolute;
  z-index: 1;
  top: 18px;
  left: 50%;
  max-width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 9px 14px;
  border: 1px solid rgb(11 72 80 / 12%);
  border-radius: 9px;
  color: var(--accent-dark);
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 5px 18px rgb(22 55 59 / 14%);
  font-size: 0.86rem;
  pointer-events: none;
}

.map-message[hidden] {
  display: none;
}

.map-message.is-error {
  color: #8a241e;
  border-color: #ecc7c3;
  background: #fff8f7;
}

.mapboxgl-ctrl-group {
  overflow: hidden;
  border: 1px solid var(--map-control-border);
  border-radius: var(--map-control-radius);
  background: var(--map-control-bg);
  box-shadow: var(--map-control-shadow);
}

.mapboxgl-ctrl-group button {
  background-color: var(--map-control-bg);
}

.mapboxgl-ctrl-group button:hover {
  background-color: var(--map-control-bg-hover);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript-message {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 3px 18px rgb(0 0 0 / 20%);
}

@media (max-width: 760px) {
  body {
    overflow: auto;
    background: var(--panel);
  }

  .app-shell {
    display: flex;
    height: auto;
    min-height: 100%;
    flex-direction: column-reverse;
  }

  .map-panel {
    position: sticky;
    z-index: 1;
    top: 0;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    flex: 0 0 auto;
  }

  .ranking-panel {
    z-index: 2;
    min-height: 70vh;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 28px rgb(18 49 53 / 18%);
  }

  .ranking-header {
    padding: 20px 16px 14px;
  }

  .ranking-scroll {
    overflow: visible;
  }

  .city-table thead {
    display: none;
  }

  .city-table tbody,
  .city-table tr,
  .city-table td {
    display: block;
  }

  .city-table tbody tr {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-auto-rows: auto;
    row-gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }

  .city-table td,
  .city-table td:first-child,
  .city-table td:last-child {
    padding: 2px 4px;
    border: 0;
    text-align: left;
  }

  .city-table td.column-rank {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    font-size: 0.82rem;
  }

  .city-table td.column-city {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .city-table td.column-metric {
    grid-column: 2;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--ink-muted);
    font-size: 0.78rem;
    text-align: right;
  }

  .city-table td.column-metric::before {
    min-width: 0;
    flex: 1 1 auto;
    color: #879496;
    content: attr(data-label);
    font-weight: 500;
    text-align: left;
  }

  .city-table td.column-metric.is-rank-metric {
    color: #214f55;
    font-size: 0.94rem;
    font-weight: 750;
  }

  .city-link {
    border: 0;
    font-size: 1.05rem;
  }

  .about {
    padding: 28px 20px 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


@media (max-width: 760px) {
  .geometry-timeline {
    left: 8px;
    bottom: 8px;
    right: 8px;
  }

  .geometry-timeline-bar {
    width: calc(100vw - 16px);
    grid-template-columns: 34px 68px auto minmax(80px, 1fr) 30px;
    gap: 6px;
    padding: 5px 6px;
  }

  .geometry-timeline-toggle {
    width: auto;
    min-width: 38px;
    height: 38px;
    padding-inline: 9px 11px;
    gap: 7px;
    font-size: .7rem;
  }

  .geometry-timeline-date {
    min-width: 62px;
    font-size: .7rem;
  }

  .geometry-timeline-speed-label select {
    min-width: 64px;
    max-width: 84px;
  }
}
