@font-face { font-family: "Kahroba"; src: url(../fonts/kahroba-vf.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
/* ───────── Fonts ───────── */

/* ───────── Tokens ───────── */
:root {
  --bg: #f5f2e8;
  --surface: #ffffff;
  --surface-2: #ebe8db;
  --ink: #2b2e22;
  --ink-soft: #43473a;
  --muted: #666a56; /* was #7a7e69: small grey text now passes 4.5:1 on the cream page and on the tab strip */
  --line: #e2dfd0;
  --accent: #5f6549;
  --accent-soft: #e6e8dc;
  --gold: #585e4a;
  --shadow: 0 1px 2px rgb(60 66 45 / .06), 0 8px 24px rgb(60 66 45 / .07);

  --ui: "Kahroba", system-ui, sans-serif;
  /* Weights chosen by Navid (2026-11-13) */
  --cntr: 50; /* Kahroba contrast axis (0 low – 100 high); width stays at the standard 100 */
  --fw-brand: 500; --fw-name: 450; --fw-meta: 450; --fw-title: 450; --fw-text: 350; --fw-verse: 390; --fw-cover: 800; --fw-btn: 400; --fw-strong: 450;
  --poem: "Kahroba", serif;
  --verse: "Kahroba", serif;
  --poem-scale: 1;
  --poem-size: calc(1.15rem * var(--poem-scale));

  --radius: 18px;
  --gutter: 20px;
  --bar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --hair: #fff; /* thin dividers between rows */
  color-scheme: light;
}
/* Dark mode (chosen in reading settings): everything dark except the portrait wall itself */
:root[data-theme="dark"] {
  --bg: #1a1c15; --surface: #23261d; --surface-2: #2c2f25;
  --ink: #e9e7dc; --ink-soft: #cfcdc0; --muted: #94977f; --line: #34372b;
  --accent: #b3b996; --accent-soft: #33372a; --gold: #a3a988; --hair: #2e3127;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
  color-scheme: dark;
}
:root[data-theme="dark"] .wall-root { --w-plaster: #2f3526; --w-grout: #262b1f; --w-paper: var(--bg); --w-paper-ink: var(--ink); --w-paper-mid: var(--muted); --w-accent: var(--accent); }
/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 106%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Kahroba contrast on every element (the font shorthand would otherwise reset it); set --cntr anywhere to change it there. */
*, *::before, *::after { font-variation-settings: "CNTR" var(--cntr, 50), "wdth" 100; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font: 350 1rem/1.75 var(--ui); letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; font-weight: var(--fw-strong); line-height: 1.4; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 6px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { inset-inline-start: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── Top bar & navigation ───────── */
/* No bar: only the logo floats at the top (right on phones, centre on desktop); it opens the menu. */
.topbar {
  position: fixed; z-index: 50; right: calc(var(--gutter) - 6px); top: calc(env(safe-area-inset-top, 0px) + 10px);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: var(--fw-strong); font-size: 1.08rem; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: var(--accent); }
.brand-mark svg { width: 26px; height: 26px; }
.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  color: var(--ink-soft); transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.settings-btn { margin-inline-start: auto; }
.icon-btn.on { color: var(--accent); }
.icon-btn.on svg { fill: currentColor; }
/* Close button on book pages: top left, level with the logo. */
/* A black disc the same size as the logo's disc (logo circle = 77% of the logo's width), level with it. */
.page-x { position: fixed; z-index: 50; left: var(--gutter); top: calc(env(safe-area-inset-top, 0px) + 16px);
  width: 36px; height: 36px; background: #000; color: #fff; }
.page-x:hover { background: #000; }
.page-x svg { width: 18px; height: 18px; }
.page-x svg, .pclose svg { stroke-width: 1.8; }
/* While a poem sheet is open, only the sheet's own close button shows. */
body.psheet-open .page-x { opacity: 0; pointer-events: none; }
.page-x { transition: opacity .3s; }
/* Hover hints on icon buttons (mouse only). */
:where([data-tip]) { position: relative; }
@media (hover: hover) {
  [data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; translate: -50% -3px; z-index: 60;
    padding: 3px 10px 5px; border-radius: 8px; background: var(--ink, #2b2e22); color: var(--bg, #f5f2e8);
    font-family: var(--ui, inherit); font-size: .72rem; font-weight: 350; line-height: 1.4; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .15s, translate .15s; }
  [data-tip]:hover::after { opacity: 1; translate: -50% 0; transition-delay: .25s; }
  .tip-l[data-tip]::after, .wp-x[data-tip]::after { left: 0; translate: 0 -3px; }
  .tip-l[data-tip]:hover::after, .wp-x[data-tip]:hover::after { translate: 0 0; }
  .wp-dl[data-tip]::after { left: auto; right: 0; translate: 0 -3px; }
  .wp-dl[data-tip]:hover::after { translate: 0 0; }
}

/* Menu: the logo holds everything */
.menu-btn, .w-menu { display: grid; place-items: center; padding: 6px; background: none; transition: transform .15s, opacity .2s; }
.menu-btn:active, .w-menu:active { transform: scale(.94); }
.menu-btn img, .w-menu img { display: block; width: 46px; height: auto; }
.logo-on-dark { display: none !important; }
:root[data-theme="dark"] .logo-on-light { display: none !important; }
:root[data-theme="dark"] .logo-on-dark { display: block !important; }

main:focus, main:focus-visible, .psheet:focus, .psheet:focus-visible { outline: none; }
main { display: block; padding-top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); padding-bottom: calc(48px + var(--safe-b)); outline: none; }
.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 var(--gutter); }

@media (min-width: 860px) {
  :root { --gutter: 32px; --bar-h: 68px; }
  .topbar { right: auto; left: 50%; translate: -50% 0; top: calc(env(safe-area-inset-top, 0px) + 14px); }
  .menu-btn img { width: 54px; }
  .page-x { width: 42px; height: 42px; top: calc(env(safe-area-inset-top, 0px) + 20px); }
  main { padding-bottom: 80px; }
}

/* ───────── Shared pieces ───────── */
.eyebrow { font-size: .8rem; color: var(--muted); font-weight: var(--fw-strong); }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 1.12rem; }
.link { color: var(--accent); font-weight: var(--fw-strong); font-size: .92rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 999px; font-weight: var(--fw-strong);
  background: var(--accent); color: var(--bg); transition: transform .12s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn svg { width: 20px; height: 20px; }
.muted { color: var(--muted); }
.fadein { animation: fadein .45s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 40%, var(--surface-2) 80%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; }
.sk-verses { width: min(420px, 82%); aspect-ratio: 155 / 132; margin: 56px auto 0; border-radius: 0; -webkit-mask: url(../icons/verses.svg) center / contain no-repeat; mask: url(../icons/verses.svg) center / contain no-repeat; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.sk-line { height: 1.1em; margin: 18px 0; }

.error-box { text-align: center; padding: 64px 12px; color: var(--muted); }
.error-box h2 { color: var(--ink); font-size: 1.1rem; margin-bottom: 8px; }
.error-box .btn { margin-top: 20px; }

/* ───────── Home ───────── */
.hero { padding-top: 22px; }
.hero .date { font-size: .86rem; color: var(--muted); }
.hero h1 { font-size: 1.55rem; margin-top: 2px; }

.today { margin-top: 18px; padding: 26px 22px 20px; position: relative; overflow: hidden; display: block; }
.today::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(120% 70% at 100% 0%, var(--accent-soft), transparent 60%);
}
.today > * { position: relative; }
.today .eyebrow { display: flex; align-items: center; gap: 6px; color: var(--gold); }
.today .eyebrow svg { width: 16px; height: 16px; }
.today .verses { margin: 18px 0 16px; font-size: calc(var(--poem-size) * 1.02); }
.today .foot { display: flex; align-items: center; justify-content: space-between; font-size: .9rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.today .foot b { color: var(--ink); font-weight: var(--fw-strong); }
.today .foot .link { display: inline-flex; align-items: center; gap: 4px; }
.today .foot .link svg { width: 16px; height: 16px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile { display: flex; flex-direction: column; gap: 10px; padding: 18px; text-align: start; }
.tile .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile b { font-weight: var(--fw-strong); font-size: 1rem; }
.tile span { font-size: .8rem; color: var(--muted); line-height: 1.6; }
.tile:active { transform: scale(.98); }

.continue { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.continue .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.continue .t { flex: 1; min-width: 0; }
.continue .t b { display: block; font-weight: var(--fw-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue .t span { font-size: .8rem; color: var(--muted); }

.poet-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px var(--gutter) 10px; margin: 0 calc(var(--gutter) * -1); scrollbar-width: none; }
.poet-strip::-webkit-scrollbar { display: none; }
.poet-chip { scroll-snap-align: start; flex: none; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: .86rem; }
.poet-chip .pl-face { width: 72px; height: 72px; margin: 0; }
.mono {
  display: grid; place-items: center; border-radius: 50%; flex: none;
  font-family: var(--poem); font-weight: var(--fw-strong); line-height: 1;
  background: var(--surface); border: 1px solid var(--line); color: var(--accent);
  box-shadow: var(--shadow);
}

/* ───────── Poets list ───────── */
.page-title { padding-top: 22px; }
.page-title h1 { font-size: 1.5rem; }
.page-title p { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.search {
  position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); z-index: 5;
  margin: 16px calc(var(--gutter) * -1) 6px; padding: 8px var(--gutter);
  background: var(--bg);
}
.search label { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; height: 100%; min-width: 0; }
.search input::placeholder { color: var(--muted); }
.poet-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; }
.poet-list a { display: flex; align-items: center; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.poet-list .mono { width: 44px; height: 44px; font-size: 1.15rem; box-shadow: none; }
.poet-list b { font-weight: var(--fw-strong); }
.poet-list .chev { margin-inline-start: auto; color: var(--muted); width: 18px; height: 18px; }
@media (min-width: 640px) { .poet-list { grid-template-columns: 1fr 1fr; column-gap: 28px; } }

/* ───────── Category / poet ───────── */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; padding-top: 18px; font-size: .84rem; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.poet-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 34px 0 14px; }
.poet-pic { display: block; width: min(300px, 72vw); height: auto; aspect-ratio: 1;
  /* Feather the edges so no seam shows against the page green. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent); mask-composite: intersect; }
/* Poet page: the page takes the portrait's own green, so the picture melts into it. */
html:has(body.poet-bg), body.poet-bg { background: #585e4a; }
body.poet-bg main { --bg: #585e4a; --ink: #f3f1e7; --ink-soft: #e4e2d6; --muted: #d6d8c5; --accent: #eef0df; --hair: rgb(255 255 255 / .14); --line: rgb(255 255 255 / .14); color: var(--ink); }
:root[data-theme="dark"]:has(body.poet-bg), :root[data-theme="dark"] body.poet-bg { background: #2f3526; }
:root[data-theme="dark"] body.poet-bg main { --bg: #2f3526; --hair: rgb(255 255 255 / .08); --line: rgb(255 255 255 / .08); }
.poet-head h1 { font-size: 1.8rem; margin: 0; }
.poet-head .meta { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }
.bio { margin-top: 18px; color: var(--ink-soft); font-size: .95rem; line-height: 2; text-align: justify; }
.bio.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bio-toggle { margin-top: 6px; color: var(--accent); font-size: .9rem; font-weight: var(--fw-strong); }
.cat-title { padding-top: 10px; font-size: 1.5rem; }
.cat-desc { margin-top: 8px; color: var(--muted); font-size: .92rem; }

/* A poet's works: a shelf of cloth-bound covers. Persian books bind on the right, so the spine is on the right. */
.books { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 20px; margin: 26px 0 8px; padding: 0 6px; }
@media (min-width: 560px) { .books { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .books { grid-template-columns: repeat(4, 1fr); gap: 34px 26px; } }
.book { display: block; perspective: 900px; animation: bookIn .6s cubic-bezier(.22,1,.36,1) both; animation-delay: var(--d, 0ms); }
@keyframes bookIn { from { opacity: 0; transform: translateY(14px); } }
.cover { --cloth: #3d4232; --ink-c: #e9e4d0; --foil: rgb(233 228 208 / .45);
  position: relative; display: block; aspect-ratio: 5 / 7; border-radius: 3px 7px 7px 3px; overflow: hidden;
  background: var(--cloth); color: var(--ink-c);
  box-shadow: 0 1px 1px rgb(0 0 0 / .18), 0 10px 22px -8px rgb(0 0 0 / .45), inset 0 0 0 1px rgb(255 255 255 / .05);
  transform-origin: right center; transition: transform .45s cubic-bezier(.22,1,.36,1), box-shadow .45s; }
/* Cloth grain and the spine with its hinge groove. */
.cover::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background: repeating-linear-gradient(0deg, rgb(255 255 255 / .05) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgb(0 0 0 / .05) 0 1px, transparent 1px 3px); }
.cover::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 13%; pointer-events: none;
  background: linear-gradient(to left, rgb(0 0 0 / .28), rgb(255 255 255 / .07) 55%, rgb(0 0 0 / .22) 62%, rgb(255 255 255 / .05) 70%, transparent); }
.cover .frame { position: absolute; inset: 9% 17% 9% 9%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center;
  border: 1px solid var(--foil); border-radius: 2px; padding: 22% 8% 10%; }
.cover b { font-weight: var(--fw-strong); font-size: 1.12rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; text-wrap: balance; }
.cover small { font-size: .68rem; opacity: .72; line-height: 1.4; }
.cover.c1 { --cloth: #a9ad91; --ink-c: #2b2e22; --foil: rgb(43 46 34 / .35); }
.cover.c2 { --cloth: #e7e1cf; --ink-c: #3d4232; --foil: rgb(61 66 50 / .4); }
.cover.c3 { --cloth: #262b1f; }
@media (hover: hover) { .book:hover .cover { transform: rotateY(-9deg) translateX(-3px); box-shadow: 0 1px 1px rgb(0 0 0 / .18), 0 18px 30px -10px rgb(0 0 0 / .5); } }
.book:active .cover { transform: scale(.97); }
.book-link { position: absolute; inset: 0; z-index: 2; }
.book-link:focus-visible { outline: none; }
.book:has(.book-link:focus-visible) .cover { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .book { animation: none; } .cover { transition: none; } }

.list-tools { display: flex; align-items: center; gap: 10px; margin-top: 26px; }
.list-tools .count { font-size: .85rem; color: var(--muted); margin-inline-end: auto; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .84rem; color: var(--ink-soft); }
.chip-btn svg { width: 17px; height: 17px; }
.chip-btn[disabled] { opacity: .6; }
.poems { list-style: none; margin: 10px 0 0; padding: 0; }
.poems a { display: flex; align-items: center; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.poems .n { min-width: 2.4em; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.poems .tt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.poems .fl { font-family: var(--poem); font-size: 1.08rem; line-height: 1.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poems .fl:empty { display: none; }
.poems small { font-size: .78rem; color: var(--muted); }
.poems a:not(.has-fl) small { font-size: 1rem; color: var(--ink); }
.poems .marks { display: flex; align-items: center; gap: 8px; }
.poems .marks:empty { display: none; }
.poems .seen { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); opacity: .8; }
.poems .mk-save { display: grid; color: var(--accent); }
.poems .mk-save svg { width: 15px; height: 15px; fill: currentColor; stroke: currentColor; }
.more-btn { display: block; width: 100%; margin-top: 16px; }

/* ───────── Poem ───────── */

.poem-head { text-align: center; padding: 26px 0 8px; }
.poem-head .who { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; }
.poem-head .who a:hover { color: var(--accent); }
.poem-head h1 { margin-top: 8px; font-size: 1.18rem; font-weight: var(--fw-strong); }
.fal-badge { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 4px 12px; border-radius: 999px; font-size: .8rem; background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); font-weight: var(--fw-strong); }
.fal-badge svg { width: 15px; height: 15px; }

.verses { font-family: var(--verse); font-weight: var(--fw-verse); font-size: calc(var(--poem-size) * 1.1); line-height: 1.9; color: var(--ink); }
.poem .verses { margin: 18px 0 8px; }
.bayt { position: relative; display: block; width: 100%; padding: 10px 6px; border-radius: 12px; text-align: inherit; cursor: pointer; transition: background .2s; }
@media (hover: hover) { .bayt:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); } }
.bayt.lit { background: var(--accent-soft); }
.m { display: block; text-wrap: pretty; }
.m1 { text-align: right; }
.m2 { text-align: left; }
.center-pair .m { text-align: center; padding: 0; }
.center-pair { color: var(--accent); }
.single { padding: 2px 6px; }
.single .m { text-align: right; padding: 0; }
.prose { font-family: var(--poem); font-size: calc(var(--poem-size) * .92); line-height: 2.1; text-align: justify; padding: 8px 6px; color: var(--ink-soft); }
.note { font-family: var(--ui); font-size: .82rem; color: var(--muted); padding: 4px 6px; }
.section-break { height: 18px; }
.today .bayt { padding: 4px 0; cursor: inherit; }
.today .bayt:hover { background: none; }

@media (min-width: 760px) {
  :root { --poem-size: calc(1.28rem * var(--poem-scale)); }
}

.about { margin-top: 26px; padding: 18px 20px; }
.about summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: var(--fw-strong); }
.about summary::-webkit-details-marker { display: none; }
.about summary svg { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; }
.about[open] summary svg { transform: rotate(180deg); }
.about p { margin-top: 12px; color: var(--ink-soft); font-size: .94rem; line-height: 2; text-align: justify; }
.about.fal { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }

.poem-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }

.poem-bar { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; margin: 0 -8px; }
.poem-bar .grp { display: flex; gap: 2px; }

/* ───────── Fal ───────── */
.fal-page { min-height: calc(100dvh - var(--bar-h) - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px var(--gutter); }
.fal-orb {
  position: relative; width: 200px; height: 200px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, var(--surface), var(--surface-2));
  border: 1px solid var(--line); box-shadow: var(--shadow), inset 0 0 0 10px color-mix(in srgb, var(--bg) 60%, transparent);
  color: var(--gold); transition: transform .3s;
}
.fal-orb::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--gold) 50%, transparent); animation: spin 40s linear infinite; }
.fal-orb svg { width: 86px; height: 86px; stroke-width: 1; }
.fal-orb.opening { animation: breathe 1.6s ease-in-out; }
.fal-orb.opening::after { animation-duration: 1.6s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(.2); opacity: 0; } }
.fal-page h1 { margin-top: 34px; font-size: 1.5rem; }
.fal-page p { margin-top: 10px; color: var(--muted); max-width: 30em; line-height: 2; }
.fal-page .btn { margin-top: 28px; min-width: 180px; height: 52px; font-size: 1.05rem; }
.fal-page blockquote { margin: 26px 0 0; font-family: var(--poem); color: var(--ink-soft); font-size: 1.05rem; line-height: 2; }

/* ───────── Saved ───────── */
.tabs { display: flex; gap: 6px; margin-top: 18px; padding: 4px; background: var(--surface-2); border-radius: 999px; width: fit-content; }
.tabs button { height: 38px; padding: 0 18px; border-radius: 999px; font-size: .9rem; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.saved-list { list-style: none; margin: 14px 0 0; padding: 0; }
.saved-item { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.saved-item a { flex: 1; min-width: 0; padding: 14px 2px; }
.saved-item .t { font-weight: var(--fw-strong); }
.saved-item .s { display: block; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-item .q { display: block; font-family: var(--poem); font-size: 1rem; color: var(--ink-soft); margin-bottom: 2px; }
.empty-state { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty-state svg { width: 44px; height: 44px; stroke-width: 1.2; color: var(--line); margin-bottom: 10px; }
.empty-state b { display: block; color: var(--ink); font-weight: var(--fw-strong); margin-bottom: 4px; }

/* ───────── Sheet ───────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(30 33 24 / .38); opacity: 0; transition: opacity .25s; }
.sheet-backdrop.show { opacity: 1; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 41; margin: 0 auto; max-width: 560px;
  max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 22px calc(24px + var(--safe-b));
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgb(0 0 0 / .18);
  transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1); visibility: hidden; outline: none;
}
.sheet.show { transform: none; visibility: visible; }
@media (min-width: 860px) {
  .sheet { bottom: auto; top: 50%; border-radius: 24px; transform: translateY(-46%) scale(.97); opacity: 0; transition: transform .25s, opacity .25s; }
  .sheet.show { transform: translateY(-50%); opacity: 1; }
  .sheet-handle { display: none; }
}
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 14px; }
.sheet h3 { font-size: 1.05rem; margin: 6px 0 16px; }
.sheet .q { font-family: var(--poem); font-size: calc(var(--poem-size) * 1.02); line-height: 2.1; text-align: center; padding: 18px 8px; border-radius: 16px; background: var(--bg); }
.sheet .q .m { text-align: center; padding: 0; }
.sheet .meaning { margin-top: 16px; }
.sheet .meaning b { display: block; font-size: .82rem; color: var(--gold); font-weight: var(--fw-strong); margin-bottom: 4px; }
.sheet .meaning p { color: var(--ink-soft); line-height: 2; font-size: .95rem; }
.sheet .actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.sheet .actions button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; background: var(--surface-2); font-size: .82rem; }
.sheet .actions button:active { transform: scale(.97); }

.setting { margin-bottom: 22px; }
.setting > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.seg button { height: 42px; border-radius: 10px; font-size: .9rem; color: var(--ink-soft); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: var(--fw-strong); }
.seg .sw { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); }
.size-row { display: flex; align-items: center; gap: 14px; }
.size-row input[type=range] { flex: 1; accent-color: var(--accent); }
.size-row .a-sm { font-size: .85rem; } .size-row .a-lg { font-size: 1.35rem; }
.preview { margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--bg); font-family: var(--poem); font-size: var(--poem-size); text-align: center; line-height: 2; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--line); transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(-20px); }

/* ───────── Toast ───────── */
.toast {
  position: fixed; inset-inline: 0; bottom: calc(90px + var(--safe-b)); z-index: 60; margin: 0 auto; width: fit-content; max-width: calc(100% - 40px);
  padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: .9rem;
  opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
@media (min-width: 860px) { .toast { bottom: 32px; } }

.install { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-top: 14px; }
.install .t { flex: 1; font-size: .88rem; }
.install .t b { display: block; font-weight: var(--fw-strong); font-size: .95rem; }
.install .btn { height: 38px; padding: 0 16px; font-size: .88rem; }

.footer-note { margin-top: 48px; text-align: center; font-size: .78rem; color: var(--muted); line-height: 2; }
.footer-note a { color: var(--accent); }

/* ───────── Home: the wall ───────── */
body.wall-mode { overflow: hidden; overscroll-behavior: none; background: #585e4a; }
:root[data-theme="dark"] body.wall-mode { background: #2f3526; }
body.wall-mode .topbar, body.wall-mode main#main { display: none; }
.wall-root {
  --w-plaster: #585e4a; --w-grout: #4d5240; --w-ink: #f1eee4; --w-ink-soft: #d9d6c8;
  --w-paper: #f5f2e8; --w-paper-ink: #2b2e22; --w-paper-mid: #66695a; --w-accent: #5f6549; --w-gold: #585e4a;
}
.wall { position: fixed; inset: 0; background: var(--w-plaster); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.wall.dragging { cursor: grabbing; }
.w-tile {
  position: absolute; top: 0; left: 0; overflow: hidden; will-change: transform;
  background: var(--w-plaster);
  /* A very faint hairline on the right and bottom edge: one line per seam. */
  box-shadow: inset -1px -1px 0 rgb(0 0 0 / .07);
}
:root[data-theme="dark"] .w-tile { box-shadow: inset -1px -1px 0 rgb(0 0 0 / .12); }
.w-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; opacity: 0; transition: opacity .6s; transform: scale(.8); }
.w-tile img.loaded { opacity: 1; }
.w-tile.w-hidden img { opacity: 0; transition: none; }
.w-tglow { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .9s;
  background: var(--w-tglow) no-repeat center / 100% 100%; }
@media (hover: none) { .w-name { transition: none; } }
@media (hover: hover) { .w-tile:hover .w-tglow { opacity: 1; } .w-tile:hover .w-name { opacity: 1; } }
.w-name {
  position: absolute; z-index: 2; bottom: 16px; inset-inline: 8px; text-align: center; pointer-events: none;
  font-family: var(--poem); font-size: 1.1rem; line-height: 1.5; color: var(--w-ink); text-shadow: 0 1px 2px rgb(0 0 0 / .25);
  opacity: 0; transition: opacity .45s;
}
.w-tile:focus-visible { outline: 1.5px solid var(--w-ink); outline-offset: -10px; }
.w-grain { position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .35; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.w-sun { position: fixed; top: 0; left: 0; z-index: 2; pointer-events: none; opacity: 0; will-change: transform, opacity;
  background: no-repeat center / 100% 100%; }

.w-header {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 48px;
  width: min(880px, 96vw); padding: calc(18px + env(safe-area-inset-top, 0px)) 64px 26px;
  background: linear-gradient(color-mix(in srgb, var(--w-grout) 92%, transparent), color-mix(in srgb, var(--w-grout) 55%, transparent) 55%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  transition: opacity .5s;
}
.w-title { font-family: var(--poem); font-weight: var(--fw-strong); font-size: 1.35rem; color: var(--w-ink); text-shadow: 0 1px 0 rgb(0 0 0 / .15); white-space: nowrap; }
.w-menu img { width: 54px; }
.w-btn { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; color: var(--w-ink-soft); white-space: nowrap; transition: color .25s; }
.w-btn:hover { color: #fff; }
.w-btn svg { width: 17px; height: 17px; }
.wall-root.focused .w-header { background: none; }

.w-veil { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity .65s cubic-bezier(.4,0,.2,1);
  background: color-mix(in srgb, var(--w-plaster) 90%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.w-veil.show { opacity: 1; pointer-events: auto; transition: opacity .8s cubic-bezier(.22,1,.36,1); }
.w-focus { position: fixed; top: 0; left: 0; z-index: 11; pointer-events: none; opacity: 0;
  transition: transform .65s cubic-bezier(.4,0,.2,1), width .65s cubic-bezier(.4,0,.2,1), height .65s cubic-bezier(.4,0,.2,1), opacity .5s cubic-bezier(.4,0,.2,1); will-change: transform; }
.w-focus.show { opacity: 1; pointer-events: auto; cursor: zoom-out; transition: transform .85s cubic-bezier(.22,1,.36,1), width .85s cubic-bezier(.22,1,.36,1), height .85s cubic-bezier(.22,1,.36,1), opacity .4s ease; }
.w-focus img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, rgb(0 0 0 / .5) 82%, transparent 100%); mask-image: radial-gradient(closest-side, #000 62%, rgb(0 0 0 / .5) 82%, transparent 100%); }
.w-glow { position: absolute; inset: -30%; background: radial-gradient(circle closest-side at 50% 48%, rgb(255 255 255 / .1) 0%, rgb(255 255 255 / .075) 22%, rgb(255 255 255 / .045) 42%, rgb(255 255 255 / .02) 62%, rgb(255 255 255 / .006) 80%, transparent 100%); }

.w-panel {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 12; width: min(480px, 36vw); overflow-y: auto; overscroll-behavior: contain;
  padding: 34px 40px 40px; background: var(--w-paper); color: var(--w-paper-ink); outline: none;
  box-shadow: 8px 0 40px rgb(0 0 0 / .12);
  transform: translateX(-104%); transition: transform .65s cubic-bezier(.4,0,.2,1); will-change: transform;
}
.w-panel.open { transform: none; transition: transform .85s cubic-bezier(.22,1,.36,1); }
.wp-grip { display: none; }
.wp-head { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--w-paper-mid); }
.wp-close { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--w-paper-mid); margin-inline-end: -10px; }
.wp-close:hover { background: rgb(0 0 0 / .05); }
.wp-close svg { width: 18px; height: 18px; }
.wp-rule { display: flex; justify-content: center; margin: 36px 0 10px; color: var(--w-accent); font-size: .85rem; font-weight: var(--fw-strong); }
.wp-head + .wp-rule { margin-top: 18px; }
.wp-name { text-align: center; font-family: var(--poem); font-weight: var(--fw-strong); font-size: 1.6rem; line-height: 1.4; white-space: nowrap; padding-inline: 34px; }
/* Whole-poet download: outline icon; a ring fills while saving; solid once saved. */
.wp-dl { position: absolute; top: 34px; right: 26px; z-index: 3; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  color: var(--w-paper-mid); border: 1.5px solid color-mix(in srgb, var(--w-paper-ink) 22%, transparent); transition: background .3s, color .3s, border-color .3s; }
.wp-dl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wp-dl:hover { color: var(--w-accent); border-color: var(--w-accent); }
.wp-dl.busy { color: var(--w-accent); cursor: progress; }
.wp-dl.busy::before { content: ''; position: absolute; inset: -1.5px; border-radius: 50%;
  background: conic-gradient(var(--w-accent) calc(var(--p) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); }
.wp-x { position: absolute; top: 34px; left: 26px; z-index: 3; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--w-paper-mid); transition: background .2s, color .2s; }
.wp-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.wp-x:hover { color: var(--w-paper-ink); background: rgb(0 0 0 / .05); }
.wp-dl.saved { background: var(--w-accent); border-color: var(--w-accent); color: var(--w-paper); cursor: default; }
.wp-full { text-align: center; color: var(--w-paper-mid); font-size: .95rem; }
.wp-era { text-align: center; color: var(--w-paper-mid); font-size: .82rem; margin-top: -2px; line-height: 1.4; }
.wp-bayt { margin: 30px 0 0; padding: 0 10px; font-family: var(--poem); font-size: 1.15rem; line-height: 1.6; text-align: center; color: var(--w-paper-ink); }
.wp-bayt span { display: block; }
.wp-intro { margin-top: 30px; font-size: .95rem; line-height: 2.1; color: var(--ink-soft); text-align: justify; }
.wp-books { list-style: none; margin: 0 0 28px; padding: 0; }
.wp-books a { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; font-size: .98rem; }
.wp-books li + li a { border-top: 1px solid var(--hair); }
.wp-books a:hover { color: var(--w-accent); }
.wp-books svg { width: 16px; height: 16px; color: var(--w-paper-mid); }
.wp-cta { display: flex; align-items: center; justify-content: center; height: 50px; margin-top: 28px; border-radius: 999px; background: var(--w-plaster); color: var(--w-ink); font-weight: var(--fw-strong); transition: background .2s; }
.wp-cta:hover { background: #687052; }
.wp-wait { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.wp-wait i { width: 6px; height: 6px; border-radius: 50%; background: var(--w-paper-mid); opacity: .4; animation: wpdot 1.2s infinite; }
.wp-wait i:nth-child(2) { animation-delay: .2s; } .wp-wait i:nth-child(3) { animation-delay: .4s; }
@keyframes wpdot { 30% { opacity: 1; } }

@media (max-width: 767px) {
  .w-header { width: 100%; gap: 12px; padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 20px; -webkit-mask-image: none; mask-image: none; }
  .w-title { font-size: 1.15rem; }
  .w-btn span { display: none; }
  .w-btn svg { width: 22px; height: 22px; }
  .w-name { bottom: 8px; font-size: .72rem; }
  .w-tile img { transform: scale(.86); }
  /* A tall sheet resting at 64% of the screen; drag it up to read it all, down to close. */
  .w-panel {
    top: auto; left: 0; right: 0; width: 100%; height: calc(100dvh - 20px); border-radius: 22px 22px 0 0;
    padding: 18px 22px calc(28px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 30px rgb(0 0 0 / .15);
    transform: translateY(105%); overflow-y: hidden;
  }
  .w-panel.open { transform: translateY(calc(36dvh - 20px)); }
  .w-panel.full { overflow-y: auto; }
  .wp-name { font-size: 1.4rem; }
  .wp-dl { top: 26px; right: 18px; }
  .wp-x { top: 26px; left: 18px; }
  .wp-head + .wp-rule { margin-top: 6px; }
  .wp-grip { display: grid; place-items: center; position: sticky; top: -18px; z-index: 2; height: 24px; margin: -18px -22px 14px; background: var(--w-paper); cursor: grab; }
  .wp-grip i { width: 44px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--w-paper-ink) 22%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .w-focus, .w-panel, .w-veil { transition: none; } }

/* ───────── Poem cards: each poem a sheet; the next slides over the last ───────── */
.stack { width: 100%; max-width: 1000px; margin: 0 auto; padding: 8px 10px 0; }
.pcard {
  position: sticky; top: 22px; display: block; margin-bottom: 18px;
  min-height: calc(100dvh - var(--sheet-top) - 40px); padding: 4px clamp(16px, 4vw, 56px) 28px;
  background: var(--surface); border-radius: 24px;
  box-shadow: 0 -1px 0 rgb(60 66 45 / .04), 0 -10px 34px rgb(60 66 45 / .09);
}
.pcard .poem-bar { margin: 0 -6px; padding-top: 8px; }
.pcard .poem-head { padding-top: 18px; }
.pcard .ptitle { margin-top: 8px; font-size: 1.18rem; font-weight: var(--fw-strong); }
.pcard .verses { margin: 26px 0 8px; }
.pcard .about { margin-top: 56px; padding: 20px 4px 112px; border-top: 0; }
.pcard .about summary { justify-content: center; gap: 6px; font-size: .82rem; font-weight: 350; color: var(--muted); }
.pcard .about summary svg { width: 14px; height: 14px; }
.pcard .about p { max-width: var(--vw, none); margin-inline: auto; }
.pcard .about[open] { padding-bottom: 140px; }
.pcard .about p { margin-top: 18px; }
.pcard .footer-note { margin-top: 26px; }
.stack-end { min-height: 40vh; text-align: center; color: var(--muted); font-size: .85rem; padding-top: 10px; }

/* Poem sheet over the list */
:root { --sheet-top: 64px; }
@media (min-width: 860px) { :root { --sheet-top: 80px; } }
body.psheet-open { overflow: hidden; }
.psheet-wrap { position: fixed; inset: 0; z-index: 35; }
.psheet-backdrop { position: absolute; inset: 0; background: rgb(30 33 24 / .3); opacity: 0; transition: opacity .4s; }
.psheet {
  position: absolute; inset: var(--sheet-top) 0 0 0; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgb(30 33 24 / .2);
  transform: translateY(102%); transition: transform .45s cubic-bezier(.2, .8, .2, 1); outline: none;
}
.psheet-wrap.open .psheet { transform: none; }
.psheet-wrap.open .psheet-backdrop { opacity: 1; }
.psheet-grip { position: sticky; top: 0; z-index: 6; width: 160px; margin-inline: auto; height: 34px; margin-bottom: -34px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.psheet-grip i { width: 44px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 22%, transparent); }
.psheet .stack { padding: 0; max-width: none; }
.psheet .pcard { top: 0; margin-bottom: 0; border-radius: 24px 24px 0 0; min-height: calc(100dvh - var(--sheet-top)); padding-top: 18px; }
.psheet .stack-end { min-height: 30vh; }


/* Every misra is as wide as the longest one; kashida fills the difference. */
.pcard .m { width: var(--mw, auto); max-width: 100%; white-space: nowrap; text-align: justify; text-align-last: justify; }
.pcard .m.wraps { white-space: normal; text-align: center; text-align-last: auto; }
.pcard .m { margin-inline: auto; }
.pcard.two-col .bayt:not(.center-pair):not(.single) { display: grid; grid-template-columns: var(--mw) var(--mw); justify-content: center; column-gap: 48px; }
.pcard.two-col .bayt .m { margin: 0; }
/* Band couplets (tarji'/tarkib refrains) and lone misras stay centred under the two columns. */
.pcard.two-col .center-pair .m, .pcard.two-col .single .m { margin-inline: auto; }
.kmeter { position: absolute; visibility: hidden; white-space: nowrap; pointer-events: none; }
.kmeter > span { display: block; width: max-content; }

/* Opening card: the name in a small white box in the middle, then it fades away */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; pointer-events: none; transition: opacity .7s ease, visibility .7s; }
.splash-box { width: var(--w-tile, min(62vw, 250px)); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); box-shadow: 0 10px 40px rgb(30 33 24 / .18); opacity: 0; animation: splash-in .7s ease .1s forwards; }
.splash-box b { font-weight: 350; font-size: 1.75rem; line-height: 1.4; color: var(--ink); display: inline-block; white-space: nowrap; }
.splash-box small { font-weight: 350; font-size: .78rem; color: var(--muted); }
.splash.out { opacity: 0; visibility: hidden; }
.no-splash .splash { display: none; }
@keyframes splash-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Poet panel opened fully: the portrait drifts up and fades softly instead of being cut off */
.w-focus img { transition: opacity .76s cubic-bezier(.22,1,.36,1), transform .76s cubic-bezier(.22,1,.36,1); }
.wall-root.panel-full .w-focus img { opacity: 0; transform: translateY(-14%) scale(.94); }

/* Phones and narrow tablets: the logo sits at the top right, matching the inner pages. */
@media (max-width: 859px) {
  .w-header { justify-content: flex-start; padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-inline: calc(var(--gutter) - 6px); }
  .w-menu img { width: 40px; }
}

/* Wall: "all poets" button, bottom centre */
.w-all {
  position: fixed; z-index: 30; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); translate: -50% 0;
  padding: 6px 20px 8px; border-radius: 999px; background: var(--w-paper); color: var(--w-paper-ink); font-family: inherit; border: 0; cursor: pointer;
  font-size: .84rem; font-weight: var(--fw-strong); white-space: nowrap; box-shadow: 0 8px 28px rgb(20 24 14 / .28);
  transition: opacity .5s, transform .15s;
}
.w-all:active { transform: scale(.96); }
.wall-root.focused .w-all, .wall-root.listing .w-all { opacity: 0; pointer-events: none; }
.w-lb { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--w-grout) 72%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.w-lb.open { opacity: 1; pointer-events: auto; }
.w-lb-card { width: min(400px, 100%); height: min(72dvh, 640px); display: flex; flex-direction: column;
  background: var(--w-paper); color: var(--w-paper-ink); border-radius: 22px; box-shadow: 0 24px 70px rgb(15 18 10 / .35);
  padding: 24px 22px 10px; transform: translateY(14px) scale(.97); transition: transform .45s cubic-bezier(.22,1,.36,1); }
.w-lb.open .w-lb-card { transform: none; }
.w-lb-card h2 { text-align: center; font-size: 1.3rem; font-weight: var(--fw-strong); margin: 0 0 14px; }
.w-lb-q { width: 100%; padding: 8px 16px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--w-paper-ink) 14%, transparent);
  background: transparent; color: inherit; font: inherit; font-size: 1rem; outline: none; margin-bottom: 8px; }
.w-lb-list { flex: 1; min-height: 0; list-style: none; margin: 0; padding: 0; overflow: auto; overscroll-behavior: contain; }
.w-lb-list li + li { border-top: 1px solid color-mix(in srgb, var(--w-paper-ink) 8%, transparent); }
.w-lb-list li { display: flex; align-items: center; gap: 12px; padding-inline: 6px; }
.w-lb-list a { flex: 1; display: block; padding: 10px 0; font-size: 1.1rem; color: inherit; }
.w-lb-cap { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 2px; padding: 0 6px 8px; border-bottom: 1px solid color-mix(in srgb, var(--w-paper-ink) 8%, transparent); font-size: .72rem; color: var(--w-paper-mid); }
.w-lb-allrow { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.w-lb-allrow b { font-weight: var(--fw-strong); font-size: .9rem; color: var(--w-paper-ink); }
.w-lb-tick { position: relative; flex: none; width: 20px; height: 20px; cursor: pointer; }
.w-lb-tick input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: inherit; }
.w-lb-tick i { position: absolute; inset: 0; border-radius: 5px; border: 1.5px solid color-mix(in srgb, var(--w-paper-ink) 35%, transparent); transition: background .2s, border-color .2s; }
.w-lb-tick input:checked + i { background: var(--w-accent); border-color: var(--w-accent); }
.w-lb-tick input:indeterminate + i { background: color-mix(in srgb, var(--w-accent) 45%, transparent); border-color: var(--w-accent); }
.w-lb-tick input:indeterminate + i::after { content: ''; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; margin-top: -1px; background: var(--w-paper); }
.w-lb-tick input:checked + i::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--w-paper); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.w-lb-tick input:focus-visible + i { outline: 2px solid var(--w-accent); outline-offset: 2px; }
.w-lb-tick.off { opacity: .3; cursor: default; }
.w-lb-list a:hover { color: var(--w-accent); }
.w-lb-empty { padding: 18px 6px; text-align: center; color: var(--w-paper-mid); }
@media (min-width: 860px) { .w-all { bottom: 36px; font-size: .9rem; padding: 7px 24px 9px; } }

/* Version tag: tiny, bottom right, never in the way. */
.site-ver { position: fixed; right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); z-index: 5; font-size: .58rem; line-height: 1; color: var(--muted); opacity: .6; pointer-events: none; user-select: none; }
body.wall-mode .site-ver { color: rgb(255 255 255 / .5); }

/* Poem sheet: close, share and bookmark sit above the sheet, top left, as black discs like the page close button. */
.pcard .poem-bar { display: none; }
.psheet-tools { position: absolute; z-index: 2; left: var(--gutter); top: calc(env(safe-area-inset-top, 0px) + 16px); display: flex; gap: 10px; direction: ltr;
  opacity: 0; transition: opacity .35s; }
.psheet-wrap.open .psheet-tools { opacity: 1; }
.psheet-tools .icon-btn { width: 36px; height: 36px; background: #000; color: #fff; }
.psheet-tools .icon-btn:hover { background: #000; }
.psheet-tools .icon-btn svg { width: 18px; height: 18px; stroke-width: 1.8; }
.psheet-tools .pt-save.on svg { fill: currentColor; }
@media (min-width: 860px) { .psheet-tools { top: calc(env(safe-area-inset-top, 0px) + 20px); } .psheet-tools .icon-btn { width: 42px; height: 42px; } }

/* Menu: one card in the middle of the screen, the same size as «همه سخنوران». */
.mx { position: fixed; inset: 0; z-index: 70; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 20px; overflow: hidden;
  background: rgb(38 43 31 / .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.mx.open { opacity: 1; pointer-events: auto; }
.mx-card { width: min(400px, 100%); min-width: 0; max-width: 100%; height: min(72dvh, 640px); display: flex; flex-direction: column; outline: none;
  background: var(--bg); color: var(--ink); border-radius: 22px; box-shadow: 0 24px 70px rgb(15 18 10 / .35);
  padding: 20px 20px 12px; transform: translateY(14px) scale(.97); transition: transform .45s cubic-bezier(.22,1,.36,1); }
:root[data-theme="dark"] .mx-card { background: var(--surface); }
.mx.open .mx-card { transform: none; }
body.menu-open { overflow: hidden; }
.mx-search { position: relative; display: block; flex: none; }
.mx-search svg { position: absolute; right: 14px; top: 50%; width: 18px; height: 18px; translate: 0 -50%; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.mx-search input { width: 100%; padding: 10px 42px 10px 16px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  background: color-mix(in srgb, var(--ink) 4%, transparent); color: inherit; font: inherit; font-size: 1rem; outline: none; transition: border-color .2s, background .2s; }
.mx-search input:focus { border-color: var(--accent); background: transparent; }
.mx-search input::placeholder { color: var(--muted); }
.mx-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; margin: 10px -8px 0; padding: 0 8px; }
.mx-nav { display: flex; flex-direction: column; padding-top: 6px; }
.mx-nav a, .mx-nav button { display: block; width: 100%; text-align: start; padding: 11px 6px; font: inherit; font-size: 1.12rem; color: inherit; background: none; border: 0; cursor: pointer; border-radius: 10px; }
.mx-nav > * + * { border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.mx-nav a[aria-current="page"] { color: var(--accent); font-weight: var(--fw-strong); }
.mx-nav a:hover, .mx-nav button:hover { color: var(--accent); }
.mx-nav button { font-size: 1.12rem; color: inherit; }
.mx-list { list-style: none; margin: 0; padding: 0; }
.mx-list li + li { border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.mx-list a { display: block; padding: 11px 6px; color: inherit; }
.mx-l { display: block; overflow-wrap: anywhere; font-size: 1.05rem; line-height: 1.75; }
.mx-l mark { background: none; color: var(--accent); font-weight: var(--fw-strong); }
.mx-list small { display: block; margin-top: 2px; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-list a:hover .mx-l { color: var(--accent); }
.mx-note { padding: 22px 8px; text-align: center; color: var(--muted); font-size: .9rem; line-height: 1.9; margin: 0; }
.mx-foot { flex: none; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); padding-top: 12px; margin-top: 4px; display: grid; gap: 10px; }
.mx-size { display: flex; align-items: center; gap: 10px; }
.mx-size button { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: none; color: var(--ink); cursor: pointer; font: inherit; line-height: 1; }
#mxSm { font-size: .85rem; } #mxLg { font-size: 1.35rem; }
.mx-size input { flex: 1; accent-color: var(--accent); }
.mx-toggles { display: flex; gap: 8px; }
.mx-pill { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); background: none; color: var(--ink); font: inherit; font-size: .9rem; transition: background .2s, color .2s, border-color .2s; }
.mx-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.mx-pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
:root[data-theme="dark"] .mx-pill[aria-pressed="true"] { color: var(--surface); }
.mx-pill[aria-pressed="true"] svg { fill: currentColor; }
.mx-ver { margin: 0; text-align: center; font-size: .66rem; color: var(--muted); opacity: .8; }
.mx-nav a:focus-visible, .mx-nav button:focus-visible, .mx-list a:focus-visible, .mx-pill:focus-visible, .mx-size button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.verses .found { background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 8px; transition: background .6s; }
.about p { line-height: 2; margin: 0 0 10px; }
.about a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.about .muted { color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: reduce) { .mx, .mx-card { transition: none; } }
.mx-nav[hidden], .mx-res[hidden], .mx-clr[hidden] { display: none; }
.mx-nav a, .mx-nav button { line-height: 1.5; }
.mx-list a, .mx-list small { line-height: 1.5; }
.mx-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.mx-clr { position: absolute; left: 8px; top: 50%; translate: 0 -50%; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); display: grid; place-items: center; padding: 0; }
.mx-clr svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; position: static; translate: none; fill: none; }
.mx-search input { padding-left: 42px; }

/* Close buttons of the menu and «همه سخنوران» */
.lb-x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); transition: background .2s; }
.lb-x:hover { background: color-mix(in srgb, var(--ink) 15%, transparent); }
.lb-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.lb-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mx-top { display: flex; align-items: center; gap: 10px; flex: none; }
.mx-top .mx-search { flex: 1; }
.w-lb-card { position: relative; }
.w-lb-card .lb-x { position: absolute; top: 16px; left: 16px; color: var(--w-paper-ink); background: color-mix(in srgb, var(--w-paper-ink) 9%, transparent); }
.w-lb-card h2 { margin-bottom: 4px; padding-inline: 40px; }
.w-lb-hint { margin: 0 0 14px; text-align: center; font-size: .8rem; line-height: 1.7; color: var(--w-paper-mid); padding-inline: 8px; }
.w-lb-cap { justify-content: flex-end; }

/* Poets list on the portrait green: each poet's portrait, unframed, in place of the letter circle. */
.pl-face { flex: none; width: 64px; height: 64px; object-fit: cover; margin: -8px 0;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent); mask-image: radial-gradient(closest-side, #000 72%, transparent); }
body.poet-bg .search label { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .16); }
body.poet-bg .search input { color: var(--ink); }
body.poet-bg .poet-list .mono { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .16); color: var(--ink); }
/* «همه سخنوران»: a small round portrait beside each name. */
.w-lb-list a { display: flex; align-items: center; gap: 12px; padding-inline-start: 12px; }
.w-lb-face { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; background: color-mix(in srgb, var(--w-paper-ink) 8%, transparent); }

/* The wall's poet panel: the same book covers, always two to a row. */
.books.wp-shelf { grid-template-columns: repeat(2, 1fr); gap: 22px 18px; margin: 4px 0 30px; padding: 0 4px; }
.wp-shelf .cover b { font-size: 1.02rem; }

/* Shelves: one titled group per divan, the other works under «آثار». */
.shelf { margin-top: 30px; }
.shelf-h { display: flex; align-items: center; gap: 14px; margin: 0 0 4px; font-size: .9rem; font-weight: var(--fw-strong); color: var(--muted); }
.shelf-h::before, .shelf-h::after { content: ''; flex: 1; height: 1px; background: var(--hair); }
.shelf .books { margin-top: 14px; }
.wp-shelves .shelf-h { color: var(--w-paper-mid); }
/* Panel covers are the same size as on the poet page. */
.books.wp-shelf { grid-template-columns: repeat(2, minmax(0, 150px)); justify-content: center; gap: 22px 22px; margin: 14px 0 6px; padding: 0; }
.wp-shelf .cover b { font-size: 1rem; }
.wp-shelves { margin-bottom: 30px; }
.wall-root.solo .w-tile { box-shadow: none !important; outline: none; }
.wall-root.solo .wall { cursor: default; }

/* Weights per part of the site (Navid, 2026-11-13). */
.brand, .w-title, .splash-box b { font-weight: var(--fw-brand); }
.poet-head h1, .wp-name, .poet-list b, .w-lb-list a { font-weight: var(--fw-name); }
.poet-list b { font-weight: var(--fw-name); }
.poet-head .meta, .wp-era { font-weight: var(--fw-meta); }
.ptitle, .poem-head h1, .cat-title, .page-title h1, .w-lb-card h2 { font-weight: var(--fw-title); }
.poem-head .who, .crumbs { font-weight: var(--fw-title); }
.bio, .wp-intro, .poems, .poems .fl, .mx-nav a, .mx-nav button, .mx-list, .mx-search input, .search input, .w-lb-q, .w-lb-hint, .mx-note, .mx-ver, .site-ver, .about p { font-weight: var(--fw-text); }
.mx-nav a[aria-current="page"] { font-weight: var(--fw-text); }
.cover b { font-weight: var(--fw-cover); }
.btn, .w-all, .wp-cta, .mx-pill, .lb-x, .sheet button, .share-opts button { font-weight: var(--fw-btn); }
.wp-bayt, .mx-l { font-weight: var(--fw-verse); }
.w-name { font-size: .88rem; font-weight: 350; }
@media (max-width: 767px) { .w-name { font-size: .72rem; } }
/* Parts inside a book (غزلیات، قصاید…): a plain list. */
.parts { display: flex; flex-direction: column; margin-top: 18px; max-width: 640px; }
.part { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px; font-size: 1.05rem; }
.part + .part { border-top: 1px solid var(--hair); }
.part b { font-weight: var(--fw-text); }
.part .chev { color: var(--muted); width: 18px; height: 18px; }
@media (hover: hover) { .part:hover { color: var(--accent); } }

/* Bookmarks: poems / couplets / read, sorted by time or grouped by poet */
.sort-row { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: .82rem; color: var(--muted); }
.sort-row button { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.sort-row button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); }
.saved-group { display: flex; align-items: baseline; gap: 8px; padding: 22px 2px 6px; font-weight: var(--fw-name); color: var(--ink); border-bottom: 1px solid var(--line); }
.saved-group small { color: var(--muted); font-size: .75rem; }
.bayt-item .q .m { display: block; }
.sheet .actions.four { grid-template-columns: repeat(4, 1fr); }
.sheet .actions.two { grid-template-columns: repeat(2, 1fr); }
.sheet #bSave[aria-pressed="true"] { color: var(--accent); }
.sheet #bSave[aria-pressed="true"] svg { fill: currentColor; }
.mx-pill:not([aria-pressed]) svg { fill: none; }
.mx-toggles { flex-wrap: wrap; }
.mx-pill { white-space: nowrap; }

/* Menu switches (night mode, harakat): a sliding knob, like a phone settings switch */
.mx-toggles { align-items: center; }
.mx-sw { display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; border: 0; background: none; color: var(--ink); font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap; }
.mx-sw .sw { direction: ltr; position: relative; flex: none; width: 54px; height: 30px; border-radius: 999px;
  background: #e9e9e6; box-shadow: inset 0 1px 3px rgb(0 0 0 / .18); transition: background .25s; }
.mx-sw .sw-k { position: absolute; top: 3px; left: 27px; width: 24px; height: 24px; border-radius: 50%;
  background: #2b2b2b; box-shadow: 0 1px 3px rgb(0 0 0 / .35); transition: left .25s cubic-bezier(.3,.7,.3,1), background .25s; }
.mx-sw .sw svg, .mx-sw .sw b { position: absolute; top: 7px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; transition: opacity .2s; }
.mx-sw .sw b { top: 3px; font-weight: 500; font-size: 15px; line-height: 22px; text-align: center; font-style: normal; }
.mx-sw .sw-sun, .mx-sw .sw-off { left: 6px; color: #2b2b2b; }
.mx-sw .sw-moon, .mx-sw .sw-on { right: 6px; left: auto; color: #fff; opacity: 0; }
.mx-sw .sw-moon { fill: currentColor; stroke: none; }
.mx-sw[aria-checked="true"] .sw { background: #262626; box-shadow: inset 0 1px 3px rgb(0 0 0 / .5); }
.mx-sw[aria-checked="true"] .sw-k { left: 3px; background: #f4f4f1; }
.mx-sw[aria-checked="true"] .sw-moon, .mx-sw[aria-checked="true"] .sw-on { opacity: 1; }
.mx-sw[aria-checked="true"] .sw-sun, .mx-sw[aria-checked="true"] .sw-off { opacity: 0; }
.mx-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }
#mxBackup { flex: 0 1 auto; margin-inline-start: auto; }
.mx-toggles { justify-content: space-between; row-gap: 10px; }
.mx-sw .sw b { top: 4px; height: 22px; line-height: 26px; font-size: 16px; font-family: inherit; }
.mx-sw[aria-checked="true"] .sw { box-shadow: inset 0 1px 3px rgb(0 0 0 / .5), inset 0 0 0 1px rgb(255 255 255 / .14); }

/* One close button everywhere: a black disc with a white ×, the same as the page close button. */
.page-x, .pclose, .psheet-tools .pt-x, .lb-x, .w-lb-card .lb-x, .wp-x, .sheet-x {
  width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: #000; color: #fff; }
.page-x:hover, .pclose:hover, .lb-x:hover, .w-lb-card .lb-x:hover, .wp-x:hover, .sheet-x:hover { background: #000; color: #fff; }
.page-x svg, .pclose svg, .lb-x svg, .wp-x svg, .sheet-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sheet-x { position: absolute; top: 14px; left: 16px; z-index: 2; }
.sheet-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet-body { position: relative; }
/* Switch knob: slide with transform (works the same in every browser, whatever the page direction). */
.mx-sw .sw-k { left: 3px; right: auto; transform: translateX(24px); transition: transform .25s cubic-bezier(.3,.7,.3,1), background .25s; will-change: transform; }
.mx-sw[aria-checked="true"] .sw-k { left: 3px; transform: translateX(0); }
.sheet-body { padding-top: 44px; }
.sheet-x { top: 0; left: 0; }
/* Switches carry no label: the name shows as a hint on hover, or for a moment after a tap on touch screens. */
.mx-toggles { justify-content: flex-start; gap: 14px; }
.mx-sw[data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; translate: -50% -3px; z-index: 60;
  padding: 3px 10px 5px; border-radius: 8px; background: var(--ink); color: var(--bg);
  font-size: .72rem; font-weight: 350; line-height: 1.4; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, translate .15s; }
.mx-sw[data-tip]:hover::after, .mx-sw.tip-show::after { opacity: 1; translate: -50% 0; }

/* First-load hint under the logo: black bubble, white text, an arrow pointing up at the logo. */
.logo-hint { position: fixed; z-index: 80; padding: 7px 14px 9px; border-radius: 10px; background: #000; color: #fff;
  font-size: .85rem; font-weight: var(--fw-btn); line-height: 1.4; white-space: nowrap; pointer-events: none;
  box-shadow: 0 6px 20px rgb(0 0 0 / .25); opacity: 0; translate: 0 6px; transition: opacity .35s, translate .35s; }
.logo-hint::before { content: ''; position: absolute; top: -6px; left: var(--ax, 50%); translate: -50% 0; width: 12px; height: 12px; background: #000; rotate: 45deg; border-radius: 2px; }
.logo-hint.show { opacity: 1; translate: 0 0; }
/* Keep the ticks clear of the scrollbar (it sits on the left in RTL). */
.w-lb-list li { padding-inline-end: 22px; }
.w-lb-cap { padding-inline-end: 22px; }
/* Poem head spacing (Navid): double the room above the poet line, between it and the title, and between the title and the verses; title inset twice as far from the sides. */
.pcard .poem-head { padding-top: 56px; }
.pcard .ptitle { margin-top: 18px; padding-inline: 16px; }
.pcard .verses { margin-top: 60px; }
/* Weight slider: a thin آ at one end, a bold آ at the other. */
#mxLt, #mxBd { font-size: 1.1rem; }
#mxLt { font-weight: 250; } #mxBd { font-weight: 700; }
/* Home: «ادامه خواندن» and «همه سخنوران» side by side, bottom centre. */
.w-bar { position: fixed; z-index: 30; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; display: flex; gap: 10px; transition: opacity .5s; }
.w-bar .w-all { position: static; translate: none; left: auto; bottom: auto; display: inline-block; text-decoration: none; }
.wall-root.focused .w-bar, .wall-root.listing .w-bar { opacity: 0; pointer-events: none; }
@media (min-width: 860px) { .w-bar { bottom: 36px; } }
/* While a poem sheet is open, the page behind it fades away (no list text showing above the sheet). */
.psheet-backdrop { background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* Weight and contrast per text style, chosen by Navid on the test page (2026-11-13). Set explicitly too, because "font: inherit" on some of these would otherwise reset it. */
.brand, .w-title, .splash-box b { font-weight: 500; --cntr: 39; font-variation-settings: "CNTR" 39, "wdth" 100; }
.poet-head h1, .wp-name, .poet-list b, .w-lb-list a, .saved-group { font-weight: 670; --cntr: 86; font-variation-settings: "CNTR" 86, "wdth" 100; }
.w-name { font-weight: 360; --cntr: 46; font-variation-settings: "CNTR" 46, "wdth" 100; }
.poet-head .meta, .wp-era { font-weight: 590; --cntr: 75; font-variation-settings: "CNTR" 75, "wdth" 100; }
.ptitle, .poem-head h1, .cat-title, .page-title h1, .w-lb-card h2, .poem-head .who, .crumbs, .shelf-h { font-weight: 590; --cntr: 70; font-variation-settings: "CNTR" 70, "wdth" 100; }
.verses { --cntr: 17; font-variation-settings: "CNTR" 17, "wdth" 100; }
.wp-bayt, .mx-l, .saved-item .q, .sheet .q { font-weight: 450; --cntr: 50; font-variation-settings: "CNTR" 50, "wdth" 100; }
.bio, .wp-intro, .about p, .sheet .meaning, .sheet .meaning p, .w-lb-hint, .mx-note { font-weight: 360; --cntr: 19; font-variation-settings: "CNTR" 19, "wdth" 100; }
.poems, .poems .fl, .mx-list, .part b, .saved-item .t, .saved-item .s { font-weight: 440; --cntr: 50; font-variation-settings: "CNTR" 50, "wdth" 100; }
.mx-nav a, .mx-nav button, .mx-nav a[aria-current="page"] { font-weight: 420; --cntr: 57; font-variation-settings: "CNTR" 57, "wdth" 100; }
.mx-search input, .search input, .w-lb-q { font-weight: 330; --cntr: 50; font-variation-settings: "CNTR" 50, "wdth" 100; }
.cover b { font-weight: 800; --cntr: 100; font-variation-settings: "CNTR" 100, "wdth" 100; }
.btn, .w-all, .wp-cta, .mx-pill, .lb-x, .sheet button, .share-opts button, .seg button, .seg button[aria-pressed="true"] { font-weight: 400; --cntr: 50; font-variation-settings: "CNTR" 50, "wdth" 100; }
.logo-hint { font-weight: 550; --cntr: 74; font-variation-settings: "CNTR" 74, "wdth" 100; }
.mx-ver, .site-ver, .splash-box small, .toast, [data-tip]::after, .mx-sw[data-tip]::after { font-weight: 310; --cntr: 0; font-variation-settings: "CNTR" 0, "wdth" 100; }
/* Hint bubbles are fully rounded capsules (Navid, 2026-11-13). */
.logo-hint, [data-tip]::after, .mx-sw[data-tip]::after { border-radius: 999px; }
.logo-hint { padding-inline: 18px; }
/* Logo is the same size on every page (the larger inner-page size). */
@media (max-width: 859px) { .w-menu img { width: 46px; } }
/* A solid band under the phone status bar, so scrolled text never shows there as a blurred smear. */
/* A solid header, the page's own colour, behind the logo and the close buttons. The home-screen iPhone app blurs
   the top of any page that has none (test pages, Navid 2026-11-18: only the fixed-header variants stayed sharp).
   It reaches as far down as the poem sheet's top edge. */
.top-edge { position: fixed; z-index: 49; top: 0; left: 0; right: 0; height: calc(env(safe-area-inset-top, 0px) + var(--sheet-top)); background: var(--bg); }
body.poet-bg .top-edge { background: #585e4a; }
:root[data-theme="dark"] body.poet-bg .top-edge { background: #2f3526; }
body.psheet-open .top-edge, body.poet-bg.psheet-open .top-edge { background: var(--bg); }
body.wall-mode .top-edge { display: none; }
/* The poem sheet sits above that header (its buttons must show); its own layer lets taps through except on its parts,
   and its backdrop starts where the sheet starts, so the header above stays the top of the page. */
.psheet-wrap { z-index: 50; pointer-events: none; }
.psheet-wrap > * { pointer-events: auto; }
.psheet-backdrop { top: var(--sheet-top); }
/* Poet download button: same size as the close button; black with a white icon once downloaded (Navid, 2026-11-13). */
.wp-dl { width: 36px; height: 36px; }
.wp-dl svg { width: 18px; height: 18px; }
.wp-dl.saved, .wp-dl.saved:hover { background: #000; border-color: #000; color: #fff; }
/* Couplet number: small and faint at the right, between the two halves; poem card only, drawn by CSS so it is never copied or exported (Navid, 2026-11-13). */
/* The number sits in the card's side margin, so the poem keeps its full width and stays centred. */
.pcard .bayt[data-n]::before { content: attr(data-n); position: absolute; right: var(--nr, -14px); top: 50%; translate: 0 -50%; width: 16px; text-align: center;
  font-family: var(--ui); font-size: .62rem; font-weight: 350; line-height: 1; color: var(--muted); opacity: .55; pointer-events: none; user-select: none; -webkit-user-select: none; }

/* 0.9.63 — UX review fixes */
/* Book lists: a row keeps the height it will have once its first line arrives, so nothing jumps under the finger. */
.poems a[data-u]:not(.has-fl) .tt { min-height: 3.416rem; justify-content: center; }
/* Poem buttons keep their look but take a 44px touch. */
.psheet-tools .icon-btn { position: relative; }
.psheet-tools .icon-btn::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; }
/* The pull handle fades once the poem scrolls, so it never sits over the verses. */
.psheet-grip i { transition: opacity .2s; }
.psheet.scrolled .psheet-grip i { opacity: 0; }
/* Searching on a phone: the reading settings step aside so the results have room. */
@media (max-width: 700px), (max-height: 700px) { .mx.searching .mx-foot { display: none; } }
/* Privacy note in «دربارهٔ سُرایش» (Navid 2026-11-20, 0.9.165). */
.about .about-h { margin: 18px 0 6px; font-size: 1rem; color: var(--ink); }
.about .about-credit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, rgba(127,127,127,.25)); }

/* Version tag: only on the home wall (Navid, 2026-11-18). */
body:not(.wall-mode) .site-ver { display: none; }
/* End of a section: on to the next one, set apart from the list. */
.next-sec { display: flex; width: 100%; height: auto; min-height: 56px; justify-content: flex-start; margin: 40px 0 8px; padding: 12px 24px; background: var(--surface-2); color: var(--ink); text-decoration: none; }
.next-sec small { color: var(--muted); flex: none; }
.next-sec b { flex: 1; font-weight: var(--fw-title); }
.next-sec svg { flex: none; width: 18px; height: 18px; }
/* Poets page: the ticks that choose the home wall (they used to live in a card over the wall). */
.pl-hint { color: var(--muted); font-size: .88rem; margin-top: 10px; }
.poet-list li { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.poet-list li a { flex: 1; min-width: 0; border-bottom: 0; }
.poet-list li.empty-state { border-bottom: 0; }
.pl-allrow { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 6px 2px 4px; cursor: pointer; color: var(--muted); font-size: .9rem; }
.pl-allrow b { font-weight: inherit; }
.pl-tick { position: relative; flex: none; width: 22px; height: 22px; cursor: pointer; }
.pl-tick input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: inherit; }
.pl-tick i { position: absolute; inset: 0; border-radius: 6px; border: 1.5px solid color-mix(in srgb, var(--ink) 45%, transparent); transition: background .2s, border-color .2s; }
.pl-tick input:checked + i { background: var(--accent); border-color: var(--accent); }
.pl-tick input:indeterminate + i { background: color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.pl-tick input:indeterminate + i::after { content: ''; position: absolute; left: 5px; right: 5px; top: 50%; height: 2px; margin-top: -1px; background: var(--bg); }
.pl-tick input:checked + i::after { content: ''; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pl-tick input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The poem sheet's layer starts below the status bar, so the green strip there stays the top-edge element
   (iPhone Safari otherwise takes the sheet's layer as the page top and blurs the top after it closes). */
.psheet-wrap { top: env(safe-area-inset-top, 0px); }
.psheet { top: calc(var(--sheet-top) - env(safe-area-inset-top, 0px)); }
.psheet-tools { top: 16px; }
@media (min-width: 860px) { .psheet-tools { top: 20px; } }
/* The couplet sheet and its backdrop open above the poem sheet (now z-index 50) and the top header. */
.sheet-backdrop { z-index: 55; }
.sheet { z-index: 56; }
/* Divider lines (***) sit in the middle of the card. */
.sep-line { text-align: center; color: var(--muted); font-family: var(--ui); letter-spacing: .3em; padding: 4px 0; margin: 0; text-indent: .3em; }
/* Poet page: whole-poet download beside the close button, same black disc; a ring fills while saving, a tick once saved. */
.page-dl { position: fixed; z-index: 50; left: calc(var(--gutter) + 46px); top: calc(env(safe-area-inset-top, 0px) + 16px);
  width: 36px; height: 36px; background: #000; color: #fff; transition: opacity .3s; }
.page-dl:hover { background: #000; }
.page-dl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.page-dl.busy { cursor: progress; }
.page-dl.busy::before { content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 360deg), rgb(255 255 255 / .25) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px)); }
.page-dl.saved { cursor: pointer; }
body.psheet-open .page-dl { opacity: 0; pointer-events: none; }
/* A poem whose first line can't be shown keeps its title at the same size as the other rows' first lines. */
.poems a:not(.has-fl) small { font-family: var(--poem); font-size: 1.08rem; }
/* Centred lines (green) and a lone * : centred, no kashida, not justified to the couplets' width. */
.pcard .center-pair .m { width: auto; text-align: center; text-align-last: center; }
/* Menu button: three dots on a black disc, the same size as the close button (replaces the logo, Navid 2026-11-18). */
.menu-btn .dots, .w-menu .dots { width: 36px; height: 36px; margin: 5px; border-radius: 50%; background: #000; display: flex; align-items: center; justify-content: center; gap: 3.5px; }
.menu-btn .dots i, .w-menu .dots i { width: 4.5px; height: 4.5px; border-radius: 50%; background: #fff; }
/* One size for every top button: 36px black discs, centred 34px from the top on phones and 38px on desktop (Navid 2026-11-18). */
@media (min-width: 860px) {
  .psheet-tools .icon-btn { width: 36px; height: 36px; }
  .page-dl { top: calc(env(safe-area-inset-top, 0px) + 20px); }
}
.menu-btn .dots, .w-menu .dots { translate: 0 -5px; }
@media (min-width: 860px) { .w-menu .dots { translate: 0 -9px; } }
/* Poets list tools: «به ترتیب الفبا» on the right, «انتخاب همه» on the left, same size and line. */
.pl-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px 4px; }
.pl-tools .pl-allrow { padding: 0; }
.pl-sort { color: var(--muted); font-size: .9rem; font-family: inherit; font-weight: inherit; background: none; border: 0; padding: 0; cursor: pointer; line-height: 22px; }
.pl-sort:hover { color: var(--ink); }
.poet-list .pl-letter { font-family: var(--poem); font-size: 1.35rem; font-weight: 670; color: var(--accent); padding: 22px 2px 6px; border: 0; list-style: none; }
.poet-list .pl-letter:first-child { padding-top: 10px; }
.pl-sort { display: inline-flex; align-items: center; gap: 4px; }
.pl-sort svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Poets list: portrait and letter disc share one 56px slot, so names start on one line;
   rows without a tick keep its space, so every arrow lines up (Navid 2026-11-18). */
.poet-list .pl-face { width: 56px; height: 56px; margin: -6px 0; }
.poet-list .mono { flex: none; width: 48px; height: 48px; margin-inline: 4px; }
.pl-tick-sp { visibility: hidden; }
/* Home: black round search button between «همه سخنوران» and «ادامه خواندن». */
.w-search { flex: none; align-self: center; width: var(--wb-h, 36px); height: var(--wb-h, 36px); display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: #000; color: #fff; cursor: pointer; box-shadow: 0 8px 28px rgb(20 24 14 / .28); transition: transform .15s; }
.w-search:active { transform: scale(.94); }
.w-search svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.s-res { margin-top: 10px; }
.w-bar { --wb-h: 39px; }
@media (min-width: 860px) { .w-bar { --wb-h: 43px; } }
/* Wall names: cream, no shadow, a little larger; always shown (opacity set from the distance to the screen centre). */
.w-name { color: #f5f2e8; text-shadow: none; opacity: .3; font-size: 1.02rem; transition: none; }
@media (max-width: 767px) { .w-name { font-size: .84rem; } }
/* Every text field: a full capsule, 48px tall, 16px type, 18px search icon 16px from the right (Navid 2026-11-18). */
.search label { height: 48px; padding: 0 15px; border-radius: 999px; gap: 10px; }
.search label svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search input { font: inherit; font-size: 1rem; color: inherit; }
.mx-search input { height: 48px; padding: 0 44px 0 42px; border-radius: 999px; font-size: 1rem; }
.mx-search > svg, .mx-search label > svg { right: 16px; width: 18px; height: 18px; }
/* Menu: the close button sits to the left of the search field (Navid 2026-11-18). */
.mx-top #mxX { order: 2; }
/* Book bookmark: a ribbon hanging from the top left of each cover; outline, red when saved. */
.bk-mark { position: absolute; z-index: 3; top: 0; left: 3%; width: 30px; height: 40px; display: flex; justify-content: center; align-items: flex-start; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bk-mark svg { width: 14px; height: 22px; fill: none; stroke: var(--ink-c); stroke-width: 1.3; stroke-linejoin: round; opacity: .8; transition: fill .2s, stroke .2s, opacity .2s; overflow: visible; }
.bk-mark:hover svg { opacity: 1; }
.bk-mark.on svg { fill: #c0392b; stroke: #c0392b; opacity: 1; }
.bk-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
#sbooks .books { margin-top: 18px; }
/* Ribbon 1.6× the first size, hairline stroke (Navid 2026-11-18). */
.bk-mark { left: 4%; width: 38px; height: 52px; }
.bk-mark svg { width: 22.4px; height: 35.2px; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.bk-mark svg path { vector-effect: non-scaling-stroke; stroke-width: 1px; }
/* The unsaved ribbon is filled with the cover's cloth, so the frame line doesn't show through it. */
.bk-mark:not(.on) svg { fill: var(--cloth); }
/* Anything bookmarked shows in one red, the book-ribbon red (Navid 2026-11-18). */
:root { --saved: #c0392b; }
.bk-mark.on svg { fill: var(--saved); stroke: var(--saved); }
.icon-btn.on svg, .icon-btn.save.on svg, .psheet-tools .pt-save.on svg, .poems .mk-save svg, #bSave[aria-pressed="true"] svg { fill: var(--saved); stroke: var(--saved); color: var(--saved); }
.icon-btn.on, .poems .mk-save { color: var(--saved); }
/* Ribbon fully opaque, so nothing of the frame line shows under it; only its outline is softened. */
.bk-mark svg { opacity: 1; }
.bk-mark:not(.on) svg { stroke: color-mix(in srgb, var(--ink-c) 80%, var(--cloth)); }
/* Couplet meaning: paragraphs, a word list, and the source small at the end. */
.sheet .meaning p + p { margin-top: 10px; }
.sheet .meaning .gloss { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); font-size: .9rem; color: var(--ink-soft); line-height: 1.9; }
.sheet .meaning .gloss b { display: inline; font-size: inherit; color: var(--ink); margin: 0; font-weight: 600; }
.sheet .meaning .m-src { display: block; margin-top: 10px; font-size: .76rem; color: var(--muted); }
/* Sheet buttons always fill the width, however many there are (two for prose, three or four for poems). */
.sheet .actions, .sheet .actions.two, .sheet .actions.four { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }

/* Poets list: «به ترتیب الفبا» and «بر اساس قرن» side by side (0.9.117). */
.pl-sorts { display: inline-flex; align-items: center; gap: 14px; }
.pl-sort, .pl-allrow b { white-space: nowrap; }

/* Book covers (Navid, 2026-11-18): Persian motif on top (drawn by js/covers/), cream band below with the title; no frame line, light spine. */
.cover { background: #e7e1cf; color: #2b2e22; }
.cover .art { position: absolute; top: 0; left: 0; right: 0; height: 59.5%; background: var(--cloth); }
.cover .art svg { display: block; width: 100%; height: 100%; }
.cover::before { z-index: 2; }
.cover::after { z-index: 2; width: 9%; background: linear-gradient(to left, rgb(0 0 0 / .1), rgb(255 255 255 / .04) 55%, rgb(0 0 0 / .08) 62%, transparent); }
.cover .frame { inset: 59.5% 13% 0 8%; border: 0; border-radius: 0; padding: 8% 0 0; align-items: flex-start; justify-content: flex-start; text-align: right; color: #2b2e22; }
.cover { container-type: inline-size; }
.cover .frame { padding-top: 8%; }
.cover .frame b, .wp-shelf .cover .frame b { font-size: 9.2cqw; line-height: 1.35; -webkit-line-clamp: 2; text-wrap: balance; }
.cover .frame small { margin-top: auto; margin-bottom: 9%; font-size: 8.3cqw; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Unsaved ribbon: cream at half opacity, so it shows on every cover colour (Navid 2026-11-18). */
.cover .bk-mark:not(.on) svg { fill: #f1e7d3; stroke: #f1e7d3; opacity: .5; }
/* Cover art must not inherit the icon rule (svg { stroke: currentColor }), which outlined every shape; draw it as designed. */
.cover .art svg { fill: #000; stroke: none; stroke-width: 1; stroke-linecap: butt; stroke-linejoin: miter; }

/* Poet download (0.9.118): the disc slides open to the right into a capsule that fills left to right and counts the size, then closes into a tick. */
.page-dl { display: flex; align-items: center; justify-content: flex-start; gap: 6px; padding: 0 9px; overflow: hidden; white-space: nowrap;
  border-radius: 18px; direction: ltr; transition: width .38s cubic-bezier(.2,.8,.2,1), opacity .3s;
  background: linear-gradient(to right, #4a4f40 calc(var(--p, 0) * 100%), #000 0); }
.page-dl:hover { background: linear-gradient(to right, #4a4f40 calc(var(--p, 0) * 100%), #000 0); }
.page-dl .dl-ico { display: grid; place-items: center; flex: none; width: 18px; height: 18px; }
.page-dl .dl-txt { direction: rtl; font-family: var(--ui); font-size: .82rem; color: #fff; opacity: 0; transition: opacity .2s; font-variant-numeric: tabular-nums; }
.page-dl.busy { width: 178px; }
.page-dl.busy .dl-txt { opacity: 1; transition-delay: .18s; }
.page-dl.busy::before { content: none; }
/* Cover titles: line-clamp needs overflow hidden, which cut the dots above tall letters (فـ); room above, same position (0.9.124). */
.cover .frame b, .wp-shelf .cover .frame b { padding-top: .3em; margin-top: -.3em; padding-bottom: .15em; margin-bottom: -.15em; }
/* Desktop: the menu button sits at the top right, as on phones, not in the centre (Navid 2026-11-19). */
@media (min-width: 860px) {
  .topbar { left: auto; right: calc(var(--gutter) - 11px); translate: none; }
  .w-header { width: 100%; justify-content: flex-start; padding-inline: calc(var(--gutter) - 11px); -webkit-mask-image: none; mask-image: none; }
}

/* Popup sheets (0.9.129, Navid): one inner padding on every side for everything inside.
   The close disc sits that far from the top and left edges, the content that far from the sides,
   and the bottom row of buttons that far from the bottom edge. The grab handle floats and takes no room. */
.sheet { --pad: 22px; padding: var(--pad) var(--pad) calc(var(--pad) + var(--safe-b)); }
.sheet-handle { position: absolute; top: 8px; left: 50%; translate: -50% 0; margin: 0; }
.sheet-body { padding-top: calc(36px + 16px); }
.sheet-x { top: 0; left: 0; }
.sheet h3 { margin-top: 0; }
.sheet .about { margin-top: 0; padding: 0; }
.sheet-body > :last-child, .sheet .about > :last-child { margin-bottom: 0; }
/* All poets page (Navid 2026-11-19): centred; a grid of 3 poets a row (2 on narrow phones), portrait on top, name under it,
   and under each poet with a portrait a small tick «نمایش در خانه». Alphabet/century groups each get their own heading. */
.pl-page .page-title, .pl-page .pl-hint { text-align: center; }
.pl-page .pl-tools { flex-direction: column; justify-content: center; gap: 14px; padding: 10px 0 4px; }
.pl-page .pl-sorts { justify-content: center; gap: 22px; }
.pl-page .pl-allrow { justify-content: center; }
.poet-groups { padding-bottom: 48px; }
.pl-group + .pl-group { margin-top: 18px; }
.pl-head { display: flex; align-items: center; gap: 16px; margin: 40px 0 16px; font-family: var(--poem); font-size: 1.5rem; font-weight: 670; color: var(--accent); }
.pl-head::before, .pl-head::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.pl-head.pl-cent { font-size: 1.2rem; }
.pl-head span { flex: none; padding: 0 4px; }
.poet-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pl-group:first-child .poet-grid { margin-top: 14px; }
@media (max-width: 519px) { .poet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } }
.pt { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 14px 8px 16px; isolation: isolate; }
.pt a { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; color: inherit; }
.pt-pic { display: grid; place-items: center; width: 78%; max-width: 168px; aspect-ratio: 1; }
.pt .pl-face { width: 100%; height: 100%; margin: 0; transition: transform .35s cubic-bezier(.2,.7,.2,1); }
.pt .mono { width: 62%; height: 62%; margin: 0; font-size: clamp(1.6rem, 6vw, 2.6rem); box-shadow: none; transition: transform .35s cubic-bezier(.2,.7,.2,1);
  background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .16); color: var(--ink); }
.pt b { display: block; transition: color .3s; font-size: 1.02rem; line-height: 1.5; overflow-wrap: anywhere; }
.pt-wall { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; padding: 3px 4px; cursor: pointer; color: var(--muted); font-size: .76rem; line-height: 1.4; white-space: nowrap; }
.pt-wall .pl-tick { width: 16px; height: 16px; }
.pt-wall .pl-tick i { border-radius: 4.5px; }
.pt-wall .pl-tick input:checked + i::after { left: 4.6px; top: 1.6px; width: 4px; height: 8px; border-width: 0 1.7px 1.7px 0; }
.pt-wall:has(input:checked) { color: var(--ink-soft); }
.pt-wall:hover { color: var(--ink); }
/* Hover: no box, just a soft light around the portrait, like the home wall (Navid 2026-11-19). */
.pt-pic { position: relative; }
.pt-pic::after { content: ''; position: absolute; inset: -12.5%; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .9s;
  /* Same light as a home wall tile: a circle the size of the tile laid OVER the portrait, alpha .085 x (1 - t^2)^2.2 (sunImage in js/wall.js). */
  background: radial-gradient(circle closest-side, rgb(255 255 255 / .085) 0%, rgb(255 255 255 / .078) 20%, rgb(255 255 255 / .058) 40%, rgb(255 255 255 / .032) 60%, rgb(255 255 255 / .02) 70%, rgb(255 255 255 / .009) 80%, rgb(255 255 255 / .002) 90%, transparent 100%); }
.pt-pic > * { position: relative; }
@media (hover: hover) { .pt:hover .pt-pic::after { opacity: 1; } .pt:hover b { color: #fff; } }
.pt:has(a:active) .pt-pic::after { opacity: 1; }
.pt:has(a:focus-visible) .pt-pic::after { opacity: 1; }
.poet-groups .empty-state { text-align: center; padding: 40px 0; }
@media (max-width: 519px) { .pt { padding: 12px 4px 14px; } .pt b { font-size: .95rem; } .pt-wall { font-size: .72rem; gap: 6px; } }
/* Poets page as square cells like the home wall, set edge to edge (Navid 2026-11-19): 3 a row (2 on narrow phones),
   the cells parted by the same hairline as the century headings (var(--line)), only between cells, never on the outer edge. */
.poet-grid { gap: 0; }
.pt { aspect-ratio: 1; justify-content: center; padding: 6% 6px; border: 0 solid var(--line); border-bottom-width: 1px; border-inline-end-width: 1px; }
.pt a { gap: 6px; }
.pt-pic { width: 58%; max-width: none; }
.pt-wall { margin-top: 4px; }
.poet-grid > .pt:nth-child(3n) { border-inline-end-width: 0; }
.poet-grid > .pt:nth-child(3n+1):nth-last-child(-n+3), .poet-grid > .pt:nth-child(3n+1):nth-last-child(-n+3) ~ .pt { border-bottom-width: 0; }
@media (max-width: 519px) {
  .poet-grid { gap: 0; }
  .pt { padding: 5% 4px; }
  .pt-pic { width: 54%; }
  .poet-grid > .pt:nth-child(3n) { border-inline-end-width: 1px; }
  .poet-grid > .pt:nth-child(2n) { border-inline-end-width: 0; }
  .poet-grid > .pt:nth-child(3n+1):nth-last-child(-n+3), .poet-grid > .pt:nth-child(3n+1):nth-last-child(-n+3) ~ .pt { border-bottom-width: 1px; }
  .poet-grid > .pt.pt:nth-child(2n+1):nth-last-child(-n+2), .poet-grid > .pt:nth-child(2n+1):nth-last-child(-n+2) ~ .pt.pt { border-bottom-width: 0; }
}
/* Hover light: the whole cell, as on a wall tile. */
.pt-pic::after { display: none; }
.pt::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .9s;
  background: radial-gradient(circle closest-side, rgb(255 255 255 / .085) 0%, rgb(255 255 255 / .078) 20%, rgb(255 255 255 / .058) 40%, rgb(255 255 255 / .032) 60%, rgb(255 255 255 / .02) 70%, rgb(255 255 255 / .009) 80%, rgb(255 255 255 / .002) 90%, transparent 100%); }
@media (hover: hover) { .pt:hover::after { opacity: 1; } }
.pt:has(a:active)::after, .pt:has(a:focus-visible)::after { opacity: 1; }
/* Every poet square is closed all round, the outer edge too (Navid 2026-11-19): the grid draws its top and right edge,
   each cell its bottom and left edge, so every line is one hairline thick. */
.poet-grid { border: 0 solid var(--line); border-top-width: 1px; border-inline-start-width: 1px; }
.poet-grid > .pt, .poet-grid > .pt.pt { border-bottom-width: 1px !important; border-inline-end-width: 1px !important; }
/* The «نمایش در خانه» tick is gone; the book ribbon at each square's top left marks a poet (red = on the home wall). */
.pt-wall { display: none; }
.pt-mark { position: absolute; z-index: 3; top: 0; left: 4%; width: 38px; height: 52px; display: flex; justify-content: center; align-items: flex-start; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pt-mark svg { width: 22.4px; height: 35.2px; overflow: visible; fill: #f1e7d3; stroke: #f1e7d3; opacity: .5; transition: fill .2s, stroke .2s, opacity .2s; }
.pt-mark svg path { vector-effect: non-scaling-stroke; stroke-width: 1px; stroke-linejoin: round; }
.pt-mark:hover svg { opacity: .8; }
.pt-mark.on svg { fill: var(--saved); stroke: var(--saved); opacity: 1; }
.pt-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
/* Poet ribbon = book ribbon size on every screen (Navid 2026-11-19). */
/* «کتابخانهٔ من» › «سخنوران»: the marked poets as the same squares, on the portrait green. */
/* «کتابخانهٔ من» › سخنوران (Navid 2026-11-19, 0.9.156): no fill, only the square hairlines; each portrait in a circle on the portrait colour. */
.saved-poets { margin-top: 18px; }
.saved-poets .pt-pic { border-radius: 50%; overflow: hidden; background: #585e4a; }
:root[data-theme="dark"] .saved-poets .pt-pic { background: #2f3526; }
/* Five tabs in «کتابخانهٔ من» fit a phone: they share the width instead of pushing the page sideways. */
@media (max-width: 519px) { #stabs { width: 100%; max-width: 100%; gap: 2px; } #stabs button { flex: 1 1 auto; min-width: 0; padding: 0 6px; font-size: .84rem; white-space: nowrap; } }
/* Unmarked poet ribbon: empty, outlined with exactly the squares' hairline (Navid 2026-11-19). */
.pt-mark:not(.on) svg { fill: none; stroke: var(--line); opacity: 1; }
.pt-mark:not(.on):hover svg { stroke: var(--muted); }
/* Offline cloud (Navid 2026-11-19): empty outline = not downloaded, filled with a tick = downloaded. Poet page button and «کتابخانهٔ من». */
/* Both clouds are solid Material shapes: filled, never stroked (the old stroke rule left the empty cloud invisible). */
svg.cl path { fill: currentColor; stroke: none; }
.page-dl svg.cl { width: 20px; height: 20px; }
.page-dl .dl-ico { width: 20px; height: 20px; }
/* «کتابخانهٔ من»: reading percent and the cloud under each book and poet. */
.lib-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 0 2px; color: var(--muted); font-size: .86rem; line-height: 1; font-variant-numeric: tabular-nums; }
.lib-meta .lib-cl { display: grid; place-items: center; }
.lib-meta svg.cl { width: 22px; height: 22px; }
.pt .lib-meta { justify-content: center; gap: 18px; margin-top: 8px; }
.pt .lib-meta svg.cl { width: 20px; height: 20px; }
/* «کتابخانهٔ من» › کتاب‌ها: books read to 100% sit at the bottom under «خوانده‌شده‌ها», faded (Navid 2026-11-19). */
.lib-done-head { display: flex; align-items: center; gap: 16px; margin: 40px 0 0; font-size: 1.1rem; font-weight: 670; color: var(--muted); }
.lib-done-head::before, .lib-done-head::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.lib-done-head[hidden], .lib-done[hidden] { display: none; }
.book.read-done { opacity: .45; transition: opacity .2s; }
.book.read-done:hover { opacity: .7; }
/* «کتابخانهٔ من»: under each book/poet, right to left: «…» menu, cloud, and the percent at the far left (Navid 2026-11-19). */
.lib-meta, .pt .lib-meta { justify-content: flex-start; gap: 10px; }
.pt .lib-meta { width: 100%; padding: 0 14px; margin-top: 8px; }
.lib-meta .lib-pct { margin-inline-start: auto; }
.lib-dots { display: grid; place-items: center; width: 30px; height: 26px; margin-inline-start: -4px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; }
.lib-dots:hover { color: var(--ink); }
.lib-dots svg.dots3 { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.lib-menu-sub { margin: -6px 0 10px; color: var(--muted); font-size: .9rem; }
.lib-menu { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.lib-menu button { display: flex; align-items: center; gap: 14px; width: 100%; height: 50px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: .95rem; text-align: start; cursor: pointer; }
.lib-menu button:active { transform: scale(.98); }
.lib-menu button:disabled { opacity: .55; cursor: default; }
.lib-menu button svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#lmDel, #lmUndl { color: var(--saved); }
/* Cloud sits in the exact centre of the round poet-page button (Navid 2026-11-19, 0.9.152); the cloud path itself is centred by its viewBox. */
.page-dl:not(.busy) { justify-content: center; padding: 0; gap: 0; }
/* «کتابخانهٔ من» disc on the home bar, beside search (Navid 2026-11-19, 0.9.155). */
.w-search svg.ms, .w-lib svg.ms { width: 21px; height: 21px; } /* home discs: Material search + newsstand (library, Navid 0.9.159) */
/* Material Symbols (Sharp 400 since 0.9.160, self-hosted in js/icons.js; Navid 2026-11-19, 0.9.158): solid shapes, so never stroked.
   A toggled icon carries its filled form (.f) and shows it when on, in place of the outline (.o). */
svg.ms { fill: currentColor !important; stroke: none !important; }
svg.ms .f { display: none; }
.icon-btn.on svg.ms .o, .psheet-tools .pt-save.on svg.ms .o, .poems .mk-save svg.ms .o, #bSave[aria-pressed="true"] svg.ms .o { display: none; }
.icon-btn.on svg.ms .f, .psheet-tools .pt-save.on svg.ms .f, .poems .mk-save svg.ms .f, #bSave[aria-pressed="true"] svg.ms .f { display: inline; }

/* Small controls keep their look but take a finger-sized touch area (at least ~40px) through an invisible halo. */
.lib-dots, .pl-sort, .sort-row button, .bio-toggle { position: relative; }
.lib-dots::after, .pl-sort::after, .sort-row button::after, .bio-toggle::after { content: ''; position: absolute; }
.lib-dots::after { inset: -8px -6px; }
.pl-sort::after { inset: -10px -6px; }
.sort-row button::after { inset: -6px -2px; }
.bio-toggle::after { inset: -8px -6px; }
/* A download on its way: the empty cloud breathes, with how far it is beside it. */
.lib-busy { display: inline-flex; align-items: center; gap: 5px; }
.lib-busy svg.cl { animation: libdl 1.2s ease-in-out infinite alternate; }
.lib-busy small { font-size: .78rem; font-variant-numeric: tabular-nums; }
@keyframes libdl { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lib-busy svg.cl { animation: none; } }
/* Phones: the menu card grows to fit all its rows, so «دربارهٔ سُرایش» is not hidden under the settings. */
@media (max-width: 700px) { .mx-card { height: min(calc(100dvh - 40px), 600px); } }
.mx-off { padding: 12px 8px 6px; font-size: .82rem; }

/* QC fixes (0.9.170). Short screens (a phone on its side): the menu card scrolls as one piece, so its links are
   never squeezed out by the settings under them. */
@media (max-height: 520px) {
  .mx-card { overflow-y: auto; overscroll-behavior: contain; }
  .mx-body { flex: none; overflow: visible; }
}
/* The narrowest phones (320px): the home bar keeps all four buttons inside the screen. */
@media (max-width: 350px) {
  .w-bar { gap: 6px; }
  .w-bar .w-all { padding-inline: 12px; font-size: .78rem; }
}
/* Menu items with an icon (Navid 2026-11-21, 0.9.173). */
.mx-nav a, .mx-nav button { display: flex; align-items: center; gap: 12px; }
.mx-nav .mx-disc { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #000; color: #fff; display: grid; place-items: center; }
.mx-nav .mx-ic { width: 18px; height: 18px; fill: currentColor; stroke: none; }
/* Menu: everything lines up on the same right (and left) edge as the search field (Navid 2026-11-21, 0.9.175). */
.mx-nav a, .mx-nav button { padding-inline: 0; }
.mx-size button:first-child { text-align: right; padding: 0; }
.mx-size button:last-child { text-align: left; padding: 0; }
.mx-sw { padding-inline: 0; }

.mx-ver { text-align: right; }
/* Sheet corners (Navid 2026-11-21, 0.9.176): behind the rounded top corners show exactly what is above the sheet.
   The backdrop starts below the corners, and the page-coloured top strip reaches down behind them. */
.psheet-backdrop { top: calc(var(--sheet-top) + 24px); }
body.psheet-open .top-edge { height: calc(env(safe-area-inset-top, 0px) + var(--sheet-top) + 24px); }
/* Random poem: a fixed die at the bottom right shows another poem (Navid 2026-11-21, 0.9.177). */
.pt-dice { position: fixed; z-index: 3; right: 20px; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0;
  background: #000; color: #fff; display: grid; place-items: center; cursor: pointer; }
.pt-dice svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.pt-dice.roll svg { animation: dice-roll .5s cubic-bezier(.3,.7,.3,1); }
@keyframes dice-roll { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.pt-dice:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 860px) { .pt-dice { right: 32px; bottom: 32px; } }

/* Random die: centred at the bottom, the same size and height as the home page's search/library discs (Navid 2026-11-21, 0.9.179). */
.pt-dice { right: auto; left: 50%; translate: -50% 0; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); width: 39px; height: 39px; }
.pt-dice svg { width: 21px; height: 21px; }
@media (min-width: 860px) { .pt-dice { right: auto; bottom: 36px; width: 43px; height: 43px; } }
/* No colour layer under the poem sheet (Navid 2026-11-21, 0.9.182): the page behind stays as it is.
   The backdrop stays (transparent) so a tap outside the sheet still closes it. */
.psheet-backdrop { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; top: var(--sheet-top); }
