:root {
  --bg: #eef2f8;
  --bg-grad-a: #e7eefb;
  --bg-grad-b: #f6f8fc;
  --card: #ffffff;
  --card-2: #f7f9fc;
  --ink: #141c28;
  --muted: #64748b;
  --line: #e2e8f2;
  --accent: #2f6fed;
  --temp: #ef7a2a;
  --rain: #3f7ce0;
  --wind: #0f9c94;
  --now-bg: #fff6e8;
  --shadow: 0 1px 2px rgba(16, 32, 60, 0.04), 0 12px 28px rgba(16, 32, 60, 0.07);
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111a;
    --bg-grad-a: #101a28;
    --bg-grad-b: #0b111a;
    --card: #141d29;
    --card-2: #19232f;
    --ink: #e9eff8;
    --muted: #93a2b7;
    --line: #24303f;
    --accent: #6f9dff;
    --temp: #ff9a4d;
    --rain: #6fa3ff;
    --wind: #3ecfc1;
    --now-bg: #2a2117;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 12% -10%, var(--bg-grad-a), transparent 70%),
    radial-gradient(900px 500px at 100% 0%, rgba(120, 170, 255, 0.16), transparent 65%),
    var(--bg-grad-b);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

/* hero */
.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 16px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(22px, 4.4vw, 30px);
  letter-spacing: -0.02em;
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.sub strong { color: var(--ink); }

.now {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "label label" "temp meta";
  align-items: baseline;
  justify-content: start;
  gap: 0 8px;
  background: var(--now-bg);
  border-radius: 14px;
  padding: 10px 14px;
  min-width: 168px;
}

.now-label { grid-area: label; font-size: 11px; font-weight: 700; color: var(--temp); letter-spacing: 0.04em; }
.now-temp { grid-area: temp; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.now-meta { grid-area: meta; font-size: 12px; color: var(--muted); }

.meta-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.meta-row .dot { opacity: 0.5; }

/* notice */
.notice {
  margin-top: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
}

/* tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab {
  flex: 0 0 auto;
  min-width: 92px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 12px;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tab:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.tab[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.tab-today { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--card)), var(--card)); }

.tab-label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.tab-today .tab-label { color: var(--accent); }
.tab-date { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; margin-top: 1px; }
.tab-mini { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.tab-mini b { color: var(--temp); font-weight: 700; }

/* cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
}

.card + .card { margin-top: 14px; }

.day-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.day-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.day-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.day-facts { display: flex; gap: 8px; flex-wrap: wrap; }
.fact {
  background: var(--card-2);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.fact b { color: var(--ink); font-size: 13px; }

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 16px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg em { font-style: normal; opacity: 0.75; }
.lg::before { content: ""; width: 16px; height: 3px; border-radius: 2px; background: currentColor; }
.lg-rain::before { height: 9px; width: 9px; border-radius: 2px; }
.lg-temp { color: var(--temp); }
.lg-rain { color: var(--rain); }
.lg-wind { color: var(--wind); }
.lg-wind::before { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }

.chart-box { margin-top: 6px; overflow: hidden; }
.chart-box svg { display: block; width: 100%; height: auto; }

/* table */
.table-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-head h2 { margin: 0; font-size: 16px; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }

.table-scroll { margin-top: 12px; overflow-x: auto; }

table.hours { width: 100%; max-width: 640px; border-collapse: collapse; font-size: 13.5px; }
.hours th:nth-child(1) { width: 104px; }
.hours th:nth-child(3) { width: 84px; }
.hours th:nth-child(4) { width: 110px; }
.hours th:nth-child(5) { width: 84px; }

.hours th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--card);
}

.hours td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.hours tr:last-child td { border-bottom: none; }
.hours .num { text-align: right; font-variant-numeric: tabular-nums; }
.hours th.num { text-align: right; }

.hours tbody tr { cursor: pointer; }
.hours tbody tr:hover { background: var(--card-2); }

.hours tr.now-row { background: var(--now-bg); }
.hours tr.now-row td:first-child { box-shadow: inset 3px 0 0 var(--temp); }
.hours tr.selected-row td { background: color-mix(in srgb, var(--accent) 9%, transparent); }

.time-cell { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill-now {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--temp);
  border-radius: 999px;
  vertical-align: 1px;
}

.wx { white-space: nowrap; }
.wx .ico { display: inline-block; width: 20px; text-align: center; margin-right: 4px; }
.temp-val { color: var(--temp); font-weight: 700; }
.rain-val { color: var(--rain); font-weight: 600; }
.wind-val { color: var(--wind); font-weight: 600; }
.rain-cell { position: relative; }
.rain-bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--rain) 55%, transparent);
  vertical-align: middle;
  margin-right: 6px;
}

.empty-row td { color: var(--muted); text-align: center; padding: 22px 0; }

/* footer */
footer { margin-top: 18px; padding: 0 4px; }
.attrib { margin: 0; font-size: 13px; }
.attrib a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.attrib a:hover { border-color: var(--accent); color: var(--accent); }
.attrib .apple { font-size: 15px; line-height: 1; }
.attrib .apple-logo { display: block; }
.fine { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }

/* 권역 · 동네 선택 */
.regions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 16px 0 10px;
  padding: 5px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.region {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 11px;
  padding: 8px 4px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.region:hover { background: var(--card-2); color: var(--ink); }

.region[aria-selected="true"] {
  background: var(--card);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(16, 32, 60, 0.06);
}

.region .rn { display: block; font-size: 10px; font-weight: 600; color: var(--muted); opacity: 0.8; }
.region[aria-selected="true"] .rn { color: color-mix(in srgb, var(--accent) 75%, var(--muted)); }

.spots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 0 2px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border-color: var(--accent);
  color: var(--accent);
}

/* 동네별 비교 카드 */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.spot-card {
  display: grid;
  gap: 2px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.spot-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.spot-card[aria-pressed="true"] {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--card)), var(--card));
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.sc-name { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: -0.01em; }
.spot-card[aria-pressed="true"] .sc-name { color: var(--accent); }
.sc-main { display: flex; align-items: baseline; gap: 6px; }
.sc-temp { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.sc-cond { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.sc-row { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sc-row b { color: var(--ink); font-weight: 700; }
.sc-row .rain { color: var(--rain); font-weight: 700; }
.sc-row .wind { color: var(--wind); font-weight: 700; }

@media (max-width: 560px) {
  .wrap { padding: 14px 12px 32px; }
  .hero { padding: 16px 16px 13px; }
  .now { width: 100%; min-width: 0; }
  .card { padding: 15px 14px 16px; border-radius: 16px; }
  .tab { min-width: 84px; padding: 8px 10px; }
  .hours th, .hours td { padding: 7px 7px; }
  table.hours { font-size: 13px; }
  .day-facts { width: 100%; }
  .regions { gap: 4px; padding: 4px; margin-top: 12px; }
  .region { font-size: 12px; padding: 7px 2px; }
  .region .rn { font-size: 9.5px; }
  .compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .spot-card { padding: 9px 10px; }
  .sc-temp { font-size: 21px; }
  .chip { padding: 5px 10px; font-size: 12px; }
}
