/* 춘천 리얼티 트윈 — 차분한 다크 테마 (한 가지 강조색 + 가격 색) */
:root {
  /* 디자인 토큰 (docs/design/DESIGN_SYSTEM.md) */
  --primary: #3988E8;
  --primary-2: #76B7F5;
  --teal: #25B8AA;
  --bg: #F5F8FC;
  --panel: #FFFFFF;
  --panel-2: #EDF3FA;
  --text: #243247;
  --text-2: #68788D;
  --muted: #95A2B2;
  --line: #E5EBF2;
  --good: #20A878;
  --warn: #E9A23B;
  --bad: #E45B62;
  --accent: var(--primary);
  --accent-soft: rgba(57, 136, 232, 0.10);
  --on-accent: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(36, 50, 71, 0.06), 0 2px 8px rgba(36, 50, 71, 0.05);
  --shadow-lg: 0 8px 28px rgba(36, 50, 71, 0.12);
  --radius: 14px;
  --side: 360px;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14.5px; --fs-lg: 17px; --fs-xl: 22px;
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.warn { color: var(--warn); }

/* ── 왼쪽 패널 ── */
.side {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--side); z-index: 20;
  display: flex; flex-direction: column; gap: 12px; padding: 18px 16px 0;
  background: var(--panel); border-right: 1px solid var(--line);
}
.side-head { display: flex; flex-direction: column; gap: 10px; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand img { border-radius: 10px; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.03em; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.wx { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 7px 10px; border-radius: 10px; background: var(--panel-2); }
.wx-place { font-weight: 700; color: var(--accent); white-space: nowrap; }
.wx-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wx-temp { font-size: 15px; }

.search { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 17px; }
.search input {
  width: 100%; padding: 11px 12px 11px 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); outline: none; font-size: 14.5px;
}
.search input:focus { border-color: var(--accent); }
.results { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  border-radius: 10px; max-height: 50vh; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.results button, #fav-list button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.results button:hover, .results button:focus-visible, #fav-list button:hover { background: var(--accent-soft); }
.results small { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 98px; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.list-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); margin: 0 -16px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px 8px; }
.list-head b { display: block; font-size: 14px; }
.list-head small { font-size: 11.5px; }
.list-head select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font-size: 12.5px; }
.cx-list { list-style: none; margin: 0; padding: 0 8px 16px; overflow-y: auto; flex: 1; }
.cx-item { display: grid; grid-template-columns: 10px 1fr 96px; gap: 10px; align-items: center; width: 100%; text-align: left;
  padding: 9px 8px; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.cx-item:hover { background: var(--panel-2); }
.cx-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.cx-dot { width: 10px; height: 10px; border-radius: 3px; }
.cx-main { min-width: 0; }
.cx-main b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-main small { color: var(--muted); font-size: 11.5px; }
.cx-price { text-align: right; }
.cx-price b { font-size: 13.5px; }
.cx-bar { display: block; height: 4px; margin-top: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.cx-bar i { display: block; height: 100%; border-radius: 99px; }
.side-toggle { display: none; }

/* ── 지도 ── */
#map { position: fixed; top: 0; right: 0; bottom: 0; left: var(--side); }
.map-tools { position: fixed; top: 16px; left: calc(var(--side) + 16px); z-index: 15; display: flex; gap: 6px; }
.tool { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow-sm); font-size: 13px; font-weight: 600; color: var(--text-2); }
.tool em { font-style: normal; }
.tool b { background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 0 5px; font-size: 11px; }
.tool:hover { border-color: var(--primary-2); }
.tool[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.legend { position: fixed; left: calc(var(--side) + 16px); bottom: 16px; z-index: 5; width: 270px; padding: 12px 14px;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 12px; }
.legend-title { font-weight: 700; font-size: 12.5px; margin-bottom: 8px; }
.legend-title small { color: var(--muted); font-weight: 500; }
.ramp { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; }
.ramp i { flex: 1; }
.ramp-labels { position: relative; height: 16px; margin: 4px 0 10px; color: var(--text-2); font-size: 11px; }
.ramp-labels span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ramp-labels span.first { transform: none; }
.ramp-labels span.last { transform: translateX(-100%); }
.ramp-labels.free { position: static; height: auto; }
.ramp-labels.free span { position: static; transform: none; }
.legend-rows { display: grid; gap: 4px; color: var(--muted); }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--text-2); }
.sw-na { background: #C3CCD8; }
.sw-solid { opacity: 1; }
.sw-mid { opacity: 0.65; }
.sw-faint { opacity: 0.3; outline: 1px dashed var(--text-2); }

.dist-label { display: flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.95); color: var(--text); box-shadow: var(--shadow-sm);
  border: 1px solid var(--line); font-size: 11.5px; white-space: nowrap; pointer-events: none; }
.dist-label i { width: 7px; height: 7px; border-radius: 50%; }
.popup { color: var(--text); font-size: 13px; }
.maplibregl-ctrl-attrib { background: rgba(255, 255, 255, 0.85) !important; color: var(--text-2); }
.maplibregl-ctrl-attrib a { color: var(--muted); }

/* ── 오른쪽 분석 서랍 ── */
.drawer { position: fixed; top: 16px; right: 16px; bottom: 16px; z-index: 30; width: 420px; display: flex; flex-direction: column;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: slide 0.25s ease; }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; gap: 10px; padding: 16px 16px 4px; }
.drawer-title { min-width: 0; }
.drawer-head small { color: var(--muted); font-size: 12px; }
.drawer-head h2 { margin: 2px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25; }
.drawer-actions { display: flex; gap: 6px; flex: none; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 15px; }
.icon-btn:hover { border-color: var(--primary-2); }
.icon-btn[aria-pressed="true"] { color: var(--warn); border-color: var(--warn); }

.hero { padding: 8px 16px 12px; }
.hero-main { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.hero-price, .hero-side { padding: 12px; border-radius: 12px; background: var(--panel-2); }
.hero-price { border-left: 4px solid var(--c, var(--accent)); }
.hero small { display: block; color: var(--muted); font-size: 11.5px; }
.hero-price strong { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0; }
.hero-side b { display: block; font-size: 17px; margin: 4px 0 2px; }
.hero span { font-size: 11.5px; color: var(--muted); }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; font-size: 12px; }
.hero-meta .btn { margin-left: auto; }
.hero-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

.tabs { display: flex; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; padding: 10px 4px; border: 0; background: none; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--accent); }
.tab-body { flex: 1; overflow-y: auto; padding: 12px 16px 20px; }

.card { background: var(--panel-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.card.slim { padding: 10px 12px; }
.card.notice { border: 1px solid var(--line); }
.card.error { border: 1px solid var(--bad); }
.card.chart { height: 270px; display: flex; flex-direction: column; }
.card.chart.tall { height: 360px; }
.card.chart canvas { flex: 1; min-height: 0; }
.card p { margin: 6px 0; line-height: 1.55; }
.card ol { padding-left: 20px; line-height: 1.7; margin: 6px 0 10px; }
.card > b { font-size: 14px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.btn { display: inline-block; padding: 8px 12px; border-radius: 9px; border: 0; background: var(--accent); color: var(--on-accent);
  font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.ghost, .ghost { background: none; border: 1px solid var(--line); color: var(--text); padding: 6px 10px; border-radius: 9px; cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: wait; }

.qbadge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.q-verified { background: rgba(32, 168, 120, 0.12); color: var(--good); }
.q-open, .q-osm { background: rgba(57, 136, 232, 0.10); color: var(--primary); }
.q-est { color: #7A5CC4; border: 1px dashed #A48BE0; }
.q-user { color: var(--warn); border: 1px solid var(--warn); }
.q-na, .q-old { color: var(--muted); border: 1px dashed var(--muted); }

.controls { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.seg { display: flex; gap: 4px; }
.seg.wrap { flex-wrap: wrap; }
.seg button { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.kpi { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
.kpi small { display: block; color: var(--muted); font-size: 11.5px; }
.kpi strong { display: block; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0; }
.kpi span { font-size: 11.5px; color: var(--muted); }

.spread-res { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; border-left: 4px solid; background: var(--bg); }
.spread-num { font-size: 24px; font-weight: 800; }
.lv-low { border-color: var(--good); } .lv-fair { border-color: var(--primary); } .lv-nego { border-color: var(--warn); } .lv-hot { border-color: var(--bad); }
input[type="text"], select { padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); max-width: 100%; }
select option { background: var(--panel); }

.slider { display: grid; grid-template-columns: 120px 1fr 52px; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.slider input { accent-color: var(--accent); }
.slider b { text-align: right; }
.parts { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; }
.parts li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }

.trades { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; }
.trades li { display: grid; grid-template-columns: 86px 96px 1fr; gap: 2px 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.trades .t-amt { font-weight: 700; }
.trades .t-tag { grid-column: 3; color: var(--muted); font-size: 11.5px; }
.trades .t-meta { color: var(--muted); }
.trades li.cancelled .t-amt, .trades li.cancelled .t-date { text-decoration: line-through; color: var(--muted); }

.radar { height: 230px; }
.scores { list-style: none; padding: 0; margin: 6px 0; }
.scores li { display: grid; grid-template-columns: 38px 1fr 28px; align-items: center; gap: 0 8px; padding: 4px 0; }
.scores .s-axis { font-weight: 700; }
.scores small { grid-column: 2 / 4; color: var(--muted); font-size: 11.5px; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.facts { padding-left: 0; list-style: none; margin: 6px 0; line-height: 1.6; font-size: 13.5px; }
.facts li { margin-bottom: 4px; }
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.count { text-align: center; padding: 8px 4px; border-radius: 10px; background: var(--bg); }
.count b { display: block; font-size: 18px; font-weight: 800; }
.count small { color: var(--muted); font-size: 11.5px; }
.nearby { list-style: none; padding: 0; margin: 0; font-size: 13px; max-height: 260px; overflow-y: auto; }
.nearby li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.nearby small { margin-left: auto; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.src-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.src-table th, .src-table td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.src-table th { white-space: nowrap; font-weight: 600; }

/* ── 관심·비교 ── */
.pop { position: fixed; top: 62px; left: calc(var(--side) + 16px); z-index: 40; border-radius: 12px; padding: 12px; width: 280px; max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
#fav-list { list-style: none; padding: 0; margin: 8px 0 0; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(36, 50, 71, 0.35); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(920px, 100%); max-height: 90vh; overflow: auto; border-radius: var(--radius); padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.cmp-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center; margin: 14px 0; }
.cmp-pick select { width: 100%; min-width: 0; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cmp-table th, .cmp-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: center; }
.cmp-table tbody th { text-align: left; color: var(--muted); font-weight: 600; }
.cmp-table thead th { font-weight: 800; }
.cmp-table td.win { color: var(--good); font-weight: 800; }

.fallback { position: fixed; top: 16px; left: calc(var(--side) + 16px); right: 16px; z-index: 5; border-radius: var(--radius); padding: 16px; background: var(--panel); border: 1px solid var(--line); }

/* ── 알림 ── */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; max-width: 360px; padding: 10px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); box-shadow: var(--shadow-lg);
  font-size: 13.5px; transition: opacity 0.4s, transform 0.4s; }
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--bad); }
.toast.out { opacity: 0; transform: translateX(20px); }

/* ── 폰 ── */
@media (max-width: 900px) {
  :root { --side: 0px; }
  .side { top: auto; right: 0; width: auto; height: 46vh; padding: 12px 12px 0; gap: 8px; border-right: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0; transition: height 0.25s; }
  .side.open { height: 88vh; }
  .brand img { width: 28px; height: 28px; }
  .brand h1 { font-size: 16px; }
  .brand p { display: none; }
  .side-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .wx { padding: 4px 8px; font-size: 11.5px; }
  .wx .muted { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; max-height: none; scrollbar-width: none; }
  .chip { flex: none; }
  .list-head { padding: 8px 12px 6px; }
  .side-toggle { display: block; position: absolute; top: -40px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; font-weight: 600; cursor: pointer; }
  #map { left: 0; bottom: 46vh; }
  .map-tools { top: 12px; left: 12px; right: 12px; justify-content: flex-end; }
  .tool em { display: none; }
  .legend { display: none; }
  .pop { left: auto; right: 12px; top: 56px; }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 72vh; border-radius: 18px 18px 0 0; animation: rise 0.25s ease; }
  @keyframes rise { from { transform: translateY(20px); opacity: 0; } }
  .toasts { top: 56px; left: 12px; right: 12px; align-items: stretch; }
  .toast { max-width: none; }
  .slider { grid-template-columns: 100px 1fr 46px; }
  .hero-price strong { font-size: 20px; }
}

/* ── 실거래 단지명 찾기 · 교차 확인 ── */
.picker { margin-top: 8px; }
.picker summary { cursor: pointer; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.picker .row { margin-top: 8px; }
.picker input { flex: 1; min-width: 140px; }
.name-results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 220px; overflow-y: auto; }
.name-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; padding: 6px 8px;
  border: 0; border-radius: 8px; background: none; cursor: pointer; }
.name-item:hover, .name-item:focus-visible { background: var(--accent-soft); }
.name-item b { font-size: 13px; }
.name-item small { color: var(--muted); font-size: 11.5px; }
.name-item.auto { color: var(--accent); font-weight: 700; }
input[type="month"] { padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color-scheme: light; }
.cross-links { display: grid; gap: 6px; margin: 8px 0; }
.cross-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.cross-link:hover { border-color: var(--accent); }
.cross-link small { color: var(--muted); font-size: 11.5px; text-align: right; }


/* ── 밝은 테마 다듬기 ── */
.side { box-shadow: 1px 0 0 var(--line); }
.brand h1 { color: var(--text); }
.brand p, .list-head small, .cx-main small, .hero span, .kpi span, .kpi small { color: var(--text-2); }
.search input, input[type="text"], select, input[type="month"] { background: var(--panel); border-color: var(--line); color: var(--text); }
.search input:focus, input[type="text"]:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chip { color: var(--text-2); background: var(--panel); }
.tool[aria-pressed="true"] { background: var(--accent-soft); }
.tool:hover { color: var(--text); }
.cx-item.active { background: var(--accent-soft); }
.cx-price b, .hero-price strong, .kpi strong { color: var(--text); }
.hero-price strong { font-size: 26px; }
.hero-price, .hero-side, .kpi, .card { background: var(--bg); }
.drawer .card { background: var(--bg); }
.count, .spread-res, .cross-link { background: var(--panel); }
.tabs button { color: var(--text-2); }
.tabs button[aria-selected="true"] { color: var(--primary); border-color: var(--primary); }
.btn.ghost, .ghost { background: var(--panel); color: var(--text); }
.btn { transition: background .15s; }
.btn:hover { background: #2F78D4; }
.btn.ghost:hover, .ghost:hover { border-color: var(--primary-2); color: var(--primary); background: var(--panel); }
.bar i { background: linear-gradient(90deg, var(--primary-2), var(--primary)); }
.trades li.cancelled .t-amt, .trades li.cancelled .t-date { color: var(--muted); }
.wx { background: var(--bg); }
.wx-place { color: var(--primary); }
.icon-btn { background: var(--panel); color: var(--text-2); }
.picker summary, .name-item.auto { color: var(--primary); }
select option { background: var(--panel); color: var(--text); }

/* ── 첫 화면 안내 ── */
.intro { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, rgba(245, 248, 252, 0.92), rgba(237, 243, 250, 0.85)); backdrop-filter: blur(3px); }
.intro-card { width: min(560px, 100%); background: var(--panel); border-radius: 20px; padding: 36px 36px 28px; box-shadow: var(--shadow-lg); }
.intro-eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--teal); }
.intro h2 { margin: 6px 0 6px; font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.intro-lead { margin: 0 0 22px; color: var(--text-2); font-size: 16px; }
.intro-stats { list-style: none; padding: 0; margin: 0 0 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.intro-stats li { padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.intro-stats b { display: block; font-size: 22px; font-weight: 800; color: var(--primary); }
.intro-stats small { color: var(--text-2); font-size: 12px; }
.intro-steps { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; font-size: 14.5px; }
.intro-steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 10px; border-radius: 50%;
  background: var(--accent-soft); color: var(--primary); font-size: 12px; }
.intro-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.big { padding: 12px 18px; font-size: 15px; border-radius: 11px; }
.intro-src { margin: 16px 0 0; font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .intro-card { padding: 26px 20px 20px; }
  .intro h2 { font-size: 26px; }
  .intro-stats b { font-size: 18px; }
  .btn.big { flex: 1; }
}

/* ── 왜 이 가격? ── */
.why { margin-bottom: 14px; }
.why-head { padding: 4px 2px 10px; }
.why-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 8px 0 6px; }
.why-big strong { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.why-big strong.up { color: var(--bad); }
.why-big strong.down { color: var(--primary); }
.why-big span { font-size: 12.5px; color: var(--text-2); }
.why-lines { margin: 4px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.65; }
.why-sec { padding: 12px 0; border-top: 1px solid var(--line); }
.why-sec > b { font-size: 14px; }
.peer-bars { list-style: none; padding: 0; margin: 8px 0 0; }
.peer-bars li { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr 64px; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 8px; }
.peer-bars li.me { background: var(--accent-soft); }
.pb-name b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-name small { color: var(--text-2); font-size: 11px; }
.pb-bar { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.pb-bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary-2); }
.peer-bars li.me .pb-bar i { background: var(--primary); }
.pb-val { text-align: right; font-size: 12.5px; font-weight: 700; }
.why-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.why-table th, .why-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.why-table th:first-child { text-align: left; font-weight: 600; }
.why-table thead th { color: var(--text-2); font-weight: 600; font-size: 11.5px; }
.why-table small { display: block; font-size: 11px; font-weight: 700; }
.fx-up small { color: var(--bad); }
.fx-down small { color: var(--primary); }
.why-more { padding-top: 10px; }
.why-more summary { cursor: pointer; font-size: 12.5px; color: var(--primary); font-weight: 600; }

/* ── 지도 색 기준 · 시장 요약 ── */
.legend-seg { margin-bottom: 10px; }
.legend-seg button { flex: 1; padding: 5px 6px; }
.tool[aria-pressed="true"] { background: #EAF2FD; }
.mkt { padding: 12px 16px 10px; border-bottom: 1px solid var(--line); }
.mkt-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mkt-title b { font-size: 14px; }
.mkt-title small { color: var(--muted); font-size: 11px; }
.mkt-nums { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; margin: 8px 0; }
.mkt-nums small { display: block; color: var(--text-2); font-size: 11px; }
.mkt-nums b { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.up { color: var(--bad); }
.down { color: var(--primary); }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 30px; }
.spark i { flex: 1; background: #CFE2F8; border-radius: 2px 2px 0 0; }
.spark i.now { background: var(--primary-2); }
.mkt-note { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.cx-price b.up { color: var(--bad); }
.cx-price b.down { color: var(--primary); }
.trades li.bulk .t-amt, .trades li.bulk .t-date { color: var(--muted); }
@media (max-width: 900px) {
  .legend { display: block; left: 8px; bottom: calc(46vh + 8px); width: 230px; padding: 8px 10px; }
  .legend .legend-rows, .legend .legend-title small { display: none; }
  .legend-title { margin-bottom: 4px; font-size: 12px; }
  .ramp-labels { margin-bottom: 0; }
  body.drawer-open .legend { display: none; }
  .mkt { padding: 8px 12px; }
  .spark, .mkt-note { display: none; }
  .mkt-nums { margin: 4px 0 0; }
  .mkt-nums b { font-size: 15px; }
}

/* 범례 구간 목록 */
.legend-bins { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 12px; }
.legend-bins li { display: flex; align-items: center; }
.legend-foot { margin: 8px 0 6px; font-size: 11px; color: var(--muted); line-height: 1.4; }
.legend-height { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 11px; color: var(--text-2); }
.legend-height .sw { margin-right: 4px; }
.ramp-mini { display: none; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.ramp-mini .ramp { flex: 1; }
.chip:not([aria-pressed="true"]):hover { border-color: var(--primary-2); color: var(--primary); }
.chip[aria-pressed="true"]:hover { color: var(--on-accent); }
@media (max-width: 900px) {
  .legend { top: 58px; bottom: auto; width: 210px; }
  .legend-bins, .legend-foot, .legend-height { display: none; }
  .ramp-mini { display: flex; }
}

/* ── 비교 ── */
.modal-head h2 small { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-left: 6px; }
.cmp-lines { margin: 0 0 12px; padding-left: 18px; font-size: 14px; line-height: 1.65; }
.cmp-chart { height: 240px; display: flex; flex-direction: column; margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.cmp-chart b { font-size: 13.5px; margin-bottom: 6px; }
.cmp-chart canvas { flex: 1; min-height: 0; }
.cmp-scroll { overflow-x: auto; }
.cmp-table thead th { white-space: nowrap; }
.cmp-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.cmp-table td { white-space: nowrap; }
@media (max-width: 900px) {
  .cmp-pick { grid-template-columns: 1fr; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-card { max-height: 92vh; border-radius: 18px 18px 0 0; padding: 14px; }
  .cmp-table { font-size: 12.5px; }
}
