/* =====================================================================
   style.css — Weather Command Center
   색상은 모두 CSS 변수로 정의한다. 기본은 밝은(라이트) 테마, 어두운 테마는 전환 버튼으로.
   ===================================================================== */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5f9;
  --card: #ffffff;
  --card-2: #f6f8fb;
  --border: #e2e8f0;
  --text: #1f2937;
  --text-2: #4b5563;
  --muted: #8a94a6;
  --accent: #1f8ce6;          /* 기상청 계열 파랑 */
  --accent-soft: #e8f3fd;
  --accent-ink: #ffffff;
  --warning: #e5484d;         /* 경보 · 경고 */
  --advisory: #f5a524;        /* 주의보 · 주의 */
  --advisory-ink: #4a2e00;
  --ok: #1f9d55;
  --t-min: #1f8ce6;           /* 최저기온 */
  --t-max: #e5484d;           /* 최고기온 */
  --grid: #e9edf3;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --skeleton-a: #e9eef4;
  --skeleton-b: #f5f8fb;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --marker-bg: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.92);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #273449;
  --border: rgba(255, 255, 255, 0.09);
  --text: #e2e8f0;
  --text-2: #a3b0c2;
  --muted: #74839a;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --accent-ink: #0f172a;
  --warning: #f05252;
  --advisory: #f5a524;
  --advisory-ink: #2a1a00;
  --ok: #34d399;
  --t-min: #60a5fa;
  --t-max: #f87171;
  --grid: #2c3a50;
  --series-1: #3987e5;
  --series-2: #d95926;
  --skeleton-a: #273449;
  --skeleton-b: #31415a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --marker-bg: #1e293b;
  --header-bg: rgba(15, 23, 42, 0.9);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* display 를 지정한 요소에서도 hidden 속성이 이기도록 */
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Pretendard Variable', Pretendard, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, .data td, .data th { font-variant-numeric: tabular-nums; }
img.flag { display: inline-block; width: 20px; height: 14px; border-radius: 2px; object-fit: cover; vertical-align: -2px; box-shadow: 0 0 0 1px var(--border); }
.t-min { color: var(--t-min); font-weight: 700; }
.t-max { color: var(--t-max); font-weight: 700; }

/* ---------- 헤더 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 16px; background: var(--header-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.brand-icon { font-size: 20px; }
.clocks { display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.today { font-weight: 700; color: var(--text); }
.clock b { color: var(--accent); font-weight: 700; margin-right: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.actions { display: flex; gap: 6px; margin-left: auto; }

.btn {
  font: inherit; font-weight: 600; font-size: 13px;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon { padding: 6px 10px; }
.btn.spin { opacity: 0.6; pointer-events: none; }
.btn:focus-visible, .tab:focus-visible, .seg button:focus-visible, .data th:focus-visible, .data tbody tr:focus-visible, .issue:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.badge.is-stale .dot { background: var(--muted); }
.badge.is-error .dot { background: var(--warning); }
.badge-stale { background: var(--muted); color: #fff; border: 0; }

/* ---------- 섹션 메뉴 (헤더 둘째 줄) ---------- */
.pages { flex-basis: 100%; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 2px -4px -10px; }
.pages::-webkit-scrollbar { display: none; }
.pages button {
  font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer;
  background: transparent; color: var(--text-2); border: 0; border-bottom: 3px solid transparent;
  padding: 8px 14px 9px;
}
.pages button:hover { color: var(--accent); }
.pages button[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.pages button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- 섹션 ---------- */
.page { display: grid; gap: 16px; }
.page-title { margin: 0; font-size: 20px; font-weight: 800; }
.grid-2c { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .grid-2c { grid-template-columns: 1fr; } }
.news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none !important; }
.air-col { display: grid; gap: 16px; }
.watch { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.wc {
  scroll-snap-align: start; display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  font: inherit; color: var(--text); border: 1px solid var(--border);
  background: linear-gradient(160deg, color-mix(in srgb, var(--band, var(--accent)) 16%, var(--card)), var(--card) 70%);
}
.wc:hover { border-color: var(--accent); transform: translateY(-1px); }
.wc .top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.wc .mid { display: flex; align-items: center; gap: 6px; }
.wc .mid .i { font-size: 30px; line-height: 1; }
.wc .mid .t { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.wc .sub { font-size: 12px; color: var(--text-2); }
.wc .src { font-size: 11px; color: #0b7285; }
.wc .clk { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.obs-line { margin-top: 4px; display: inline-block; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--card-2); border-radius: 999px; padding: 2px 10px; }
.obs-line.on { color: #0b7285; background: color-mix(in srgb, #15aabf 12%, var(--card)); }
.obs-cell { font-size: 12px; color: var(--muted); white-space: nowrap; }
.obs-cell.on { color: #0b7285; font-weight: 600; }
.obs-tag { font-size: 10px; font-weight: 700; color: #0b7285; background: color-mix(in srgb, #15aabf 12%, var(--card)); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.h-pmt { height: 280px; }
.live { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #e03131; background: color-mix(in srgb, #e03131 10%, var(--card)); border-radius: 999px; padding: 1px 8px; vertical-align: 2px; }
.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #e03131; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .live::before { animation: none; } }
.pm-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pm-summary .g { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--gc) 14%, var(--card)); color: color-mix(in srgb, var(--gc) 75%, var(--text)); }
.pm-summary .avg { font-size: 12px; color: var(--text-2); padding: 3px 4px; }
.kma { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--card-2); }
.kma-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.kma ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.kma li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.kma .k { font-size: 11px; font-weight: 800; border-radius: 5px; padding: 0 6px; color: #fff; background: var(--muted); }
.kma .k.특보 { background: var(--warning); }
.kma .k.예비특보 { background: var(--advisory); color: var(--advisory-ink); }
.kma .k.정보, .kma .k.속보 { background: var(--accent); }
.kma .t { color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.kma .cm { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-2); }
.kma .cm b { color: var(--text); }
.mag { display: inline-grid; place-items: center; min-width: 40px; height: 24px; border-radius: 6px; font-weight: 800; font-size: 13px; color: #fff; background: #868e96; }
.mag.m4 { background: #f59f00; } .mag.m5 { background: #f76707; } .mag.m6 { background: #e03131; } .mag.m7 { background: #9c36b5; }
.eqk-item { grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.eqk-item .item-sub { grid-column: 2; }
.src-tag { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
@media (max-width: 760px) { .news-grid { grid-template-columns: 1fr; } }

/* ---------- 경고 배너 ---------- */
.alert-banner { position: sticky; z-index: 999; }
.alert-banner-inner {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; cursor: pointer;
  font: inherit; color: var(--advisory-ink); text-align: left; padding: 8px 16px; background: var(--advisory);
}
.alert-banner.level-warning .alert-banner-inner { background: var(--warning); color: #fff; }
.alert-banner.flash .alert-banner-inner { animation: flash 1s ease-in-out 3; }
@keyframes flash { 50% { filter: brightness(1.25); } }
.alert-banner-label { font-weight: 800; white-space: nowrap; }
.ticker { overflow: hidden; flex: 1; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-track { display: inline-block; padding-left: 100%; animation: ticker 40s linear infinite; font-weight: 600; }
.ticker-track span { margin-right: 32px; }
@keyframes ticker { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; padding-left: 0; }
  .alert-banner.flash .alert-banner-inner { animation: none; }
}

/* ---------- 레이아웃 ---------- */
.wrap { max-width: 1440px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.grid-map { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 960px) { .grid-map, .grid-3 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head.sub { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 800; }

/* ---------- 주요 이슈 ---------- */
.issues { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.issue {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start;
  padding: 10px 12px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border);
  border-left: 4px solid var(--muted); text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.issue:hover { border-color: var(--accent); }
.issue.lv-3 { border-left-color: var(--warning); }
.issue.lv-2 { border-left-color: #f97316; }
.issue.lv-1 { border-left-color: var(--advisory); }
.issue-ico { font-size: 22px; line-height: 1.2; grid-row: span 2; }
.issue-title { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.issue-sub { font-size: 12px; color: var(--text-2); }
.issue-sk { height: 64px; }
.headlines { margin-top: 12px; display: grid; gap: 4px; font-size: 13px; }
.headlines a { color: var(--text); }
.headlines a:hover { color: var(--accent); }
.headlines .hl-tag { display: inline-block; min-width: 54px; font-size: 11px; font-weight: 700; color: var(--accent); }

/* ---------- 탭 ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; background: var(--card); color: var(--text-2); border: 1px solid var(--border);
}
.tab:hover { color: var(--accent); border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tab .cnt { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--warning); color: #fff; }
.tab .cnt.adv { background: var(--advisory); color: var(--advisory-ink); }
.basebar { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; margin-top: -6px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; min-height: 96px; min-width: 0; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.2; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.kpi-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-sub b { color: var(--text); }

/* ---------- 칩 ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; color: #fff; white-space: nowrap; }
.chip-warning { background: var(--warning); }
.chip-advisory { background: var(--advisory); color: var(--advisory-ink); }
.chip-info { background: var(--accent-soft); color: var(--accent); }
.chip-self { outline: 1px dashed currentColor; outline-offset: -3px; }

/* ---------- 지도 ---------- */
.map-card { display: flex; flex-direction: column; }
.map-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map { height: 620px; border-radius: 10px; overflow: hidden; background: var(--card-2); }
@media (max-width: 600px) { .map { height: 380px; } }
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg button { font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; border: 0; background: transparent; color: var(--text-2); padding: 4px 10px; border-radius: 6px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.toggle { font-size: 12px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* 날씨누리식 지도 카드: 도시명 · 아이콘 · 값 */
.wxm {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 0;
  min-width: 46px; padding: 2px 6px 3px; border-radius: 8px;
  background: var(--marker-bg); color: var(--text); border: 1px solid var(--border);
  border-bottom: 3px solid var(--band, var(--muted));
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18); white-space: nowrap; cursor: pointer;
  font-family: 'Pretendard Variable', Pretendard, system-ui, sans-serif; font-variant-numeric: tabular-nums;
}
.wxm .nm { font-size: 10px; font-weight: 600; color: var(--text-2); line-height: 1.2; }
.wxm .ic { font-size: 17px; line-height: 1.15; }
.wxm .vl { font-size: 12px; font-weight: 800; line-height: 1.2; }
.wxm.compact { flex-direction: row; gap: 3px; padding: 1px 6px; min-width: 0; }
.wxm.compact .nm { display: none; }
.wxm.compact .ic { font-size: 13px; }
.wxm.line { flex-direction: row; align-items: center; gap: 4px; padding: 1px 7px 1px 4px; min-width: 0; border-radius: 999px; border-bottom-width: 1px; border-left: 4px solid var(--band, var(--muted)); }
.wxm.line .nm { order: 2; font-size: 11px; color: var(--text); font-weight: 700; }
.wxm.line .ic { order: 1; font-size: 14px; }
.wxm.line .vl { order: 3; font-size: 12px; }
.wxm.dim { opacity: 0.35; }
.wxm.ring { box-shadow: 0 0 0 3px var(--warning), 0 1px 4px rgba(0, 0, 0, 0.2); }
.wxm.ring.adv { box-shadow: 0 0 0 3px var(--advisory), 0 1px 4px rgba(0, 0, 0, 0.2); }
.wxm.sel { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 2; }
.wxm .arrow { display: inline-block; width: 16px; height: 16px; }
.tc-marker { position: absolute; transform: translate(-50%, -50%); font-size: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); animation: spin 6s linear infinite; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) { .tc-marker { animation: none; } }
.leaflet-container { font-family: inherit; background: var(--card-2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.pop-title { font-weight: 800; font-size: 14px; margin-bottom: 4px; }
.pop-grid { display: grid; grid-template-columns: auto auto; gap: 2px 12px; font-variant-numeric: tabular-nums; }
.pop-grid span:nth-child(odd) { color: var(--text-2); }

/* ---------- 현재 날씨 패널 (날씨누리식) ---------- */
.now-card { display: flex; flex-direction: column; gap: 12px; }
.now-loc { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.now-loc .place { font-weight: 800; font-size: 16px; }
.now-loc .when { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.now-main { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 6px 0; }
.now-ico { font-size: 56px; line-height: 1; }
.now-temp { font-size: 52px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.now-temp sup { font-size: 22px; font-weight: 700; vertical-align: top; margin-left: 2px; }
.now-feel { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.now-cmp { text-align: center; font-size: 17px; font-weight: 600; }
.now-cmp b { font-weight: 800; }
.now-cmp .up { color: var(--t-max); }
.now-cmp .down { color: var(--t-min); }
.now-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 10px 0; }
.now-stats > div + div { border-left: 1px solid var(--border); }
.now-stats .k { font-size: 12px; color: var(--text-2); }
.now-stats .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.now-sun { display: flex; justify-content: center; gap: 22px; font-size: 13px; color: var(--text-2); }
.now-sun b { color: var(--text); font-variant-numeric: tabular-nums; }
.now-alert { background: var(--card-2); border-radius: 8px; padding: 10px 12px; text-align: center; font-size: 13px; color: var(--text-2); }
.now-alert.on { text-align: left; background: color-mix(in srgb, var(--warning) 10%, var(--card)); color: var(--text); }
.now-alert ul { margin: 4px 0 0; padding-left: 18px; }
.gauges { display: flex; justify-content: space-around; gap: 8px; }
.gauge { display: grid; justify-items: center; gap: 2px; font-size: 12px; }
.gauge svg { width: 78px; height: 78px; }
.gauge .g-val { font-size: 15px; font-weight: 800; fill: var(--text); }
.gauge .g-unit { font-size: 9px; fill: var(--text-2); }
.gauge .g-name { font-weight: 600; }
.gauge .g-grade { font-weight: 700; }
.now-src { font-size: 11px; color: var(--muted); }
.obs-box { font-size: 12px; background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; }

/* ---------- 일별 예보 (날씨누리식) ---------- */
.daily-wrap { overflow-x: auto; }
.daily { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, 1fr); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-width: 960px; }
.dcol { border-left: 1px solid var(--border); text-align: center; font-variant-numeric: tabular-nums; }
.dcol:first-child { border-left: 0; }
.dcol.today { background: var(--accent-soft); }
.dhead { padding: 6px 4px; background: var(--card-2); border-bottom: 1px solid var(--border); }
.dcol.today .dhead { background: var(--accent); color: var(--accent-ink); }
.dhead .d { font-weight: 800; }
.dhead .w { font-size: 12px; }
.dhead .w.sun { color: var(--t-max); }
.dhead .w.sat { color: var(--t-min); }
.dcol.today .dhead .w { color: inherit; }
.dhalf { display: grid; grid-template-columns: 1fr 1fr; }
.dhalf > div { padding: 4px 0; }
.dhalf .lbl { font-size: 11px; color: var(--text-2); }
.dhalf .ico { font-size: 22px; line-height: 1.3; }
.dtemp { padding: 6px 0; font-size: 14px; border-top: 1px dashed var(--border); }
.dpop { padding: 4px 0 6px; font-size: 12px; color: var(--text-2); }

/* ---------- 시간별 예보 (날씨누리식) ---------- */
.hourly-wrap { overflow-x: auto; position: relative; }
.htable { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 13px; }
.htable th { position: sticky; left: 0; z-index: 2; background: var(--card); text-align: left; padding: 6px 12px 6px 0; font-size: 12px; color: var(--text-2); font-weight: 600; white-space: nowrap; border-right: 1px solid var(--border); }
.htable td { text-align: center; padding: 5px 0; border-left: 1px dashed var(--grid); min-width: var(--colw, 62px); width: var(--colw, 62px); }
.htable td.daystart { border-left: 2px solid var(--accent); }
.htable tr.r-day td { padding: 4px 0 2px; }
.htable .daychip { display: inline-block; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.htable tr.r-ico td { font-size: 22px; line-height: 1.3; }
.htable tr.r-temp td { padding: 0; border-left: 0; }
.htable .tsvg { display: block; overflow: visible; }
.htable .tsvg text { font-size: 13px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.htable .tsvg text.hi { fill: #d9480f; font-size: 15px; font-weight: 800; }
.htable .tsvg text.lo { fill: var(--t-min); font-size: 15px; font-weight: 800; }
.htable .tsvg .line { fill: none; stroke: var(--curve, #f08c00); stroke-width: 2.5; stroke-linejoin: round; }
.htable .tsvg circle { fill: var(--card); stroke: var(--curve, #f08c00); stroke-width: 2; }
.htable .tsvg circle.hi { fill: #d9480f; stroke: #d9480f; }
.htable .tsvg circle.lo { fill: var(--t-min); stroke: var(--t-min); }
.htable .tsvg .sep { stroke: var(--border); stroke-dasharray: 3 3; }
.htable .pbar { display: inline-block; width: 12px; height: 26px; border-radius: 4px; background: var(--grid); position: relative; overflow: hidden; vertical-align: bottom; }
.htable .pbar i { position: absolute; left: 0; right: 0; bottom: 0; background: #4dabf7; }
.htable .ptxt { display: block; font-size: 11px; color: var(--muted); }
.htable .ptxt.on { color: var(--accent); font-weight: 700; }
.htable .warr { display: inline-block; width: 16px; height: 16px; color: var(--text); }
.htable .wcls { display: block; font-size: 11px; color: var(--text-2); }

/* ---------- 도시 검색 ---------- */
.city-search { position: relative; }
.city-search .sicon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.city-search input {
  width: 100%; font: inherit; font-size: 15px; padding: 12px 14px 12px 42px; border-radius: 12px;
  background: var(--card); color: var(--text); border: 1.5px solid var(--border); box-shadow: var(--shadow);
}
.city-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.city-results {
  position: absolute; z-index: 1500; left: 0; right: 0; top: calc(100% + 4px); max-height: 420px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15); padding: 4px;
}
.sr {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px; width: 100%;
  font: inherit; text-align: left; color: var(--text); background: transparent; border: 0; border-radius: 8px; padding: 9px 10px; cursor: pointer;
}
.sr:hover, .sr.on { background: var(--accent-soft); }
.sr .nm { font-weight: 700; }
.sr .sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr .tv { font-weight: 700; font-variant-numeric: tabular-nums; }
.sr-note { padding: 8px 12px; font-size: 12px; color: var(--muted); }
.wxm.pin { border-color: var(--accent); }

/* ---------- 현재 날씨 패널 (네이버식: 현재 | 내일 · 정보 상자 · 24시간 띠) ---------- */
.nv-top { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; }
.nv-now, .nv-tmr { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 4px 8px; text-align: center; }
.nv-tmr { border-left: 1px solid var(--border); }
.nv-pill { font-size: 12px; font-weight: 700; padding: 2px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); }
.nv-big { display: flex; align-items: center; gap: 4px; }
.nv-big .ico { font-size: 46px; line-height: 1; }
.nv-big .t { font-size: 50px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: normal; }
.nv-desc { font-size: 15px; }
.nv-desc b { font-weight: 800; }
.nv-desc .up { color: var(--t-max); }
.nv-desc .down { color: var(--t-min); }
.nv-mm { font-size: 13px; color: var(--text-2); }
.nv-tmr-mm { display: flex; align-items: flex-end; gap: 8px; margin: 2px 0 4px; }
.nv-tmr-mm small { display: block; font-size: 11px; color: var(--text-2); }
.nv-tmr-mm b { font-size: 34px; font-weight: 800; line-height: 1; }
.nv-tmr-mm .sl { font-size: 22px; color: var(--muted); }
.nv-half { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.nv-half .lbl { color: var(--text-2); font-size: 12px; }
.nv-half .ico { font-size: 18px; }
.nv-half .pp { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.nv-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nv-box { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; display: grid; gap: 1px; background: var(--card); }
.nv-box .k { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.nv-box b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nv-box b small { font-size: 12px; font-weight: 600; color: var(--text-2); margin-left: 1px; }
.nv-box.air, .nv-box.sun { font-size: 12px; align-content: center; }
.nv-box.sun b { font-size: 13px; }
.gdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 3px 0 4px; vertical-align: 0; }
svg.mini { width: 13px; height: 13px; vertical-align: -2px; color: var(--accent); }
.nv-strip { overflow-x: auto; border-top: 1px solid var(--border); padding-top: 8px; }
.nv-table { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
.nv-table th { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; font-size: 11px; font-weight: 600; color: var(--text-2); padding: 2px 6px 2px 0; white-space: nowrap; }
.nv-table th small { font-size: 9px; margin-left: 1px; }
.nv-table td { min-width: var(--w); width: var(--w); text-align: center; padding: 3px 0; }
.nv-table td.mid { border-left: 2px solid #9775fa; }
.nv-table td.ev { color: #f76707; }
.nv-table .dchip { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: #343a40; border-radius: 999px; padding: 0 7px; }
.nv-table .dchip.tm { background: #9775fa; }
.nv-table .evt { font-weight: 700; color: #f76707; }
.nv-table .evchip { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; background: #ff922b; border-radius: 999px; padding: 1px 6px; }
.nv-table tr.ic td { font-size: 19px; line-height: 1.3; }
.nv-table tr.cv td { padding: 0; }
.nv-table tr.cv svg { display: block; }
.nv-table tr.tp td { font-size: 15px; font-weight: 800; }
.nv-table tr.po td { color: var(--accent); font-size: 12px; font-weight: 700; }
.nv-table tr.wd td { white-space: nowrap; }

/* ---------- 예보 머리말 (제목 · 기간 · 요약 칩) ---------- */
.fc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.fc-head h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.fc-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.fc-chip { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; }
.fc-chip .hot { color: var(--t-max); }
.fc-chip .cold { color: var(--t-min); }
.fc-chip .rain { color: var(--accent); }

/* ---------- 일별 예보 (일자 카드) ---------- */
.dcards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.dcard {
  display: grid; justify-items: center; gap: 4px; padding: 10px 6px 12px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--border); text-align: center; font-variant-numeric: tabular-nums;
}
.dcard.today { border: 2px solid var(--accent); background: var(--card); }
.dcard.wet { background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.dcard .dd { font-size: 17px; font-weight: 800; }
.dcard .dd small { font-size: 13px; font-weight: 600; }
.dcard .dd.sun { color: var(--t-max); }
.dcard .dd.sat { color: var(--t-min); }
.dcard .rel { font-size: 11px; color: var(--accent); font-weight: 700; min-height: 15px; }
.dcard .icons { display: flex; gap: 6px; }
.dcard .icons > span { display: grid; justify-items: center; font-size: 24px; line-height: 1.2; }
.dcard .icons small { font-size: 10px; color: var(--text-2); }
.dcard .tt { font-size: 16px; font-weight: 800; }
.dcard .tt .t-min, .dcard .tt .t-max { font-weight: 800; }
.rbar { position: relative; width: 70%; height: 4px; border-radius: 2px; background: var(--grid); }
.rbar i { position: absolute; top: 0; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--t-min), var(--t-max)); }
.dcard .pl { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.dcard .pv { display: flex; gap: 10px; font-size: 13px; font-weight: 700; }
.dcard .pv .hi { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; }

/* ---------- 시간별 예보 꼬리말 ---------- */
.fc-foot { display: flex; justify-content: flex-end; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.fc-foot .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }

/* ---------- 상태 배지 (네이버식) ---------- */
.pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.pill {
  border-radius: 12px; padding: 8px 12px; font-size: 13px;
  background: color-mix(in srgb, var(--pc, var(--muted)) 13%, var(--card));
}
.pill .k { color: var(--text-2); font-size: 12px; }
.pill .v { font-weight: 800; color: color-mix(in srgb, var(--pc, var(--text)) 80%, var(--text)); font-variant-numeric: tabular-nums; }

/* ---------- 도시별 주간 날씨 (한눈에 읽는 매트릭스) ---------- */
.week { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-variant-numeric: tabular-nums; }
.week th, .week td { text-align: center; vertical-align: middle; border-bottom: 1px solid var(--border); }
.week th { padding: 8px 4px; font-size: 14px; font-weight: 800; color: var(--text); background: var(--card-2); }
.week th .d { display: block; font-size: 11px; font-weight: 500; color: var(--text-2); }
.week th.sat, .week th.sat .d { color: var(--t-min); }
.week th.sun, .week th.sun .d { color: var(--t-max); }
.week th.today { background: var(--accent); color: var(--accent-ink); border-radius: 10px 10px 0 0; }
.week th.today .d { color: inherit; opacity: 0.9; }
.week td.today { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
.week tbody tr:last-child td.today { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent), inset 0 -2px 0 var(--accent); }
.week .city { position: sticky; left: 0; z-index: 1; width: 128px; text-align: left; padding: 8px 10px; background: var(--card); white-space: nowrap; }
.week th.city { background: var(--card-2); }
.week .city .sub { display: block; font-size: 11px; color: var(--text-2); margin-left: 26px; }
.week td { padding: 6px 2px; }
.week td.wet { background: color-mix(in srgb, #339af0 15%, var(--card)); }
.week td.hot { background: color-mix(in srgb, var(--t-max) 13%, var(--card)); }
.week td.cold { background: color-mix(in srgb, #7048e8 13%, var(--card)); }
.week tbody tr { cursor: pointer; }
.week tbody tr:hover td { filter: brightness(0.97); }
.week tbody tr.sel .city { color: var(--accent); }
.week tbody tr.sel td.city { box-shadow: inset 3px 0 0 var(--accent); }
.wk { display: grid; justify-items: center; gap: 1px; }
.wk .ico { font-size: 26px; line-height: 1.15; }
.wk .tt { font-size: 15px; }
.wk .tt b { font-weight: 800; }
.wk .tt i { font-style: normal; color: var(--muted); margin: 0 2px; }
.wk .pp, .pp-demo { font-size: 11px; font-weight: 700; color: #fff; background: #339af0; border-radius: 999px; padding: 0 7px; line-height: 17px; }
.wk .pp.none { background: transparent; height: 17px; }
.wk-legend { margin-top: 0; }
.wk-legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--border); }
.wk-legend .sw.wet { background: color-mix(in srgb, #339af0 25%, var(--card)); }
.wk-legend .sw.hot { background: color-mix(in srgb, var(--t-max) 22%, var(--card)); }
.wk-legend .sw.cold { background: color-mix(in srgb, #7048e8 22%, var(--card)); }

/* ---------- 헤드라인 (이슈 카드 아래) ---------- */
.hl-head { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.hl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
@media (max-width: 760px) { .hl-grid { grid-template-columns: 1fr; } }
.hl { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 6px 8px; border-radius: 8px; color: var(--text); }
.hl:hover { background: var(--card-2); text-decoration: none; }
.hl-tag { grid-row: span 2; align-self: start; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.hl-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-m { font-size: 11px; color: var(--muted); }
.en { display: inline-block; font-size: 10px; font-weight: 800; color: var(--text-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-right: 5px; vertical-align: 1px; }

/* ---------- 리스트 (경고 · 지진 · 뉴스) ---------- */
.panel-card { display: flex; flex-direction: column; }
.list { display: grid; gap: 6px; overflow-y: auto; min-height: 40px; align-content: start; }
#alert-list { max-height: 520px; }
#eqk-list { max-height: 360px; }
#news-list { max-height: 520px; }
.item { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--card-2); border-left: 3px solid var(--muted); }
.item.lv-warning { border-left-color: var(--warning); }
.item.lv-advisory { border-left-color: var(--advisory); }
.item.lv-info { border-left-color: var(--accent); }
.item-title { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.item-title a { color: var(--text); }
.item-title a:hover { color: var(--accent); }
.item-sub { font-size: 12px; color: var(--text-2); }
.empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }

/* ---------- 표 ---------- */
.search { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; width: 200px; background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.table-wrap { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 13px; }
.data th, .data td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.data th:first-child, .data td:first-child, .data th.l, .data td.l { text-align: left; }
.data th { color: var(--text-2); font-weight: 600; cursor: pointer; user-select: none; background: var(--card-2); }
.data th[aria-sort="ascending"]::after { content: ' ▲'; font-size: 9px; }
.data th[aria-sort="descending"]::after { content: ' ▼'; font-size: 9px; }
.data th:first-child, .data td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); }
.data th:first-child { background: var(--card-2); }
.data tbody tr.sel td:first-child { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.data tbody tr { cursor: pointer; }
.data tbody tr:hover { background: var(--card-2); }
.data tbody tr.sel { background: var(--accent-soft); }
.data td .t-cell { display: inline-block; min-width: 48px; padding: 1px 6px; border-radius: 5px; font-weight: 700; text-align: center; }
.data td.wx { text-align: left; }
.data td.wx .ico { margin-right: 4px; }
.data td.c { text-align: center; }
.diff.up { color: var(--t-max); }
.diff.down { color: var(--t-min); }
.wk-cell { display: grid; justify-items: center; line-height: 1.25; }
.wk-cell .ico { font-size: 18px; }
.wk-cell .tt { font-size: 12px; }

/* ---------- 차트 ---------- */
.chart-box { position: relative; width: 100%; height: 360px; }

/* ---------- 스켈레톤 ---------- */
.skeleton { background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
.skeleton.line { height: 38px; }
.kpi.skeleton { border-color: transparent; }
@keyframes shimmer { to { background-position: -200% 0; } }
.is-loading { opacity: 0.55; transition: opacity 0.2s; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 2000; max-width: min(380px, calc(100vw - 32px));
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--warning);
  border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(15, 23, 42, 0.2); font-size: 13px;
}

/* ---------- 푸터 ---------- */
.footer { max-width: 1440px; margin: 8px auto 24px; padding: 0 16px; font-size: 12px; color: var(--text-2); }
.footer p { margin: 4px 0; }

@media (max-width: 600px) {
  .topbar { padding: 8px 16px; }
  .brand h1 { font-size: 15px; }
  .badges { order: 5; flex-basis: 100%; }
  .alert-banner { top: 0 !important; position: relative; }
  .kpi-value { font-size: 22px; }
  .search { width: 100%; }
  .now-temp { font-size: 44px; }
  .issues { grid-template-columns: 1fr; }
}
