:root {
  --glass: rgba(255,255,255,.14);
  --glass-2: rgba(255,255,255,.1);
  --line: rgba(255,255,255,.14);
  --muted: rgba(255,255,255,.7);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #fff;
  min-height: 100vh;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 28px 16px 40px;
  background: linear-gradient(160deg, #6b7b8c, #41505f);
  background-attachment: fixed;
  transition: background .9s ease;
  -webkit-font-smoothing: antialiased;
}
body.weather-clear-day   { background: linear-gradient(160deg, #4a90d9, #2c5f8a); }
body.weather-clear-night { background: linear-gradient(160deg, #233355, #0d1526); }
body.weather-clouds      { background: linear-gradient(160deg, #7d8a99, #4a5568); }
body.weather-rain        { background: linear-gradient(160deg, #51617a, #2f3a4d); }
body.weather-storm       { background: linear-gradient(160deg, #3a3f5a, #1b1e2e); }
body.weather-snow        { background: linear-gradient(160deg, #a9c2d6, #6b7e92); }
body.weather-fog         { background: linear-gradient(160deg, #8c9099, #5f666f); }

.app { width: 100%; max-width: 460px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { font-size: 1.05rem; font-weight: 600; letter-spacing: .03em; opacity: .95; }
.units { display: flex; gap: 2px; background: var(--glass-2); border-radius: 999px; padding: 3px; }
.unit-btn { border: none; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; cursor: pointer; transition: .2s; }
.unit-btn.active { background: #fff; color: #33414f; }

.search-row { display: flex; gap: 10px; margin-bottom: 18px; }
.search-field { position: relative; flex: 1; }
.search-field input { width: 100%; padding: 15px 48px 15px 18px; border: none; border-radius: 16px; background: var(--glass); color: #fff; font-size: 1rem; outline: none; transition: background .2s; }
.search-field input::placeholder { color: rgba(255,255,255,.6); }
.search-field input:focus { background: rgba(255,255,255,.22); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: none; border-radius: 16px; background: var(--glass); color: #fff; cursor: pointer; transition: background .2s; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.22); }
.search-field .icon-btn { position: absolute; right: 0; top: 0; height: 100%; background: transparent; }
.search-field .icon-btn:hover { background: rgba(255,255,255,.15); }

.message { background: rgba(255,255,255,.15); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; font-size: .92rem; line-height: 1.4; margin-bottom: 16px; }

.card { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 24px; padding: 26px 24px; box-shadow: 0 12px 34px rgba(0,0,0,.18); transition: opacity .25s; }
.card.reloading { opacity: .5; }
.current-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.location { font-size: 1.45rem; font-weight: 600; line-height: 1.2; }
.desc { margin-top: 4px; opacity: .85; }
.icon { width: 92px; height: 92px; flex: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.22)); }
.temp { font-size: 4.6rem; font-weight: 200; line-height: 1; margin-top: 10px; }
.temp .unit-sym { font-size: 1.8rem; font-weight: 400; vertical-align: super; margin-left: 2px; opacity: .9; }
.feels { opacity: .85; margin-top: 8px; font-size: .98rem; }
.details { display: flex; gap: 12px; margin-top: 24px; }
.detail { flex: 1; background: var(--glass-2); border-radius: 14px; padding: 14px 16px; }
.detail-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.detail-value { display: block; font-size: 1.2rem; font-weight: 500; margin-top: 5px; }

.forecast { display: flex; gap: 10px; margin-top: 16px; }
.forecast-card { flex: 1; background: var(--glass-2); border: 1px solid var(--line); border-radius: 18px; padding: 14px 6px; text-align: center; min-width: 0; }
.forecast-day { font-size: .8rem; opacity: .8; font-weight: 500; }
.forecast-icon { width: 52px; height: 52px; margin: 2px auto; display: block; }
.forecast-temps { display: flex; justify-content: center; gap: 8px; font-size: .92rem; }
.forecast-temps .hi { font-weight: 600; }
.forecast-temps .lo { opacity: .6; }

.loading { display: flex; justify-content: center; padding: 50px 0; }
.spinner { width: 38px; height: 38px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card, .forecast { animation: rise .4s ease both; }

.hidden { display: none !important; }

@media (max-width: 380px) {
  .temp { font-size: 3.6rem; }
  .icon { width: 76px; height: 76px; }
  .location { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
