:root {
  color-scheme: dark;
  --bg: #14161d;
  --panel: rgba(18, 22, 31, 0.78);
  --panel-strong: rgba(20, 25, 35, 0.94);
  --panel-subtle: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.17);
  --text: #f4f7fb;
  --muted: #8f9aaa;
  --soft: #c7d0dc;
  --accent: #2dd4bf;
  --accent-deep: #0f9f8f;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-2: #d5a34d;
  --flow-accent: #2be6ff;
  --flow-glow: rgba(43, 230, 255, 0.3);
  --flow-end: #eafcff;
  --dim-opacity: 0.18;
  --dim-road-opacity: 0.06;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.22);
  font-family:
    Inter, Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

.shell {
  width: 100vw;
  height: 100vh;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.08), transparent 30%),
    linear-gradient(315deg, rgba(70, 84, 112, 0.12), transparent 38%),
    var(--bg);
}

.map-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

#map {
  position: absolute;
  inset: 0;
}

#map::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(20, 22, 29, 0.48), transparent 34%),
    linear-gradient(0deg, rgba(20, 22, 29, 0.42), transparent 32%);
}

.topbar,
.detail-panel,
.legend,
.tooltip,
.rank-panel {
  backdrop-filter: blur(20px) saturate(1.08);
  -webkit-backdrop-filter: blur(20px) saturate(1.08);
}

/* ---- 좌측 순위/검색 사이드바 ------------------------------------------ */
.rank-panel {
  position: absolute;
  z-index: 5;
  top: 104px;
  left: 18px;
  display: flex;
  flex-direction: column;
  width: min(300px, calc(100vw - 36px));
  /* 위 topbar ~ 아래 legend 사이에 양끝 고정 — 화면이 작아도 겹침 불가 */
  bottom: 238px;
  max-height: none;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.rank-search {
  position: relative;
  margin-bottom: 12px;
}

.rank-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.rank-search input:focus {
  border-color: rgba(45, 212, 191, 0.72);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
}

.search-results {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  margin: 0;
  padding: 4px;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.search-results:empty {
  display: none;
}

.search-results li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  transition: background 150ms ease, color 150ms ease;
}

.search-results li:hover,
.search-results li.active {
  background: var(--accent-soft);
}

.search-results li small {
  color: var(--muted);
  font-size: 12px;
}

.rank-heading {
  margin-bottom: 10px;
}

.rank-heading h2 {
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
}

.rank-list {
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.rank-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.rank-row:hover {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.08);
}

.rank-row.active {
  background: var(--accent-soft);
  border-color: rgba(45, 212, 191, 0.36);
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.16);
}

.rank-num {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rank-row.active .rank-num {
  color: var(--accent);
}

.rank-name {
  min-width: 0;
  overflow: hidden;
}

.rank-name b {
  display: block;
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-name small {
  color: var(--muted);
  font-size: 11px;
}

.rank-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  width: 64px;
}

.rank-val {
  font-size: 13px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.rank-bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.095);
  overflow: hidden;
}

.rank-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

.rank-toggle {
  display: none;
  position: absolute;
  z-index: 6;
  top: 104px;
  left: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 720;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: border-color 150ms ease, background 150ms ease;
}

.topbar {
  position: absolute;
  z-index: 4;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 22, 31, 0.76);
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(23px, 3vw, 33px);
  line-height: 1.08;
  font-weight: 760;
  letter-spacing: 0;
}

.metric-control {
  display: grid;
  gap: 8px;
  min-width: 190px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 38px 11px 13px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

select:focus {
  border-color: rgba(45, 212, 191, 0.72);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
}

.detail-panel {
  position: absolute;
  z-index: 5;
  right: 18px;
  bottom: 18px;
  width: min(390px, calc(100vw - 36px));
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: 0;
}

.panel-summary {
  color: var(--soft);
  font-size: 14px;
  line-height: 1.62;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stat-grid article {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 10px;
  background: var(--panel-subtle);
}

.stat-grid span,
.bar-row > span,
.legend-header strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.section-title h3 {
  font-size: 15px;
  font-weight: 740;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.breakdown-row,
.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 58px;
  align-items: center;
  gap: 10px;
  min-height: 35px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.breakdown-row span:first-child {
  color: var(--soft);
  font-size: 13px;
}

.breakdown-row strong,
.bar-row strong {
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 180ms ease;
}

.bar.selected {
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

.bar.average {
  background: linear-gradient(90deg, #9f7a35, var(--accent-2));
}

/* 창업 여건(베타) 3요소 분해 */
.ease-factor {
  display: grid;
  grid-template-columns: 96px 1fr 56px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  margin-bottom: 10px;
}
.ease-factor-label {
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
}
.ease-factor-word {
  text-align: right;
  font-size: 13px;
  color: var(--accent);
}
.ease-factor-hint {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.ease-note {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  margin: 4px 0 0;
}

/* 동네 상세 링크 / 준비중 안내 */
.detail-link {
  margin: 12px 0 2px;
}
.detail-btn {
  display: inline-block;
  border: 1px solid rgba(45, 212, 191, 0.38);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 720;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease;
}
.detail-btn:hover {
  background: rgba(45, 212, 191, 0.2);
  border-color: var(--accent);
}
.detail-soon {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.legend {
  position: absolute;
  z-index: 4;
  left: 18px;
  bottom: 18px;
  width: min(310px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 22, 31, 0.76);
  box-shadow: var(--shadow-soft);
}

.legend-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.legend-header span {
  font-size: 14px;
  font-weight: 760;
}

.legend-copy {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.4;
}

.legend-chips {
  display: grid;
  gap: 6px;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chip-swatch {
  width: 18px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.chip-label {
  color: var(--soft);
  font-size: 12px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.tooltip {
  position: fixed;
  z-index: 20;
  display: none;
  min-width: 210px;
  max-width: min(320px, calc(100vw - 32px));
  pointer-events: none;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
}

.tooltip strong {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
}

.tooltip-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #dffcf7;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
}

.vacancy-rec {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.vacancy-rec strong {
  margin-bottom: 0;
  font-size: 12px;
}

.vacancy-rec p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.tooltip span {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.7;
}

.tooltip span b {
  min-width: 0;
  color: var(--text);
  font-weight: 760;
  text-align: right;
  overflow-wrap: anywhere;
}

.maplibregl-ctrl-bottom-left {
  display: none;
}
.maplibregl-ctrl-bottom-right {
  display: block;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(18, 22, 31, 0.82);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.maplibregl-ctrl-group button {
  background-color: transparent;
}

.maplibregl-ctrl-group button + button {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.maplibregl-ctrl-attrib {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(18, 22, 31, 0.72) !important;
  color: var(--muted);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ===== 서교동 딥다이브 전용 ===== */
.back-link {
  align-self: center;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--soft);
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.back-link:hover {
  border-color: rgba(45, 212, 191, 0.55);
  background: var(--accent-soft);
  color: var(--text);
}

/* 업종 필터 칩 바 — topbar 아래 가로 스크롤 */
.chip-bar {
  position: absolute;
  z-index: 5;
  top: 98px;
  left: 18px;
  right: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 22, 31, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px) saturate(1.08);
  -webkit-backdrop-filter: blur(20px) saturate(1.08);
}
.chip-bar-inner {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.cat-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--soft);
  font: inherit;
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.cat-chip:hover {
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
}
.cat-chip.active {
  border-color: rgba(45, 212, 191, 0.78);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.26), rgba(15, 159, 143, 0.24));
  color: #effffb;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.18), 0 8px 22px rgba(15, 159, 143, 0.12);
}
.chip-count {
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.cat-chip.active .chip-count {
  color: #b7fff3;
}

/* 서교동 패널: 4칸 stat grid */
.seogyo-panel .stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.seogyo-panel .stat-grid strong {
  font-size: 19px;
}
.dense-copy {
  font-size: 12.5px;
  line-height: 1.55;
}
.near-name {
  color: var(--soft);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seogyo-legend {
  max-width: min(330px, calc(100vw - 36px));
}

@media (max-width: 760px) {
  .chip-bar {
    top: 118px;
    left: 12px;
    right: 12px;
  }
  .back-link {
    justify-self: start;
  }
}

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

  .shell {
    min-height: 100vh;
    height: auto;
    padding: 0;
  }

  .map-stage {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    top: 12px;
    left: 12px;
    right: 12px;
    display: grid;
    padding: 13px;
    gap: 12px;
  }

  .metric-control {
    min-width: 0;
  }

  .legend {
    left: 12px;
    right: 12px;
    bottom: 282px;
    width: auto;
    padding: 13px;
  }

  .rank-toggle {
    display: block;
    top: auto;
    bottom: 282px;
    left: 12px;
  }

  .rank-panel {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 60vh;
    padding: 13px;
  }

  /* 모바일: 접힘 상태(토글로 펼침). 펼침 시 상세패널 위로 덮음 */
  .rank-panel[hidden] {
    display: none;
  }

  .rank-panel:not([hidden]) {
    z-index: 7;
  }

  .detail-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 254px;
    padding: 14px;
  }

  .stat-grid {
    gap: 8px;
    margin: 14px 0;
  }

  .stat-grid article {
    padding: 12px;
  }

  h2 {
    font-size: 21px;
  }

  .panel-summary {
    font-size: 13px;
  }
}

.subtitle {
  margin-left: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
  letter-spacing: 0;
}


/* select 옵션 — OS 기본 흰 배경에서도 읽히게 (버그픽스) */
select option {
  color: #16181f;
  background: #ffffff;
}

/* ===== 지금 홍대: 실시간 혼잡도 위젯 ===== */
.live-widget {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-subtle);
}
.live-widget[hidden] {
  display: none;
}
.live-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.live-head {
  min-width: 0;
}
.live-head .eyebrow {
  margin: 0 0 7px;
}
.live-congest {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--lv, var(--muted)) 18%, transparent);
  color: var(--lv, var(--soft));
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lv, var(--muted)) 45%, transparent);
}
.live-figures {
  text-align: right;
  flex: 0 0 auto;
}
.live-figures strong {
  display: block;
  font-size: 17px;
  font-weight: 760;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.live-figures span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.live-msg {
  margin: 10px 0 0;
  color: var(--soft);
  font-size: 12.5px;
  line-height: 1.5;
}
.live-msg:empty {
  display: none;
}
.live-fcst {
  margin-top: 12px;
}
.live-fcst-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 48px;
}
.live-bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px 3px 1px 1px;
  opacity: 0.9;
}
.live-fcst-axis {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.live-fcst-axis span {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.live-source {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

/* ===== Redesign v1 layout overrides ===== */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --fz-hero: 48px;
  --fz-h1: 22px;
  --fz-h2: 20px;
  --fz-stat: 28px;
  --fz-h3: 14px;
  --fz-body: 13px;
  --fz-label: 12px;
  --fz-eyebrow: 11px;
  --lh-tight: 1.1;
  --lh-body: 1.55;
  --fw-reg: 450;
  --fw-med: 600;
  --fw-bold: 740;
  --surface-1: rgba(20, 24, 33, 0.92);
  --surface-2: rgba(255, 255, 255, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-panel: 0 8px 28px rgba(0, 0, 0, 0.3);
  --ui-accent: #5b9dff;
  --ui-accent-soft: rgba(91, 157, 255, 0.16);
  --hero-ink: #ffffff;
  --accent: var(--ui-accent);
  --accent-deep: #3478e5;
  --accent-soft: var(--ui-accent-soft);
}

.shell {
  padding: 0;
  background: var(--bg);
}

.map-stage {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#map::after {
  background: linear-gradient(90deg, rgba(20, 22, 29, 0.18), transparent 22%);
}

.topbar,
.detail-panel,
.legend,
.tooltip,
.rank-panel,
.metric-chip-bar {
  backdrop-filter: blur(12px) saturate(1.04);
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
}

.topbar {
  z-index: 5;
  top: var(--space-4);
  left: var(--space-4);
  right: var(--region-right);
  height: 64px;
  box-sizing: border-box;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.topbar .eyebrow {
  display: none;
}

h1 {
  font-size: var(--fz-h1);
  line-height: var(--lh-tight);
}

.subtitle {
  font-size: var(--fz-label);
}

.metric-control {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.metric-chip-bar {
  position: absolute;
  z-index: 5;
  top: 76px;
  left: calc(256px + var(--space-4) * 2);
  right: auto;
  max-width: calc(100vw - 256px - var(--space-4) * 3);
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(20, 24, 33, 0.84);
  box-shadow: var(--shadow-panel);
  scrollbar-width: thin;
}

.metric-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  font: inherit;
  font-size: var(--fz-body);
  font-weight: var(--fw-med);
  cursor: pointer;
}

.metric-chip.active {
  border-color: rgba(91, 157, 255, 0.72);
  background: var(--ui-accent-soft);
  color: var(--text);
}

.rank-panel {
  top: 76px;
  bottom: var(--space-4);
  left: var(--space-4);
  width: 256px;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-panel);
}

.rank-heading h2 {
  font-size: var(--fz-h3);
}

.rank-row {
  grid-template-columns: 26px 1fr auto;
  padding: var(--space-2) 9px;
  border-radius: var(--radius-sm);
}

.rank-row.active {
  border-color: rgba(91, 157, 255, 0.34);
  box-shadow: inset 4px 0 0 var(--ui-accent);
}

.rank-row.active .rank-num {
  color: var(--ui-accent);
}

.rank-search input:focus,
select:focus {
  border-color: rgba(91, 157, 255, 0.72);
  box-shadow: 0 0 0 3px var(--ui-accent-soft);
}

.detail-panel {
  z-index: 6;
  top: 72px;
  right: var(--space-4);
  bottom: 72px;
  width: 360px;
  max-height: none;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-panel);
  transform: translateX(112%);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.detail-panel.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.detail-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.hero {
  margin: 2px 40px var(--space-5) 0;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.hero-label {
  display: block;
  color: var(--muted);
  font-size: var(--fz-label);
  font-weight: var(--fw-bold);
}

.hero-num {
  display: block;
  margin-top: var(--space-2);
  color: var(--hero-ink);
  font-size: var(--fz-hero);
  font-weight: var(--fw-bold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-rank {
  display: inline-block;
  margin-top: var(--space-2);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--ui-accent-soft);
  color: #dce9ff;
  font-size: var(--fz-label);
  font-weight: var(--fw-bold);
}

.panel-heading {
  display: block;
}

h2 {
  font-size: var(--fz-h2);
}

.panel-summary,
.breakdown-row span:first-child,
.ease-factor-label {
  font-size: var(--fz-body);
}

.stat-grid strong {
  font-size: var(--fz-stat);
}

.section-title h3 {
  font-size: var(--fz-h3);
}

.legend {
  left: calc(256px + var(--space-4) * 2);
  right: 392px;
  bottom: var(--space-4);
  width: auto;
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(20, 24, 33, 0.86);
  box-shadow: var(--shadow-panel);
}

.legend-header,
.legend-chips {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.legend-header {
  justify-content: flex-start;
  margin-bottom: var(--space-2);
}

.legend-copy {
  display: none;
}

.legend-chip {
  gap: 6px;
}

.chip-swatch {
  width: 28px;
  height: 12px;
  border-radius: 4px;
}

.sheet-stop-controls {
  display: none;
}

.disclaimer {
  z-index: 4 !important;
}

@media (max-width: 1024px) {
  .metric-chip-bar {
    left: var(--space-4);
    top: 136px;
  }

  .rank-panel {
    top: 188px;
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .shell,
  .map-stage {
    height: 100vh;
    min-height: 100vh;
  }

  .topbar {
    top: var(--space-3);
    left: var(--space-3);
    right: var(--space-3);
    min-height: 52px;
    padding: var(--space-3);
  }

  h1 {
    font-size: 18px;
  }

  .subtitle {
    display: block;
    margin: 4px 0 0;
  }

  .metric-chip-bar {
    top: 76px;
    left: var(--space-3);
    right: var(--space-3);
  }

  .legend {
    left: var(--space-3);
    right: var(--space-3);
    bottom: 128px;
    padding: var(--space-2);
  }

  .legend-header {
    margin-bottom: 6px;
  }

  .legend-chips {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .rank-toggle {
    display: none;
  }

  .rank-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    width: auto;
    height: 120px;
    padding: 16px 16px 20px;
    border-radius: 16px 16px 0 0;
    overflow: auto;
    scroll-snap-type: y proximity;
  }

  .rank-panel::before {
    display: block;
    width: 36px;
    height: 4px;
    margin: 0 auto var(--space-3);
    border-radius: 2px;
    background: var(--line-strong);
    content: "";
  }

  .rank-heading,
  .rank-search,
  .rank-row {
    scroll-snap-align: start;
  }

  .detail-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 48vh;
    max-height: 88vh;
    padding: 24px 16px 22px;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    scroll-snap-type: y proximity;
    transform: translateY(104%);
  }

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

  .detail-panel[data-sheet="peek"] {
    height: 120px;
  }

  .detail-panel[data-sheet="half"] {
    height: 48vh;
  }

  .detail-panel[data-sheet="full"] {
    height: 88vh;
  }

  .detail-panel::before {
    position: absolute;
    top: 9px;
    left: 50%;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--line-strong);
    transform: translateX(-50%);
    content: "";
  }

  .sheet-stop-controls {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin: -4px 44px var(--space-2);
  }

  .sheet-stop-controls button {
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 4px 8px;
    background: var(--surface-2);
    color: var(--muted);
    font: inherit;
    font-size: 11px;
  }

  .hero,
  .panel-heading,
  .panel-summary,
  .stat-grid,
  .ease-breakdown,
  .detail-link,
  .breakdown,
  .comparison {
    scroll-snap-align: start;
  }

  .hero {
    margin-right: 38px;
    margin-bottom: var(--space-4);
  }

  .hero-num {
    font-size: var(--fz-hero);
  }

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

  .disclaimer {
    display: none;
  }
}

/* ===== Seogyo pass-2: fullscreen map + slide-in detail + movement layers ===== */
.chip-bar {
  top: 76px;
  left: var(--space-4);
  right: 512px;
  border-radius: var(--radius-md);
  background: rgba(20, 24, 33, 0.84);
  backdrop-filter: blur(12px) saturate(1.04);
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
}

.chip-bar-inner {
  padding: 10px 14px;
}

.cat-chip.active {
  border-color: rgba(91, 157, 255, 0.72);
  background: var(--ui-accent-soft);
  color: var(--text);
  box-shadow: none;
}

.cat-chip:hover {
  border-color: rgba(91, 157, 255, 0.42);
}

.cat-chip.active .chip-count {
  color: #dce9ff;
}

.layer-bar {
  position: absolute;
  z-index: 5;
  top: 150px;
  left: 18px;
  right: auto;
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(20, 24, 33, 0.84);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(12px) saturate(1.04);
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
}

.layer-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  font: inherit;
  font-size: var(--fz-body);
  font-weight: var(--fw-med);
  cursor: pointer;
}

.layer-chip.active {
  border-color: rgba(91, 157, 255, 0.72);
  background: var(--ui-accent-soft);
  color: var(--text);
}

.live-dock {
  position: absolute;
  z-index: 5;
  top: 76px;
  right: var(--space-4);
  width: 360px;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(12px) saturate(1.04);
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
}

.live-dock .live-msg,
.live-dock .live-fcst,
.live-dock .live-source {
  display: none;
}

.seogyo-panel {
  top: 76px;
  right: var(--space-4);
  bottom: var(--space-4);
  width: 360px;
}

.seogyo-panel .panel-heading {
  margin-right: 40px;
}

.seogyo-legend {
  left: var(--space-4);
  right: 392px;
  bottom: var(--space-4);
  max-width: none;
}

.seogyo-legend .legend-chips {
  flex-wrap: wrap;
  row-gap: var(--space-2);
}

.seogyo-legend .chip-swatch {
  width: 18px;
}

@media (max-width: 1024px) {
  .chip-bar {
    right: var(--space-4);
  }

  .live-dock {
    top: 132px;
  }

  .layer-bar {
    top: 132px;
    left: var(--space-4);
    right: auto;
  }

  .seogyo-panel {
    top: 188px;
  }
}

@media (max-width: 760px) {
  .chip-bar {
    top: 76px;
    left: var(--space-3);
    right: var(--space-3);
  }

  .layer-bar {
    top: 128px;
    left: var(--space-3);
  }

  .live-dock {
    top: 128px;
    right: var(--space-3);
    width: min(230px, calc(100vw - 152px));
    padding: var(--space-2);
  }

  .live-dock .live-figures strong {
    font-size: 14px;
  }

  .live-dock .live-congest {
    font-size: 12px;
    padding: 3px 9px;
  }

  .seogyo-legend {
    left: var(--space-3);
    right: var(--space-3);
    bottom: 128px;
  }

  .seogyo-panel {
    top: auto;
    right: 0;
    bottom: 0;
    width: auto;
  }
}

/* ===== Seogyo region grid: exclusive UI regions, no coordinate competition ===== */
:root {
  --region-gap: 16px;
  --left-panel-w: 280px;
  --right-panel-w: 380px;
  --live-widget-w: var(--right-panel-w);
  --right-column-top: 16px;
  --right-stack-gap: 14px;
  --live-dock-h: 72px;
  --bottom-region-h: 168px;
  --region-left: calc(var(--left-panel-w) + var(--region-gap) * 2);
  --region-right: calc(var(--right-panel-w) + var(--region-gap) * 2);
  --panel-nav-w: 90px;
}

.left-panel,
.topbar,
.live-dock,
.seogyo-panel,
.bottom-region {
  position: absolute;
  border: 1px solid var(--line);
  background: rgba(20, 24, 33, 0.86);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(12px) saturate(1.04);
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
}

.left-panel {
  z-index: 7;
  top: var(--region-gap);
  bottom: var(--region-gap);
  left: var(--region-gap);
  width: var(--left-panel-w);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.left-panel-head {
  flex: 0 0 auto;
}

.left-panel > .left-panel-head:first-child {
  min-height: 34px;
  padding-right: calc(var(--panel-nav-w) + 12px);
}

.left-panel-head .eyebrow {
  margin: 0 0 6px;
}

.left-panel-head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.left-panel .chip-bar {
  position: static;
  z-index: auto;
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.left-panel .chip-bar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 4px 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.left-panel .cat-chip {
  flex: 0 0 auto;
  width: 100%;
  min-height: 38px;
  justify-content: space-between;
  gap: 10px;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  white-space: normal;
  text-align: left;
  line-height: 1.25;
}

.left-panel .cat-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.left-panel .cat-swatch {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--cat-color, #8f9aaa);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 10px color-mix(in srgb, var(--cat-color, #8f9aaa) 55%, transparent);
}

.left-panel .cat-chip.active .cat-swatch {
  width: 12px;
  height: 12px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.34), 0 0 16px color-mix(in srgb, var(--cat-color, #8f9aaa) 78%, transparent);
}

.left-panel .chip-count {
  flex: 0 0 auto;
}

.near-shop-row {
  grid-template-columns: minmax(0, 1fr) 58px;
}

.traffic-panel {
  flex: 0 0 auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.layer-card {
  display: block;
}

.layer-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  cursor: pointer;
  list-style: none;
}

.layer-card-head::-webkit-details-marker {
  display: none;
}

.layer-card-head::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.layer-card[open] .layer-card-head::after {
  transform: rotate(-135deg);
}

.layer-card:has(.layer-chip.active) .layer-card-head {
  box-shadow: inset 3px 0 0 var(--ui-accent);
  padding-left: var(--space-2);
}

.layer-card-body {
  display: grid;
  gap: var(--space-3);
  padding: 0 0 var(--space-3);
}

.traffic-panel .layer-bar {
  position: static;
  z-index: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  margin-top: var(--space-3);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.traffic-panel .layer-chip {
  width: 100%;
  min-height: 38px;
  border-radius: var(--radius-sm);
  text-align: left;
}

.flow-panel {
  display: grid;
  gap: var(--space-3);
}

.flow-panel .layer-bar {
  margin-top: 0;
}

.flow-direction-bar {
  padding-top: 4px;
}

.heatmap-legend {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.heatmap-ramp {
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: linear-gradient(90deg, #ffffcc, #ffeda0, #fed976, #feb24c, #fd8d3c, #f03b20, #bd0026);
}

.heatmap-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.heatmap-legend p {
  margin: 0;
}

.inflow-top {
  display: grid;
  gap: var(--space-2);
  color: var(--soft);
  font-size: var(--fz-body);
  font-weight: 700;
  line-height: 1.35;
}

.inflow-top-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.inflow-top-head strong {
  color: var(--text);
  font-size: 12px;
}

.inflow-top-head span {
  color: var(--muted);
  font-size: 11px;
}

.flow-source {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.inflow-rows {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.inflow-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fz-body);
}

.inflow-name {
  min-width: 0;
  color: var(--soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inflow-row strong {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.inflow-row .bar-track {
  grid-column: 1 / 3;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
}

.inflow-row .bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--flow-accent);
}

.vacancy-panel {
  display: grid;
  gap: var(--space-3);
}

.vacancy-panel .layer-bar {
  margin-top: 0;
}

.vacancy-legend {
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.vacancy-legend span {
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
}

.vacancy-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 2px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 1px rgba(255, 237, 213, 0.82), 0 0 12px rgba(245, 158, 11, 0.65);
}

.survival-panel {
  display: grid;
  gap: 10px;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

.survival-panel[hidden] {
  display: none;
}

.survival-note,
.survival-legend-copy {
  margin: 0;
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.survival-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
}

.survival-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.survival-table th,
.survival-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: right;
  white-space: nowrap;
}

.survival-table tr:last-child th,
.survival-table tr:last-child td {
  border-bottom: 0;
}

.survival-table th:first-child {
  text-align: left;
  white-space: normal;
}

.survival-table thead th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.topbar {
  z-index: 5;
  top: var(--region-gap);
  left: var(--region-left);
  right: var(--region-gap);
  height: auto;
  min-height: 92px;
  box-sizing: border-box;
  padding: 10px calc(var(--right-panel-w) + var(--region-gap)) 10px 16px;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: stretch;
  gap: var(--space-4);
  border-radius: var(--radius-md);
}

.topbar .left-panel-head {
  display: none;
}

.topbar .eyebrow,
.topbar .back-link {
  display: none;
}

.topbar h1 {
  margin: 0;
}

.topbar .chip-bar {
  position: static;
  grid-column: 1 / -1;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.topbar .chip-bar-inner {
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 2px;
  scrollbar-width: thin;
}

.topbar .cat-chip {
  flex: 0 0 auto;
  width: auto;
  min-height: 30px;
  justify-content: center;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  white-space: nowrap;
}

.linewalk-legend {
  display: inline-flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.linewalk-legend-title {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.linewalk-legend-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.linewalk-legend-key i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.linewalk-legend-key i.picked {
  background: var(--ui-accent);
  box-shadow: 0 0 0 2px rgba(91, 157, 255, 0.18);
}

.linewalk-legend-key i.nearby {
  background: var(--flow-end);
  box-shadow: 0 0 0 2px var(--flow-glow);
}

.live-dock {
  z-index: 6;
  top: var(--right-column-top);
  right: var(--region-gap);
  width: var(--right-panel-w);
  height: 64px;
  box-sizing: border-box;
  max-width: none;
  margin: 0;
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
}

.live-dock .live-msg,
.live-dock .live-fcst,
.live-dock .live-source {
  display: none;
}

.seogyo-panel {
  z-index: 6;
  top: calc(var(--right-column-top) + var(--live-dock-h) + var(--right-stack-gap));
  right: var(--region-gap);
  bottom: var(--region-gap);
  width: var(--right-panel-w);
  max-width: none;
  max-height: calc(100vh - var(--right-column-top) - var(--live-dock-h) - var(--right-stack-gap) - var(--region-gap));
  border-radius: var(--radius-md);
  overflow-y: auto;
}

.seogyo-panel.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.bottom-region {
  z-index: 5;
  left: var(--region-left);
  right: auto;
  bottom: var(--region-gap);
  width: min(300px, calc(100vw - var(--region-left) - var(--region-right)));
  min-height: var(--bottom-region-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

.bottom-region .time-sim {
  position: static;
  inset: auto;
  width: auto;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.bottom-region .legend,
.seogyo-legend {
  display: none !important;
}

.bottom-region .legend-copy {
  margin: 6px 0 10px;
}

.bottom-region .legend-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.time-sim {
  color: var(--text);
}

.time-sim-collapse {
  display: none;
}

.time-sim-body {
  display: grid;
  gap: 10px;
}

.time-sim-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.time-sim-head .eyebrow {
  margin: 0 0 5px;
}

.time-sim-head strong {
  font-size: 13px;
  line-height: 1.2;
}

.time-sim-toggle {
  display: flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
}

.time-sim-toggle button {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 5px 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.time-sim-toggle button.active {
  background: var(--ui-accent-soft);
  color: var(--text);
}

.time-sim-chart {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 48px;
}

.time-bar {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: 3px 3px 1px 1px;
  background: rgba(143, 154, 170, 0.45);
  padding: 0;
  cursor: pointer;
}

.time-bar.active {
  background: var(--ui-accent);
}

.time-bar span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.time-sim-control {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.time-sim-control span,
.time-sim-source {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.time-sim-source {
  margin: 0;
}

.time-sim-control input {
  width: 100%;
  min-width: 0;
}

.maplibregl-ctrl-top-left {
  top: var(--region-gap);
  left: calc(var(--region-gap) + var(--left-panel-w) - var(--panel-nav-w) - 32px);
  z-index: 9;
}

.maplibregl-ctrl-top-left .maplibregl-ctrl-group {
  display: flex;
}

.maplibregl-ctrl-top-left .maplibregl-ctrl-group button + button {
  border-top-color: transparent;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.maplibregl-ctrl-bottom-left {
  left: var(--region-left);
  bottom: calc(var(--bottom-region-h) + var(--region-gap) * 2);
}

.maplibregl-ctrl-bottom-right {
  right: var(--region-right);
  bottom: calc(var(--bottom-region-h) + var(--region-gap) * 2);
}

@media (max-width: 1439px) {
  :root {
    --right-panel-w: 360px;
    --live-widget-w: 280px;
  }

  .bottom-region {
    width: min(280px, calc(100vw - var(--region-left) - var(--region-right)));
  }
}

@media (max-width: 1180px) {
  :root {
    --right-panel-w: 340px;
    --bottom-region-h: 188px;
  }

  .bottom-region {
    width: 260px;
  }

  .time-sim-chart {
    height: 40px;
  }
}

@media (max-width: 760px) {
  :root {
    --mobile-gap: 12px;
    --left-panel-w: 100vw;
    --right-panel-w: 100vw;
    --bottom-region-h: 122px;
  }

  .shell,
  .map-stage {
    width: 100vw;
    height: 100vh;
  }

  .topbar {
    top: var(--mobile-gap);
    left: var(--mobile-gap);
    right: var(--mobile-gap);
    min-height: 82px;
    padding: 10px calc(190px + var(--mobile-gap)) 10px 12px;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .linewalk-legend {
    display: none;
  }

  .live-dock {
    top: var(--mobile-gap);
    right: var(--mobile-gap);
    width: 190px;
    padding: 10px;
  }

  .live-dock .live-head {
    min-width: 0;
  }

  .live-dock .live-congest {
    font-size: 11px;
    padding: 3px 7px;
  }

  .live-dock .live-figures strong {
    font-size: 13px;
  }

  .left-panel {
    position: fixed;
    z-index: 8;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 292px;
    padding: 14px var(--mobile-gap) calc(14px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    transition: transform 220ms ease, opacity 220ms ease;
  }

  .left-panel > .left-panel-head {
    grid-column: 1 / 2;
    min-height: 0;
    padding-right: 0;
  }

  .left-panel .chip-bar {
    grid-column: 1 / 2;
    min-height: 0;
  }

  .left-panel .chip-bar-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 7px;
    height: 100%;
    overflow-y: auto;
  }

  .left-panel .cat-chip {
    min-height: 34px;
    padding: 7px 8px;
    font-size: 12px;
  }

  .traffic-panel {
    grid-column: 2 / 3;
    grid-row: auto;
    padding-top: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding-left: 12px;
  }

  .vacancy-legend,
  .flow-source {
    font-size: 10px;
  }

  .vacancy-legend span {
    gap: 6px;
  }

  .traffic-panel .layer-chip {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .bottom-region {
    left: var(--mobile-gap);
    right: var(--mobile-gap);
    width: auto;
    bottom: calc(292px + var(--mobile-gap));
    min-height: var(--bottom-region-h);
    max-height: var(--bottom-region-h);
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
    transition: transform 220ms ease, opacity 220ms ease;
  }

  .bottom-region .legend-copy,
  .bottom-region .time-sim-chart,
  .bottom-region .time-sim-source {
    display: none;
  }

  .bottom-region .legend-header {
    margin-bottom: 6px;
  }

  .bottom-region .legend-chips {
    max-height: 46px;
    overflow-y: auto;
  }

  .bottom-region .time-sim-head {
    display: none;
  }

  .seogyo-panel {
    position: fixed;
    z-index: 9;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-width: none;
    border-radius: 18px 18px 0 0;
  }

  .map-stage.detail-active .left-panel,
  .map-stage.detail-active .bottom-region {
    transform: translateY(calc(100% + 260px));
    opacity: 0;
    pointer-events: none;
  }

  .maplibregl-ctrl-bottom-left,
  .maplibregl-ctrl-bottom-right {
    bottom: calc(292px + var(--bottom-region-h) + var(--mobile-gap) * 2);
  }

  .maplibregl-ctrl-bottom-left {
    left: var(--mobile-gap);
  }

  .maplibregl-ctrl-bottom-right {
    right: var(--mobile-gap);
  }

  .maplibregl-ctrl-top-left {
    top: auto;
    left: calc(100vw - var(--panel-nav-w) - var(--mobile-gap) - 10px);
    bottom: calc(292px + var(--mobile-gap));
  }
}
