:root {
  color-scheme: light;
  --bg: #eef4fb;
  --bg-accent: #dbe9fb;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --text: #16233a;
  --muted: #5a6b85;
  --line: rgba(22, 35, 58, 0.1);
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.12);
  --radius: 18px;
  --shadow: 0 18px 40px rgba(28, 52, 92, 0.12);
}

html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d1626;
  --bg-accent: #16233a;
  --panel: rgba(24, 36, 56, 0.86);
  --panel-strong: #1b2942;
  --text: #e8effb;
  --muted: #9aabc4;
  --line: rgba(232, 239, 251, 0.12);
  --accent: #7aa7ff;
  --accent-soft: rgba(122, 167, 255, 0.16);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 18px 40px;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-accent) 0%, var(--bg) 55%, var(--bg) 100%);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  overflow-wrap: anywhere;
}

.app {
  width: min(880px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

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

.head h1 { margin: 0; font-size: 22px; letter-spacing: 0.02em; }
.head__sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn--ghost {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}

.picker { display: grid; gap: 10px; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip[aria-pressed='true'] {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.search { display: flex; gap: 8px; }
.search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  font-size: 15px;
}
.search input:focus-visible,
.btn:focus-visible,
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.status {
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
}
.status[data-tone='error'] { background: rgba(214, 69, 69, 0.14); color: #b3261e; }
html[data-theme='dark'] .status[data-tone='error'] { color: #ff9d96; }
.status[data-tone='idle'] { display: none; }

.current,
.forecast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(12px);
}

.current__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.current__place { display: flex; align-items: center; gap: 12px; }
.current__icon { font-size: 44px; line-height: 1; }
.current__place h2 { margin: 0; font-size: 19px; }
.current__desc { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.current__temp { text-align: right; }
.current__temp > span:first-child { font-size: 48px; font-weight: 700; letter-spacing: -0.02em; }
.current__unit { font-size: 20px; color: var(--muted); margin-left: 2px; }
.current__feels { margin: 0; color: var(--muted); font-size: 13px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}
.metrics div { display: grid; gap: 2px; }
.metrics dt { color: var(--muted); font-size: 12px; }
.metrics dd { margin: 0; font-size: 15px; font-weight: 600; }

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

.days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.day {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  display: grid;
  gap: 6px;
}
.day__date { font-size: 13px; color: var(--muted); }
.day__look { font-size: 26px; line-height: 1; }
.day__desc { font-size: 14px; }
.day__temp { font-size: 15px; font-weight: 600; }
.day__temp small { color: var(--muted); font-weight: 500; }
.day__rain { font-size: 12px; color: var(--muted); }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 520px) {
  body { padding: 18px 14px 32px; }
  .current__main { align-items: flex-start; }
  .current__temp { text-align: left; }
  .current__temp > span:first-child { font-size: 40px; }
  .search { flex-wrap: wrap; }
  .search input { flex: 1 1 100%; }
  .search .btn { flex: 1 1 100%; }
}
