:root {
  --bg: #081127;
  --bg-deep: #060d20;
  --surface: rgba(20, 34, 70, 0.78);
  --surface-light: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.1);
  --text: #f4f7ff;
  --muted: #a7b3d2;
  --soft: #7482a9;
  --accent: #7ce5dc;
  --accent-strong: #65dbc9;
  --warm: #ffd166;
  --card-radius: 26px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg-deep); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 80% -10%, rgba(95, 103, 255, 0.22), transparent 34rem),
    linear-gradient(155deg, #0c1736 0%, var(--bg-deep) 64%);
}

button, input { font: inherit; }
button { border: 0; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
}

.ambient { position: fixed; z-index: 0; width: 50vw; height: 50vw; border-radius: 50%; filter: blur(80px); opacity: .18; pointer-events: none; }
.ambient-one { top: 24%; left: -25%; background: #4b68f0; }
.ambient-two { top: 60%; right: -28%; background: #15ada1; }

.topbar, .hero-topline, .hero-main, .hero-meta, .section-heading, .sheet-heading, .setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { margin-bottom: 24px; }
.eyebrow, .section-kicker { margin: 0 0 4px; color: var(--soft); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.location-button { display: inline-flex; align-items: center; gap: 8px; padding: 0; background: transparent; font-size: 24px; font-weight: 650; letter-spacing: -.04em; }
.location-pin { position: relative; width: 12px; height: 15px; border: 2px solid var(--accent); border-radius: 8px 8px 8px 8px; transform: scale(.8); }
.location-pin::after { content: ""; position: absolute; top: 3px; left: 3px; width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
.chevron { width: 7px; height: 7px; margin: 1px 0 0 1px; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); transform: rotate(45deg); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .avatar-button, .close-button { display: grid; place-items: center; background: var(--surface-light); border: 1px solid var(--stroke); }
.icon-button { width: 44px; height: 44px; border-radius: 14px; }
.avatar-button { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(145deg, #a18cff, #5368dc); font-size: 14px; font-weight: 700; box-shadow: 0 5px 18px rgba(75, 94, 221, .35); }
.icon-refresh { width: 17px; height: 17px; border: 1.5px solid var(--muted); border-right-color: transparent; border-radius: 50%; position: relative; }
.icon-refresh::after { content: ""; position: absolute; right: -3px; top: -2px; border: 3px solid transparent; border-left-color: var(--muted); transform: rotate(-25deg); }
.icon-button:active, .avatar-button:active, .nav-item:active { transform: scale(.95); }

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 286px;
  padding: 20px 20px 18px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--card-radius);
  background: linear-gradient(145deg, rgba(64, 85, 177, .95), rgba(21, 38, 93, .9) 68%, rgba(10, 22, 54, .96));
  box-shadow: 0 24px 70px rgba(2, 8, 29, .35), inset 0 1px rgba(255,255,255,.16);
}
.hero-card.is-night { background: linear-gradient(145deg, #182548, #101936 68%, #090f25); }
.hero-card.is-cloudy { background: linear-gradient(145deg, #3b5b7e, #1d365b 68%, #101f3c); }
.hero-orbit { position: absolute; border: 1px solid rgba(196, 229, 255, .16); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 280px; height: 280px; right: -110px; top: -160px; }
.orbit-two { width: 220px; height: 220px; right: -66px; top: -130px; border-color: rgba(255,255,255,.09); }
.hero-topline { position: relative; z-index: 1; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.12); color: #d6fffa; font-size: 11px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(124,229,220,.15); }
.update-label { color: rgba(255,255,255,.6); font-size: 11px; }
.hero-main { position: relative; z-index: 1; align-items: flex-end; margin: 35px 0 24px; }
.hero-condition { margin: 0 0 4px; color: rgba(255,255,255,.76); font-size: 16px; }
.hero-main h1 { margin: 0; font-size: clamp(72px, 19vw, 98px); line-height: .86; font-weight: 430; letter-spacing: -.09em; }
.hero-main h1 sup { top: -.9em; margin-left: 3px; font-size: .28em; font-weight: 500; letter-spacing: 0; }
.feels-like { margin: 15px 0 0; color: rgba(255,255,255,.62); font-size: 12px; }
.hero-weather-icon { margin: 0 10px 10px 0; font-size: clamp(62px, 17vw, 84px); filter: drop-shadow(0 8px 18px rgba(255,208,80,.22)); }
.hero-meta { position: relative; z-index: 1; gap: 8px; padding-top: 17px; border-top: 1px solid rgba(255,255,255,.13); }
.meta-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.meta-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; background: rgba(255,255,255,.12); font-size: 14px; }
.meta-label { display: block; margin-bottom: 2px; color: rgba(255,255,255,.54); font-size: 10px; }
.meta-item strong { font-size: 12px; font-weight: 550; white-space: nowrap; }

.section-block { margin-top: 31px; }
.section-heading { align-items: flex-end; margin-bottom: 14px; }
.section-heading h2, .sheet-heading h2 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.04em; }
.text-button { padding: 4px 0; background: transparent; color: var(--accent); font-size: 12px; }
.text-button span { margin-left: 4px; font-size: 16px; vertical-align: -1px; }
.unit-label { color: var(--soft); font-size: 12px; }

.hourly-scroller { display: flex; gap: 9px; overflow-x: auto; padding: 2px 1px 9px; scrollbar-width: none; scroll-snap-type: x proximity; }
.hourly-scroller::-webkit-scrollbar { display: none; }
.hour-card { flex: 0 0 69px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 8px 13px; border: 1px solid var(--stroke); border-radius: 20px; background: rgba(24, 41, 82, .56); scroll-snap-align: start; }
.hour-card.active { border-color: rgba(124,229,220,.55); background: linear-gradient(180deg, rgba(89, 160, 181, .5), rgba(29, 66, 112, .7)); box-shadow: 0 10px 24px rgba(30, 93, 131, .2); }
.hour-time { color: var(--muted); font-size: 11px; }
.hour-card.active .hour-time { color: #e8fffc; }
.hour-icon { font-size: 23px; line-height: 1; }
.hour-temp { font-size: 14px; font-weight: 620; }
.hour-rain { color: var(--accent); font-size: 10px; }

.daily-list { display: grid; gap: 6px; }
.day-row { display: grid; grid-template-columns: 60px 35px 1fr 66px; align-items: center; gap: 10px; min-height: 55px; padding: 9px 11px; border: 1px solid transparent; border-radius: 18px; }
.day-row.today { border-color: var(--stroke); background: rgba(27, 46, 89, .52); }
.day-name { font-size: 13px; font-weight: 590; }
.day-name small { display: block; margin-top: 2px; color: var(--soft); font-size: 10px; font-weight: 400; }
.day-icon { font-size: 22px; text-align: center; }
.day-bar { position: relative; height: 5px; border-radius: 999px; background: rgba(255,255,255,.08); }
.day-bar-fill { position: absolute; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6cd4ed, #ffd166); }
.day-temps { display: flex; justify-content: flex-end; gap: 6px; font-size: 13px; }
.day-temps .low { color: var(--soft); }

.sparkle { color: var(--warm); font-size: 20px; }
.insight-card { display: flex; align-items: center; gap: 13px; padding: 15px; border: 1px solid rgba(255,209,102,.18); border-radius: 20px; background: linear-gradient(135deg, rgba(130, 89, 39, .35), rgba(54, 47, 69, .42)); }
.insight-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 13px; background: rgba(255,209,102,.15); font-size: 21px; }
.insight-card strong { display: block; margin-bottom: 4px; font-size: 13px; }
.insight-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.insight-arrow { margin-left: auto; color: var(--warm); font-size: 18px; }

.bottom-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: flex; justify-content: center; padding: 9px 18px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgba(5, 11, 29, .95) 22%); pointer-events: none; }
.bottom-nav::before { content: ""; position: absolute; right: 12px; bottom: 8px; left: 12px; height: 66px; border: 1px solid rgba(255,255,255,.1); border-radius: 23px; background: rgba(15, 27, 61, .78); box-shadow: 0 16px 50px rgba(0,0,0,.35); backdrop-filter: blur(18px); }
.nav-item { position: relative; z-index: 1; display: flex; flex: 1; max-width: 150px; flex-direction: column; align-items: center; gap: 5px; padding: 8px 10px; background: transparent; color: var(--soft); font-size: 10px; pointer-events: auto; transition: color .2s ease, transform .2s ease; }
.nav-item.active { color: var(--accent); }
.nav-icon { position: relative; display: block; width: 19px; height: 19px; }
.icon-sun::before { content: "☼"; position: absolute; top: -4px; left: -1px; font-size: 25px; line-height: 1; }
.icon-chart::before { content: "⌁"; position: absolute; top: -8px; left: -1px; font-size: 29px; transform: rotate(-18deg); }
.icon-sliders::before { content: "☷"; position: absolute; top: -4px; left: -1px; font-size: 24px; line-height: 1; }

.sheet-backdrop { position: fixed; z-index: 19; inset: 0; background: rgba(3, 8, 24, .66); backdrop-filter: blur(3px); }
.search-sheet, .settings-sheet { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; width: min(100%, 520px); margin: 0 auto; padding: 11px 18px max(24px, env(safe-area-inset-bottom)); border: 1px solid rgba(255,255,255,.12); border-bottom: 0; border-radius: 28px 28px 0 0; background: rgba(15, 28, 62, .97); box-shadow: 0 -24px 60px rgba(1, 5, 20, .4); }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 18px; border-radius: 99px; background: rgba(255,255,255,.22); }
.sheet-heading { align-items: flex-start; margin-bottom: 18px; }
.close-button { width: 44px; height: 44px; border-radius: 50%; color: var(--muted); font-size: 22px; line-height: 1; }
.search-form { display: flex; align-items: center; gap: 8px; padding: 6px 7px 6px 13px; border: 1px solid var(--stroke); border-radius: 15px; background: rgba(255,255,255,.06); }
.search-icon { width: 14px; height: 14px; border: 1.5px solid var(--soft); border-radius: 50%; position: relative; }
.search-icon::after { content: ""; position: absolute; right: -4px; bottom: -3px; width: 5px; height: 1.5px; background: var(--soft); transform: rotate(45deg); }
.search-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.search-form input::placeholder { color: var(--soft); }
.search-form button { padding: 8px 13px; border-radius: 10px; background: var(--accent); color: #09212b; font-size: 12px; font-weight: 700; }
.search-hint { margin: 12px 2px; color: var(--soft); font-size: 11px; }
.search-results { display: grid; gap: 5px; max-height: 200px; overflow-y: auto; }
.result-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 10px; border-radius: 13px; background: rgba(255,255,255,.045); text-align: left; }
.result-item:hover { background: rgba(124,229,220,.09); }
.result-item strong { display: block; font-size: 13px; }
.result-item span { display: block; margin-top: 3px; color: var(--soft); font-size: 10px; }
.result-arrow { color: var(--accent); font-size: 18px; }
.locate-button { display: flex; align-items: center; gap: 8px; margin: 15px auto 0; padding: 10px 13px; border-radius: 12px; background: rgba(124,229,220,.1); color: var(--accent); font-size: 12px; }
.locate-icon { font-size: 17px; }

.settings-list { display: grid; gap: 2px; }
.setting-row { padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.setting-row > div:first-child { min-width: 0; }
.setting-row strong { display: block; margin-bottom: 4px; font-size: 13px; }
.setting-row span { color: var(--soft); font-size: 11px; }
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.06); }
.segmented button { padding: 6px 9px; border-radius: 7px; background: transparent; color: var(--soft); font-size: 11px; }
.segmented button.selected { background: var(--accent); color: #09212b; font-weight: 700; }
.switch { width: 39px; height: 23px; padding: 3px; border-radius: 999px; background: rgba(255,255,255,.12); text-align: left; }
.switch span { display: block; width: 17px; height: 17px; border-radius: 50%; background: var(--soft); transition: transform .22s ease, background .22s ease; }
.switch.selected { background: rgba(124,229,220,.32); }
.switch.selected span { background: var(--accent); transform: translateX(16px); }
.settings-footer { margin: 20px 0 0; color: var(--soft); font-size: 10px; text-align: center; }

.about-panel { position: fixed; z-index: 18; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3,8,24,.7); backdrop-filter: blur(8px); }
.about-panel[hidden], .sheet-backdrop[hidden], .search-sheet[hidden], .settings-sheet[hidden] { display: none; }
.about-panel-inner { position: relative; width: min(100%, 390px); padding: 29px 24px 25px; border: 1px solid rgba(255,255,255,.13); border-radius: 25px; background: linear-gradient(160deg, rgba(45,65,128,.96), rgba(14,26,58,.98)); box-shadow: 0 30px 90px rgba(0,0,0,.4); }
.about-panel-inner h2 { margin: 21px 0 10px; font-size: 26px; letter-spacing: -.05em; }
.about-panel-inner p { margin: 0 0 15px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.about-panel-inner a { display: inline-block; margin-top: 14px; color: var(--accent); font-size: 12px; text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .16em; }
.attribution { color: var(--soft); font-size: 10px; }
.about-panel-inner .close-button { position: absolute; top: 14px; right: 14px; }
.toast { position: fixed; z-index: 30; bottom: 94px; left: 50%; max-width: calc(100% - 40px); padding: 10px 15px; border: 1px solid var(--stroke); border-radius: 13px; background: rgba(15, 28, 61, .94); box-shadow: 0 10px 35px rgba(0,0,0,.32); color: var(--text); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .22s ease, transform .22s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 620px) {
  body { padding: 16px 0; }
  .app-shell { min-height: calc(100vh - 32px); padding-bottom: 110px; border: 1px solid rgba(255,255,255,.06); border-radius: 34px; background: rgba(7,15,37,.38); }
  .bottom-nav { bottom: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
