@import url("/tokens.css?v=1");

/* === 기본 스타일 · 공통 버튼과 아이콘 === */

:root {
  --map-header-height: 44px;
  color-scheme: dark;
  font-family: var(--font-system);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  font-synthesis: none;
}

/* Keep map spacing independent of the common site's global reset. */
:where(.map-page) :where(*) {
  margin: revert;
  padding: revert;
  letter-spacing: normal;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg-canvas);
  min-height: 0;
  font-family: var(--font-system);
  touch-action: auto;
}

.map-page > .header {
  position: fixed;
  inset: 0 0 auto;
  height: var(--map-header-height);
  line-height: normal;
}

.map-back.icon-button { display: none; }
.map-back .icon { transform: rotate(180deg); }

@media (max-width: 959px) {
  :root { --map-header-height: 0px; }
  .map-page > .header { display: none; }
  .map-back.icon-button { display: grid; flex: 0 0 40px; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--bg-surface); }
  .map-page .topbar { gap: 8px; }
  .map-page .search-results { width: min(340px, calc(100vw - 78px)); }
}

button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  color: inherit;
}

button {
  border: 0;
}

button:disabled {
  cursor: default;
  opacity: 0.4;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

button,
a,
input {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.svg-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-raised);
}

.text-button {
  background: transparent;
  font-size: var(--text-2xl);
}

.quiet-note {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
}

.eyebrow {
  font-size: var(--text-2xs);
  letter-spacing: 1.9px;
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

/* === 지도 배경 === */

#map {
  position: fixed;
  inset: var(--map-header-height) 0 0;
}

.map-vignette {
  pointer-events: none;
  position: fixed;
  inset: var(--map-header-height) 0 0;
  box-shadow: inset 0 0 120px color-mix(in srgb, var(--bg-sunken) 9%, transparent);
}

/* === 검색창 === */

.topbar {
  position: absolute;
  top: calc(var(--map-header-height) + 22px);
  left: 26px;
  width: max-content;
  height: 54px;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  z-index: 5;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-surface);
  height: 49px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  width: 284px;
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
}

.search-wrap > .icon {
  fill: currentColor;
  stroke: none;
  flex-shrink: 0;
}

.search-wrap input {
  background: transparent;
  border: 0;
  outline: 0;
  width: 100%;
  min-width: 0;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.search-wrap input::placeholder {
  color: var(--text-secondary);
}

.search-results {
  position: absolute;
  top: 58px;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  overflow: auto;
  max-height: 390px;
  padding: var(--space-2);
}

.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: transparent;
}

.search-result:hover {
  background: var(--bg-hover);
}

.search-result small {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.search-result b {
  font-weight: var(--font-semibold);
}

/* === 왼쪽 패널 · 산 목록 === */

.sidebar {
  position: absolute;
  top: calc(var(--map-header-height) + 98px);
  left: 26px;
  width: 284px;
  bottom: 32px;
  max-height: calc(100dvh - var(--map-header-height) - 130px);
  overflow: auto;
  background: var(--bg-surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  z-index: 3;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

.mountain-list {
  padding: 11px;
}

.mountain-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px 26px;
  gap: var(--space-2);
  padding: 13px 10px;
  text-align: left;
  background: transparent;
  align-items: center;
  border-radius: var(--radius-sm);
}

.mountain-row:hover {
  background: var(--bg-hover);
}

.mountain-row .row-name {
  display: block;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

.mountain-row small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  margin-top: var(--space-1);
}

.sidebar > .quiet-note,
#explore-panel > .quiet-note {
  margin: 18px 22px 22px;
}

/* === 오른쪽 지도 조작 버튼 === */

.map-actions {
  position: absolute;
  right: 26px;
  top: calc(50% + var(--map-header-height) / 2);
  transform: translateY(-50%);
  display: flex;
  gap: 3px;
  flex-direction: column;
  align-items: flex-end;
  z-index: 4;
}

.map-actions .icon {
  fill: currentColor;
  stroke: none;
}

.action-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 0;
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.zoom-buttons,
.rotation-buttons {
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.foliage-toggle[aria-pressed="false"] img {
  filter: grayscale(1);
  opacity: .5;
}

.foliage-peak { display: flex; align-items: center; gap: 3px; margin: 0 0 8px; }
.foliage-peak time { color: var(--accent-danger-bright); font-size: var(--text-base); font-weight: var(--font-semibold); }

.zoom-buttons button,
.rotation-buttons button {
  display: block;
  width: 30px;
  height: 30px;
  background: var(--bg-tertiary);
  font-size: var(--text-2xl);
  font-weight: var(--font-regular);
}

.zoom-buttons button {
  display: grid;
  place-items: center;
}

/* === 하단 타임라인 · 날짜와 시간 선택 === */

.timeline {
  position: absolute;
  left: 342px;
  right: 87px;
  bottom: 32px;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 0;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  z-index: 4;
}

.date-tabs {
  display: flex;
  margin: 0 0 5px;
  padding-bottom: 6px;
  overflow: auto;
  scrollbar-width: none;
}

.date-tabs button {
  flex: 1;
  height: 34px;
  background: transparent;
  border-radius: 7px;
  padding: 6px 7px;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  min-width: 64px;
}

.date-tabs button strong {
  font-size: inherit;
  font-weight: var(--font-semibold);
  margin-right: 3px;
  color: var(--text-primary);
}

.date-tabs button.active {
  background: var(--bg-hover);
}

.date-tabs button.active strong {
  color: var(--text-primary);
}

.hour-track {
  --hour-height: 34px;
  --hour-inset: 0px;
  position: relative;
  flex: 1;
  min-width: 0;
  height: var(--hour-height);
  border-radius: 999px;
  background: var(--bg-hover);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hour-selection {
  position: absolute;
  inset: 0 auto 0 0;
  width: 12.5%;
  border-radius: 999px;
  background: var(--text-primary);
  transform: translateX(calc(var(--hour-position, 0) * 100%));
  transition: transform 180ms ease-out;
  pointer-events: none;
}

.hour-track.is-dragging .hour-selection {
  transition: none;
}

.hour-track.is-dragging,
.hour-track.is-dragging * {
  cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
  .hour-selection {
    transition: none;
  }
}

.hour-track input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  border-radius: inherit;
  margin: 0;
  pointer-events: none;
}

.hour-track input::-webkit-slider-thumb {
  appearance: none;
  width: calc(100% / var(--slot-count, 8));
  height: calc(var(--hour-height) - var(--hour-inset) * 2);
  background: transparent;
  border-radius: 7px;
  border: 0;
}

.hour-track input::-moz-range-thumb {
  width: calc(100% / var(--slot-count, 8));
  height: calc(var(--hour-height) - var(--hour-inset) * 2);
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.hour-labels {
  position: absolute;
  inset: var(--hour-inset);
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  place-items: center;
  pointer-events: none;
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.hour-rail {
  position: absolute;
  inset: var(--hour-inset);
  border-radius: inherit;
}

.hour-rail input {
  position: absolute;
  left: calc(var(--start-index, 0) * 12.5%);
  width: calc(var(--slot-count, 8) * 12.5%);
}

.hour-rail input:disabled {
  cursor: default;
}

.hour-labels button {
  position: relative;
  z-index: 0;
  pointer-events: auto;
  width: 100%;
  padding: 0;
  background: transparent;
  font-size: inherit;
  line-height: 16px;
  color: inherit;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
}

.hour-labels button:disabled {
  opacity: 1;
  color: var(--text-quaternary);
  cursor: not-allowed;
}

.hour-labels button:disabled::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 50% 0 auto;
  height: calc(var(--hour-height) - var(--hour-inset) * 2);
  transform: translateY(-50%);
  background: repeating-linear-gradient(135deg, transparent 0 5px, var(--border-subtle) 5px 6px) var(--bg-sunken);
  pointer-events: none;
}

.hour-labels button:first-child:disabled::before,
.hour-labels button:not(:disabled) + button:disabled::before {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.hour-labels button:last-child:disabled::before,
.hour-labels button:disabled:has(+ button:not(:disabled))::before {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.hour-labels button.pending {
  color: var(--text-primary);
  text-decoration: underline dotted;
  text-underline-offset: 1px;
}

.hour-labels button.active {
  color: var(--bg-canvas);
  cursor: grab;
}

@media (hover: hover) {
  .hour-labels button:not(:disabled):not(.active):hover {
    color: var(--text-primary);
  }
}

/* === 산 상세 · 제목과 날씨 === */

.detail-hero {
  padding: var(--space-4);
  background: transparent;
}

.detail-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.detail-back {
  width: var(--space-6);
  height: var(--space-6);
  flex: none;
  margin-left: calc(var(--space-1) * -1);
  background: transparent;
  color: var(--text-secondary);
}

.detail-back .icon {
  transform: rotate(180deg);
}

#detail-panel .icon {
  fill: currentColor;
  stroke: none;
  flex-shrink: 0;
}

.detail-hero h1 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.5px;
  margin: 0;
  word-break: keep-all;
}

.detail-meta {
  padding-left: calc(var(--space-6) + var(--space-1));
  font-size: var(--text-xs);
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.detail-weather-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.detail-weather {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.detail-weather strong {
  display: inline-flex;
  align-items: flex-start;
  font-size: calc(var(--text-xl) * 2);
  line-height: 1;
  font-weight: var(--font-regular);
  letter-spacing: -2px;
}

.detail-weather strong small {
  font-size: var(--text-2xl);
  line-height: 1;
  letter-spacing: 0;
  margin-left: 2px;
}

.detail-weather-info {
  min-width: 0;
  margin: 0;
}

.detail-weather-context {
  display: grid;
  gap: 5px;
  text-align: left;
}

.detail-weather-context small {
  display: block;
  font-size: var(--text-2xs);
  line-height: var(--lh-normal);
  color: var(--text-tertiary);
}

.weather-basis {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.weather-basis-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 2px 3px;
  border-radius: calc(var(--radius-sm) - var(--space-1));
  color: var(--text-quaternary);
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  line-height: var(--lh-tight);
  white-space: nowrap;
  cursor: default;
  border: 1px solid var(--text-quaternary);
}

.weather-basis-option.active {
  color: var(--text-secondary);
  border: 1px solid var(--text-secondary);
}

.weather-basis-option.active::before {
  visibility: visible;
}

.detail-weather-description {
  margin: 0;
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
}

.weather-stats span {
  display: block;
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.weather-stats strong {
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-semibold);
}

/* === 산 상세 · 추천 점수와 기온, 코스 === */

.detail-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: 0 var(--space-4) var(--space-5);
}

.detail-conditions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.detail-section {
  min-width: 0;
  padding: 0;
  border: 0;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}

.section-label h2 {
  font-size: var(--text-base);
  margin: 0;
  font-weight: var(--font-semibold);
}

.section-label > span {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.score-line {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.score-value {
  font-size: calc(var(--text-lg) * 2);
  flex-shrink: 0;
  line-height: var(--lh-tight);
  letter-spacing: -1px;
  font-weight: var(--font-semibold);
  color: var(--accent-success-bright);
}

.score-value small {
  font-size: var(--text-xs);
  font-weight: var(--font-regular);
  color: var(--text-tertiary);
  letter-spacing: 0;
}

.score-line p {
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
  color: var(--text-secondary);
  margin: 0;
}

.score-meter {
  height: 4px;
  background: var(--bg-canvas);
  border-radius: var(--radius-full);
  margin-top: var(--space-2);
  overflow: hidden;
}

.score-meter > span {
  display: block;
  height: 100%;
  background: var(--accent-success-bright);
}

.sun-row {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-3);
  gap: var(--space-2);
}

.sun-row > div {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.sun-row .icon {
  width: 16px;
  height: 16px;
}

.sun-row b {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.hourly-chart {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: stretch;
}

.chart-hour {
  min-width: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-rows: var(--space-3) var(--space-5) var(--space-4) minmax(0, 1fr);
  gap: var(--space-1);
  align-items: center;
  justify-items: center;
  padding: var(--space-2) 0;
  line-height: var(--lh-tight);
  color: var(--text-secondary);
  font-size: var(--text-2xs);
}

.chart-hour.active {
  background: color-mix(in srgb, var(--text-primary) 12%, transparent);
  color: var(--text-primary);
}

.chart-hour b {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.chart-hour .weather-icon {
  width: 16px;
  height: 16px;
}

.chart-bar {
  align-self: end;
  width: 10px;
  min-height: 3px;
  border-radius: calc(var(--radius-sm) / 2);
  background: var(--accent-info-bright);
}

.course-button {
  background: var(--bg-raised);
  border: 0;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: left;
  padding: var(--space-3);
  margin-bottom: var(--space-1);
}

.course-button:last-child {
  margin-bottom: 0;
}

.course-button.active {
  background: color-mix(in srgb, var(--accent-info-bright) 14%, transparent);
}

.course-button strong {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  display: block;
}

.course-button span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}

.trail-course-choices .course-button small {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: var(--lh-normal);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.detail-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: var(--space-3);
  width: 100%;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin: 0;
}

.detail-button.secondary {
  justify-content: space-between;
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-2) 0;
}

.detail-source {
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  line-height: var(--lh-loose);
  margin: 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.detail-source dl,
.detail-source dd { margin: 0; }

.detail-source .source-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.detail-source dt { color: var(--text-tertiary); }
.detail-source dd { overflow-wrap: anywhere; display: flex; gap: 4px; }
.detail-source dd > span { display: block; color: var(--text-tertiary); }
.detail-source a { text-decoration: underline; text-underline-offset: 1px; }

.status-chip {
  display: inline-block;
  padding: 5px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.status-chip.warning {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 12%, transparent);
}

.poi-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.poi-counts > span {
  font-size: var(--text-xs);
  border: 0;
  padding: var(--space-2);
  min-width: 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--bg-raised);
}

/* 상세 패널의 섹션 위계와 보조 정보 */
.detail-score {
  padding: var(--space-3);
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
}

.detail-control .control-section {
  padding: 0;
  gap: 3px;
  flex-direction: column;
}

.detail-control .control-section .control-date {
  font-size: var(--text-2xs);
}

.score-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  line-height: var(--lh-normal);
}

.score-meta:empty {
  display: none;
}

#detail-panel .quiet-note {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  line-height: var(--lh-normal);
}

.detail-courses .section-label {
}

.poi-counts .poi-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poi-counts b {
  margin-left: auto;
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.detail-links {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-2);
}

.score-meter.segmented {
  position: relative;
  height: auto;
  background: none;
  border-radius: 0;
  overflow: visible;
}

.score-meter.segmented::before {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-canvas);
}

.score-filled {
  position: relative;
  display: flex;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-labels {
  /* Keep labels at the exact cumulative starts, even when narrow segments overlap. */
  position: relative;
  height: 1.5em;
  font-size: var(--text-2xs);
  line-height: 1.5;
  margin-bottom: 6px;
}

.score-segment {
  flex: 0 1 0;
  min-width: 0;
}

.score-segment-label {
  position: absolute;
  left: 0;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
}

.score-segment-label:nth-child(2) { left: var(--score-start-1); }
.score-segment-label:nth-child(3) { left: var(--score-start-2); }
.score-segment-label:nth-child(4) { left: var(--score-start-3); }

.score-segment-fill {
  display: block;
  height: 6px;
  background: var(--score-color);
}

.score-segment.has-separator .score-segment-fill { box-shadow: inset 2px 0 var(--bg-canvas); }
.score-meter.empty .score-segment-fill { visibility: hidden; }

.detail-temperature .weather-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-4);
  margin: var(--space-4) 0 0;
  font-size: var(--text-xs);
}

.weather-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2) 0;
  border-bottom: .5px solid var(--border-subtle);
  font-weight: var(--font-regular);
}

.weather-stat:nth-of-type(1), .weather-stat:nth-of-type(2) {
  border-top: .5px solid var(--border-subtle);
}

.weather-stat dt { flex-shrink: 0; color: var(--text-secondary); }
.weather-stat dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.chart-hour.past { opacity: .5; cursor: default; }
.chart-hour:disabled { cursor: default; }

.dust-observations { margin-top: var(--space-2); }
.dust-observations p {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1);
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.dust-observations p > span:last-child { font-size: var(--text-2xs); }
#camera-status:empty { display: none; }
#camera-source a { color: var(--text-primary); text-decoration: underline; }

.detail-dust, .detail-foliage, .detail-warnings, .phenomenon-section, .detail-control {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: .5px solid var(--border-subtle);
}

/* === 지도 팝업 · 출처와 축척 === */

.maplibregl-popup-content {
  background: var(--bg-surface);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  font-family: inherit;
  min-width: 170px;
  color: var(--text-primary);
}

.maplibregl-popup-content strong {
  font-size: var(--text-base);
}

.maplibregl-popup-content p {
  font-size: var(--text-2xs);
  line-height: var(--lh-loose);
  color: var(--text-secondary);
  margin: 3px 0 0;
}

.maplibregl-popup-close-button {
  font-size: var(--text-xl);
  padding: 3px var(--space-2);
  color: var(--text-secondary);
}

.maplibregl-ctrl-attrib {
  font-size: var(--text-2xs) !important;
  background: transparent !important;
}

.maplibregl-ctrl-top-right {
  top: calc(4px + env(safe-area-inset-top, 0px));
  right: calc(4px + env(safe-area-inset-right, 0px));
  max-width: calc(100% - 366px);
}

.maplibregl-ctrl-top-right .maplibregl-ctrl-attrib {
  max-width: 100%;
  margin: 0;
  line-height: var(--lh-normal);
  padding: 0;
  text-align: right;
}

.maplibregl-ctrl-attrib a {
  white-space: nowrap;
}

.maplibregl-ctrl-scale {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: var(--text-secondary) !important;
  font-size: var(--text-xs) !important;
  line-height: var(--lh-normal);
  white-space: nowrap;
  text-shadow: 0 1px 4px var(--bg-sunken);
}

/* === 초기 로딩 · 안내 메시지와 CCTV === */

.is-loading > :not(#map-loading):not(noscript):not(.header):not(.topbar):not(.modal-overlay),
.is-loading .search-wrap {
  visibility: hidden;
}

.is-loading .topbar { z-index: 21; }

.map-loading {
  position: fixed;
  inset: var(--map-header-height) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg-canvas);
  z-index: 20;
}

.map-loading strong {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.map-loading > span {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

#map-loading-status {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--lh-normal);
  color: var(--text-secondary);
  text-align: center;
}

.loading-indicator {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-default);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

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

.loading-check {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: var(--text-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loading-check path {
  stroke-width: 2.5;
  stroke-dasharray: 1;
  animation: loading-check 0.22s ease-out both;
}

@keyframes loading-check {
  from {
    stroke-dashoffset: 1;
  }

  to {
    stroke-dashoffset: 0;
  }
}

.toast {
  border: 0;
  opacity: 1;
  animation: none;
  position: absolute;
  bottom: 245px;
  left: 50%;
  transform: translateX(-30%);
  background: color-mix(in srgb, var(--bg-raised) 96%, transparent);
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: 13px 20px;
  max-width: min(440px, 90vw);
  border-radius: var(--radius-md);
  z-index: 12;
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  line-height: var(--lh-loose);
}

.mobile-detail-toggle,
.mobile-detail-close {
  display: none;
}

dialog {
  border: 0;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  width: min(680px, calc(100vw - 30px));
  padding: var(--space-5);
  box-shadow: 0 20px 90px color-mix(in srgb, var(--bg-sunken) 40%, transparent);
}

dialog::backdrop {
  background: color-mix(in srgb, var(--bg-sunken) 70%, transparent);
  backdrop-filter: blur(5px);
}

.camera-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 17px;
}

.camera-heading h2 {
  margin: 0;
  font-size: var(--text-xl);
  letter-spacing: -0.7px;
}

.camera-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.camera-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 13px;
}

#camera-options {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

#camera-source {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 0 1 auto;
  min-width: 0;
  max-width: 45%;
  margin: 0;
  white-space: nowrap;
}

#camera-source a {
  overflow: hidden;
  text-overflow: ellipsis;
}

#camera-options button {
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  padding: 7px var(--space-3);
  font-size: var(--text-xs);
  background: var(--bg-raised);
}

#camera-options button.active {
  background: var(--text-primary);
  color: var(--bg-surface);
}

#camera-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: var(--space-4);
  text-align: center;
  pointer-events: none;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--lh-loose);
}

.no-script {
  position: fixed;
  inset: 40%;
  background: var(--bg-surface);
  padding: 20px;
  z-index: 20;
}

/* === 화면 크기별 배치 · 큰 화면, 태블릿, 모바일 === */

@media (min-width: 1700px) {
  .sidebar {
    width: 310px;
  }

  .search-wrap {
    width: 310px;
  }

  .timeline {
    left: 368px;
  }
}

@media (max-width: 1100px) {
  .topbar {
    gap: 20px;
  }

  .search-wrap {
    width: 284px;
  }

  .date-tabs button {
    min-width: 60px;
  }
}

@media (max-width: 760px) {
  .topbar {
    top: 12px;
    left: 15px;
    height: 43px;
    gap: 13px;
  }

  .search-wrap {
    height: 40px;
    border-radius: var(--radius-md);
    padding: 0 10px;
    gap: 7px;
    flex: none;
    width: 156px;
  }

  .search-wrap > .icon {
    width: 15px;
    height: 15px;
  }

  .map-actions {
    right: 15px;
    gap: 4px;
  }

  .rotation-buttons,
  .zoom-buttons {
    display: none;
  }

  .action-button {
    width: 37px;
    height: 37px;
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
  }

  .zoom-buttons button,
  .rotation-buttons button {
    width: 37px;
    height: 32px;
  }

  .map-actions .icon {
    width: 17px;
    height: 17px;
  }

  .timeline {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 10px 10px;
  }

  .date-tabs {
  }

  .date-tabs button {
    padding: 6px var(--space-1);
    min-width: 55px;
  }

  .date-tabs button strong {
    font-size: inherit;
  }

  .hour-labels {
    font-size: var(--text-xs);
  }

  .sidebar {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    max-height: 62dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 7;
    transform: translateY(105%);
    transition: transform 0.28s;
    box-shadow: 0 -10px 40px color-mix(in srgb, var(--bg-sunken) 20%, transparent);
    padding-bottom: env(safe-area-inset-bottom, 10px);
  }

  body.panel-open .sidebar {
    transform: translateY(0);
  }

  .mountain-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 6px;
  }

  .mountain-row {
    padding: 10px 7px;
  }

  .mountain-row .row-name {
    font-size: var(--text-sm);
  }

  .mountain-row small {
    font-size: var(--text-2xs);
  }

  .mobile-detail-toggle {
    display: flex;
    position: absolute;
    right: 0;
    bottom: calc(100% + var(--space-2));
    align-items: center;
    gap: 5px;
    background: var(--bg-surface);
    padding: 10px 12px;
    box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    z-index: 8;
  }

  body.panel-open .mobile-detail-toggle {
    display: none;
  }

  body.panel-open .mobile-detail-close {
    display: grid;
    position: sticky;
    top: 12px;
    width: 40px;
    height: 40px;
    margin: 12px 12px -52px auto;
    background: var(--bg-surface);
    color: var(--text-secondary);
    z-index: 1;
  }

  .detail-back {
    display: none;
  }

  .detail-top {
    padding-right: 40px;
  }

  .detail-meta {
    padding-left: 0;
  }

  .detail-hero {
    padding: var(--space-5) var(--space-5) var(--space-3) var(--space-5);
  }

  .detail-hero h1 {
    font-size: var(--text-xl);
  }

  .detail-weather strong {
    font-size: calc(var(--text-xl) * 2);
  }

  .detail-body {
    padding: 0 var(--space-5) var(--space-5) var(--space-5);
  }

  .toast {
    bottom: 315px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100vw - 35px);
    font-size: var(--text-xs);
  }

  .maplibregl-ctrl-top-right {
    max-width: calc(100% - 231px - env(safe-area-inset-right, 0px));
  }

  .maplibregl-ctrl-attrib {
    font-size: var(--text-2xs) !important;
  }

  .search-results {
    left: 0;
    width: min(340px, calc(100vw - 30px));
    right: auto;
    top: 50px;
    max-height: calc(100dvh - 95px);
  }

  .camera-heading h2 {
    font-size: var(--text-xl);
  }

  dialog {
    padding: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}

/* === 특보 · 미세먼지 · 장소 아이콘 === */

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-heading h2 {
  margin: 0;
  font-size: var(--text-md);
}

.panel-heading .icon-button {
  width: 27px;
  height: 27px;
}

.panel-heading .icon {
  width: 16px;
  height: 16px;
}

.detail-alerts small {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
}

.alert-tag {
  display: inline-block;
  align-self: flex-start;
  padding: var(--space-1) 7px;
  border-radius: calc(var(--radius-sm) / 2);
  background: color-mix(in srgb, var(--text-primary) 12%, transparent);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.alert-tag.level-2 {
  background: color-mix(in srgb, var(--accent-danger) 15%, transparent);
  color: var(--accent-danger-bright);
}

.alert-tag.level-3 {
  background: color-mix(in srgb, var(--accent-danger) 60%, var(--bg-sunken));
  color: var(--text-primary);
}

.alert-notice {
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
  padding: 9px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text-primary) 12%, transparent);
  color: var(--text-primary);
}

.detail-condition {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-sm);
}

.detail-condition .condition-icon {
  font-size: 20px;
  font-style: normal;
  font-weight: var(--font-regular);
  line-height: 1;
}

.condition-icon.ph-fill { font-family: "Phosphor-Fill"; }
.condition-icon.ph-bold { font-family: "Phosphor-Bold"; }
.dust-detail .ph-smiley::before { content: "\e436"; }
.dust-detail .ph-smiley-meh::before { content: "\e43a"; }
.dust-detail .ph-smiley-sad::before { content: "\e43e"; }
.dust-detail .ph-smiley-melting::before { content: "\ee56"; }
.detail-condition b { font-size: var(--text-base); font-weight: var(--font-semibold); }
.dust-observations b { font-weight: var(--font-semibold); }
.phenomenon-detail { color: var(--accent-info-bright); }
.phenomenon-detail.possible { color: color-mix(in srgb, var(--accent-info-bright) 75%, var(--text-primary)); }
.phenomenon-detail .ph-waves::before { content: "\e6de"; }
.phenomenon-detail .ph-snowflake::before { content: "\e5aa"; }

.detail-link-icon {
  font-family: "Phosphor-Bold";
  font-size: 16px;
  font-style: normal;
  font-weight: var(--font-regular);
  line-height: 1;
}
.detail-link-icon.ph-arrow-up-right::before { content: "\e092"; }

.detail-alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 0;
}

.detail-alerts > b {
  font-size: var(--text-xs);
}

.poi-key {
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  color: inherit;
  font-size: var(--text-base);
  font-weight: normal;
  font-style: normal;
  flex-shrink: 0;
}

.poi-counts > span {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.poi-counts .poi-key {
  width: 14px;
  height: 14px;
  font-size: var(--text-sm);
}

.maplibregl-popup-content > strong {
  display: block;
  padding-right: var(--space-2);
}

@media (max-width: 760px) {
  .mountain-list {
    grid-template-columns: 1fr;
  }
}

.morning-button {
  background: transparent;
  color: var(--text-primary);
  border: 0;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  padding: 6px 9px;
}

/* === 날씨 효과 미리보기 === */

.weather-demo {
  position: absolute;
  top: 183px;
  left: 342px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: calc(100vw - 440px);
  padding: 9px var(--space-3);
  background: var(--bg-raised);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  z-index: 4;
}

.weather-demo strong {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-primary);
}

.weather-demo small {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-2xs);
  color: var(--text-secondary);
}

.weather-demo select {
  min-width: 0;
  max-width: 145px;
  padding: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-xs);
}

.weather-demo select:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

@media (min-width: 1700px) {
  .weather-demo {
    left: 368px;
  }
}

@media (max-width: 760px) {
  .weather-demo {
    top: 153px;
    left: 15px;
    max-width: calc(100vw - 90px);
    gap: 9px;
    padding: 7px 9px;
  }

  .weather-demo strong,
  .weather-demo select {
    font-size: var(--text-xs);
  }

  .weather-demo small {
    font-size: var(--text-2xs);
  }

  .weather-demo select {
    max-width: 126px;
  }
}

/* === 특보 미리보기와 팝업 === */

.alert-demo-stop {
  position: absolute;
  right: 82px;
  top: 98px;
  z-index: 4;
  font-size: var(--text-xs);
  padding: var(--space-2) 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  white-space: nowrap;
}

.alert-popup .maplibregl-popup-content {
  padding: 17px 19px;
}

.alert-popup-body {
  max-height: min(360px, calc(100dvh - 220px));
  overflow: auto;
}

.alert-popup-body > strong {
  display: block;
  padding-right: var(--space-3);
  font-size: var(--text-md);
}

.alert-popup-body .alert-popup-scope {
  margin: 6px 0 var(--space-3);
  color: var(--text-primary);
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
}

.alert-popup-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-default);
}

.alert-popup-item small {
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
  color: var(--text-secondary);
}

.alert-popup-item em {
  font-size: var(--text-2xs);
  line-height: var(--lh-normal);
  font-style: normal;
  color: var(--text-primary);
}

.alert-popup-body .alert-popup-source {
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  margin: var(--space-3) 0 0;
  line-height: var(--lh-loose);
}

.alert-popup .maplibregl-popup-close-button {
  font-size: var(--text-xl);
  padding: var(--space-1) var(--space-2);
}

.alert-popup .alert-notice {
  font-size: var(--text-xs);
}

/* === 지도 팝업 색상 보정 === */
.brand small {
  color: var(--text-secondary);
}

.maplibregl-ctrl-attrib {
  color: var(--text-secondary) !important;
}

.maplibregl-ctrl-attrib a {
  color: inherit;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: var(--bg-surface);
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: var(--bg-surface);
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: var(--bg-surface);
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: var(--bg-surface);
}

/* === 산 목록과 상세 패널 · 날씨 아이콘과 점수 배치 === */
.row-main {
  width: 100%;
  min-width: 0;
}

.row-score {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

.row-name-line {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}

.row-name-line .row-name {
  min-width: 0;
}

.row-alerts {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
}

.row-alert {
  font-size: var(--text-xs);
  font-style: normal;
  font-weight: var(--font-regular);
  line-height: 1;
}

.row-alert.ph-fill {
  font-family: "Phosphor-Fill";
}
.row-alert.ph-bold {
  font-family: "Phosphor-Bold";
}
.row-alert.lvl-1,
.detail-condition.lvl-1 {
  color: var(--accent-warning-bright);
}
.row-alert.lvl-2,
.detail-condition.lvl-2 {
  color: var(--accent-danger-bright);
}
.row-alert.lvl-3,
.detail-condition.lvl-3 {
  color: var(--accent-critical-bright);
}

.row-alert.ph-wind::before {
  content: "\e5d2";
}

.row-alert.ph-umbrella-simple::before {
  content: "\e686";
}

.row-alert.ph-thermometer-cold::before {
  content: "\e5c8";
}

.row-alert.ph-drop-slash::before {
  content: "\e954";
}

.row-alert.ph-snowflake::before {
  content: "\e5aa";
}

.row-alert.ph-fire::before {
  content: "\e242";
}

.row-alert.ph-dots-nine::before {
  content: "\e1fc";
}

.row-alert.ph-cloud-fog::before {
  content: "\e53c";
}

.row-alert.ph-tornado::before {
  content: "\e88c";
}

.row-alert.ph-warning::before {
  content: "\e4e0";
}

/* 산 목록: 산 정보 | 하늘 상태 | 기온 | 추천 점수 */
.row-main .row-name,
.row-main > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-temp {
  text-align: center;
  white-space: nowrap;
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: var(--font-regular);
}

.row-weather {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}

.row-weather .ph-fill {
  font-family: "Phosphor-Fill";
  font-size: var(--text-md);
  font-style: normal;
  font-weight: var(--font-regular);
  line-height: 1;
  color: var(--text-secondary);
}

.row-weather .ph-sun::before {
  content: "\e472";
}

.row-weather .ph-cloud::before {
  content: "\e1aa";
}

.row-weather .ph-sun-dim::before {
  content: "\e474";
}

.row-weather .ph-umbrella-simple::before {
  content: "\e686";
}

.row-weather .ph-snowflake::before {
  content: "\e5aa";
}

.row-weather .ph-question::before {
  content: "\e3e8";
}

.row-weather .ph-moon::before {
  content: "\e330";
}

.weather-icon {
  object-fit: contain;
  flex: none;
  width: 20px;
  height: 20px;
}

.row-main > small {
  margin-top: 0;
}

.mountain-row {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.detail-weather > .weather-icon {
  width: 44px;
  height: 44px;
  margin-left: -2px;
}

.detail-weather > small {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--lh-loose);
  margin-left: auto;
}

.poi-counts .poi-key {
  padding: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.phenomenon-slots {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* === 축척 · 현위치 표시 === */

#map-scale {
  width: 42px;
  display: flex;
  justify-content: center;
  margin: 0 0 2px;
  min-height: 14px;
}

#map-scale .maplibregl-ctrl-scale {
  width: auto !important;
  float: none;
  margin: 0;
  text-align: center;
}

.user-location {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 1px 5px color-mix(in srgb, var(--bg-sunken) 53%, transparent);
  pointer-events: none;
}

.user-location::before,
.user-location::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid color-mix(in srgb, var(--text-primary) 40%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-primary) 9%, transparent);
  opacity: 0;
  animation: location-pulse 2.4s cubic-bezier(0.16, 0.5, 0.4, 1) infinite;
  pointer-events: none;
}

.user-location::after {
  animation-delay: 1.2s;
}

@keyframes location-pulse {
  0% {
    transform: scale(0.5);
    opacity: 0.65;
  }

  75%,
  100% {
    transform: scale(2.8);
    opacity: 0;
  }
}

/* === 장소 상세 팝업 === */

.place-popup > strong {
  display: block;
  padding-right: var(--space-3);
}

.place-popup dl {
  margin: 3px 0 0;
  display: grid;
  gap: 3px;
}

.place-popup dl > div {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: var(--space-2);
  font-size: var(--text-xs);
  line-height: var(--lh-normal);
}

.place-popup dt {
  color: var(--text-secondary);
}

.place-popup dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* === 사진 목록 · 등록 · 확대 보기 === */

.map-photos .section-label {
  align-items: center;
}

.map-photo-marker {
  width: 44px;
  height: 48px;
  padding: 0 2px 8px;
  background: transparent;
  border-radius: 9px;
}

.map-photo-marker::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 12px;
  height: 9px;
  background: #fff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform: translateX(-50%);
}

.photo-marker-frame {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 8px;
  background: var(--bg-raised);
  box-shadow: 0 2px 8px #0008;
}

.photo-marker-frame img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-marker-fallback {
  position: absolute;
  inset: 7px;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text-secondary);
}

.map-photo-marker:hover .photo-marker-frame,
.map-photo-marker:focus-visible .photo-marker-frame {
  box-shadow: 0 0 0 3px #ffffff40, 0 2px 10px #0008;
}

.photo-marker-count {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: var(--bg-surface);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
}

.photo-marker-gallery > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.photo-marker-popup .maplibregl-popup-content {
  width: 250px;
  padding: 16px;
}

.photo-add,
.photo-retry {
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  padding: var(--space-2) 10px;
}

.photo-add {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  color: var(--text-secondary);
}

.photo-add > .ph-plus {
  font-family: "Phosphor-Bold";
  font-size: calc(var(--text-2xl) * .8);
  font-style: normal;
  line-height: 1;
  font-weight: var(--font-regular);
}

.photo-add > .ph-plus::before { content: "\e3d4"; }

.photo-add:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.photo-retry {
  margin-top: 9px;
  line-height: var(--lh-normal);
}

.map-photo-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.map-photo-thumb {
  position: relative;
  padding: 0;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-raised);
}

.map-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-photo-thumb span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, color-mix(in srgb, var(--bg-sunken) 60%, transparent));
  font-size: var(--text-2xs);
  color: var(--text-primary);
  text-align: right;
  padding: var(--space-3) var(--space-1) var(--space-1);
}

/* Photo dialogs share the mountain cards' markup, styles and interactions. */
.map-page .photo-report-sheet,
.map-page .talk-image-modal {
  line-height: normal;
}

.map-page :is(.photo-report-sheet, .talk-image-modal) .ph-bold {
  font-family: "Phosphor-Bold";
  font-style: normal;
  font-weight: var(--font-regular);
  line-height: 1;
}

.map-page :is(.photo-report-sheet, .talk-image-modal) .ph-x::before { content: "\e4f6"; }
.map-page .photo-report-sheet .ph-image-square::before { content: "\e2cc"; }
.map-page .photo-report-sheet .ph-trash::before { content: "\e4a6"; }

.map-page:has(.photo-report-sheet:not([hidden]), .talk-image-modal:not([hidden])) #toast {
  z-index: 1300;
}

@media (max-width: 760px) {
  #map-scale {
    width: 37px;
  }

  .map-photo-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* === 등산로와 코스 · 하단 시트 === */

.route-sheet {
  position: absolute;
  left: 342px;
  right: 87px;
  bottom: 32px;
  max-width: 560px;
  max-height: min(320px, 44dvh);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 30px color-mix(in srgb, var(--bg-sunken) 15%, transparent);
  z-index: 8;
  animation: route-sheet-in 0.22s ease-out;
}

.route-sheet-header {
  flex-shrink: 0;
  padding: 10px 20px 0;
}

.route-sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.route-sheet-heading h2 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  letter-spacing: -0.4px;
  line-height: var(--lh-normal);
  margin: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.route-sheet-heading .icon-button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-secondary);
  margin-right: calc(var(--space-2) * -1);
}

.route-sheet-content {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--space-2) 20px 20px;
  scrollbar-width: thin;
}

.route-details {
  display: grid;
  gap: 10px;
}

.route-details h3 {
  margin: 0 0 3px 0;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.route-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) 28px;
  margin: 0;
}

.route-summary > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 52px;
}

.route-summary dt {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.route-summary dd {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
}

.route-waypoints {
  display: flex;
  flex-wrap: wrap;
  gap: 0 3px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--lh-loose);
}

.route-waypoints li {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  overflow-wrap: anywhere;
}

.route-waypoints li + li::before {
  content: "→";
  color: var(--text-tertiary);
}

.route-notice-text {
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
  color: var(--text-secondary);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.route-sources {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  line-height: var(--lh-loose);
  color: var(--text-secondary);
}

.route-sources dl {
  display: grid;
  gap: var(--space-1);
  margin: 0;
}

.route-source {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: var(--space-2);
}

.route-source dt { color: var(--text-tertiary); }
.route-source dd { margin: 0; overflow-wrap: anywhere; }
.route-sources a {
  text-decoration: underline;
  text-underline-offset: 1px;
}

@keyframes route-sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 1700px) {
  .route-sheet {
    left: 368px;
  }
}

@media (max-width: 760px) {
  .route-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    max-height: 40dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .route-sheet-header {
    padding: 10px 22px 0;
  }

  .route-sheet-heading h2 {
    font-size: var(--text-lg);
  }

  .route-sheet-heading .icon-button {
    width: 44px;
    height: 44px;
  }

  .route-sheet-content {
    padding: var(--space-2) 22px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  body.route-sheet-open .mobile-detail-toggle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .route-sheet {
    animation: none;
  }
}

/* === 지도 회전 버튼 · 낮은 화면 높이 대응 === */

.rotation-buttons button {
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media (max-width: 760px) and (max-height: 620px) {
  .map-actions {
    max-height: calc(100dvh - 225px);
    overflow-y: auto;
    scrollbar-width: none;
  }

  .map-actions > * {
    flex-shrink: 0;
  }
}
