/* دعاء — one calm page: warm paper, deep green ink, a little gold.
   Arabic first, right to left, phone first; the words of a du'a in Amiri,
   everything around them in IBM Plex Sans Arabic. */

:root {
  --paper: #F6F1E6;
  --card: #FFFDF8;
  --sunk: #EFE8D9;
  --ink: #1D2A24;
  --ink-2: #4E5A54;
  --muted: #6E7872;
  --line: #E2D9C6;
  --green: #1F5C4A;
  --green-2: #2D7A62;
  --green-soft: #E3EFE8;
  --gold: #A87A2C;
  --gold-soft: #F5E9CE;
  --blue: #2C5D8A;
  --blue-soft: #E2ECF6;
  --amber: #8A5A00;
  --amber-soft: #FBEBC8;
  --slate: #56606A;
  --slate-soft: #E8EBEE;
  --red: #A33A2B;
  --red-soft: #F8E1DC;
  --ins: #D9EFD8;
  --del: #F6D9D3;
  --shadow: 0 1px 2px rgba(29, 42, 36, .06), 0 4px 16px rgba(29, 42, 36, .06);
  --radius: 16px;
  --ui: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --words: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", "Times New Roman", serif;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121715;
    --card: #1A211E;
    --sunk: #151B18;
    --ink: #ECE7DB;
    --ink-2: #C4C9C1;
    --muted: #98A29C;
    --line: #2C3632;
    --green: #6CC3A0;
    --green-2: #86D3B3;
    --green-soft: #1F3329;
    --gold: #E0B866;
    --gold-soft: #3A3020;
    --blue: #8DB7E2;
    --blue-soft: #1E2B38;
    --amber: #F0C060;
    --amber-soft: #3A2E14;
    --slate: #B4BCC4;
    --slate-soft: #262C31;
    --red: #F08B7A;
    --red-soft: #3B1F1A;
    --ins: #1F3D2A;
    --del: #45231E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* The hidden attribute always wins. Classes below set `display`, and a class
   outranks the browser's own [hidden] rule — so without this, hiding
   something in script would quietly do nothing (new-app skill). */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 var(--ui);
  overscroll-behavior-y: none;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--green); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
bdi { unicode-bidi: isolate; }

.banner {
  background: var(--gold-soft);
  color: var(--ink);
  text-align: center;
  font-size: 14px;
  padding: 8px 16px;
}

/* ---------------- top bar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--green);
  color: #E9C77B;
}
.brand-word { font: 400 28px/1 var(--words); padding-top: 4px; }
.page-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.page-title:focus { outline: none; }

/* ---------------- layout ---------------- */

.view {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  outline: none;
}
.loading { color: var(--muted); text-align: center; padding: 48px 0; }
.lead { color: var(--ink-2); margin: 4px 0 16px; }
.lead a, .sugg-head a, .people a { display: inline-flex; align-items: center; min-height: 44px; }
.muted { color: var(--muted); }
.count { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.note-line { background: var(--gold-soft); padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.note-line a { display: inline-flex; align-items: center; min-height: 44px; }

.block { margin: 28px 0 0; }
.block-head { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
.block-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.block-head-row .block-head { margin: 0; }
.more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  background: none;
  border: 0;
  color: var(--green);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.group-head { font-size: 14px; color: var(--muted); font-weight: 500; margin: 18px 0 8px; }
.mini-head { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.eyebrow { font-size: 13px; letter-spacing: 0; color: var(--gold); font-weight: 700; margin: 0 0 8px; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0F1A15; } }
.btn.ghost { background: transparent; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--red); border-color: var(--red-soft); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  border-top-color: transparent;
  animation: spin .8s linear infinite;
}
.btn.ghost.busy::after { border-color: var(--green); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn.txt { font-weight: 700; font-size: 15px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 6px;
  background: none;
  border: 0;
  color: var(--green);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.link-btn.danger-soft { color: var(--red); }

/* ---------------- chips ---------------- */

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
}
.chip.strong { background: var(--green-soft); border-color: transparent; color: var(--green); font-weight: 700; }
.chip.tag { color: var(--green); }
.chip.small { min-height: 44px; font-size: 14px; padding: 0 12px; }
.chip.static { cursor: default; min-height: 32px; background: var(--sunk); border-color: transparent; color: var(--ink-2); }
.chip.toggle[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.toggle[aria-pressed="true"] { color: #0F1A15; } }

/* ---------------- search ---------------- */

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0 6px;
}
.search:focus-within { border-color: var(--green-2); }
.search-icon { display: grid; place-items: center; width: 40px; color: var(--muted); }
.search .search-input {
  flex: 1;
  width: auto;
  min-width: 0;
  min-height: 56px;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 17px;
  outline: none;
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-results { margin-top: 12px; }

/* ---------------- home ---------------- */

.today { margin-top: 20px; }
.today-card {
  display: block;
  padding: 18px 18px 14px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--green) 0%, #174838 100%);
  color: #F7F1E3;
  text-decoration: none;
  box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) { .today-card { background: linear-gradient(160deg, #1F4A3B 0%, #15302A 100%); } }
.today-text {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 2;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.today-ref { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #E9C77B; }
.today-ref .kind { background: rgba(255, 255, 255, .14); color: #F7F1E3; }

.kind-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.kind-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 72px;
  padding: 10px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--card);
}
.kind-tile b { font-size: 16px; }
.kind-tile span { font-size: 13px; color: var(--muted); }
.kind-tile.kind-quran { background: var(--green-soft); border-color: transparent; }
.kind-tile.kind-sunnah { background: var(--blue-soft); border-color: transparent; }
.kind-tile.kind-athar { background: var(--amber-soft); border-color: transparent; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.cat-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 68px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}
.cat-tile b { font-size: 15px; line-height: 1.5; }
.cat-tile span { font-size: 13px; color: var(--muted); }
.cat-tile.empty-cat { background: transparent; border-style: dashed; }
.invite { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; }
.invite p { margin: 0 0 12px; color: var(--ink-2); }
.foot { margin: 36px 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; font-size: 14px; color: var(--muted); }
.foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }

/* ---------------- lists ---------------- */

.dua-list { display: grid; gap: 10px; }
.dua-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dua-link { flex: 1; min-width: 0; display: block; padding: 14px 16px 12px; color: inherit; text-decoration: none; }
.dua-card-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; line-height: 1.6; }
.dua-card-text {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.95;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dua-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.dua-card .fav { margin: 6px 0 0 6px; color: var(--muted); }
.fav.on, .act.on { color: var(--gold); }
.times { font-size: 13px; color: var(--gold); font-weight: 500; }

.kind {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.8;
}
.kind-quran { background: var(--green-soft); color: var(--green); }
.kind-sunnah { background: var(--blue-soft); color: var(--blue); }
.kind-athar { background: var(--amber-soft); color: var(--amber); }
.kind-general { background: var(--slate-soft); color: var(--slate); }
.kind.weak, .grade.weak { background: var(--amber-soft); color: var(--amber); }
.grade { font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); }
.ref { font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 32px 8px; color: var(--ink-2); }
.empty p { margin: 0 0 16px; }

/* ---------------- one du'a ---------------- */

.dua-words { font-family: var(--words); font-weight: 400; }
.dua-head { margin: 4px 0 14px; }
.dua-title { font-size: 21px; line-height: 1.55; margin: 0 0 8px; }
.dua-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.words-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px 20px 52px;
}
.big {
  --size: 26px;
  margin: 0;
  font-size: var(--size);
  line-height: 2.15;
  text-align: start;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.orn { color: var(--gold); padding: 0 2px; }
.size-tools { position: absolute; left: 8px; bottom: 4px; display: flex; gap: 2px; }
.counter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 0; }
.counter {
  min-width: 132px;
  min-height: 56px;
  border-radius: 16px;
  border: 2px solid var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.counter.done { background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .counter.done { color: #0F1A15; } }
.note { margin: 16px 0 0; padding: 14px 16px; background: var(--sunk); border-radius: 14px; }
.note-text { margin: 0; white-space: pre-line; }
.acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 0; }
.act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 6px 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
}
.acts.quiet { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.people { margin: 20px 0 0; font-size: 14px; color: var(--ink-2); }
.people p { margin: 2px 0; }
.who { font-weight: 700; color: var(--ink); }
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--gold-soft);
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}
.notice p { margin: 0; }
.notice.link { font-weight: 700; }
.warn { background: var(--amber-soft); color: var(--ink); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.warn.small { font-size: 13px; padding: 6px 10px; margin: 6px 0; }
.ok-line { background: var(--green-soft); border-radius: 12px; padding: 10px 14px; }
.more-acts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 18px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.report-box, .discard-box { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 8px 0; }
.report-box textarea { margin: 8px 0; }
.confirm { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.confirm p { width: 100%; margin: 0 0 4px; }

.history { margin: 20px 0 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.history summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}
.history summary::-webkit-details-marker { display: none; }
.history-list { list-style: none; margin: 0; padding: 0 14px 10px; }
.history-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.h-line { margin: 0 0 6px; font-size: 14px; }

/* ---------------- diffs ---------------- */

.diff { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--sunk); }
.diff-head { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.diff-words { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-words.dua-words { font-size: 20px; line-height: 2.05; }
.diff-short { margin: 0; }
ins { background: var(--ins); text-decoration: none; border-radius: 4px; padding: 0 2px; }
del { background: var(--del); text-decoration: line-through; text-decoration-thickness: 1.5px; border-radius: 4px; padding: 0 2px; }
.diac { border-bottom: 2px dotted var(--gold); }
.diac del, .diac ins { font-size: 1.15em; }
.diac-note { margin: 0 0 4px; font-size: 13px; color: var(--gold); font-weight: 700; }
.arrow { color: var(--muted); }

/* ---------------- forms ---------------- */

.dua-form, .enter-form { display: grid; gap: 4px; }
.enter-form { margin-top: 14px; }
.field { margin: 10px 0 6px; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: 15px; margin: 0 0 6px; }
input[type="text"], input[type="search"], input[type="password"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 16px;
}
textarea { resize: vertical; line-height: 1.8; }
textarea.dua-words { font-size: 21px; line-height: 2; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); outline: none; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.hint a { display: inline-flex; align-items: center; min-height: 44px; }
.field-error, .form-error { margin: 6px 0 0; color: var(--red); font-size: 14px; font-weight: 500; }
.form-error { background: var(--red-soft); padding: 10px 14px; border-radius: 12px; }
.form-error a { display: inline-flex; align-items: center; min-height: 44px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}
.seg-btn[aria-checked="true"], .seg-btn[aria-selected="true"] { background: var(--green); border-color: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .seg-btn[aria-checked="true"], .seg-btn[aria-selected="true"] { color: #0F1A15; } }
.seg.tabs { margin: 0 0 14px; }
.pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-inline-start: 6px; border-radius: 999px; background: var(--gold); color: #fff; font-size: 12px; }
.ayat-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.num { text-align: center; }
.stepper { display: flex; align-items: center; gap: 8px; max-width: 220px; }
.stepper .icon-btn { border: 1.5px solid var(--line); background: var(--card); font-size: 22px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-left: 52px; }
.pass-wrap .eye { position: absolute; left: 2px; top: 2px; }
.preview { margin: 12px 0 4px; }
.like { color: var(--gold); }
#submitBtn { margin-top: 12px; }
.decide-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.message { margin: 10px 0; padding: 10px 14px; border-inline-start: 3px solid var(--gold); background: var(--card); border-radius: 8px; white-space: pre-line; }
.recovery {
  font: 700 22px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em;
  text-align: center;
  padding: 18px 10px;
  border-radius: 14px;
  background: var(--card);
  border: 2px dashed var(--gold);
  user-select: all;
  overflow-wrap: anywhere;
}

/* ---------------- inbox ---------------- */

.sugg-list { display: grid; gap: 10px; }
.sugg-card {
  display: block;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.sugg-card.fresh { border-color: var(--gold); }
.sugg-card p { margin: 2px 0; }
.sugg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.status { flex: none; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); }
.st-pending { background: var(--gold-soft); color: var(--gold); }
.st-accepted { background: var(--green-soft); color: var(--green); }
.st-discarded, .st-closed { background: var(--slate-soft); color: var(--slate); }
.reasons, .reply { font-size: 14px; color: var(--ink-2); }
.report-card { padding: 12px 16px; margin: 8px 0; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.plain { margin: 6px 0; padding-inline-start: 18px; }
.profile .hello { font-size: 20px; margin: 4px 0 8px; }
.settings .btn { margin-top: 4px; }

/* ---------------- about ---------------- */

.about-sec { margin: 0 0 22px; }
.about-sec p, .about-sec li { color: var(--ink-2); }
.about-sec a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------------- bottom bar ---------------- */

.tabbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 680px;
  margin: 0 auto;
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-top: 1px solid var(--line);
}
@media (min-width: 680px) { .tabbar { border-inline: 1px solid var(--line); border-radius: 18px 18px 0 0; } }
.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 56px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
}
.tabbar a.on { color: var(--green); }
.tabbar a.on span { font-weight: 700; }
.tab-new svg { background: var(--green); color: #fff; border-radius: 12px; padding: 4px; width: 34px; height: 34px; }
@media (prefers-color-scheme: dark) { .tab-new svg { color: #0F1A15; } }
.badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}
/* The keyboard is up: the bar steps aside so it never covers the field. */
body.typing .tabbar { display: none; }

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px);
  z-index: 40;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  font-weight: 500;
  box-shadow: var(--shadow);
}
.noscript { text-align: center; padding: 32px 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
