/* ─────────────────────────────────────────────────────────────────────────
   Banaag — design system
   "Vellum & Candlelight": warm parchment and ink by day, a candle-lit page by
   night. Black text, rubric red for what matters (as in old prayer books),
   gold leaf used sparingly. Three typefaces with three jobs:
     Fraunces      — the voice: titles, the verse of the day
     Newsreader    — long reading: Scripture, the journal
     Instrument Sans — everything functional
   ───────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  /* surface */
  --paper: #f3ecdc;
  --paper-sunk: #ebe2cd;
  --card: #faf6ea;
  --card-2: #f6f0df;
  --glass: rgba(243, 236, 220, 0.84);
  --scrim: rgba(35, 27, 19, 0.4);

  /* ink */
  --ink: #231b13;
  --ink-2: #51453a;
  --ink-3: #6c6051;
  --on-ink: #f6efdd;

  /* lines */
  --rule: rgba(35, 27, 19, 0.13);
  --rule-strong: rgba(35, 27, 19, 0.26);

  /* accents */
  --rubric: #a23a26;
  --rubric-soft: rgba(162, 58, 38, 0.1);
  --gold: #b07f2c;
  --gold-soft: rgba(176, 127, 44, 0.16);
  --gold-text: #7d5617;
  --flame-a: #f4a73b;
  --flame-b: #bd3f14;
  --ok: #466e3d;

  /* verse highlighter */
  --hl-yellow: rgba(238, 190, 48, 0.45);
  --hl-green: rgba(122, 186, 112, 0.42);
  --hl-blue: rgba(100, 155, 220, 0.38);
  --hl-pink: rgba(226, 118, 152, 0.36);

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 1px 2px rgba(70, 45, 15, 0.08), 0 14px 30px -18px rgba(70, 45, 15, 0.32);
  --shadow-pop: 0 2px 4px rgba(40, 25, 8, 0.12), 0 24px 48px -12px rgba(40, 25, 8, 0.42);
  --grain-opacity: 0.55;

  /* type */
  --f-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-text: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --f-ui: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* geometry */
  --gutter: 22px;
  --tab-h: 58px;
  --bar-h: 50px;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
  --r-xl: 30px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-soft: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 0.16s;
  --t-med: 0.32s;
  --t-slow: 0.55s;

  --reader-size: 20px;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.0478, 0.1657, 0.3204, 0.4862, 0.6446, 0.7838, 0.8975, 0.9837, 1.0435, 1.0801, 1.0977, 1.1009, 1.0939, 1.0808, 1.0647, 1.0479, 1.0323, 1.0188, 1.008, 0.9999, 0.9945, 0.9913, 0.9899, 0.9899, 0.9908, 0.9922, 0.9939, 0.9956, 0.9971, 0.9984, 0.9994, 1.0002, 1.0007, 1.0009, 1.001, 1.001, 1.0009, 1.0007, 1.0006);
    --spring-soft: linear(0, 0.0417, 0.1448, 0.2811, 0.4293, 0.5737, 0.7044, 0.8156, 0.9049, 0.9726, 1.0203, 1.0508, 1.0675, 1.0734, 1.0716, 1.0648, 1.0552, 1.0444, 1.0336, 1.0237, 1.0152, 1.0083, 1.003, 0.9992, 0.9967, 0.9952, 0.9946, 0.9947, 0.9951, 0.9958, 0.9966, 0.9974, 0.9981, 0.9988, 0.9993, 0.9997, 1, 1.0002, 1.0003, 1.0004);
  }
}

/* ── Dark: a candle-lit page ─────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #14100b;
    --paper-sunk: #0e0b07;
    --card: #1d1710;
    --card-2: #231b13;
    --glass: rgba(20, 16, 11, 0.82);
    --scrim: rgba(4, 2, 0, 0.64);
    --ink: #f2e9d4;
    --ink-2: #d0c4aa;
    --ink-3: #9c907a;
    --on-ink: #1a130c;
    --rule: rgba(242, 233, 212, 0.11);
    --rule-strong: rgba(242, 233, 212, 0.24);
    --rubric: #ee8f6f;
    --rubric-soft: rgba(238, 143, 111, 0.13);
    --gold: #d9b263;
    --gold-soft: rgba(217, 178, 99, 0.16);
    --gold-text: #e2be75;
    --flame-a: #ffc65f;
    --flame-b: #f0642b;
    --ok: #86b97a;
    --hl-yellow: rgba(236, 190, 60, 0.3);
    --hl-green: rgba(122, 186, 112, 0.28);
    --hl-blue: rgba(100, 155, 220, 0.3);
    --hl-pink: rgba(226, 118, 152, 0.3);
    --shadow-card: 0 1px 0 rgba(255, 240, 210, 0.05) inset, 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 32px -16px rgba(0, 0, 0, 0.7);
    --shadow-pop: 0 2px 4px rgba(0, 0, 0, 0.4), 0 28px 54px -12px rgba(0, 0, 0, 0.8);
    --grain-opacity: 0.4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14100b;
  --paper-sunk: #0e0b07;
  --card: #1d1710;
  --card-2: #231b13;
  --glass: rgba(20, 16, 11, 0.82);
  --scrim: rgba(4, 2, 0, 0.64);
  --ink: #f2e9d4;
  --ink-2: #d0c4aa;
  --ink-3: #9c907a;
  --on-ink: #1a130c;
  --rule: rgba(242, 233, 212, 0.11);
  --rule-strong: rgba(242, 233, 212, 0.24);
  --rubric: #ee8f6f;
  --rubric-soft: rgba(238, 143, 111, 0.13);
  --gold: #d9b263;
  --gold-soft: rgba(217, 178, 99, 0.16);
  --gold-text: #e2be75;
  --flame-a: #ffc65f;
  --flame-b: #f0642b;
  --ok: #86b97a;
  --hl-yellow: rgba(236, 190, 60, 0.3);
  --hl-green: rgba(122, 186, 112, 0.28);
  --hl-blue: rgba(100, 155, 220, 0.3);
  --hl-pink: rgba(226, 118, 152, 0.3);
  --shadow-card: 0 1px 0 rgba(255, 240, 210, 0.05) inset, 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 32px -16px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 2px 4px rgba(0, 0, 0, 0.4), 0 28px 54px -12px rgba(0, 0, 0, 0.8);
  --grain-opacity: 0.4;
}

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
  scroll-padding-top: calc(var(--bar-h) + var(--sat) + 12px);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  -webkit-touch-callout: none;
}
/* paper grain, a whisper — fixed, static, cheap */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 400; pointer-events: none;
  background: url("/img/grain.svg") 0 0 / 180px 180px;
  opacity: var(--grain-opacity);
}
h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--gold-soft); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico--s { width: 18px; height: 18px; }
.ico--l { width: 26px; height: 26px; }

/* ── Type roles ──────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--f-ui); font-size: 11px; font-weight: 650; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--rubric); line-height: 1.2;
}
.eyebrow--quiet { color: var(--ink-3); }
.title-xl { font-family: var(--f-display); font-size: 40px; line-height: 1.02; font-weight: 560; letter-spacing: -0.022em; font-variation-settings: "opsz" 96; }
.title-l { font-family: var(--f-display); font-size: 26px; line-height: 1.12; font-weight: 560; letter-spacing: -0.015em; }
.title-m { font-family: var(--f-display); font-size: 20px; line-height: 1.2; font-weight: 560; letter-spacing: -0.01em; }
.lede { font-family: var(--f-text); font-size: 18px; line-height: 1.5; color: var(--ink-2); }
.note { font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }
.serif-i { font-family: var(--f-text); font-style: italic; }
.num { font-variant-numeric: tabular-nums lining-nums; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font-size: 15.5px; font-weight: 600; letter-spacing: 0.005em; white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 0.5s var(--spring), background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), opacity var(--t-fast), box-shadow var(--t-med);
}
.btn:active { transform: scale(0.96); transition-duration: 0.08s; }
.btn[disabled], .btn.is-busy { opacity: 0.5; pointer-events: none; }
.btn--primary { background: var(--ink); color: var(--on-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 10px 22px -12px rgba(35, 27, 19, 0.7); }
.btn--rubric { background: var(--rubric); color: #fff8ee; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 12px 24px -12px var(--rubric); }
:root[data-theme="dark"] .btn--rubric { color: #2a1006; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--rubric { color: #2a1006; } }
.btn--soft { background: var(--paper-sunk); color: var(--ink); }
.btn--ghost { border-color: var(--rule-strong); color: var(--ink); }
.btn--danger { color: var(--rubric); border-color: color-mix(in srgb, var(--rubric) 38%, transparent); }
.btn--sm { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn--lg { min-height: 56px; padding: 0 28px; font-size: 16.5px; }
.btn--block { width: 100%; }
.btn .ico { width: 20px; height: 20px; }
.btn .spin { display: none; }
.btn.is-busy .spin { display: block; }
.btn.is-busy .btn__label { opacity: 0.0; position: absolute; }
.link {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 0; min-height: 44px;
  font-size: 14.5px; font-weight: 600; color: var(--ink-2); transition: color var(--t-fast), transform .4s var(--spring);
}
.link:active { transform: scale(0.96); }
.link--rubric { color: var(--rubric); }
.link .ico { width: 17px; height: 17px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: var(--ink-2); transition: transform 0.5s var(--spring), background-color var(--t-fast), color var(--t-fast);
}
.icon-btn:active { transform: scale(0.88); background: var(--rubric-soft); transition-duration: 0.08s; }
@media (hover: hover) {
  .btn--ghost:hover { background: var(--rubric-soft); }
  .btn--soft:hover { background: color-mix(in srgb, var(--paper-sunk) 80%, var(--ink) 8%); }
  .link:hover { color: var(--ink); }
  .icon-btn:hover { background: var(--rubric-soft); }
}
.spin {
  position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Segmented control (sliding thumb) ───────────────────────────────── */
.seg {
  --n: 2; --i: 0;
  position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr);
  background: var(--paper-sunk); border-radius: 14px; padding: 3px; isolation: isolate;
}
.seg::before {
  content: ""; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 6px) / var(--n)); border-radius: 11px;
  background: var(--card); box-shadow: 0 1px 1px rgba(40, 25, 8, 0.12), 0 4px 10px -4px rgba(40, 25, 8, 0.3);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 0.55s var(--spring-soft);
}
:root[data-theme="dark"] .seg::before { background: var(--card-2); box-shadow: 0 1px 0 rgba(255, 240, 210, 0.07) inset, 0 4px 10px -4px rgba(0, 0, 0, 0.6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg::before { background: var(--card-2); box-shadow: 0 1px 0 rgba(255, 240, 210, 0.07) inset, 0 4px 10px -4px rgba(0, 0, 0, 0.6); } }
.seg__btn { height: 38px; font-size: 14px; font-weight: 600; color: var(--ink-3); border-radius: 11px; transition: color var(--t-med); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg__btn[aria-selected="true"] { color: var(--ink); }
.seg__count { font-size: 11.5px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: var(--rubric-soft); color: var(--rubric); }

/* ── Chips ───────────────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips--scroll { scroll-padding: 0 var(--gutter); flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter); scrollbar-width: none; scroll-snap-type: x proximity; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 38px; padding: 0 16px; border-radius: 999px; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--rule-strong); color: var(--ink-2); font-size: 14px; font-weight: 550;
  transition: transform 0.5s var(--spring), background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip:active { transform: scale(0.94); transition-duration: 0.08s; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip .ico { width: 16px; height: 16px; }

/* ── Fields ──────────────────────────────────────────────────────────── */
.field { display: block; position: relative; }
.field + .field { margin-top: 16px; }
.field__label { display: block; margin-bottom: 8px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid transparent; background: var(--paper-sunk); border-radius: var(--r-m);
  padding: 14px 16px; font-size: 16px; line-height: 1.4; color: var(--ink); outline: none; appearance: none; -webkit-appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-med), background-color var(--t-fast);
  -webkit-user-select: text; user-select: text;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 0.7; }
.input:focus, .textarea:focus, .select:focus { border-color: color-mix(in srgb, var(--rubric) 70%, transparent); box-shadow: 0 0 0 4px var(--rubric-soft); background: var(--card); }
.textarea { resize: none; min-height: 112px; font-family: var(--f-text); font-size: 18px; line-height: 1.55; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 52px; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-wrap .icon-btn:active { transform: translateY(-50%) scale(0.88); }
.field-error { color: var(--rubric); font-size: 14px; font-weight: 550; display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; animation: errIn 0.5s var(--spring) both; }
@keyframes errIn { from { opacity: 0; transform: translateY(-6px); } }
.shake { animation: shake 0.46s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); } }

/* ── Ornaments ───────────────────────────────────────────────────────── */
.fleuron { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.fleuron::before, .fleuron::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--rule-strong)); }
.fleuron::after { transform: scaleX(-1); }
.fleuron svg { width: 18px; height: 18px; fill: currentColor; }
.hairline { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* ── App chrome: top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; padding-top: var(--sat);
  transition: background-color var(--t-med), box-shadow var(--t-med), backdrop-filter var(--t-med);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rule); opacity: 0; transition: opacity var(--t-med); }
.topbar.is-stuck { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); }
.topbar.is-stuck::after { opacity: 1; }
.topbar__row { position: relative; height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 calc(var(--gutter) - 8px) 0 var(--gutter); }
.topbar__mark { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.topbar__mark svg { width: 26px; height: 26px; }
.topbar__title {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, calc(-50% + 8px)); opacity: 0; pointer-events: none;
  font-family: var(--f-display); font-weight: 580; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap;
  transition: opacity var(--t-med), transform 0.5s var(--ease-out);
}
.topbar.is-stuck .topbar__title { opacity: 1; transform: translate(-50%, -50%); }
.topbar__end { display: flex; align-items: center; gap: 2px; }
.me-btn {
  width: 34px; height: 34px; border-radius: 50%; margin-right: 8px; display: grid; place-items: center;
  font-family: var(--f-display); font-size: 15px; font-weight: 600; color: var(--on-ink); background: var(--ink);
  transition: transform 0.5s var(--spring);
}
.me-btn:active { transform: scale(0.9); }
.net-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 99px; margin-right: 8px;
  font-size: 12px; font-weight: 600; color: var(--gold-text); background: var(--gold-soft);
  animation: pillIn 0.6s var(--spring) both;
}
.net-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: breathe 2.2s ease-in-out infinite; }
@keyframes pillIn { from { opacity: 0; transform: scale(0.8); } }
@keyframes breathe { 50% { opacity: 0.35; transform: scale(0.8); } }

/* ── Tab bar ─────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding-bottom: var(--sab); padding-left: var(--sal); padding-right: var(--sar);
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  transition: transform 0.45s var(--ease-ios);
}
.tabbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--rule); }
.tabbar__row { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tab-h); max-width: 640px; margin: 0 auto; }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); transition: color var(--t-med);
}
.tab svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.tab .f { fill: var(--rubric); stroke: none; opacity: 0; transition: opacity var(--t-med); }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] .f { opacity: 0.3; }
.tab[aria-current="page"] svg { animation: tabPop 0.6s var(--spring); }
.tab:active svg { transform: scale(0.88); transition: transform 0.08s; }
@keyframes tabPop { 0% { transform: scale(0.82) translateY(2px); } 100% { transform: none; } }
.tab__ind { position: absolute; top: -1px; left: 0; width: 20%; height: 3px; transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.55s var(--spring-soft); pointer-events: none; }
.tab__ind::after { content: ""; position: absolute; left: 50%; top: 0; width: 30px; height: 3px; margin-left: -15px; border-radius: 0 0 4px 4px; background: var(--rubric); }
body.kb-open .tabbar { transform: translateY(110%); }

/* ── Screen scaffolding ──────────────────────────────────────────────── */
#main { max-width: 640px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--tab-h) + var(--sab) + 56px); transition: transform 0.5s var(--ease-ios), opacity 0.4s; padding-left: max(var(--gutter), var(--sal)); padding-right: max(var(--gutter), var(--sar)); }
body.has-page #main { transform: translateX(-16%); opacity: 0.5; }
.view { display: none; }
.view.is-active { display: block; }
.view.enter > * { animation: rise 0.7s var(--ease-out) both; }
.view.enter > *:nth-child(2) { animation-delay: 0.05s; }
.view.enter > *:nth-child(3) { animation-delay: 0.1s; }
.view.enter > *:nth-child(4) { animation-delay: 0.15s; }
.view.enter > *:nth-child(5) { animation-delay: 0.2s; }
.view.enter > *:nth-child(6) { animation-delay: 0.25s; }
.view.enter > *:nth-child(n+7) { animation-delay: 0.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.screen-head { padding: 6px 0 22px; }
.screen-head .eyebrow { margin-bottom: 10px; }
.screen-head .lede { margin-top: 12px; max-width: 34ch; }
.empty {
  display: grid; justify-items: center; gap: 14px; text-align: center; padding: 38px 20px 30px; color: var(--ink-3);
  font-family: var(--f-text); font-style: italic; font-size: 17px; line-height: 1.5;
}
.empty svg { width: 44px; height: 44px; color: var(--gold); opacity: 0.8; stroke-width: 1.3; }
.empty .btn { font-style: normal; font-family: var(--f-ui); }

/* skeleton shimmer */
.skel { display: block; height: 1em; border-radius: 6px; background: linear-gradient(100deg, var(--paper-sunk) 30%, color-mix(in srgb, var(--paper-sunk) 55%, var(--card)) 50%, var(--paper-sunk) 70%) 0 0 / 220% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -120% 0; } }

/* ── Bottom sheets ───────────────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 0.4s var(--ease-out); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet.is-open .sheet__backdrop { opacity: 1; }
.sheet__panel {
  position: relative; width: 100%; max-width: 600px; max-height: min(92dvh, 920px); display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-pop);
  transform: translateY(104%); transition: transform 0.55s var(--ease-ios); will-change: transform;
  padding-bottom: var(--sab);
}
.sheet.is-open .sheet__panel { transform: translateY(0); }
.sheet.is-dragging .sheet__panel, .sheet.is-dragging .sheet__backdrop { transition: none; }
.sheet__grab { flex: none; display: grid; place-items: center; height: 26px; touch-action: none; cursor: grab; }
.sheet__grab::after { content: ""; width: 38px; height: 4.5px; border-radius: 4px; background: var(--rule-strong); }
.sheet__head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 12px 10px var(--gutter); touch-action: none; }
.sheet__title { font-family: var(--f-display); font-size: 22px; font-weight: 560; letter-spacing: -0.015em; line-height: 1.15; }
.sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px var(--gutter) 26px; }
.sheet__foot { flex: none; padding: 12px var(--gutter) 14px; display: flex; gap: 10px; border-top: 1px solid var(--rule); }
.sheet__foot .btn { flex: 1; }
.sheet--tall .sheet__panel { height: min(92dvh, 920px); }

/* confirm */
.confirm__msg { font-family: var(--f-text); font-size: 18px; line-height: 1.5; color: var(--ink-2); padding: 2px 0 6px; }

/* menu rows inside sheets */
.menu { margin: 0 calc(var(--gutter) * -1); }
.menu__row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 8px var(--gutter); text-align: left;
  font-size: 16.5px; font-weight: 550; transition: background-color var(--t-fast);
}
.menu__row + .menu__row { box-shadow: 0 -1px 0 var(--rule) inset; }
.menu__row:active { background: var(--rubric-soft); }
.menu__row .ico { color: var(--ink-3); }
.menu__row small { display: block; font-size: 13px; font-weight: 450; color: var(--ink-3); margin-top: 1px; }
.menu__row--danger { color: var(--rubric); }
.menu__row--danger .ico { color: var(--rubric); }
.menu__grow { flex: 1; min-width: 0; }

/* ── Pushed pages ────────────────────────────────────────────────────── */
.page-veil { position: fixed; inset: 0; z-index: 59; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.45s var(--ease-ios); }
.page-veil.on { opacity: 0.55; }
.page {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--paper);
  transform: translateX(104%); transition: transform 0.5s var(--ease-ios); will-change: transform;
  box-shadow: -24px 0 48px -24px rgba(20, 10, 0, 0.5);
}
.page.is-open { transform: none; }
.page.is-dragging { transition: none; }
.page__bar { flex: none; position: relative; z-index: 2; padding-top: var(--sat); background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); }
.page__bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rule); opacity: 0; transition: opacity var(--t-med); }
.page.is-scrolled .page__bar::after { opacity: 1; }
.page__row { height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.page__back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 12px 0 4px; font-size: 16px; font-weight: 550; color: var(--rubric); }
.page__back .ico { width: 24px; height: 24px; stroke-width: 2; }
.page__back:active { opacity: 0.5; }
.page__scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.page__content { max-width: 640px; margin: 0 auto; padding: 8px var(--gutter) calc(var(--sab) + 56px); }

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--sab) + 16px); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: 100%;
  min-height: 46px; padding: 11px 20px; border-radius: 999px; background: var(--ink); color: var(--on-ink);
  font-size: 14.5px; font-weight: 550; line-height: 1.3; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(22px) scale(0.92); transition: opacity 0.3s, transform 0.6s var(--spring);
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(10px) scale(0.96); transition: opacity 0.25s, transform 0.3s var(--ease-io); }
.toast__act { font-weight: 700; color: var(--flame-a); padding: 6px 2px; }
:root:not([data-theme="dark"]) .toast__act { color: #f6c36a; }
.toast .ico { width: 18px; height: 18px; color: var(--flame-a); }

/* ── Splash ──────────────────────────────────────────────────────────── */
#splash { position: fixed; inset: 0; z-index: 500; background: var(--paper); display: grid; place-items: center; transition: opacity 0.6s var(--ease-io), transform 0.8s var(--ease-io); }
#splash.gone { opacity: 0; transform: scale(1.04); pointer-events: none; }
.splash__box { display: grid; justify-items: center; gap: 22px; margin-top: -4vh; }
.splash__mark { width: 92px; height: 92px; }
.splash__mark .arch { stroke-dasharray: 520; stroke-dashoffset: 520; animation: draw 1.4s 0.1s var(--ease-io) forwards; }
.splash__mark .sun { transform-origin: 50% 66%; animation: sunrise 1.1s 0.5s var(--ease-out) both; }
.splash__mark .ray { opacity: 0; animation: fadeIn 0.6s 1.0s ease forwards; }
.splash__word { font-family: var(--f-display); font-size: 26px; font-weight: 560; letter-spacing: -0.01em; opacity: 0; animation: fadeUp 0.8s 0.7s var(--ease-out) forwards; }
.splash__word i { font-style: italic; font-weight: 400; color: var(--rubric); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes sunrise { from { transform: translateY(26px) scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
