:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3fa;
  --border: #dbe4f0;
  --text: #15243a;
  --text-muted: #5a6b83;
  --accent: #1f6feb;
  --accent-soft: #e4efff;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --radius: 18px;
  --shadow: 0 12px 28px rgba(21, 36, 58, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1622;
  --surface: #172130;
  --surface-muted: #1e2a3c;
  --border: #2a3a50;
  --text: #eaf1fb;
  --text-muted: #9fb0c6;
  --accent: #6ea8ff;
  --accent-soft: #1c2f4d;
  --danger: #ff9d93;
  --danger-soft: #3a1f1e;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card.hero { padding: 24px 20px; }

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

.city-name {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.hero-body {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.weather-icon {
  font-size: 56px;
  line-height: 1;
}

.temperature {
  font-size: 56px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.02em;
}

.temperature-unit { font-size: 22px; font-weight: 500; color: var(--text-muted); }

.condition { margin: 6px 0 0; font-size: 15px; color: var(--text-muted); }

.range { margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }

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

.detail {
  background: var(--surface-muted);
  border-radius: 12px;
  padding: 10px 12px;
}

.detail-label { font-size: 12px; color: var(--text-muted); }
.detail-value { margin-top: 4px; font-size: 16px; font-weight: 600; }

.section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

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

.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  min-height: 36px;
}

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.chip:disabled { opacity: 0.55; cursor: progress; }

.footer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.notice {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--text);
}

.error-card { border-color: var(--danger); }
.error-title { margin: 0; font-size: 18px; color: var(--danger); }
.error-detail { margin: 8px 0 0; font-size: 14px; color: var(--text-muted); line-height: 1.6; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  min-height: 40px;
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.button:disabled { opacity: 0.6; cursor: progress; }

.skeleton-line {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-muted), var(--border), var(--surface-muted));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-title { width: 42%; height: 20px; }
.skeleton-temp { width: 55%; height: 48px; margin-top: 18px; }
.skeleton-text { width: 70%; height: 14px; margin-top: 14px; }

@keyframes shimmer {
  from { background-position: 0% 0; }
  to { background-position: -200% 0; }
}

.hint { margin: 14px 0 0; font-size: 13px; color: var(--text-muted); }

@media (max-width: 480px) {
  .page { padding: 14px 12px 22px; }
  .card { padding: 16px; border-radius: 16px; }
  .hero-body { gap: 12px; }
  .temperature { font-size: 44px; }
  .weather-icon { font-size: 44px; }
  .details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip { padding: 8px 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line { animation: none; }
}
