:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --panel-strong: #eef2f3;
  --ink: #172027;
  --muted: #66727d;
  --line: #d8dee2;
  --teal: #097c86;
  --teal-dark: #075e66;
  --clay: #b65f54;
  --moss: #4f7c52;
  --slate: #586272;
  --gold: #b88a26;
  --sport-color: #097c86;
  --trad-color: #586272;
  --boulder-color: #b65f54;
  --mixed-color: #4f7c52;
  --gym-color: #8a5a12;
  --ice-color: #2f8fb8;
  --mix-color: #6d5aa8;
  --alpine-color: #466879;
  --shadow: 0 18px 48px rgba(23, 32, 39, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
}

.install-prompt {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 70;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 34px;
  gap: 10px;
  align-items: center;
  width: min(520px, calc(100vw - 24px));
  padding: 9px;
  border: 1px solid rgba(216, 222, 226, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 14px 34px rgba(23, 32, 39, 0.18);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.install-prompt.is-hidden {
  display: none;
}

.install-prompt img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.install-prompt-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.install-prompt-copy strong,
.install-prompt-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.install-prompt-copy strong {
  font-size: 0.92rem;
  line-height: 1.08;
}

.install-prompt-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.install-prompt-action,
.install-prompt-dismiss {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 850;
}

.install-prompt-action {
  padding: 0 12px;
  background: var(--teal);
  color: #fff;
}

.install-prompt-dismiss {
  display: grid;
  place-items: center;
  width: 34px;
  padding: 0;
  background: #fff;
  color: var(--ink);
}

.install-prompt-dismiss svg {
  width: 17px;
  height: 17px;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  z-index: 10;
}

.mobile-drawer-toggle {
  display: none;
}

.sidebar.has-mobile-detail {
  grid-template-rows: minmax(0, 1fr);
  padding: 0;
}

.sidebar.has-mobile-detail > :not(#detailPanel) {
  display: none;
}

.brand {
  position: relative;
  display: block;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-title {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  min-width: 0;
  gap: 0 14px;
  padding-right: 132px;
}

.brand-logo {
  grid-row: 1;
  grid-column: 1;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}

.brand-actions {
  position: absolute;
  top: 22px;
  right: 22px;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f9;
}

.language-button {
  min-width: 38px;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.language-button.is-active {
  background: var(--ink);
  color: #fff;
}

.source-label {
  display: none;
}

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

h1 {
  grid-row: 1;
  grid-column: 2;
  max-width: none;
  margin-top: 0;
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.06;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.source-link svg {
  width: 16px;
  height: 16px;
}

.filters {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.search-field {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-field svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.category-filter,
.type-filter {
  display: grid;
  gap: 6px;
}

.category-filter {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.type-filter {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filters[data-active-category="ice"] .type-filter {
  display: none;
}

.filter-button {
  min-width: 0;
  min-height: 36px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-button.is-active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.filter-button[data-category-filter="crag"].is-active {
  border-color: var(--moss);
  background: var(--moss);
}

.filter-button[data-category-filter="gym"].is-active {
  border-color: var(--gym-color);
  background: var(--gym-color);
}

.filter-button[data-category-filter="ice"].is-active {
  border-color: var(--ice-color);
  background: var(--ice-color);
}

.filter-button[data-type-filter="sport"].is-active {
  border-color: var(--sport-color);
  background: var(--sport-color);
}

.filter-button[data-type-filter="trad"].is-active {
  border-color: var(--trad-color);
  background: var(--trad-color);
}

.filter-button[data-type-filter="boulder"].is-active {
  border-color: var(--boulder-color);
  background: var(--boulder-color);
}

.filter-button[data-category-filter="crag"]:not(.is-active) {
  color: var(--moss);
}

.filter-button[data-category-filter="gym"]:not(.is-active) {
  color: var(--gym-color);
}

.filter-button[data-category-filter="ice"]:not(.is-active) {
  color: var(--ice-color);
}

.filter-button[data-type-filter="sport"]:not(.is-active) {
  color: var(--sport-color);
}

.filter-button[data-type-filter="trad"]:not(.is-active) {
  color: var(--trad-color);
}

.filter-button[data-type-filter="boulder"]:not(.is-active) {
  color: var(--boulder-color);
}

.sort-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.sort-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.summary-strip div {
  min-width: 0;
  padding: 13px 10px;
  text-align: center;
}

.summary-strip div + div {
  border-left: 1px solid var(--line);
}

.summary-strip strong {
  display: block;
  font-size: 1.18rem;
  line-height: 1.1;
}

.summary-strip span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.area-list {
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.area-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  margin: 0 0 8px;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.area-card:hover,
.area-card:focus-visible {
  border-color: #b9c7cc;
  outline: 0;
}

.area-card.is-active {
  border-color: var(--teal);
  background: #edf8f9;
}

.area-card-title {
  min-width: 0;
}

.area-card h3 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.15;
}

.area-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.route-pill {
  align-self: start;
  min-width: 54px;
  padding: 6px 7px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.type-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.type-dot {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 7px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.type-sport {
  background: var(--sport-color);
}

.type-trad {
  background: var(--trad-color);
}

.type-boulder {
  background: var(--boulder-color);
}

.type-mixed {
  background: var(--mixed-color);
}

.type-gym {
  background: var(--gym-color);
}

.type-ice {
  background: var(--ice-color);
}

.type-mix {
  background: var(--mix-color);
}

.type-alpine {
  background: var(--alpine-color);
}

.map-hint {
  display: inline-flex;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.map-hint.is-visible {
  color: var(--teal-dark);
}

.data-note {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.map-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.locate-button {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(188, 202, 207, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(23, 32, 39, 0.16);
}

.locate-button:hover,
.locate-button:focus-visible {
  outline: 0;
  border-color: var(--teal);
  color: var(--teal);
}

.locate-button.is-tracking {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.locate-button.is-tracking::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(9, 124, 134, 0.28);
  border-radius: 12px;
}

.locate-button.is-loading svg {
  animation: spin 900ms linear infinite;
}

.locate-button svg {
  width: 20px;
  height: 20px;
}

.map-legend-panel {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 6;
  width: auto;
  max-width: min(310px, calc(100% - 92px));
  border: 1px solid rgba(188, 202, 207, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 18px rgba(23, 32, 39, 0.14);
  backdrop-filter: blur(8px);
  color: var(--ink);
  overflow: hidden;
}

.map-legend-panel[open] {
  background: rgba(255, 255, 255, 0.92);
}

.map-legend-panel summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  list-style: none;
  cursor: pointer;
}

.map-legend-panel[open] summary {
  color: var(--ink);
}

.map-legend-panel summary::-webkit-details-marker {
  display: none;
}

.map-legend-panel summary svg {
  width: 15px;
  height: 15px;
  color: var(--teal);
}

.map-legend-body {
  display: grid;
  gap: 6px;
  padding: 0 11px 11px;
}

.map-legend-row {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
  line-height: 1.28;
}

.map-legend-swatch {
  display: block;
  justify-self: center;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(88, 98, 114, 0.24);
}

.map-legend-swatch.is-square {
  border-radius: 6px;
}

.map-legend-swatch.is-count {
  display: grid;
  place-items: center;
  background: var(--sport-color);
  color: #fff;
  font-size: 0.48rem;
  font-weight: 900;
  line-height: 1;
}

.map-legend-swatch.is-mixed {
  background: conic-gradient(
    var(--sport-color) 0 34%,
    var(--trad-color) 34% 66%,
    var(--boulder-color) 66% 100%
  );
}

.map-legend-swatch.is-approx {
  border-style: dashed;
  background: var(--ice-color);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.leaflet-control-attribution {
  font-size: 10px;
}

.area-marker {
  background: transparent;
  border: 0;
}

.marker-pin {
  display: grid;
  place-items: center;
  width: var(--marker-size);
  height: var(--marker-size);
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--marker-fill, var(--mixed-color));
  box-shadow: 0 8px 18px rgba(23, 32, 39, 0.3);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
}

.marker-pin > span {
  display: grid;
  place-items: center;
  width: 72%;
  height: 72%;
  border-radius: 999px;
  background: rgba(23, 32, 39, 0.68);
  line-height: 1;
}

.marker-pin.is-approx {
  border-style: dashed;
}

.marker-pin.is-selected {
  outline: 4px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 7px rgba(9, 124, 134, 0.38),
    0 16px 30px rgba(23, 32, 39, 0.38);
  transform: scale(1.2);
}

.marker-pin.is-gym {
  border-radius: 10px;
  background: var(--gym-color);
}

.marker-pin.is-gym > span {
  width: 74%;
  height: 64%;
  border-radius: 8px;
  font-size: 0.7rem;
}

.marker-pin.is-ice {
  background: var(--ice-color);
}

.marker-pin.is-ice > span {
  background: rgba(13, 45, 59, 0.72);
}

.marker-sport {
  background: var(--teal);
}

.marker-trad {
  background: var(--slate);
}

.marker-boulder {
  background: var(--clay);
}

.marker-mixed {
  background: var(--moss);
}

.detail-panel {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 5;
  width: min(max(440px, 40vw), 680px, calc(100% - 28px));
  overflow: visible;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  isolation: isolate;
}

.detail-panel.is-hidden {
  display: none;
}

.detail-panel::after {
  content: "";
  position: absolute;
  top: var(--anchor-y, 50%);
  width: 14px;
  height: 14px;
  border: 1px solid rgba(216, 222, 226, 0.9);
  background: rgba(255, 255, 255, 0.96);
  transform: translateY(-50%) rotate(45deg);
  z-index: 0;
}

.detail-panel.is-right-of-point::after {
  left: -8px;
  border-top: 0;
  border-right: 0;
}

.detail-panel.is-left-of-point::after {
  right: -8px;
  border-bottom: 0;
  border-left: 0;
}

.detail-panel.is-above-point::after {
  top: auto;
  right: auto;
  bottom: -8px;
  left: var(--anchor-x, 50%);
  border-top: 0;
  border-left: 0;
  transform: translateX(-50%) rotate(45deg);
}

.detail-panel.is-below-point::after {
  top: -8px;
  right: auto;
  bottom: auto;
  left: var(--anchor-x, 50%);
  border-right: 0;
  border-bottom: 0;
  transform: translateX(-50%) rotate(45deg);
}

.leaflet-popup.area-popup {
  margin-bottom: 12px;
}

.leaflet-popup.area-popup .leaflet-popup-content-wrapper {
  overflow: hidden;
  border: 1px solid rgba(216, 222, 226, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.leaflet-popup.area-popup .leaflet-popup-content {
  width: auto !important;
  margin: 0;
}

.leaflet-popup.area-popup .leaflet-popup-close-button {
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.leaflet-popup.area-popup .leaflet-popup-close-button:hover,
.leaflet-popup.area-popup .leaflet-popup-close-button:focus {
  background: var(--panel-strong);
  color: var(--ink);
}

.area-popup-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(820px, calc(100dvh - 28px));
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(216, 222, 226, 0.9);
  border-radius: 12px;
  background-clip: padding-box;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: clamp(16px, 1.8vw, 22px);
  color: var(--ink);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.area-popup-card > :not(.route-sample-section) {
  flex: 0 0 auto;
}

.area-popup-card h2 {
  margin: 0 34px 8px 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.2rem, 1.45vw, 1.55rem);
  line-height: 1.18;
}

.empty-detail,
.detail-content {
  padding: 18px;
}

.detail-content {
  position: relative;
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.detail-close svg {
  width: 18px;
  height: 18px;
}

.sheet-toggle {
  display: none;
}

.empty-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #edf8f9;
  color: var(--teal);
}

.empty-mark svg {
  width: 22px;
  height: 22px;
}

.empty-detail h2,
.detail-content h2 {
  margin-bottom: 8px;
  font-size: 1.28rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.empty-detail p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 750;
}

.meta-chip svg {
  width: 15px;
  height: 15px;
}

.meta-chip.warn {
  background: #fff7df;
  color: #7a5504;
}

.grade-box {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #102027;
  color: #fff;
}

.grade-box span {
  display: block;
  margin-bottom: 4px;
  color: #bad2d8;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.grade-box strong {
  display: block;
  line-height: 1.35;
}

.detail-section {
  margin-bottom: 14px;
}

.detail-section h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.detail-summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.detail-summary p {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.45;
}

.type-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.type-stat-grid-many {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.type-stat-card {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
}

.type-stat-card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 1rem;
  line-height: 1;
}

.type-stat-card span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-stat-sport {
  border-left-color: var(--sport-color);
}

.type-stat-trad {
  border-left-color: var(--trad-color);
}

.type-stat-boulder {
  border-left-color: var(--boulder-color);
}

.type-stat-other {
  border-left-color: var(--muted);
}

.type-stat-ice {
  border-left-color: var(--ice-color);
}

.type-stat-mix {
  border-left-color: var(--mix-color);
}

.type-stat-alpine {
  border-left-color: var(--alpine-color);
}

.detail-table,
.route-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.88rem;
}

.detail-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.route-sample-section {
  display: flex;
  min-height: 112px;
  flex: 1 1 auto;
  flex-direction: column;
  margin-bottom: 0;
}

.route-sample-section h3 {
  flex: 0 0 auto;
}

.route-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overscroll-behavior: contain;
  scrollbar-color: rgba(102, 114, 125, 0.65) transparent;
  scrollbar-width: thin;
}

.route-table-wrap::-webkit-scrollbar {
  width: 10px;
}

.route-table-wrap::-webkit-scrollbar-track {
  margin: 8px 0;
  background: transparent;
}

.route-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(102, 114, 125, 0.6);
  background-clip: content-box;
}

.detail-table th,
.detail-table td,
.route-table th,
.route-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.detail-table th,
.route-table th {
  background: #f5f7f7;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.route-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.detail-table tr:last-child td,
.route-table tr:last-child td {
  border-bottom: 0;
}

.route-table td:last-child {
  width: 1%;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.detail-table th {
  width: 28%;
}

.detail-table td:last-child {
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  white-space: normal;
}

.gym-info-box {
  background: #2b2518;
}

.ice-info-box {
  background: #123040;
}

.winter-note {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.detail-type-dots {
  margin-top: 0;
}

.table-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 999px;
  vertical-align: -1px;
}

.route-table a {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.detail-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  min-width: 0;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.detail-actions span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-actions a.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.detail-actions svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.empty-list {
  padding: 24px 14px;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app-shell {
    position: relative;
    display: block;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .map-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
  }

  .leaflet-control-zoom {
    display: none;
  }

  .map-legend-panel {
    top: 12px;
    right: auto;
    left: 12px;
    z-index: 18;
    width: auto;
    max-width: min(282px, calc(100% - 86px));
  }

  .map-legend-panel summary {
    min-height: 40px;
    padding: 8px 11px;
    font-size: 0.78rem;
  }

  .sidebar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
    height: 76px;
    max-height: calc(100dvh - 22px);
    min-height: 0;
    border-top: 1px solid var(--line);
    border-right: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -14px 34px rgba(23, 32, 39, 0.16);
    overflow: hidden;
    transition: height 180ms ease, transform 180ms ease;
  }

  .sidebar.is-mobile-expanded {
    height: min(78dvh, 720px);
    grid-template-rows: auto auto auto auto auto auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .sidebar:not(.is-mobile-expanded) > :not(.mobile-drawer-toggle) {
    display: none;
  }

  .mobile-drawer-toggle {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    align-items: center;
    width: 100%;
    min-height: 76px;
    border: 0;
    border-radius: 18px 18px 0 0;
    background: #fff;
    color: var(--ink);
    padding: 8px 18px 12px;
    text-align: left;
    touch-action: none;
  }

  .mobile-drawer-grip {
    justify-self: center;
    width: 54px;
    height: 5px;
    border-radius: 999px;
    background: #8e989f;
  }

  .mobile-drawer-copy {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 0;
  }

  .mobile-drawer-copy strong,
  .mobile-drawer-copy small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-drawer-copy strong {
    font-size: 0.95rem;
    line-height: 1.1;
  }

  .mobile-drawer-copy small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .app-shell.has-mobile-detail .map-shell {
    height: 100vh;
    height: 100dvh;
  }

  .app-shell.has-mobile-detail .sidebar {
    transform: translateY(100%);
    pointer-events: none;
  }

  .sidebar.is-mobile-expanded + .map-shell .detail-panel.is-mobile-preview {
    display: none;
  }

  .detail-panel.is-mobile-full::after {
    display: none;
  }

  .detail-panel.is-mobile-preview {
    position: absolute;
    z-index: 12;
    width: fit-content;
    max-width: min(300px, calc(100% - 20px));
    border-radius: 10px;
    pointer-events: auto;
  }

  .mobile-preview-card {
    position: relative;
    z-index: 1;
    display: grid;
    width: max-content;
    min-width: 156px;
    max-width: 100%;
    gap: 4px;
    border: 1px solid rgba(216, 222, 226, 0.95);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 10px 24px rgba(23, 32, 39, 0.22);
    color: var(--ink);
    padding: 10px 12px;
    text-align: left;
  }

  .mobile-preview-card strong {
    overflow: hidden;
    font-size: 0.98rem;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-preview-card span,
  .mobile-preview-card em {
    overflow: hidden;
    color: var(--ink);
    font-size: 0.82rem;
    font-style: normal;
    line-height: 1.24;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-preview-card em {
    color: var(--muted);
    font-weight: 800;
  }

  .detail-panel.is-mobile-full {
    position: fixed;
    z-index: 30;
    top: 10px;
    right: 0;
    bottom: 8px;
    left: 0;
    width: 100%;
    height: auto;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .detail-panel.is-mobile-full .area-popup-card {
    width: calc(100% - 16px);
    min-height: calc(100dvh - 18px);
    height: auto;
    max-height: none;
    margin: 0 8px;
    border: 1px solid rgba(216, 222, 226, 0.95);
    border-radius: 16px;
    box-shadow: 0 14px 34px rgba(23, 32, 39, 0.18);
    overflow: visible;
    -webkit-overflow-scrolling: touch;
    padding: 18px 16px 16px;
  }

  .detail-panel.is-mobile-full .route-table-wrap {
    overflow: visible;
  }

  .detail-panel.is-mobile-full .route-table th {
    position: static;
  }

  .sidebar.is-mobile-expanded .area-list {
    overflow: visible;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .sidebar.is-mobile-expanded .data-note {
    display: none;
  }

  .sheet-toggle {
    position: sticky;
    top: -18px;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 100%;
    height: 24px;
    margin: -10px 0 8px;
    border: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 100%);
  }

  .sheet-toggle span {
    width: 48px;
    height: 5px;
    border-radius: 999px;
    background: #8e989f;
  }

  .detail-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .install-prompt {
    top: max(8px, env(safe-area-inset-top));
    grid-template-columns: 34px minmax(0, 1fr) auto 32px;
    gap: 8px;
    width: calc(100vw - 18px);
    padding: 8px;
  }

  .install-prompt img {
    width: 34px;
    height: 34px;
  }

  .install-prompt-copy strong {
    font-size: 0.86rem;
  }

  .install-prompt-copy span {
    font-size: 0.72rem;
  }

  .install-prompt-action {
    padding: 0 9px;
    font-size: 0.78rem;
  }

  .install-prompt-dismiss {
    width: 32px;
    min-height: 32px;
  }

  .brand {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 13px 12px 12px;
  }

  .brand-title {
    display: block;
    grid-column: 1;
    padding-right: 0;
  }

  .brand-logo {
    width: 58px;
    height: 58px;
  }

  .brand-actions {
    position: static;
    grid-column: 2;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: stretch;
  }

  .language-switch {
    justify-self: stretch;
  }

  h1 {
    display: none;
  }

  .source-link {
    justify-content: center;
    width: 34px;
    min-height: 34px;
    padding: 0;
  }

  .source-link span {
    display: none;
  }

  .filters {
    padding: 12px;
    gap: 9px;
  }

  .type-filter {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .sort-field {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  .detail-panel {
    max-height: none;
  }

  .area-popup-card {
    padding: 16px;
  }

  .area-popup-card h2 {
    font-size: 1.22rem;
  }

  .type-stat-grid {
    gap: 6px;
  }

  .type-stat-card {
    padding: 7px;
  }

  .type-stat-card strong {
    font-size: 0.95rem;
  }
}
