/* Sahoor — styles.
   A night-time app, on purpose unlike MyFaith: no app bar, no full-width tab bar, no teal.
   The bold element is the sky dial at the top of Today — a half-circle from imsak (left horizon) to iftar
   (right horizon) with the sun climbing it while you fast. Content rises over the sky on a sheet; the menu is
   a floating night capsule. Dawn-lilac paper, indigo ink, lamp amber for anything "done" or "now".
   Young Serif for numbers and titles, Lexend for reading, Amiri for Arabic. */

:root {
  --paper: #f2eff9;
  --surface: #ffffff;
  --ink: #1e1940;
  --muted: #615c80;
  --line: #ddd8ee;
  --accent: #2e2670;
  --accent-ink: #ffffff;
  --lamp: #eea233;
  --lamp-ink: #2a1a05;
  --lamp-soft: #fcefd6;
  --rose: #b03f5a;
  --focus: #3d6fe0;
  --dock: #15123a;
  --dock-ink: #cfc9f0;

  --sky-night: linear-gradient(180deg, #0d0a2b 0%, #221a5a 100%);
  --sky-day: linear-gradient(180deg, #1c2a6e 0%, #3b4ea3 100%);
  --sky-dusk: linear-gradient(180deg, #24143c 0%, #6e3348 100%);
  --hero-ink: #f7f3ff;
  --hero-soft: rgba(247, 243, 255, .72);
  --hero-line: rgba(247, 243, 255, .24);

  --display: 'Young Serif', Georgia, 'Times New Roman', serif;
  --font: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --arabic: 'Amiri', 'Traditional Arabic', 'Geeza Pro', serif;
  --dock-h: 66px;
  --dock-gap: 12px;
  --r-s: 12px;
  --r-m: 20px;
  --r-l: 30px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e0b22; --surface: #1a1636; --ink: #ece8ff; --muted: #a6a1c6; --line: #2d2853;
    --accent: #b8aeff; --accent-ink: #15123a; --lamp: #f2ab45; --lamp-soft: #3a2b16; --rose: #f0879d; --focus: #8fb2ff;
    --dock: #1f1a46; --dock-ink: #bdb6e6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e0b22; --surface: #1a1636; --ink: #ece8ff; --muted: #a6a1c6; --line: #2d2853;
  --accent: #b8aeff; --accent-ink: #15123a; --lamp: #f2ab45; --lamp-soft: #3a2b16; --rose: #f0879d; --focus: #8fb2ff;
  --dock: #1f1a46; --dock-ink: #bdb6e6;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16.5px/1.55 var(--font);
  min-height: 100dvh;
  padding-bottom: calc(var(--dock-h) + var(--dock-gap) * 2 + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
svg { flex: none; }
.ar { font-family: var(--arabic); font-size: var(--ar-size, 1.8rem); line-height: 2.05; text-align: right; margin: .5rem 0 .4rem; }

/* ------------------------------------------------------------------ chrome: floating gear, floating dock */
.top { position: absolute; z-index: 15; top: calc(env(safe-area-inset-top) + 8px); right: max(8px, calc(50% - 272px)); }
.top[data-mode="sky"] .icon-btn { color: var(--hero-ink); }
.top[data-mode="bar"] {
  position: static; display: flex; align-items: center; gap: 4px;
  max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 16px 0 6px;
}
.top-title { font-family: var(--display); font-weight: 400; font-size: 1.6rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: none; color: var(--ink); text-decoration: none;
}
.icon-btn:hover { background: color-mix(in srgb, var(--lamp) 18%, transparent); }

.tabs {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--dock-gap) + env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 24px)); height: var(--dock-h); padding: 6px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  background: var(--dock); border-radius: 999px; box-shadow: 0 10px 30px rgba(13, 10, 43, .35);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0;
  border-radius: 999px; color: var(--dock-ink); text-decoration: none; font-size: .7rem;
}
.tab svg { width: 22px; height: 22px; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab[aria-current="page"] { background: var(--lamp); color: var(--lamp-ink); font-weight: 600; }
.tab[aria-current="page"] svg { stroke-width: 2.2; }
.tab:focus-visible { outline-color: var(--lamp); outline-offset: -3px; border-radius: 999px; }

main { display: block; max-width: 560px; margin: 0 auto; outline: none; }
.page { padding: calc(env(safe-area-inset-top) + 22px) 16px 28px; display: grid; gap: 24px; }
main[data-route="settings"] .page { padding-top: 12px; }
.page-title { font-family: var(--display); font-weight: 400; font-size: 1.75rem; line-height: 1.2; padding-right: 44px; }
.block + .block .page-title, .page > .page-title:not(:first-child) { padding-right: 0; font-size: 1.4rem; }
.sec-h { font-size: .95rem; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec-count { font-weight: 600; font-size: .85rem; color: var(--lamp-ink); background: var(--lamp-soft); padding: 2px 10px; border-radius: 999px; }
:root[data-theme="dark"] .sec-count { color: var(--lamp); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sec-count { color: var(--lamp); } }

/* ------------------------------------------------------------------ buttons & form bits */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: var(--r-s); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600;
  text-decoration: none; justify-self: start;
}
.btn svg { width: 20px; height: 20px; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: .88rem; }
.btn-text { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.btn:disabled, fieldset:disabled .btn { opacity: .45; cursor: default; }
.stack { display: grid; gap: 10px; margin-top: 8px; }
.stack-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.hint { color: var(--muted); font-size: .88rem; }
.note { padding: 12px 14px; background: var(--lamp-soft); border-radius: var(--r-s); font-size: .92rem; }
.field { display: grid; gap: 6px; margin-top: 14px; font-weight: 600; font-size: .92rem; }
select {
  min-height: 48px; border-radius: var(--r-s); border: 1.5px solid var(--line); background: var(--surface); padding: 0 12px; width: 100%;
}

/* ------------------------------------------------------------------ the sky (hero) */
.hero {
  --sky: var(--sky-night);
  position: relative; overflow: hidden; color: var(--hero-ink); background: var(--sky);
  padding: calc(env(safe-area-inset-top) + 12px) 20px 58px; text-align: center;
}
.hero::before { /* a few stars, visible before dawn and at night */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .9; transition: opacity .8s;
  background:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 46% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 14%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 83% 26%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 52%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 6% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 74% 44%, #fff 50%, transparent 51%);
}
.hero[data-stage="fasting"] { --sky: var(--sky-day); }
.hero[data-stage="fasting"]::before { opacity: 0; }
.hero[data-stage="done"] { --sky: var(--sky-dusk); }
.hero > * { position: relative; z-index: 1; }
.hero-top { display: flex; align-items: center; min-height: 44px; padding-right: 44px; }
.loc {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 40px; padding: 0 12px 0 8px;
  border: 0; border-radius: 999px; background: rgba(255, 255, 255, .1); color: var(--hero-ink); font-size: .84rem;
}
.loc svg { width: 18px; height: 18px; }
.loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-day { margin-top: 14px; font-family: var(--display); font-size: 1.15rem; }

.dial { position: relative; width: min(100%, 360px); margin: 10px auto 0; }
.arc { display: block; width: 100%; height: auto; overflow: visible; }
.arc-track { fill: none; stroke: var(--hero-line); stroke-width: 2; stroke-dasharray: 1.5 3.5; }
.arc-fill { fill: none; stroke: var(--lamp); stroke-width: 3.5; stroke-linecap: round; }
.arc-sun { fill: var(--lamp); }
.arc-glow { fill: rgba(238, 162, 51, .28); }
.arc-night { fill: none; stroke: var(--hero-soft); stroke-width: 1.4; }
.arc-night:first-of-type { fill: var(--lamp); stroke: var(--lamp); }
.hero[data-stage="sahur"] .arc-sun { fill: var(--hero-ink); }
.hero[data-stage="sahur"] .arc-glow { fill: rgba(247, 243, 255, .16); }
.dial-in { position: absolute; inset: 24% 17% 0; text-wrap: balance; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.hero-label { color: var(--hero-soft); font-size: .98rem; }
.hero-alone { margin: 30px auto 0; max-width: 34ch; }
.hero-count { display: flex; justify-content: center; gap: 14px; margin-top: 6px; }
.hero-count span { display: grid; justify-items: center; min-width: 2.6ch; }
.hero-count b {
  font-family: var(--display); font-weight: 400; font-size: clamp(2.3rem, 11vw, 3rem); line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
}
.hero-count small { font-size: .74rem; color: var(--hero-soft); margin-top: 4px; }
.hero-count.is-text { display: block; font-family: var(--display); font-size: clamp(1.25rem, 5.6vw, 1.55rem); line-height: 1.2; }
.dial-ends { display: flex; justify-content: space-between; width: min(100%, 360px); margin: 10px auto 0; text-align: left; }
.dial-ends span { display: grid; color: var(--hero-soft); font-size: .82rem; }
.dial-ends span:last-child { text-align: right; }
.dial-ends b { color: var(--hero-ink); font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.2; }
.hero-sub { margin-top: 16px; font-size: 1rem; }
.hero-fine { color: var(--hero-soft); font-size: .75rem; margin: 16px auto 0; max-width: 42ch; }

/* content rises over the sky */
.sheet-top {
  position: relative; z-index: 2; margin-top: -30px; padding-top: 24px;
  background: var(--paper); border-radius: var(--r-l) var(--r-l) 0 0;
}

/* first run */
.hero-setup { padding: 0; min-height: 100dvh; display: flex; flex-direction: column; }
body.is-setup { padding-bottom: 0; }
body.is-setup .tabs { display: none; }
.setup-brand { flex: 1; display: grid; place-items: center; place-content: center; padding: calc(env(safe-area-inset-top) + 56px) 24px 64px; }
.setup-brand .arc { grid-area: 1 / 1; width: min(84vw, 320px); }
.setup-name-wrap { grid-area: 1 / 1; align-self: end; display: grid; justify-items: center; margin-bottom: -6px; }
.setup-ar { font-family: var(--arabic); font-size: 1.7rem; line-height: 1.6; color: var(--lamp); }
.setup-name { font-family: var(--display); font-weight: 400; font-size: clamp(3rem, 15vw, 4.2rem); line-height: 1.05; }
/* first-run popup: rises from the bottom over the night sky */
.setup-pop {
  position: relative; z-index: 2; text-align: left; color: var(--ink); background: var(--paper);
  border-radius: var(--r-l) var(--r-l) 0 0; padding: 12px 20px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .35); animation: pop-up .5s cubic-bezier(.2, .8, .2, 1) .25s both;
}
.setup-pop::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 14px; }
@keyframes pop-up { from { transform: translateY(100%); } to { transform: none; } }
.setup-where { font-family: var(--display); font-weight: 400; font-size: 1.3rem; }
.setup-text { margin-top: 4px; font-size: .86rem; color: var(--muted); max-width: 40ch; }
.setup-actions { display: grid; gap: 8px; margin-top: 12px; }
.setup-actions .btn { justify-self: stretch; }
.btn-lamp { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); }
.setup-status { min-height: 1.3em; margin-top: 6px; }
.setup-lang { display: flex; justify-content: center; gap: 6px; }
.setup-lang button { border: 0; background: none; color: var(--muted); padding: 8px 6px; min-height: 40px; }
.setup-lang button.is-on { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

/* ------------------------------------------------------------------ Today */
.tl {
  position: relative; list-style: none; margin: 10px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, 1fr); text-align: center;
}
.tl::before { content: ''; position: absolute; left: 8%; right: 8%; top: 31px; height: 2px; background: var(--line); }
.tl li { position: relative; display: grid; justify-items: center; gap: 6px; min-width: 0; }
.tl span { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.tl i { width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--muted); }
.tl b { font-family: var(--display); font-weight: 400; font-size: 1rem; line-height: 1.2; font-variant-numeric: lining-nums; }
.tl .is-key i { border-color: var(--lamp); }
.tl .is-key b { font-size: 1.15rem; }
.tl .is-past { opacity: .5; }
.tl .is-past i { background: var(--muted); }
.tl .is-next i { width: 16px; height: 16px; margin: -2px 0; background: var(--lamp); border-color: var(--lamp); box-shadow: 0 0 0 5px color-mix(in srgb, var(--lamp) 25%, transparent); }
.tl .is-next span { color: var(--ink); font-weight: 600; }

.prep { display: grid; gap: 8px; padding: 16px; border-radius: var(--r-m); background: var(--surface); }
.prep .btn { margin-top: 4px; }

.amal-box { display: grid; gap: 12px; }
.amal { display: flex; flex-wrap: wrap; gap: 8px; }
.amal-item {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 10px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: .92rem;
}
.amal-item i { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed var(--muted); display: grid; place-items: center; color: transparent; }
.amal-item i svg { width: 14px; height: 14px; stroke-width: 2.6; }
.amal-item[aria-pressed="true"] { border-color: var(--lamp); background: var(--lamp); color: var(--lamp-ink); font-weight: 600; }
.amal-item[aria-pressed="true"] i { border: 0; background: var(--lamp-ink); color: var(--lamp); }

.daynav {
  display: flex; align-items: center; justify-content: space-between; justify-self: center; gap: 6px;
  padding: 2px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line);
}
.dayof { font-family: var(--display); font-weight: 400; font-size: 1.02rem; min-width: 11ch; text-align: center; }
.text { display: grid; }
.doa-text { background: var(--surface); border-radius: var(--r-m); padding: 18px 18px 16px; margin-top: -10px; }
.hadith-text { position: relative; padding: 4px 4px 0 4px; }
.hadith-text::before {
  content: '“'; position: absolute; right: 0; top: -18px; font-family: var(--display); font-size: 5rem; line-height: 1;
  color: var(--lamp); opacity: .55; pointer-events: none;
}
.text-title { font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.3; margin-top: 4px; }
.rumi { font-style: italic; }
.meaning { margin-top: 8px; }
.text-note { margin-top: 8px; font-size: .9rem; color: var(--muted); }
.text-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.src { display: inline-flex; align-items: center; gap: 4px; font-size: .84rem; font-weight: 600; font-style: normal; color: var(--accent); }
.src svg { width: 14px; height: 14px; }
cite.src { color: var(--muted); font-weight: 400; }

/* ------------------------------------------------------------------ Fasting: thirty moons */
.block { display: grid; gap: 12px; }
.fast-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 6px; margin-top: 4px; }
.fcell {
  display: grid; justify-items: center; align-content: center; aspect-ratio: 1; width: 100%; max-width: 62px; justify-self: center;
  border-radius: 50%; border: 1.5px dashed var(--muted); background: transparent; padding: 0; color: var(--ink);
}
.fcell b { font-family: var(--display); font-weight: 400; font-size: 1.05rem; line-height: 1.05; }
.fcell span { font-size: .66rem; color: var(--muted); line-height: 1.1; }
.fcell.is-y { background: var(--lamp); border: 0; color: var(--lamp-ink); box-shadow: 0 0 14px color-mix(in srgb, var(--lamp) 45%, transparent); }
.fcell.is-y span { color: var(--lamp-ink); font-size: .85rem; }
.fcell.is-n { border: 2px solid var(--rose); color: var(--rose); }
.fcell.is-n span { color: var(--rose); font-size: .85rem; }
.fcell.is-today { border-style: solid; border-width: 2px; border-color: var(--accent); }
.fcell[aria-disabled="true"] { opacity: .5; }
.fast-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; font-weight: 600; }
.fast-sum .ok { color: var(--ink); }
.fast-sum .ok::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--lamp); margin-right: 6px; }
.fast-sum .no { color: var(--rose); }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reasons .btn { justify-self: stretch; }

.qada-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; background: var(--surface); border-radius: var(--r-m); padding: 14px 4px; }
.qada-stats div { display: grid; padding: 0 4px; }
.qada-stats div + div { border-left: 1px solid var(--line); }
.qada-stats b { font-family: var(--display); font-weight: 400; font-size: 2.1rem; line-height: 1.1; }
.qada-stats span { font-size: .8rem; color: var(--muted); }
.qada-stats .is-left b { color: var(--rose); }
.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper-row small { display: block; margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 2px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); flex: none; }
.stepper output { min-width: 2.2ch; text-align: center; font-family: var(--display); font-size: 1.2rem; }
.stepper .icon-btn svg { width: 20px; height: 20px; }
.qada-list summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.qada-list ul { list-style: none; margin: 0; padding: 0; }
.qada-list li { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); min-height: 44px; }
.amal-sum { list-style: none; margin: 0; padding: 4px 16px; background: var(--surface); border-radius: var(--r-m); }
.amal-sum li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.amal-sum li:last-child { border-bottom: 0; }

/* ------------------------------------------------------------------ Quran */
.bar { height: 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--lamp); border-radius: 999px; transition: width .3s; }
.tad-prog { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.tad-prog b { font-family: var(--display); font-weight: 400; font-size: 1.2rem; }
.tad-prog span { color: var(--muted); }
.juz-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.juz {
  min-height: 52px; border-radius: var(--r-s); border: 1.5px solid var(--line); background: var(--surface);
  font-family: var(--display); font-size: 1.1rem;
}
.juz[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------------ Duas */
.dua-list { display: grid; gap: 8px; margin-top: -8px; }
.dua { background: var(--surface); border-radius: var(--r-m); padding: 0 16px; }
.dua summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; cursor: pointer; font-weight: 600;
}
.dua summary::-webkit-details-marker { display: none; }
.dua summary::after {
  content: '+'; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--lamp-soft); color: var(--ink); font-weight: 400; font-size: 1.2rem; transition: transform .2s;
}
.dua[open] summary::after { transform: rotate(45deg); }
.dua-body { padding: 0 0 18px; }

/* ------------------------------------------------------------------ Zakat */
.tiers { border: 0; padding: 0; margin: 6px 0 0; min-width: 0; }
.tiers legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.tier-list { background: var(--surface); border-radius: var(--r-m); padding: 0 14px; }
.tier { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 54px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tier:last-child { border-bottom: 0; }
.tier input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.tier b { font-family: var(--display); font-weight: 400; font-size: 1.1rem; }
.z-custom { width: 6.5em; min-height: 42px; border-radius: var(--r-s); border: 1.5px solid var(--line); background: var(--paper); padding: 0 10px; text-align: right; }
.z-total {
  display: grid; gap: 2px; margin-top: 6px; padding: 18px 20px; border-radius: var(--r-m);
  background: var(--sky-night); color: var(--hero-ink);
}
.z-total span { color: var(--hero-soft); }
.z-total b { font-family: var(--display); font-weight: 400; font-size: 2.5rem; line-height: 1.1; color: var(--lamp); }
.z-total small { color: var(--hero-soft); }

/* ------------------------------------------------------------------ settings */
.settings { gap: 0; }
.set-h { font-size: .95rem; font-weight: 600; color: var(--muted); margin: 26px 0 10px; }
.set-h:first-child { margin-top: 0; }
.set-card { background: var(--surface); border-radius: var(--r-m); padding: 14px 16px; display: grid; gap: 8px; }
.set-zone b { margin-right: 4px; }
.set-label { font-weight: 600; font-size: .92rem; margin-top: 6px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--r-s); background: var(--paper); justify-self: start; }
.settings > .seg { background: var(--surface); }
.seg button { min-height: 40px; padding: 0 14px; border-radius: 9px; border: 0; background: none; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + i { background: var(--lamp); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--focus); outline-offset: 2px; }
.alerts { border: 0; padding: 0; margin: 4px 0 0; min-width: 0; display: grid; gap: 4px; border-top: 1px solid var(--line); }
.alerts legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.alerts:disabled { opacity: .5; }
.alerts .btn { margin-top: 10px; }

/* ------------------------------------------------------------------ sheet, toast */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(13, 10, 43, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .2s; }
.sheet-wrap.open { background: rgba(13, 10, 43, .55); }
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; background: var(--paper); outline: none;
  border-radius: var(--r-l) var(--r-l) 0 0; padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s ease-out;
}
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.sheet-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.3rem; }
.zone-list { border: 0; padding: 0; margin: 14px 0 0; }
.zone-list legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.zone-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.zone-opt input { margin-top: 5px; width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.set-label + .reasons { margin-top: -4px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + var(--dock-gap) + 14px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px;
  background: var(--lamp); color: var(--lamp-ink); font-size: .95rem; font-weight: 600;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 600px) {
  .hero { border-radius: 0 0 var(--r-l) var(--r-l); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
