/* مكتبة الدواوين — الأنماط
   الفكرة: كتاب رقمي هادئ؛ عمود قراءة واحد، زمردي وعاجي وذهبي، زخرفة نجمة ثمانية خفيفة فقط عند الفواصل. */
@font-face { font-family: "Amiri"; src: url(fonts/Amiri-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Amiri"; src: url(fonts/Amiri-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Aref Ruqaa"; src: url(fonts/ArefRuqaa-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Reem Kufi"; src: url(fonts/ReemKufi.woff) format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "El Messiri"; src: url(fonts/ElMessiri.woff) format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Noto Naskh Arabic"; src: url(fonts/NotoNaskhArabic.woff) format("woff"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #f6f0e1;          /* عاجي */
  --paper: #fffbf1;
  --ink: #1f2a25;
  --muted: #66706a;
  --line: #e4dac2;
  --emerald: #0e4d3d;
  --emerald-2: #176650;
  --emerald-soft: #e2ece5;
  --gold: #a9822f;
  --gold-soft: #f2e6c6;
  --on-emerald: #fbf5e4;
  --mark: #f3dd9b;
  --shadow: 0 1px 2px rgb(14 77 61 / 6%), 0 8px 24px -12px rgb(14 77 61 / 18%);
  --verse: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --ui: "Noto Naskh Arabic", "Amiri", "Segoe UI", Tahoma, sans-serif;
  --title: "Aref Ruqaa", "Amiri", serif;           /* عناوين القصائد */
  --kufi: "Reem Kufi", "Noto Naskh Arabic", sans-serif; /* الأقسام */
  --names: "El Messiri", "Noto Naskh Arabic", sans-serif; /* أسماء المشايخ */
  --name: #8a6418;
  --verse-scale: 1;
  --verse-size: calc(1.32rem * var(--verse-scale));
  --radius: 14px;
  --bar-h: 56px;
  --bottom-h: 64px;
  color-scheme: light;
}
:root[data-mode="light"] { --bg: #ffffff; --paper: #ffffff; --line: #ebe6da; --emerald-soft: #e8f1ec; }
:root[data-mode="night"] {
  --bg: #0f1714; --paper: #15201c; --ink: #e9e3d2; --muted: #a2aca5; --line: #26332d;
  --emerald: #7cc8ab; --emerald-2: #93d6bb; --emerald-soft: #1b2c25; --gold: #d8b866; --gold-soft: #2e2918;
  --on-emerald: #0f1714; --mark: #5a4a1c; --shadow: 0 1px 2px rgb(0 0 0 / 30%); --name: #e0bf72; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]), :root[data-mode="auto"] {
    --bg: #0f1714; --paper: #15201c; --ink: #e9e3d2; --muted: #a2aca5; --line: #26332d;
    --emerald: #7cc8ab; --emerald-2: #93d6bb; --emerald-soft: #1b2c25; --gold: #d8b866; --gold-soft: #2e2918;
    --on-emerald: #0f1714; --mark: #5a4a1c; --shadow: 0 1px 2px rgb(0 0 0 / 30%); --name: #e0bf72; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 16.5px; line-height: 1.8;
  min-height: 100dvh; padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--emerald); text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--emerald); color: var(--on-emerald); padding: 6px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ——— الشريط العلوي ——— */
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 6px; background: var(--emerald); color: var(--on-emerald);
}
:root[data-mode="night"] .topbar { background: #12201b; color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-mode]) .topbar, :root[data-mode="auto"] .topbar { background: #12201b; color: var(--ink); } }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; font-family: var(--verse); font-size: 1.3rem; font-weight: 700; flex: 1; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .star { width: 20px; height: 20px; fill: var(--gold); stroke: none; flex: none; }
:root:not([data-mode="night"]) .topbar .brand .star { fill: #d6b264; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgb(255 255 255 / 10%); }
.topnav { display: none; gap: 4px; }
.topnav a { color: inherit; opacity: .82; padding: 6px 12px; border-radius: 10px; }
.topnav a[aria-current="page"], .topnav a:hover { opacity: 1; background: rgb(255 255 255 / 12%); }

/* ——— الشريط السفلي (الهاتف) ——— */
.bottomnav {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  background: var(--paper); border-top: 1px solid var(--line);
}
.bottomnav a { display: grid; place-items: center; align-content: center; gap: 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.bottomnav a svg { width: 23px; height: 23px; }
.bottomnav a[aria-current="page"] { color: var(--emerald); font-weight: 600; }
.bottomnav a[aria-current="page"] svg { stroke-width: 2.2; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottomnav { display: none; }
  .topnav { display: flex; }
  #search-shortcut { display: none; }
  .brand { flex: 0 1 auto; margin-inline-end: 24px; }
  .topbar { justify-content: flex-start; }
}

/* ——— القائمة الجانبية ——— */
.drawer-scrim { position: fixed; inset: 0; background: rgb(10 20 16 / 45%); z-index: 40; }
.drawer {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 41; width: min(86vw, 340px); background: var(--paper);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  padding-inline-start: max(16px, env(safe-area-inset-right, 0px));
  overflow-y: auto; display: flex; flex-direction: column; gap: 18px; box-shadow: -10px 0 30px rgb(0 0 0 / 18%);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; font-family: var(--verse); font-size: 1.25rem; color: var(--emerald); }
.drawer-nav { display: grid; gap: 2px; }
.drawer-nav a, #drawer-books a { display: flex; align-items: center; gap: 12px; }
.drawer-nav a svg { color: var(--gold); width: 21px; height: 21px; flex: none; }
.emblem { width: .8em; height: .8em; fill: var(--gold); stroke: none; flex: none; display: inline-block; vertical-align: -.05em; margin-inline-end: .4em; }
.emblem .hole { fill: var(--paper); }
#drawer-books .emblem { width: 16px; height: 16px; margin: 0; }
.drawer-nav a, .drawer-sec a { color: var(--ink); padding: 8px 10px; border-radius: 10px; }
.drawer-nav a:hover, .drawer-sec a:hover { background: var(--emerald-soft); }
.drawer-sec { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.drawer-sec h3 { margin: 0; font-size: .85rem; color: var(--muted); font-weight: 600; }
.drawer-foot { margin: auto 0 0; font-size: .75rem; color: var(--muted); }
.setting { display: grid; gap: 6px; }
.seg { display: flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 6px 4px; cursor: pointer; min-height: 38px; }
.seg button[aria-checked="true"] { background: var(--emerald); color: var(--on-emerald); }
.seg output { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }

/* ——— عام ——— */
main { outline: none; }
.page { max-width: 760px; margin: 0 auto; padding-block: 20px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 22px; }
.page.wide { max-width: 1040px; }
.page > * { min-width: 0; }
h1, h2, h3 { text-wrap: balance; }
.h-display { font-family: var(--verse); font-weight: 700; color: var(--emerald); margin: 0; line-height: 1.4; }
.eyebrow { font-size: .82rem; color: var(--gold); font-weight: 600; letter-spacing: .01em; }
.muted { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 20px; border-radius: 12px; border: 1px solid transparent; background: var(--emerald); color: var(--on-emerald); font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { background: var(--emerald-2); }
.btn.ghost { background: transparent; color: var(--emerald); border-color: var(--line); }
.btn.ghost:hover { background: var(--emerald-soft); }
.btn.wide { width: 100%; }
.btn svg { width: 19px; height: 19px; }
.ornament { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to left, transparent, var(--gold), transparent); opacity: .55; }
.ornament svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty .big { font-family: var(--verse); font-size: 1.3rem; color: var(--ink); }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* ——— المكتبة ——— */
.lib-head { display: grid; gap: 4px; text-align: center; padding-top: 8px; }
.lib-head h1 { font-family: var(--kufi); font-weight: 700; font-size: clamp(2.1rem, 8vw, 3rem); letter-spacing: .01em; }
.continue-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; background: var(--emerald); color: var(--on-emerald); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.continue-card .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgb(255 255 255 / 12%); }
.continue-card .t { font-family: var(--title); font-size: 1.28rem; line-height: 1.5; }
.continue-card small { opacity: .8; display: block; }
.continue-card .btn { grid-column: 1 / -1; background: var(--on-emerald); color: var(--emerald); }
:root[data-mode="night"] .continue-card .btn { color: #0f1714; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 18px; }
.book-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; grid-template-columns: 112px 1fr; box-shadow: var(--shadow); }
.book-card .cover { background: var(--emerald-soft); aspect-ratio: 905 / 1280; height: 100%; }
.book-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card .body { padding: 14px 14px 14px 12px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.book-card h2 { font-family: var(--title); font-size: 1.22rem; line-height: 1.5; margin: 0; color: var(--ink); }
.book-card .meta { font-size: .85rem; color: var(--muted); }
.book-card .btn { justify-self: start; min-height: 42px; padding-inline: 16px; }
@media (min-width: 560px) { .book-card { grid-template-columns: 150px 1fr; } }

/* ——— صفحة الديوان ——— */
.book-hero { display: grid; gap: 18px; align-items: start; }
.book-hero .cover { width: min(64%, 240px); justify-self: center; border-radius: 10px; overflow: hidden; box-shadow: 0 18px 40px -18px rgb(14 77 61 / 45%); }
.book-hero h1 { font-family: var(--title); font-size: clamp(1.7rem, 6vw, 2.4rem); line-height: 1.7; text-align: center; }
.book-hero .summary { text-align: center; color: var(--muted); max-width: 60ch; margin: 0 auto; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
@media (min-width: 720px) {
  .book-hero { grid-template-columns: 220px 1fr; gap: 28px; }
  .book-hero .cover { width: 100%; }
  .book-hero h1, .book-hero .summary { text-align: start; margin: 0; }
  .actions { justify-content: flex-start; }
}
.sheikhs { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.sheikhs li { font-family: var(--names); font-weight: 600; color: var(--name); font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 0 8px; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.sheikhs li span { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.panel h2 { font-size: 1.05rem; margin: 0; color: var(--emerald); }

/* ——— الفهرس ——— */
.toc { display: grid; gap: 14px; }
.toc-sec { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.toc-sec > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 14px 16px; }
.toc-sec > summary::-webkit-details-marker { display: none; }
.toc-sec > summary h2 { margin: 0; font-family: var(--kufi); font-weight: 700; font-size: 1.55rem; color: var(--emerald); line-height: 1.5; letter-spacing: .01em; }
.toc-sec > summary .count { font-size: .82rem; color: var(--muted); grid-column: 1; }
.toc-sec > summary .chev { grid-row: 1 / span 2; grid-column: 2; transition: transform .2s; color: var(--gold); }
.toc-sec[open] > summary .chev { transform: rotate(180deg); }
.sec-about { padding: 0 16px 10px; display: grid; gap: 8px; color: var(--muted); font-size: .95rem; }
.sec-about .quran { font-family: var(--verse); color: var(--ink); font-size: 1.08rem; line-height: 2; text-align: center; }
.toc-group { padding: 0 6px 6px; }
.toc-group h3 { margin: 10px 10px 4px; font-family: var(--names); font-size: 1rem; color: var(--name); font-weight: 600; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list a { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 10px; color: var(--ink); }
.toc-list a:hover { background: var(--emerald-soft); }
.toc-list .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; text-align: center; }
.toc-list .t { font-family: var(--title); font-size: 1.22rem; line-height: 1.8; color: var(--emerald); }
.toc-list .a { display: block; font-family: var(--names); font-size: .85rem; color: var(--name); }
.toc-list .fav { color: #b5483b; font-size: .85rem; }
.toc-list a.current { background: var(--gold-soft); }
.toc-plain { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 6px; }

/* ——— القارئ ——— */
.reader { max-width: 860px; }
.reader-tools { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); z-index: 10; display: flex; align-items: center; gap: 4px; padding: 6px max(8px, env(safe-area-inset-left, 0px)) 6px max(8px, env(safe-area-inset-right, 0px)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.reader-tools .crumb { flex: 1; min-width: 0; font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-tools .crumb a { color: var(--muted); }
.reader-tools .icon-btn { color: var(--emerald); width: 42px; height: 42px; }
.reader-tools .icon-btn:hover { background: var(--emerald-soft); }
.reader-tools .icon-btn[aria-pressed="true"] svg { fill: #c4513f; stroke: #c4513f; }
.poem-head { text-align: center; display: grid; gap: 6px; padding-top: 6px; }
.poem-head .sec { font-family: var(--kufi); font-size: 1.05rem; color: var(--gold); font-weight: 600; letter-spacing: .02em; }
.poem-head h1 { font-family: var(--title); font-weight: 700; color: var(--emerald); font-size: calc(2.05rem * var(--verse-scale)); line-height: 1.75; margin: 0; }
.poem-head h1 .num { font-family: var(--ui); font-size: .55em; color: var(--gold); vertical-align: middle; margin-inline-end: 8px; font-weight: 600; }
.poem-head .by { font-family: var(--names); font-weight: 600; font-size: 1.12rem; color: var(--name); }
.poem-head .by::before, .poem-head .by::after { content: "۞"; color: var(--gold); margin: 0 8px; font-size: .8em; }

.poem { font-family: var(--verse); font-size: calc(var(--verse-size) * var(--fit, 1)); line-height: 2.05; display: grid; gap: 1.1em; padding: 6px 0 10px; }
.poem .blk { display: grid; gap: .5em; }
.poem .row { display: grid; border-radius: 8px; justify-content: center; }
.poem .part { min-width: 0; }
.poem .tx { white-space: nowrap; }
.poem.measuring .part { text-align: start !important; text-align-last: start !important; }
.poem .blk.prose .tx { white-space: normal; }
/* كل شطر على سطر واحد، مضبوط من البداية إلى النهاية بعرض موحّد (--colw يحسبه البرنامج) */
.poem .row.v2 .part, .poem .row.v3 .part { text-align: justify; text-align-last: justify; white-space: nowrap; }
.poem.stack .row.v2, .poem.stack .row.v3 { padding-bottom: .4em; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.poem.stack .part:empty { display: none; }
.poem .row.span { text-align: center; color: var(--emerald); white-space: nowrap; }
.poem .blk.prose .row { text-align: justify; justify-content: stretch; }
.poem .blk.c1:not(.prose) .row { text-align: center; color: var(--emerald); white-space: nowrap; }
.poem .row.hit { background: var(--gold-soft); }
.poem mark, .result mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.poem-notes { font-size: .85rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pager a { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; color: var(--ink); display: grid; gap: 0; min-width: 0; }
.pager a:hover { border-color: var(--gold); }
.pager small { color: var(--muted); font-size: .78rem; }
.pager .t { font-family: var(--title); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager .next { text-align: end; }
.pager .ph { visibility: hidden; }
.reader-foot { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ——— البحث ——— */
.search-box { position: relative; }
.search-box input { width: 100%; font: inherit; font-size: 1.1rem; padding: 12px 46px 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); min-height: 52px; }
.search-box input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.search-box svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-inline-start: 46px; padding-inline-end: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 4px 14px; cursor: pointer; font-size: .9rem; min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--emerald); color: var(--on-emerald); border-color: var(--emerald); }
.results { display: grid; gap: 10px; }
.result { display: grid; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); }
.result:hover { border-color: var(--gold); }
.result .top { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.result .t { font-family: var(--title); font-size: 1.2rem; color: var(--emerald); }
.result .src { font-family: var(--names); font-size: .85rem; color: var(--name); }
.result .snip { font-family: var(--verse); font-size: 1.05rem; line-height: 1.9; }
.result .more { font-size: .8rem; color: var(--gold); }
.result-count { color: var(--muted); font-size: .9rem; }

/* ——— المقدمة ——— */
.intro { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; display: grid; gap: 14px; font-size: 1.04rem; line-height: 2; }
.intro > * { min-width: 0; }
.intro p { margin: 0; text-align: justify; overflow-wrap: anywhere; }
.intro .basmala { text-align: center; font-size: clamp(1.4rem, 7vw, 2rem); overflow: hidden; color: var(--emerald); font-family: var(--verse); }
.intro .verse, .intro .quran { text-align: center; font-family: var(--verse); font-size: 1.15rem; }
.intro ul { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 4px; }
.intro .sign { text-align: end; font-weight: 700; color: var(--emerald); }
.intro .sign + .sign { font-weight: 400; color: var(--muted); }

/* ——— المفضلة ——— */
.fav-list { display: grid; gap: 8px; }
.fav-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 6px 6px; }
.fav-item a { color: var(--ink); padding: 6px 10px; display: grid; min-width: 0; }
.fav-item .t { font-family: var(--title); font-size: 1.18rem; color: var(--emerald); }
.fav-item small { color: var(--muted); }
.fav-item.gone .t { color: var(--muted); text-decoration: line-through; }

/* ——— الإشعار ——— */
.toast { position: fixed; inset-inline: 0; margin: 0 auto; width: fit-content; max-width: calc(100% - 32px); bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px) + 14px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.toast button { background: transparent; border: 1px solid currentColor; border-radius: 8px; color: inherit; padding: 2px 10px; cursor: pointer; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .topbar, .bottomnav, .reader-tools, .pager, .reader-foot { display: none !important; } body { padding: 0; } }
