:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --glass: rgba(255, 255, 255, 0.13);
  --glass-strong: rgba(255, 255, 255, 0.18);
  --hairline: rgba(255, 255, 255, 0.22);
  --text-shadow: 0 1px 3px rgba(8, 18, 40, 0.35);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  position: relative;
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: #fff;
  background: #16202e;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-shadow: var(--text-shadow);
}

/* ---------- фон: небо и частицы ---------- */
.sky {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, #2678dd, #4fa4ef 60%, #6dbdf2);
  transition: opacity 0.6s ease;
}

.sky.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: lightning 9s ease-in-out infinite;
}

@keyframes lightning {
  0%, 93%, 100% { opacity: 0; }
  94% { opacity: 0.22; }
  95% { opacity: 0.02; }
  96% { opacity: 0.14; }
  97% { opacity: 0; }
}

.bgfx {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: #ffe9b8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- шапка ---------- */
.header { padding: 26px 0 4px; }

.header__row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(8, 18, 40, 0.35);
}

.logo__icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(8, 18, 40, 0.3));
}

/* ---------- вкладки разделов ---------- */
.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  text-decoration: none;
  text-shadow: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tab:hover { background: var(--glass); text-decoration: none; }

.tab.active {
  background: var(--glass-strong);
  border-color: var(--hairline);
  color: #fff;
}

/* ---------- поиск ---------- */
.search {
  position: relative;
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 240px;
}

.search__input {
  flex: 1;
  padding: 11px 18px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  font-size: 1rem;
  outline: none;
  text-shadow: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.search__input::placeholder { color: rgba(255, 255, 255, 0.75); }
.search__input:focus { background: var(--glass-strong); border-color: rgba(255, 255, 255, 0.55); }

.search__geo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.search__geo:hover { background: var(--glass-strong); transform: scale(1.06); }

.search__results {
  position: absolute;
  top: 52px;
  left: 0;
  right: 54px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(13, 20, 36, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(3, 10, 25, 0.45);
  z-index: 30;
  text-shadow: none;
}

.search__results li {
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.search__results li:hover { background: rgba(255, 255, 255, 0.12); }
.search__results .sub { color: rgba(255, 255, 255, 0.6); font-size: 0.83rem; }

/* ---------- ярлыки городов ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
  margin-bottom: 22px;
}

.chip {
  padding: 6px 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.88rem;
  cursor: pointer;
  text-shadow: none;
  transition: background 0.2s ease, transform 0.15s ease;
}

.chip:hover { background: var(--glass-strong); transform: translateY(-1px); }

.chip.active {
  background: #fff;
  border-color: #fff;
  color: #1c2733;
  box-shadow: 0 4px 14px rgba(8, 18, 40, 0.25);
}

/* ---------- карточки (стекло) ---------- */
.card {
  position: relative;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 14px 44px rgba(5, 15, 35, 0.28);
  padding: 24px 26px;
  margin-bottom: 20px;
  animation: fadeUp 0.65s ease both;
}

.card:nth-of-type(2) { animation-delay: 0.08s; }
.card:nth-of-type(3) { animation-delay: 0.16s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.92);
}

/* ---------- текущая погода ---------- */
.hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero__top h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.hero__date {
  margin-top: 2px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.8);
}

.hero__tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero__upd { font-size: 0.85rem; color: rgba(255, 255, 255, 0.75); }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--glass);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.3s ease;
}

.icon-btn:hover { background: var(--glass-strong); }
.icon-btn.spin svg { animation: spin 0.7s ease; }

@keyframes spin { to { transform: rotate(360deg); } }

.hero__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 10px 0 4px;
}

.hero__temp {
  font-size: clamp(4.4rem, 12vw, 6.2rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -2px;
  text-shadow: 0 4px 18px rgba(8, 18, 40, 0.35);
}

.hero__temp .deg {
  font-style: normal;
  font-size: 0.45em;
  font-weight: 300;
  vertical-align: top;
  line-height: 1.35;
  margin-left: 2px;
  opacity: 0.9;
}

.hero__desc {
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 500;
}

.hero__feels {
  margin-top: 2px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
}

.hero__icon {
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 16px rgba(8, 18, 40, 0.3));
}

.hero__icon svg { width: 132px; height: 142px; }

/* линейные иконки погоды */
.wi svg { display: block; }

.ic-rays {
  transform-box: fill-box;
  transform-origin: center;
  animation: spin 28s linear infinite;
}

.ic-drop { animation: dropFall 1.4s linear infinite; }
.ic-drop:nth-of-type(2) { animation-delay: 0.45s; }
.ic-drop:nth-of-type(3) { animation-delay: 0.9s; }

.ic-flake { animation: flakeDrift 2.8s ease-in-out infinite alternate; }
.ic-flake:nth-of-type(2) { animation-delay: 0.7s; }
.ic-flake:nth-of-type(3) { animation-delay: 1.4s; }

.ic-bolt { animation: boltGlow 3.2s ease-in-out infinite; }

.ic-fogline { animation: fogPulse 4.5s ease-in-out infinite alternate; }
.ic-fogline:nth-of-type(2) { animation-delay: 1.2s; }

@keyframes dropFall {
  0% { transform: translateY(-3px); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(4px); opacity: 0; }
}

@keyframes flakeDrift {
  from { transform: translateY(-1px); opacity: 0.65; }
  to { transform: translateY(2px); opacity: 1; }
}

@keyframes boltGlow {
  0%, 88%, 100% { opacity: 0.85; }
  90% { opacity: 0.35; }
  92% { opacity: 1; }
}

@keyframes fogPulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* ---------- детали ---------- */
.details {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  list-style: none;
  margin: 20px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.details li { display: flex; flex-direction: column; gap: 2px; }
.details span { font-size: 0.78rem; color: rgba(255, 255, 255, 0.7); letter-spacing: 0.2px; }
.details b { font-weight: 600; font-size: 0.98rem; }

/* ---------- почасовой прогноз ---------- */
.hourly {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.hour {
  flex: 0 0 auto;
  width: 78px;
  text-align: center;
  padding: 12px 6px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  scroll-snap-align: start;
  transition: transform 0.18s ease, background 0.18s ease;
}

.hour:hover { transform: translateY(-3px); background: var(--glass-strong); }

.hour.now {
  background: rgba(255, 255, 255, 0.92);
  border-color: #fff;
  color: #1c2733;
  text-shadow: none;
  box-shadow: 0 6px 18px rgba(8, 18, 40, 0.28);
}

.hour__time { font-size: 0.8rem; color: rgba(255, 255, 255, 0.75); }
.hour.now .hour__time { color: rgba(28, 39, 51, 0.65); }
.hour__icon { display: flex; justify-content: center; margin: 6px 0 4px; }
.hour__temp { font-weight: 600; font-size: 1.02rem; }
.hour__pop { font-size: 0.75rem; color: #bfe3ff; }
.hour.now .hour__pop { color: #2f7df6; }

/* ---------- прогноз на неделю ---------- */
.days { display: flex; flex-direction: column; }

.day {
  display: grid;
  grid-template-columns: 118px 34px 1fr 180px 56px;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  transition: background 0.18s ease;
}

.day:hover { background: rgba(255, 255, 255, 0.07); }
.day:last-child { border-bottom: none; }

.day__name { font-weight: 600; }
.day__name .sub { display: block; color: rgba(255, 255, 255, 0.65); font-weight: 400; font-size: 0.78rem; }
.day__icon { display: flex; justify-content: center; }
.day__desc { color: rgba(255, 255, 255, 0.8); font-size: 0.92rem; }

.day__bar { display: flex; align-items: center; gap: 10px; }
.day__min, .day__max { font-size: 0.88rem; width: 32px; }
.day__min { color: rgba(255, 255, 255, 0.65); text-align: right; }

.bar {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
}

.bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #6ab7ff, #ffd166);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.35);
}

.day__pop { font-size: 0.82rem; color: #bfe3ff; text-align: right; }

/* ---------- ошибка ---------- */
.error {
  background: rgba(120, 30, 40, 0.35);
  border: 1px solid rgba(255, 160, 160, 0.4);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
  animation: fadeUp 0.5s ease both;
}

.error p { margin: 0 0 12px; }

.btn {
  padding: 9px 22px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #1c2733;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-shadow: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(8, 18, 40, 0.3); }

/* ---------- заглушка раздела «Новости» ---------- */
.placeholder {
  text-align: center;
  padding: 56px 26px;
}

.placeholder__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, 0.85);
}

.placeholder h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.placeholder__text {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.05rem;
}

/* ---------- подвал ---------- */
.footer {
  padding: 22px 0 34px;
  text-align: center;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
}

.footer p { margin: 2px 0; }
.footer__sub { color: rgba(255, 255, 255, 0.6); font-size: 0.82rem; }

/* ---------- мобильная версия ---------- */
@media (max-width: 680px) {
  .header { padding: 18px 0 2px; }
  .card { padding: 20px 18px; }
  .hero__top h1 { font-size: 1.5rem; }
  .hero__main { flex-direction: row; align-items: center; }
  .hero__icon svg { width: 92px; height: 100px; }
  .details { grid-template-columns: repeat(3, 1fr); }
  .day { grid-template-columns: 92px 30px 1fr 120px; }
  .day__desc, .day__pop { display: none; }
  .search__results { right: 0; }

  /* ярлыки городов — одной строкой с прокруткой */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 24px -20px 20px;
    padding: 0 20px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; flex: 0 0 auto; }
}

/* ---------- меньше движения ---------- */
@media (prefers-reduced-motion: reduce) {
  .card, .ic-rays, .ic-drop, .ic-flake, .ic-bolt, .ic-fogline,
  .sky.flash::after, .icon-btn.spin svg {
    animation: none !important;
  }
}
