:root{
  --bg:#fff8ec;
  --card:#ffffff;
  --ink:#2b1d0e;
  --muted:#7a6a55;
  --accent:#e8a33d;
  --accent-dark:#b8721c;
  --line:#f0e0c4;
  --shadow: 0 2px 10px rgba(120,80,20,0.10);
}
*{box-sizing:border-box;}
html{
  /* Always reserve space for the scrollbar so switching between a short
     page (Home) and a tall one (Details) doesn't shift the centered
     content sideways when the scrollbar appears/disappears. */
  overflow-y:scroll;
}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background: var(--bg);
  color:var(--ink);
  min-height:100vh;
}
/* Top padding matches the fixed title bar's real measured height (see
   updateHeaderHeightVar in the script) - the title is taken clean out of
   the flow by position:fixed below, so .wrap has to reserve that space
   itself instead. */
.wrap{max-width:452px;margin:0 auto;padding:var(--header-h, 90px) 16px calc(88px + env(safe-area-inset-bottom));}
/* Truly fixed (not sticky) - always on screen regardless of scroll, on
   any page. Content (including day-card headers) scrolls up underneath
   it. Matches .wrap's own max-width/centering since position:fixed takes
   it out of .wrap's layout entirely. */
header{
  display:flex;justify-content:center;
  position:fixed;left:0;right:0;top:0;z-index:10;
  max-width:452px;margin:0 auto;
  padding:max(20px, calc(env(safe-area-inset-top) + 10px)) 0 14px;
  background:var(--bg);
}
/* Fixed to the bottom of the viewport so it stays visible while scrolling
   (e.g. through the long Details list), matching the app's own max-width
   so it lines up with the rest of the centered content. */
.view-toggle{
  display:flex;justify-content:flex-start;gap:8px;
  position:fixed;left:0;right:0;bottom:0;margin:0 auto;
  max-width:452px;padding:10px 16px calc(10px + env(safe-area-inset-bottom));
  background:var(--bg);
  border-top:1px solid var(--line);z-index:40;
}
.view-btn{padding:8px 22px;border-radius:999px;border:1px solid var(--line);background:var(--card);color:var(--muted);font-weight:700;font-size:13.5px;cursor:pointer;box-shadow:var(--shadow);flex-shrink:0;}
.view-btn.active{background:var(--accent-dark);color:#fff;border-color:var(--accent-dark);}

/* Search tab stretches to fill the rest of the row and doubles as the
   current-location readout, instead of staying the same compact size as
   the icon-only Home/Details/Info tabs. */
.view-btn--search{
  flex:1 1 auto;display:flex;align-items:center;justify-content:center;
  gap:7px;min-width:0;overflow:hidden;
}
.view-btn--search .loc-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

.page[hidden]{display:none;}

/* Base gauge circle — kept ahead of .gauge--home in source order so the
   home-page size override below always wins the cascade. */
.gauge{width:120px;height:120px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-direction:column;flex-shrink:0;color:#fff;box-shadow:inset 0 0 0 6px rgba(255,255,255,0.25);}
.gauge .num{font-size:34px;font-weight:800;line-height:1;}

.home-hero{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:44px 20px 40px;text-align:center;}
.gauge--home{width:300px;height:300px;}
.gauge--home .num{font-size:68px;}
.home-verdict{font-size:17px;font-weight:700;color:var(--ink);max-width:320px;margin:0;}

/* Current conditions under the circle: just the weather emoji + temperature */
.home-now{display:flex;align-items:center;justify-content:center;gap:12px;}
.home-now-emoji{font-size:32px;line-height:1;}
.home-now-temp{font-size:26px;font-weight:800;color:var(--ink);}

/* "Best time this week" card lives on the Details page now */
.home-best{
  margin-bottom:20px;background:var(--card);border:1px solid var(--line);border-radius:16px;
  padding:14px 22px;box-shadow:var(--shadow);text-align:center;
}
.home-best-label{font-size:11px;text-transform:uppercase;letter-spacing:0.05em;color:var(--muted);font-weight:700;margin-bottom:5px;}
.home-best-value{font-size:15.5px;font-weight:700;color:var(--ink);display:flex;align-items:center;justify-content:center;gap:8px;}
.home-best-score{font-weight:800;font-size:13px;border-radius:8px;padding:2px 9px;}

@media (max-width:520px){
  .gauge--home{width:200px;height:200px;}
  .gauge--home .num{font-size:52px;}
}
.brand{display:flex;align-items:center;gap:0px;}
.brand .logo{font-size:34px;}
.brand h1{font-size:24px;margin:0;letter-spacing:-0.02em;}

/* Search tab: current location, then a plain in-page form to change it
   (no more popover - it's just a page like the others now). */
.search-panel{
  background:var(--card);border:1px solid var(--line);border-radius:16px;
  padding:18px;box-shadow:var(--shadow);
}
.search-current{font-size:13.5px;color:var(--muted);margin-bottom:14px;}
.search-current .loc-name{font-weight:700;color:var(--ink);}
#searchResults{position:relative;width:100%;margin-bottom:10px;}
#searchResults input{width:100%;padding:9px 12px;border-radius:10px;border:1px solid var(--line);font-size:14px;}
#searchResults .dropdown{position:absolute;top:100%;left:0;right:0;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);margin-top:4px;overflow:hidden;z-index:5;}
#searchResults .dropdown div{padding:9px 12px;cursor:pointer;font-size:13.5px;}
#searchResults .dropdown div:hover{background:#fdf1da;}
.search-panel button{width:100%;padding:9px 14px;border-radius:10px;border:none;background:var(--accent);color:#fff;font-weight:600;cursor:pointer;}
.search-panel .status{padding:14px 0 0;}

.status{color:var(--muted);font-size:14px;padding:30px 0;text-align:center;}

/* Vertical list of per-day boxes (Yr-app style): today/tomorrow hour by
   hour, the rest of the week in 00-06/06-12/12-18/18-24 blocks. */
.day-list{display:flex;flex-direction:column;gap:16px;}

.day-card{
  position:relative;
  background:var(--card);border:1px solid var(--line);border-radius:18px;
  box-shadow:var(--shadow);
  /* No overflow:hidden - that would make this card its own scrolling box
     and break the header's stickiness relative to the actual page scroll. */
}
.day-card-header{
  padding:13px 18px;font-weight:700;font-size:14px;color:var(--ink);
  /* Opaque, not the translucent rgba tint this used to be - it's sticky,
     so a see-through background would let scrolled-past rows show through
     it once it's pinned in place. Same apparent colour, just pre-mixed to
     a solid hex. */
  background:#fbf7f1;border-bottom:1px solid var(--line);
  border-top-left-radius:18px;border-top-right-radius:18px;
  position:sticky;top:var(--header-h, 90px);z-index:2;
}
/* JS (via a sentinel + IntersectionObserver, see setupStickyHeaders)
   detects the exact moment this header is actually pinned flush against
   the fixed title bar above - only then do the rounded corners get
   squared off, since that's the only moment they'd otherwise expose a
   sliver of whatever's scrolled behind them. Same height/padding always;
   nothing changes except the corners, right when it matters. */
.day-card-header.is-pinned{
  border-top-left-radius:0;border-top-right-radius:0;
  border-top:1px solid var(--line);
}
.stick-sentinel{position:absolute;top:0;left:0;width:1px;height:1px;visibility:hidden;pointer-events:none;}
.day-rows{display:flex;flex-direction:column;}
.day-rows[hidden]{display:none;}

.day-toggle{
  display:flex;align-items:center;justify-content:center;gap:4px;
  width:100%;padding:10px 0;border:none;border-top:1px solid rgba(43,29,14,0.06);
  background:transparent;color:var(--muted);font-weight:600;font-size:12.5px;cursor:pointer;
  border-bottom-left-radius:18px;border-bottom-right-radius:18px;
}
.day-toggle:hover{background:rgba(184,114,28,0.05);}
.day-toggle .chev{font-size:10px;}
.day-row{
  display:flex;align-items:center;gap:10px;padding:11px 18px;
  border-bottom:1px solid rgba(43,29,14,0.06);
}
.day-row:last-child{border-bottom:none;}
.row-time{width:52px;flex-shrink:0;font-weight:700;font-size:13.5px;color:var(--ink);}
.row-emoji{width:26px;flex-shrink:0;font-size:18px;text-align:center;}
.row-temp{width:40px;flex-shrink:0;font-weight:700;font-size:15px;color:var(--ink);text-align:right;}
.row-bi{flex:1;min-width:36px;text-align:center;font-weight:800;font-size:13px;border-radius:8px;padding:3px 8px;}

.info-panel{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:16px 18px;font-size:13px;color:var(--muted);text-align:left;line-height:1.55;box-shadow:var(--shadow);}
.info-panel b{color:var(--ink);}
