/* Commuterputer — bold bento, app-feel, mobile-first */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
/* must beat component display rules (.skeleton{display:grid}, .sheet{display:flex}, …) */
[hidden] { display: none !important; }

:root {
  --bg: #0a0b0f;
  --surface: #191c24;
  --surface-2: #20242e;
  --surface-hi: #282c38;
  --border: rgba(255,255,255,.11);
  --border-hi: rgba(255,255,255,.18);
  --text: #f4f5f8;
  --text-s: rgba(255,255,255,.62);
  --text-t: rgba(255,255,255,.38);

  --accent: #ccff4d;       /* lime brand */
  --accent-ink: #16180a;
  --out: #22d3ee;          /* cyan = outbound */
  --ret: #a78bfa;          /* purple = return */

  --green: #3ddc84; --yellow: #ffd23f; --orange: #ff8c42; --red: #ff5a5a;

  --r-lg: 28px; --r-md: 20px; --r-sm: 14px;
  --shadow: 0 18px 40px -16px rgba(0,0,0,.7);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --ease: cubic-bezier(.4,0,.2,1);
  --safe-t: env(safe-area-inset-top);
  --safe-b: env(safe-area-inset-bottom);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- dynamic sky ---------- */
.sky { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
.sky-tint {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 80% -10%, rgba(99,102,241,.22), transparent 55%),
    radial-gradient(100% 60% at -10% 110%, rgba(34,211,238,.14), transparent 55%);
  transition: background 1.2s var(--ease);
}

/* ---------- app bar (collapsing) ---------- */
.appbar { position: sticky; top: 0; z-index: 20; padding-top: var(--safe-t); }
.appbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 18px 18px 12px;
  transition: padding .25s var(--ease);
}
.appbar.shrink .appbar-inner { padding: 10px 18px; }
.appbar.shrink { background: rgba(11,12,16,.72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--border); }
.greeting h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; transition: font-size .25s var(--ease); }
.appbar.shrink .greeting h1 { font-size: 1.15rem; }
.greet-sub { color: var(--text-s); font-size: .82rem; margin-top: 5px; font-weight: 500; transition: opacity .2s var(--ease), height .2s var(--ease); }
.appbar.shrink .greet-sub { opacity: 0; height: 0; margin: 0; overflow: hidden; }
.settings-fab {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 16px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  display: grid; place-items: center; transition: transform .3s var(--spring), background .2s;
}
.settings-fab:active { transform: scale(.9) rotate(35deg); background: var(--surface-hi); }

.container { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 4px 18px calc(48px + var(--safe-b)); }

/* ---------- reveal animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.98); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; animation: rise .6s var(--spring) forwards; animation-delay: calc(var(--i, 0) * 70ms); }

/* ---------- HERO BENTO ---------- */
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 6px; }

.tile { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; }
.tile-tap { cursor: pointer; transition: transform .25s var(--spring); -webkit-user-select: none; user-select: none; }
.tile-tap:active { transform: scale(.97); }

/* feature: your next ride */
.feature {
  grid-column: 1 / -1; padding: 22px; display: flex; flex-direction: column; gap: 18px;
  border-color: var(--eff, var(--green));
  background: linear-gradient(165deg, var(--eff-fill, rgba(61,220,132,.14)), var(--surface) 62%);
  box-shadow: 0 18px 50px -22px var(--eff, rgba(61,220,132,.6));
}
.feature::before {
  content: ""; position: absolute; inset: 0; opacity: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 100% -10%, var(--glow, rgba(61,220,132,.45)), transparent 58%);
  transition: background 1s var(--ease);
}
.feature::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; pointer-events: none;
  background: var(--eff, var(--green));
}
.feature > * { position: relative; }
.feat-top { display: flex; align-items: center; justify-content: space-between; }
.feat-kicker { font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--text-s); }
.feat-wx { font-size: .92rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.feat-main { display: flex; align-items: center; gap: 20px; }
.gauge { width: 128px; height: 128px; flex-shrink: 0; position: relative; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .g-track { stroke: rgba(255,255,255,.08); }
.gauge .g-val { stroke: var(--eff, var(--green)); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--spring); filter: drop-shadow(0 0 8px var(--eff, var(--green))); }
.gauge .g-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .g-num b { font-size: 2.5rem; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
.gauge .g-num span { font-size: .58rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-t); margin-top: 3px; }
.feat-info { flex: 1; min-width: 0; }
.feat-label { font-size: 2.3rem; font-weight: 900; letter-spacing: -.03em; line-height: .95; }
.feat-label .eff-word { color: var(--eff, var(--green)); }
.feat-sub { color: var(--text-s); font-size: .85rem; margin-top: 6px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.feat-verdict { font-size: .95rem; font-weight: 600; line-height: 1.4; color: var(--text); background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; }

/* leg tiles */
.leg-tile {
  padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 146px;
  background: linear-gradient(160deg, var(--eff-fill, transparent), var(--surface) 66%);
  border-color: color-mix(in srgb, var(--eff) 30%, var(--border));
}
.leg-tile::after { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 6px; border-radius: 0 6px 6px 0; background: var(--legc); }
.leg-tile .lt-head { display: flex; align-items: center; gap: 7px; font-size: .73rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--legc); padding-left: 10px; }
.leg-tile .lt-num { font-size: 3rem; font-weight: 900; letter-spacing: -.05em; line-height: .85; padding-left: 10px; color: var(--eff); }
.leg-tile .lt-num small { font-size: .9rem; font-weight: 700; color: var(--text-s); letter-spacing: 0; }
.leg-tile .lt-wind { display: flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--text-s); font-weight: 600; padding-left: 10px; margin-top: auto; }
.leg-tile .lt-watts { font-size: .7rem; color: var(--text-t); padding-left: 10px; font-weight: 600; }
.wind-arrow { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.08); align-items: center; justify-content: center; font-size: .8rem; }

/* stat tiles */
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 15px 14px; display: flex; flex-direction: column; gap: 5px; }
.stat .s-ico { font-size: 1.3rem; }
.stat .s-val { font-size: 1.4rem; font-weight: 900; letter-spacing: -.02em; }
.stat .s-lbl { font-size: .58rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-t); }
.stat.warn { border-color: rgba(255,210,63,.35); background: linear-gradient(160deg, rgba(255,210,63,.12), var(--surface)); }
.stat.warn .s-val { color: var(--yellow); }

/* ---------- week ---------- */
.week { margin-top: 26px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.sec-head h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }
.sec-hint { font-size: .72rem; color: var(--text-t); font-weight: 600; }
.week-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.week-strip::-webkit-scrollbar { display: none; }
.day-card {
  flex: 0 0 92px; scroll-snap-align: start; border-radius: var(--r-md); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); padding: 12px 10px; text-align: center;
  transition: transform .25s var(--spring), border-color .2s; position: relative;
}
.day-card:active { transform: scale(.95); }
.day-card.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 30px -12px rgba(204,255,77,.4); }
.day-card.off { opacity: .5; }
.day-card .dc-day { font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-s); }
.day-card .dc-date { font-size: .64rem; color: var(--text-t); margin-bottom: 8px; font-weight: 600; }
.day-card.today .dc-day { color: var(--accent); }
.day-card .dc-icon { font-size: 1.5rem; margin-bottom: 3px; }
.day-card .dc-temp { font-size: .76rem; font-weight: 700; margin-bottom: 9px; }
.day-card .dc-legs { display: flex; flex-direction: column; gap: 5px; }
.dc-leg { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px; border-radius: 9px; background: rgba(255,255,255,.05); font-size: .66rem; }
.dc-leg .ll { font-weight: 800; } .dc-leg.out .ll { color: var(--out); } .dc-leg.ret .ll { color: var(--ret); }
.dc-leg .lv { font-weight: 800; }
.dc-rest { font-size: .6rem; color: var(--text-t); padding: 14px 0; font-weight: 600; }

/* ---------- notify card ---------- */
.notify-card { margin-top: 26px; position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); padding: 18px; }
.notify-glow { position: absolute; inset: 0; background: radial-gradient(90% 60% at 0% 0%, rgba(204,255,77,.14), transparent 60%); pointer-events: none; }
.notify-body { display: flex; gap: 14px; align-items: flex-start; position: relative; }
.notify-icon { font-size: 1.6rem; }
.notify-card h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.notify-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; position: relative; }
.ios-hint { margin-top: 12px; position: relative; }

/* ---------- buttons ---------- */
.btn {
  border: none; border-radius: 14px; font-family: inherit; font-size: .88rem; font-weight: 700;
  cursor: pointer; min-height: 46px; padding: 0 20px; transition: transform .2s var(--spring), filter .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .5; }
.btn-accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -8px rgba(204,255,77,.5); }
.btn-accent:active { filter: brightness(1.05); }
.btn-ghost { background: var(--surface-hi); border: 1px solid var(--border-hi); color: var(--text); }
.btn-lg { width: 100%; min-height: 54px; font-size: .95rem; }
.icon-btn { background: var(--surface-hi); border: 1px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 12px; font-size: 1rem; cursor: pointer; }
.small-btn { min-height: 38px; padding: 0 14px; font-size: .78rem; margin-top: 10px; align-self: flex-start; }

/* ---------- bottom sheet ---------- */
.sheet-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); opacity: 0; transition: opacity .35s var(--ease); }
.sheet-scrim.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 560px; margin: 0 auto; max-height: 92dvh;
  background: var(--surface); border-radius: 28px 28px 0 0;
  border-top: 1px solid var(--border-hi);
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,.8);
  transform: translateY(100%); transition: transform .42s var(--spring);
  display: flex; flex-direction: column; overscroll-behavior: contain;
}
.sheet.in { transform: translateY(0); }
.sheet-grip { padding: 12px 0 4px; display: flex; justify-content: center; cursor: grab; touch-action: none; flex-shrink: 0; }
.sheet-grip span { width: 42px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.22); }
.sheet-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 18px calc(28px + var(--safe-b)); }

.sheet-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-h h3 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.sheet-h .date { color: var(--text-s); font-size: .8rem; margin-top: 3px; font-weight: 500; }

/* segmented control */
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; margin-bottom: 18px; }
.seg-pill { position: absolute; top: 4px; bottom: 4px; width: calc(50% - 4px); border-radius: 11px; background: var(--surface-hi); transition: transform .35s var(--spring); box-shadow: var(--shadow); }
.seg.ret .seg-pill { transform: translateX(100%); }
.seg button { position: relative; z-index: 1; background: none; border: none; color: var(--text-s); font-family: inherit; font-size: .82rem; font-weight: 700; padding: 11px 6px; cursor: pointer; transition: color .25s; }
.seg.out button.s-out { color: var(--out); } .seg.ret button.s-ret { color: var(--ret); }

.eff-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 20px; font-size: .82rem; font-weight: 800; background: var(--effbg); color: var(--eff); border: 1px solid var(--effbd); }

/* compass / wind */
.wind-block { display: flex; gap: 18px; align-items: center; padding: 4px 0 18px; }
.compass { width: 150px; height: 150px; flex-shrink: 0; }
.compass svg { width: 100%; height: 100%; }
.wind-detail { font-size: .85rem; line-height: 1.85; min-width: 0; }
.wind-detail .wl { color: var(--text-s); }
.wind-detail b { font-weight: 700; }
.bar-wrap { margin-top: 8px; }
.bar-label { font-size: .64rem; color: var(--text-s); display: flex; justify-content: space-between; margin-bottom: 5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.bar-track { height: 9px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .9s var(--spring); }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 20px; }
.metric { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 13px 14px; }
.metric .mv { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.metric .ml { font-size: .58rem; color: var(--text-t); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-top: 3px; }

.hourly-h { font-size: .95rem; font-weight: 800; margin-bottom: 12px; }
.hourly-h small { color: var(--text-t); font-weight: 500; }
.hourly-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.hourly-scroll::-webkit-scrollbar { display: none; }
.hour-card { flex: 0 0 60px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; padding: 10px 4px; text-align: center; }
.hour-card.dep { border-color: var(--legc); box-shadow: 0 0 0 1px var(--legc); }
.hour-card .ht { font-size: .62rem; color: var(--text-t); font-weight: 700; margin-bottom: 3px; }
.hour-card .hi { font-size: 1.05rem; }
.hour-card .hd { font-size: .78rem; font-weight: 800; }
.hour-card .hw { font-size: .56rem; color: var(--text-t); margin-top: 2px; font-weight: 600; }
.hour-card .hbar { height: 4px; border-radius: 3px; margin-top: 6px; }

/* ---------- empty / loading / error ---------- */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state .em-icon { font-size: 3rem; margin-bottom: 14px; }
.empty-state h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 10px; letter-spacing: -.02em; }
.empty-state p { font-size: .88rem; color: var(--text-s); max-width: 340px; margin: 0 auto 22px; line-height: 1.55; }
.muted { color: var(--text-s); font-size: .85rem; line-height: 1.5; }
.small { font-size: .76rem; }
.error-box { background: rgba(255,90,90,.12); border: 1px solid rgba(255,90,90,.3); color: var(--red); border-radius: var(--r-md); padding: 14px 16px; font-size: .85rem; margin: 14px 0; font-weight: 600; }
.note { text-align: center; color: var(--text-t); font-size: .68rem; margin-top: 30px; }
.note a { color: var(--accent); text-decoration: none; }

.skeleton { display: grid; gap: 12px; margin-top: 6px; }
.skeleton .sk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.skeleton .sk-row:last-child { grid-template-columns: repeat(3, 1fr); }
.sk { border-radius: var(--r-md); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-hi) 50%, var(--surface) 70%); background-size: 220% 100%; animation: shimmer 1.4s infinite; }
.sk-feature { height: 188px; border-radius: var(--r-lg); }
.sk-half { height: 134px; } .sk-stat { height: 78px; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* ---------- settings dialog ---------- */
dialog { border: none; background: transparent; padding: 0; max-width: 100%; max-height: 100%; width: 100%; height: 100%; color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
dialog[open] { animation: dlgIn .35s var(--spring); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.settings-form { background: var(--bg); min-height: 100%; width: 100%; padding: calc(16px + var(--safe-t)) 18px calc(30px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-head h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; background: var(--surface); }
legend { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--text-s); padding: 0 8px; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-out { background: var(--out); } .dot-ret { background: var(--ret); }
.field { display: flex; flex-direction: column; gap: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col + .two-col { margin-top: 12px; }
label { font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--text-s); }
input, select { background: var(--surface-2); border: 1px solid var(--border-hi); color: var(--text); padding: 13px 14px; border-radius: var(--r-sm); font-family: inherit; font-size: 16px; outline: none; transition: border-color .2s, box-shadow .2s; width: 100%; min-height: 48px; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(204,255,77,.18); }
select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='rgba(255,255,255,0.4)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
option { background: #1a1d24; color: var(--text); }
.gear-readout .readout { font-size: 1.05rem; font-weight: 800; padding: 13px 2px; color: var(--accent); }
.city-wrap { position: relative; }
.city-results { position: absolute; top: 76px; left: 0; right: 0; z-index: 30; background: #1a1d24; border: 1px solid var(--border-hi); border-radius: var(--r-sm); max-height: 230px; overflow-y: auto; display: none; box-shadow: var(--shadow); }
.city-results.show { display: block; }
.city-result { padding: 13px 14px; cursor: pointer; font-size: .85rem; border-bottom: 1px solid var(--border); }
.city-result small { color: var(--text-s); margin-left: 4px; }
.day-chips { display: flex; gap: 6px; }
.day-chip { flex: 1; text-align: center; padding: 11px 0; border-radius: 11px; font-size: .74rem; font-weight: 800; background: var(--surface-2); border: 1px solid var(--border-hi); color: var(--text-s); cursor: pointer; transition: all .2s var(--spring); user-select: none; -webkit-user-select: none; }
.day-chip:active { transform: scale(.92); }
.day-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- larger screens ---------- */
@media (min-width: 600px) {
  .compass { width: 170px; height: 170px; }
  .settings-form { max-width: 540px; margin: auto; min-height: 0; border-radius: 28px; border: 1px solid var(--border); max-height: 88vh; }
  dialog { display: grid; place-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; }
}
