:root {
  --bg1: #0d1020;
  --bg2: #18213d;
  --bg3: #243051;
  --card: rgba(12, 16, 34, 0.70);
  --card-strong: rgba(18, 24, 47, 0.92);
  --text: #f4f7ff;
  --muted: rgba(244, 247, 255, 0.72);
  --line: rgba(255,255,255,0.10);
  --accent: #84d7ff;
  --accent2: #b7ffcb;
  --shadow: 0 24px 80px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(132, 215, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(183, 255, 203, 0.12), transparent 28%),
    linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  overflow-x: hidden;
}

body.theme-sunny { --bg1: #203051; --bg2: #365472; --bg3: #5b7b8f; --accent: #ffe08a; }
body.theme-cloudy { --bg1: #171d31; --bg2: #25324d; --bg3: #36415b; --accent: #b9d0ff; }
body.theme-rainy { --bg1: #101827; --bg2: #1a2740; --bg3: #1b2f4a; --accent: #7ed6ff; }
body.theme-snowy { --bg1: #26344b; --bg2: #3c5270; --bg3: #577594; --accent: #d6f6ff; }
body.theme-night { --bg1: #060814; --bg2: #111a34; --bg3: #1c2450; --accent: #c7b6ff; }

.backdrop {
  position: fixed;
  inset: auto;
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none;
  opacity: 0.6;
}
.backdrop-a { width: 320px; height: 320px; left: -120px; top: -80px; background: rgba(132, 215, 255, 0.14); }
.backdrop-b { width: 420px; height: 420px; right: -140px; bottom: -160px; background: rgba(183, 255, 203, 0.10); }

.shell {
  width: min(1400px, calc(100% - 32px));
  margin: 20px auto;
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.weather-panel { padding: 22px; }
.panel-header, .status-row, .hero-temp, .section-title-row, .pig-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.02; }
h2 { font-size: 1.2rem; }

.ghost-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.ghost-btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); }

.status-row {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
}
.live-dot {
  width: 12px; height: 12px; border-radius: 999px;
  background: #7bff9b;
  box-shadow: 0 0 0 0 rgba(123,255,155,0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(123,255,155,0.45); } 70% { box-shadow: 0 0 0 12px rgba(123,255,155,0); } 100% { box-shadow: 0 0 0 0 rgba(123,255,155,0); } }

.hero-temp { margin: 18px 0 16px; align-items: stretch; }
.temp-line { display: flex; align-items: flex-start; gap: 4px; }
#currentTemp { font-size: clamp(3.5rem, 8vw, 6rem); font-weight: 800; letter-spacing: -0.04em; }
.degree { font-size: 1.8rem; margin-top: 10px; color: var(--muted); }
.condition { margin-top: 4px; font-size: 1.05rem; color: var(--muted); }

.mini-card, .info-card, .detail-card, .week-card, .hour-item {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
}
.mini-card {
  min-width: 150px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.mini-card span, .info-card span, .detail-card span, .week-card p, .hour-desc { color: var(--muted); }
.mini-card strong, .info-card strong, .detail-card strong, .week-card strong, .hour-temp { font-size: 1.03rem; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.info-card {
  padding: 14px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tabs {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.day-tab {
  padding: 12px 13px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.day-tab:hover { transform: translateY(-1px); }
.day-tab.active {
  background: linear-gradient(135deg, rgba(132, 215, 255, 0.22), rgba(183, 255, 203, 0.12));
  border-color: rgba(255,255,255,0.22);
}
.day-tab .label { display: block; font-weight: 700; }
.day-tab .sub { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

.day-panel, .hourly-panel, .week-panel { margin-top: 16px; }
.section-title-row { align-items: end; margin-bottom: 12px; }
.section-title-row p { color: var(--muted); font-size: 0.92rem; }

.day-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.detail-card { padding: 16px; min-height: 84px; display: flex; flex-direction: column; justify-content: space-between; }

.hourly-list, .weekly-list { display: grid; gap: 10px; }
.hour-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  padding: 12px 14px;
  align-items: center;
}
.hour-time { font-weight: 700; font-size: 0.95rem; }
.hour-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; }

.week-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}
.week-card h3 { font-size: 1rem; margin-bottom: 3px; }
.week-values { text-align: right; }
.week-values span { display: block; color: var(--muted); margin-top: 2px; }

.source-line {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}
.source-line a { color: #d7fbff; text-decoration: none; }
.source-line a:hover { text-decoration: underline; }

.pig-panel {
  padding: 18px;
  align-self: start;
}
.pig-card {
  border-radius: 24px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
}
.mood-tag {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 0.88rem;
}
.pig-scene {
  margin-top: 16px;
  min-height: 330px;
  border-radius: 22px;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 243, 190, 0.45), transparent 18%),
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}
.pig-scene::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 90px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.18));
}
.pig-image {
  position: relative;
  z-index: 1;
  width: min(100%, 300px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 34px rgba(0,0,0,0.32));
}
.pig-textbox {
  margin-top: 14px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
}
.pig-textbox p:first-child { font-size: 1.12rem; font-weight: 800; margin-bottom: 6px; }
.pig-text { color: var(--muted); line-height: 1.45; }

.theme-sunny .pig-scene { background: linear-gradient(180deg, rgba(255, 223, 123, 0.35), rgba(93, 123, 162, 0.08)); }
.theme-cloudy .pig-scene { background: linear-gradient(180deg, rgba(181, 201, 244, 0.18), rgba(58, 77, 106, 0.08)); }
.theme-rainy .pig-scene { background: linear-gradient(180deg, rgba(101, 167, 213, 0.18), rgba(18, 31, 47, 0.06)); }
.theme-snowy .pig-scene { background: linear-gradient(180deg, rgba(219, 242, 255, 0.22), rgba(54, 81, 111, 0.08)); }
.theme-night .pig-scene { background: radial-gradient(circle at 30% 20%, rgba(220, 199, 255, 0.20), transparent 18%), linear-gradient(180deg, rgba(16, 25, 53, 0.85), rgba(6, 8, 20, 0.90)); }

.theme-sunny .mood-tag { color: #fff0b8; }
.theme-cloudy .mood-tag { color: #d9e6ff; }
.theme-rainy .mood-tag { color: #c0ebff; }
.theme-snowy .mood-tag { color: #e7fbff; }
.theme-night .mood-tag { color: #d9ceff; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 18px, 100%); margin: 10px auto; }
  .weather-panel, .pig-panel { padding: 14px; }
  .quick-grid, .day-stats, .tabs { grid-template-columns: 1fr 1fr; }
  .hour-item { grid-template-columns: 72px 1fr; }
  .week-card { flex-direction: column; align-items: flex-start; gap: 8px; }
  .week-values { text-align: left; }
}
