:root {
  --bg: #0a0f16;
  --glass: rgba(12, 19, 28, .52);
  --glass-strong: rgba(12, 19, 28, .74);
  --panel: #10171f;
  --panel-2: #16202b;
  --line: rgba(255,255,255,.09);
  --text: #f3f7fb;
  --muted: #a7b4c2;
  --dim: #7f8ea0;
  --ok: #34d17a;
  --down: #ff5b5b;
  --warm: #ffb454;
  --cool: #62c7ec;
  --accent: #62c7ec;
  --r: 18px;
  --blur: saturate(150%) blur(14px);
  --shadow: 0 12px 40px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; font-feature-settings: "tnum" 1;
}

/* ---- icons ---- */
.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.18em; }
.ico.fill { fill: currentColor; stroke: none; }
.ico.warm { color: var(--warm); }
.ico.cool { color: var(--cool); }
.wind-arrow { transition: transform .4s ease; }

/* ============================ HERO ================================= */
.hero { position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: #05080c; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.2); filter: blur(34px) brightness(.62) saturate(1.35); }
.hero-frame { position: absolute; inset: 0; z-index: 1; }
.cam-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity .55s ease; }
.cam-layer.is-active { opacity: 1; }
body.is-dark .hero-frame { filter: brightness(.62) saturate(.82); }

.vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 42%, transparent 55%, rgba(0,0,0,.35) 100%),
    linear-gradient(180deg, rgba(0,0,0,.58) 0%, transparent 22%, transparent 58%, rgba(0,0,0,.75) 100%); }

.overlay { position: absolute; z-index: 3; left: 0; right: 0; padding: clamp(16px, 3.2vw, 30px); }

/* --- top --- */
.overlay-top { top: 0; padding-top: max(clamp(16px,3.2vw,30px), env(safe-area-inset-top));
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.head-main { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.head-main h1 { margin: 0; font-size: clamp(1.7rem, 5.4vw, 3rem); font-weight: 800;
  letter-spacing: -.02em; line-height: 1; text-shadow: 0 3px 22px rgba(0,0,0,.55); }
.region { margin: 0; display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  color: #e4ecf3; font-size: clamp(.82rem,2.4vw,1rem); font-weight: 500; text-shadow: 0 1px 10px rgba(0,0,0,.7); }
.region .ico { color: var(--cool); flex: none; }

.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.status-cluster { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.live-badge, .upd-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); white-space: nowrap;
}
.live-badge { font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; padding-left: 12px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); position: relative; }
.live-badge.ok .live-dot { background: var(--ok); }
.live-badge.ok .live-dot::after, .live-badge.down .live-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: ping 1.8s cubic-bezier(0,0,.2,1) infinite; }
.live-badge.down { color: #ffd4d4; }
.live-badge.down .live-dot { background: var(--down); }
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.upd-pill { font-size: .84rem; font-weight: 500; color: var(--muted); }
.upd-pill .ico { width: 15px; height: 15px; color: var(--dim); }
.upd-pill #updated { font-variant-numeric: tabular-nums; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px;
  border-radius: 13px; cursor: pointer; color: var(--text); background: var(--glass-strong);
  border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transition: background .15s, transform .15s; }
.icon-btn:hover { background: rgba(30,42,56,.85); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .ico { width: 22px; height: 22px; }

/* --- banners --- */
.hero-banners { display: grid; gap: 8px; justify-items: start; }
.hero-banners[hidden] { display: none; }
.toast { display: inline-flex; align-items: center; gap: 9px; max-width: 100%; padding: 10px 15px;
  border-radius: 12px; font-size: .9rem; font-weight: 500; box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid rgba(255,255,255,.12); }
.toast[hidden] { display: none; }
.toast .ico { width: 19px; height: 19px; }
.toast.warn { background: rgba(120,74,20,.82); color: #ffe4bf; }
.toast.warn .ico { color: var(--warm); }
.toast.dark { background: rgba(28,40,78,.8); color: #d7e0ff; }
.toast.dark .ico { color: #9fb4ff; }

/* --- bottom --- */
.overlay-bottom { bottom: 0; padding-bottom: max(clamp(16px,3.2vw,30px), env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }

/* one frosted conditions card: weather row + sun row */
.cond-card { display: flex; flex-direction: column; border-radius: var(--r); overflow: hidden;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.cond-summary { margin: 0; display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  color: #dbe6f0; font-size: clamp(.82rem,2.4vw,.98rem); font-weight: 500; text-shadow: 0 1px 10px rgba(0,0,0,.7); }
.cond-summary[hidden] { display: none; }
.cond-summary .ico { width: 17px; height: 17px; color: var(--cool); flex: none; }
.hud { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 13px 19px; }
.hud[hidden] { display: none; }
.wx-item { display: inline-flex; align-items: center; gap: 8px; color: #eaf1f8; }
.wx-item .ico { width: 20px; height: 20px; color: var(--muted); }
.wx-item b { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.wx-item small { color: var(--muted); font-size: .82rem; }
.wx-item.temp b { font-size: 1.7rem; }
.wx-item.temp .ico { width: 24px; height: 24px; }
.wx-item.desc small { font-style: italic; color: #dbe5ef; }

.sun-row { display: flex; align-items: center; gap: 18px; padding: 10px 19px; border-top: 1px solid var(--line); }
.sun-row[hidden] { display: none; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; color: #dbe6f0; font-size: .9rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.meta-item .ico { width: 17px; height: 17px; }

.brand-hero { display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
  opacity: .8; transition: opacity .15s; }
.brand-hero:hover { opacity: 1; }
.brand-hero .brand-by { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
.brand-hero img { height: 20px; width: auto; display: block; filter: drop-shadow(0 1px 6px rgba(0,0,0,.6)); }

/* ============================ DRAWER =============================== */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(4,7,11,.62); backdrop-filter: blur(3px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(460px, 94vw);
  background: linear-gradient(180deg, #131c26, #0d141c); border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(0,0,0,.55); overflow-y: auto; padding: 0 22px 30px;
  animation: slideIn .26s cubic-bezier(.2,.8,.2,1); padding-top: env(safe-area-inset-top); }
@keyframes slideIn { from { transform: translateX(100%); } }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 16px; margin-bottom: 4px; background: linear-gradient(180deg, #131c26 72%, transparent); }
.drawer-head h2 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; }

.install-btn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  margin: 2px 0 10px; padding: 13px; border: 0; border-radius: 13px; cursor: pointer;
  background: var(--accent); color: #04121e; font-size: .95rem; font-weight: 700; font-family: inherit; }
.install-btn[hidden] { display: none; }
.install-btn .ico { width: 20px; height: 20px; }
.install-btn:active { transform: scale(.98); }
.ios-hint { display: flex; align-items: center; gap: 9px; margin: 2px 0 10px; padding: 12px 14px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: .84rem; }
.ios-hint[hidden] { display: none; }
.ios-hint .ico { width: 18px; height: 18px; flex: none; color: var(--accent); }

.dsec { padding: 20px 0; border-top: 1px solid var(--line); }
.dsec:first-of-type { border-top: 0; }
.dsec[hidden] { display: none; }
.dsec h3 { margin: 0 0 14px; display: flex; align-items: center; gap: 9px; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.dsec h3 .ico { width: 17px; height: 17px; color: var(--accent); }

/* forecast strip */
.fc-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.fc-strip::-webkit-scrollbar { height: 6px; }
.fc-strip::-webkit-scrollbar-thumb { background: #2a3a49; border-radius: 3px; }
.fc-item { flex: 0 0 auto; width: 66px; text-align: center; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 13px; padding: 11px 6px 9px; scroll-snap-align: start; }
.fc-item .fc-time { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-item .ico { width: 24px; height: 24px; margin: 8px 0 6px; color: var(--cool); }
.fc-item .fc-temp { font-weight: 700; font-size: 1.05rem; }
.fc-item .fc-wind { font-size: .68rem; color: var(--dim); margin-top: 3px; display: flex; align-items: center; justify-content: center; gap: 3px; }
.fc-item .fc-wind .ico { width: 12px; height: 12px; margin: 0; color: var(--dim); }

.fc-today { margin-bottom: 12px; }
.fc-today-line { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; }
.fc-today-line .ico { width: 20px; height: 20px; }
.fc-today-line b { font-weight: 700; font-size: 1.15rem; }
.fc-today-line small { color: var(--muted); }

.fc-days { margin-top: 14px; display: grid; gap: 8px; }
.fc-day { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; }
.fc-day-name { flex: 1; font-weight: 600; font-size: .9rem; }
.fc-day .ico { width: 22px; height: 22px; color: var(--cool); }
.fc-day-temp { font-variant-numeric: tabular-nums; display: inline-flex; align-items: baseline; gap: 6px; }
.fc-day-temp b { font-size: 1.05rem; font-weight: 700; }
.fc-day-temp small { color: var(--muted); }

/* temperature trend */
.trend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.trend-cur { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
.trend-range { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-axis { display: flex; justify-content: space-between; color: var(--dim); font-size: .72rem; margin-top: 3px; }

.link-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-radius: 12px;
  text-decoration: none; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); font-weight: 500;
  transition: border-color .15s, background .15s; }
.link-row:hover { border-color: var(--accent); background: #1a2836; }
.link-row .ico { color: var(--muted); width: 18px; height: 18px; }

/* timelapse */
.tl { margin: 0; position: relative; }
.tl img { width: 100%; border-radius: 14px; background: #0b1119; display: block; aspect-ratio: 16/9; object-fit: cover; cursor: zoom-in; }
.tl-expand { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 10px; }
.tl-expand .ico { width: 18px; height: 18px; }
.tl figcaption { position: absolute; left: 10px; bottom: 10px; padding: 5px 11px; border-radius: 8px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px); font-size: .82rem; font-variant-numeric: tabular-nums; }
.tl-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.play-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: var(--accent); color: #04121e; display: inline-flex; align-items: center; justify-content: center; }
.play-btn .ico { width: 20px; height: 20px; }
.play-btn:active { transform: scale(.94); }
input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: #29394a; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 0 0 4px rgba(98,199,236,.2); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer; }
.tl-controls select { background: #0f1a24; color: var(--text); border: 1px solid #2b3d4d; border-radius: 10px; padding: 9px 10px; font-size: .9rem; }

/* daily */
.daily-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.daily-grid figure { margin: 0; cursor: zoom-in; }
.daily-grid img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: #0b1119; display: block;
  border: 1px solid var(--line); transition: transform .15s, border-color .15s; }
.daily-grid figure:hover img { transform: translateY(-2px); border-color: var(--accent); }
.daily-grid figcaption { font-size: .72rem; color: var(--muted); margin-top: 4px; text-align: center; font-variant-numeric: tabular-nums; }

/* events */
.events-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.events-list li { display: flex; align-items: center; gap: 11px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 13px; font-size: .88rem; color: #cdd8e2; }
.events-list .ev-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.events-list .ev-time { color: var(--dim); font-variant-numeric: tabular-nums; margin-left: auto; font-size: .8rem; }
.ev-change .ev-dot { background: var(--warm); }
.ev-offline .ev-dot { background: var(--down); }
.ev-online .ev-dot { background: var(--ok); }

/* drawer footer + brand */
.drawer-foot { padding-top: 22px; margin-top: 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.brand-full { display: flex; flex-direction: column; gap: 6px; text-decoration: none; margin-bottom: 16px; }
.brand-full span { color: var(--dim); font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; }
.brand-full img { height: 30px; width: auto; opacity: .92; }
.drawer-foot p { margin: 7px 0; display: flex; align-items: center; gap: 8px; }
.drawer-foot .ico { width: 15px; height: 15px; color: var(--dim); }

/* ============================ LIGHTBOX ============================= */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(4,6,10,.93);
  display: flex; align-items: center; justify-content: center; flex-direction: column; animation: fade .2s ease; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 10px; box-shadow: 0 20px 70px rgba(0,0,0,.6); }
.lb-cap { color: #d3deea; margin-top: 14px; font-size: .95rem; font-variant-numeric: tabular-nums; }
.lb-close { position: absolute; top: 18px; right: 20px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.lb-nav.lb-prev { left: 16px; } .lb-nav.lb-next { right: 16px; }
.lb-nav[hidden] { display: none; }

@media (max-width: 560px) {
  #fs-btn { display: none; }             /* mobile browsers have their own fullscreen */
  .wx-item b { font-size: 1.2rem; }
  .wx-item.temp b { font-size: 1.5rem; }
  .overlay-bottom { align-items: flex-start; gap: 10px; }
  .cond-card { width: 100%; }
  .brand-hero { margin-left: auto; }   /* below the card, aligned right */
  .lb-nav { width: 44px; height: 44px; }
}
