/* دار الموشّحات — أنماط التطبيق
   أخضر الدار يملك الإطار (الرأس والشريطين وشريط العنوان) وعليه زخرفتها الذهبيّة خافتة،
   والذهبيّ للخطوط الفاصلة والعناوين الصغيرة كجداول المخطوطات، والورق أبيض نهاراً، وعاجيٌّ في «ورقيّ»،
   وأخضرُ قاتمٌ ليلاً. خطّ الواجهة «المراعي»، وخطّ الأبيات ما يختاره القارئ («أميري» أوّلاً). */

/* ---------------------------------------------------------------- الخطوط */
@font-face { font-family: 'Almarai'; src: url('/fonts/almarai.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Almarai'; src: url('/fonts/almarai-bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'M Amiri'; src: url('/fonts/amiri.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Naskh'; src: url('/fonts/notonaskh.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Scheherazade'; src: url('/fonts/scheherazade.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Markazi'; src: url('/fonts/markazi.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Lateef'; src: url('/fonts/lateef.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Ruqaa'; src: url('/fonts/arefruqaa.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Reem Kufi'; src: url('/fonts/reemkufi.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Messiri'; src: url('/fonts/messiri.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'M Cairo'; src: url('/fonts/cairo.woff') format('woff'); font-display: swap; }

/* ---------------------------------------------------------------- الألوان والمقاييس */
:root {
  color-scheme: light;
  --green: #094030;
  --green-2: #0d4b39;
  --green-deep: #062e22;
  --on-green: #f6efdf;
  --on-green-2: #b3d6c1;
  --gold: #ad8d49;
  --gold-on-green: #d9b96f;
  --paper: #ffffff;
  --paper-2: #f8f3e8;
  --paper-3: #efe6d2;
  --ink: #18231d;
  --ink-2: #4e5b53;
  --gold-ink: #7d6125;
  --title-ink: #0b3a2c;
  --rule: #e8dfca;
  --rule-strong: #cdb98d;
  --field-border: #9a8758;
  --mark-bg: #f3df9f;
  --danger: #9b2c1f;
  --btn-ink: #f6efdf;
  --btn-bg: #094030;
  --btn-bg-2: #0d4b39;
  --shadow-panel: 0 18px 40px -18px rgb(18 26 22 / 0.42), 0 3px 8px -3px rgb(18 26 22 / 0.14);
  --mark-g: #094030;
  --mark-o: #ad8d49;

  --ui: 'Almarai', system-ui, sans-serif;
  --font-amiri: 'M Amiri', 'Almarai', serif;
  --font-naskh: 'M Naskh', 'M Amiri', serif;
  --font-scheherazade: 'M Scheherazade', 'M Amiri', serif;
  --font-markazi: 'M Markazi', 'M Amiri', serif;
  --font-lateef: 'M Lateef', 'M Amiri', serif;
  --font-ruqaa: 'M Ruqaa', 'M Amiri', serif;
  --font-reemkufi: 'M Reem Kufi', 'Almarai', sans-serif;
  --font-messiri: 'M Messiri', 'Almarai', sans-serif;
  --font-cairo: 'M Cairo', 'Almarai', sans-serif;
  --font-almarai: 'Almarai', sans-serif;
  /* حجم كلّ خطٍّ بالنسبة إلى «أميري»، وتباعد أسطره: تتقارب الخطوط في الحجم الواحد */
  --scale-amiri: 1;        --lh-amiri: 2;
  --scale-naskh: 0.9;      --lh-naskh: 2;
  --scale-scheherazade: 1; --lh-scheherazade: 2.1;
  --scale-markazi: 1.12;   --lh-markazi: 1.8;
  --scale-lateef: 1.3;     --lh-lateef: 1.7;
  --scale-ruqaa: 1.02;     --lh-ruqaa: 2;
  --scale-reemkufi: 0.98;  --lh-reemkufi: 1.9;
  --scale-messiri: 0.94;   --lh-messiri: 1.95;
  --scale-cairo: 0.92;     --lh-cairo: 1.95;
  --scale-almarai: 0.92;   --lh-almarai: 2;

  --read-font: var(--font-amiri);
  --read-scale: var(--scale-amiri);
  --read-lh: var(--lh-amiri);
  --size: 1.2;
  --radius: 6px;
  --page: 58rem;
  --tabbar: 3.75rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
[data-font='naskh'] { --read-font: var(--font-naskh); --read-scale: var(--scale-naskh); --read-lh: var(--lh-naskh); }
[data-font='scheherazade'] { --read-font: var(--font-scheherazade); --read-scale: var(--scale-scheherazade); --read-lh: var(--lh-scheherazade); }
[data-font='markazi'] { --read-font: var(--font-markazi); --read-scale: var(--scale-markazi); --read-lh: var(--lh-markazi); }
[data-font='lateef'] { --read-font: var(--font-lateef); --read-scale: var(--scale-lateef); --read-lh: var(--lh-lateef); }
[data-font='ruqaa'] { --read-font: var(--font-ruqaa); --read-scale: var(--scale-ruqaa); --read-lh: var(--lh-ruqaa); }
[data-font='reemkufi'] { --read-font: var(--font-reemkufi); --read-scale: var(--scale-reemkufi); --read-lh: var(--lh-reemkufi); }
[data-font='messiri'] { --read-font: var(--font-messiri); --read-scale: var(--scale-messiri); --read-lh: var(--lh-messiri); }
[data-font='cairo'] { --read-font: var(--font-cairo); --read-scale: var(--scale-cairo); --read-lh: var(--lh-cairo); }
[data-font='almarai'] { --read-font: var(--font-almarai); --read-scale: var(--scale-almarai); --read-lh: var(--lh-almarai); }

[data-theme='sepia'] {
  --paper: #f5ecd7;
  --paper-2: #ede1c6;
  --paper-3: #e3d3b0;
  --ink: #33291a;
  --ink-2: #66573d;
  --gold-ink: #765a1c;
  --title-ink: #0b3a2c;
  --rule: #e0cfaa;
  --rule-strong: #c4ad7a;
  --field-border: #94804f;
  --mark-bg: #ebd187;
}
[data-theme='night'] {
  color-scheme: dark;
  --green: #0b2d23;
  --green-2: #103b2e;
  --green-deep: #071f18;
  --on-green: #efe7d4;
  --on-green-2: #a6cdb6;
  --gold: #c2a25a;
  --gold-on-green: #d4b46c;
  --paper: #0e1814;
  --paper-2: #16231d;
  --paper-3: #1e2d26;
  --ink: #ebe4d1;
  --ink-2: #a8b2a9;
  --gold-ink: #d4b46c;
  --title-ink: #efe7d4;
  --rule: #24332c;
  --rule-strong: #3f5247;
  --field-border: #6f8277;
  --mark-bg: rgb(212 180 108 / 0.3);
  --danger: #f0a08f;
  --btn-ink: #13201a;
  --btn-bg: #c9a961;
  --btn-bg-2: #d6b872;
  --shadow-panel: 0 18px 44px -14px rgb(0 0 0 / 0.65);
  --mark-g: #e9e2cf;
  --mark-o: #c9a961;
}

/* ---------------------------------------------------------------- الأساس */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-family: var(--ui);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
  color: var(--ink);
  scrollbar-color: var(--rule-strong) var(--paper);
  -webkit-tap-highlight-color: transparent;
}
body { margin: 0; min-height: 100dvh; line-height: 1.7; background: var(--paper); color: var(--ink); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--title-ink); text-decoration-thickness: 1px; text-underline-offset: 0.32em; }
[hidden] { display: none !important; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: color-mix(in srgb, var(--gold) 34%, transparent); color: inherit; }
:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }
input, textarea { caret-color: var(--gold-ink); }
@supports not (scrollbar-color: red blue) {
  ::-webkit-scrollbar { width: 11px; height: 11px; }
  ::-webkit-scrollbar-track { background: var(--paper); }
  ::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 11px; border: 3px solid var(--paper); }
}

.offscreen { position: fixed; inset-block-start: -200px; opacity: 0; pointer-events: none; }
.muted { color: var(--ink-2); }
.icon { width: 1.375rem; height: 1.375rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon .pip { fill: currentColor; stroke: none; }

/* ما على الأخضر: نصٌّ عاجيّ، وعلامتا الدار بلونين فاتحين */
.on-green, .band, .masthead, .topbar, .tabbar, .door-brand, .splash {
  --mark-g: var(--on-green);
  --mark-o: var(--gold-on-green);
  color: var(--on-green);
}
.band :focus-visible, .masthead :focus-visible, .topbar :focus-visible, .tabbar :focus-visible, .door-brand :focus-visible { outline-color: var(--gold-on-green); }
.band ::selection, .masthead ::selection { background: rgb(217 185 111 / 0.42); color: #fff; }

/* الزخرفة الذهبيّة من موقع الدار، خافتةً على الأخضر */
.pattern { position: relative; isolation: isolate; }
.pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--gold-on-green);
  opacity: 0.11;
  -webkit-mask-image: url('/icons/pattern.png');
  mask-image: url('/icons/pattern.png');
  -webkit-mask-size: 228px 132px;
  mask-size: 228px 132px;
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-position: center top;
  mask-position: center top;
}

/* ---------------------------------------------------------------- علامتا الدار */
.mark { position: relative; display: inline-block; flex: none; height: 2rem; }
.mark > i {
  position: absolute;
  inset: 0;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
.mark .mark-g { background: var(--mark-g); }
.mark .mark-o { background: var(--mark-o); }
.mark-tughra { aspect-ratio: 640 / 487; }
.mark-tughra .mark-g { -webkit-mask-image: url('/icons/tughra-green.png'); mask-image: url('/icons/tughra-green.png'); }
.mark-tughra .mark-o { -webkit-mask-image: url('/icons/tughra-gold.png'); mask-image: url('/icons/tughra-gold.png'); }
.mark-word { aspect-ratio: 640 / 247; }
.mark-word .mark-g { -webkit-mask-image: url('/icons/wordmark-green.png'); mask-image: url('/icons/wordmark-green.png'); }
.mark-word .mark-o { -webkit-mask-image: url('/icons/wordmark-gold.png'); mask-image: url('/icons/wordmark-gold.png'); }

/* ---------------------------------------------------------------- البدء */
.splash { min-height: 100dvh; display: grid; place-items: center; background: var(--green); }
.splash .mark-tughra { height: 7.5rem; animation: breathe 1.4s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: 0.55; } to { opacity: 1; } }
.noscript { padding: 2rem; text-align: center; }

/* ---------------------------------------------------------------- الإطار */
.topbar { display: none; background: var(--green); }
.topbar-inner { max-width: 76rem; margin: 0 auto; display: flex; align-items: center; gap: 1.75rem; padding: 0.55rem 1.5rem; min-height: 4.25rem; }
.topbar-brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.topbar-tughra { height: 2.6rem; }
.topbar-word { height: 1.7rem; }
[data-view='home'] .topbar-brand { visibility: hidden; }
.topbar-nav { display: flex; gap: 0.15rem; flex: 1; }
.topbar-nav a, .topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  color: var(--on-green-2);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
}
.topbar-nav a:hover, .topbar-link:hover { color: var(--on-green); background: rgb(255 255 255 / 0.07); }
.topbar-nav a[aria-current='page'], .topbar-link[aria-current='page'] {
  color: var(--gold-on-green);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.7em;
}
.topbar-end { display: flex; align-items: center; gap: 0.25rem; }
.topbar-link .icon { width: 1.2rem; height: 1.2rem; }
.account-name { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 1rem;
  background: var(--gold-on-green);
  color: #13201a;
  font: 700 0.75rem/1 var(--ui);
}
.more-item .badge { background: var(--gold); color: #fff; }
[data-theme='night'] .more-item .badge { color: #13201a; }

.tabbar {
  position: fixed;
  z-index: 30;
  inset-inline: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--green-deep);
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid rgb(217 185 111 / 0.16);
}
.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: var(--tabbar);
  padding: 0.4rem 0.2rem;
  color: var(--on-green-2);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}
.tabbar .icon { width: 1.5rem; height: 1.5rem; }
.tabbar a[aria-current='page'] { color: var(--gold-on-green); }
.tabbar a[aria-current='page'] .icon-star .star { fill: currentColor; }
.badge-dot { position: absolute; top: 0.45rem; inset-inline-end: calc(50% - 1.1rem); width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--gold-on-green); outline: 2px solid var(--green-deep); }

body:has(.tabbar) { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
#app.bare .topbar, #app.bare .tabbar { display: none; }
body:has(#app.bare) { padding-bottom: 0; }

@media (min-width: 760px) {
  .topbar { display: block; }
  .tabbar { display: none; }
  body:has(.tabbar) { padding-bottom: 0; }
}

/* ---------------------------------------------------------------- الشريط الأخضر ورأس الرئيسة */
.band { background: var(--green); }
.topbar + main .band, .topbar + main .masthead { border-top: 1px solid rgb(217 185 111 / 0.14); }
.band-inner { max-width: var(--page); margin: 0 auto; display: flex; align-items: center; gap: 0.6rem; padding: 1.1rem 1rem 1.35rem; }
.band-text { flex: 1; min-width: 0; }
.band-title { margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1.45; }
.band-sub { margin: 0.2rem 0 0; color: var(--on-green-2); font-size: 0.92rem; line-height: 1.75; }
.band-back { margin-inline-start: -0.5rem; }
@media (min-width: 760px) {
  .band-inner { padding: 1.6rem 1.5rem 1.8rem; }
  .band-title { font-size: 1.7rem; }
}

.masthead { background: var(--green); text-align: center; }
.masthead-inner { max-width: 42rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.7rem; padding: 1.6rem 1.25rem 2.1rem; }
.masthead-tughra { height: 4.6rem; }
.masthead-word { height: 3.2rem; }
.masthead-book { margin: 0 0 0.6rem; color: var(--on-green-2); font-size: 0.95rem; }
@media (min-width: 760px) {
  .masthead-inner { padding: 1.4rem 1.5rem 2.75rem; gap: 0.85rem; }
  .masthead-tughra { height: 6.25rem; }
  .masthead-word { height: 4.1rem; }
}

/* ---------------------------------------------------------------- الأزرار والحقول */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.15rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--title-ink);
  font: 700 0.95rem/1.3 var(--ui);
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--gold); background: var(--paper-2); }
.btn .icon { width: 1.2rem; height: 1.2rem; }
.btn-primary { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.btn-primary:hover { background: var(--btn-bg-2); border-color: var(--btn-bg-2); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 8%, var(--paper)); border-color: var(--danger); }
.btn.armed { background: var(--danger); border-color: var(--danger); color: var(--paper); }
.btn-sm { min-height: 2.3rem; padding: 0.3rem 0.8rem; font-size: 0.86rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn[aria-busy='true'] { cursor: progress; }
.link-btn { padding: 0; border: 0; background: none; color: var(--gold-ink); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 0.32em; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  text-decoration: none;
}
.icon-btn:hover { background: rgb(127 127 127 / 0.12); }
.band .icon-btn:hover { background: rgb(255 255 255 / 0.09); }

.form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.field > label, .field-label { font: 700 0.9rem/1.5 var(--ui); color: var(--title-ink); }
.field input, .field textarea, .filter, .list-filter {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--ui);
}
.field textarea { resize: vertical; line-height: 1.9; }
.field input:focus, .field textarea:focus, .filter:focus, .list-filter:focus, .search-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 38%, transparent);
}
[data-theme='night'] :is(.field input, .field textarea, .filter, .list-filter, .search-input):focus { border-color: var(--gold); }
::placeholder { color: #6b726d; opacity: 1; }
[data-theme='sepia'] ::placeholder { color: #6e6250; }
[data-theme='night'] ::placeholder { color: #8d988f; }
.field-hint { margin: 0; color: var(--ink-2); font-size: 0.84rem; line-height: 1.75; }
.field-static { margin: 0; padding: 0.55rem 0; color: var(--ink); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-inline-end: 3.1rem; }
.pass-toggle { position: absolute; inset-inline-end: 0.15rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); }
.form-error {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 7%, var(--paper));
  color: var(--danger);
  font-size: 0.92rem;
  line-height: 1.7;
}
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ---------------------------------------------------------------- البحث */
.search-box { position: relative; display: flex; align-items: center; width: 100%; }
.search-input {
  width: 100%;
  height: 3.25rem;
  padding: 0 3rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 400 1.05rem/1 var(--ui);
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-icon { position: absolute; inset-inline-start: 0.95rem; color: var(--ink-2); pointer-events: none; }
.search-clear { position: absolute; inset-inline-end: 0.3rem; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 0; border-radius: var(--radius); background: none; color: var(--ink-2); }
.search-clear:hover { color: var(--ink); background: var(--paper-2); }
.search-box-hero .search-input { height: 3.5rem; border-color: transparent; background: #fbf7ee; color: #18231d; box-shadow: 0 10px 26px -14px rgb(0 0 0 / 0.55); }
.search-box-hero .search-icon, .search-box-hero .search-clear { color: #4e5b53; }
.search-box-hero .search-input:focus { border-color: var(--gold-on-green); box-shadow: 0 0 0 3px rgb(217 185 111 / 0.45); }
[data-theme='night'] .search-box-hero .search-input { background: var(--paper-2); color: var(--ink); }
[data-theme='night'] .search-box-hero .search-icon, [data-theme='night'] .search-box-hero .search-clear { color: var(--ink-2); }

.page-search .search-head { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.1rem; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; align-items: center; }
.filter { min-height: 2.75rem; padding-block: 0.4rem; font-size: 0.92rem; }
.filters-clear { grid-column: 1 / -1; justify-self: start; font-size: 0.9rem; }
@media (min-width: 760px) {
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
  .filters-clear { grid-column: auto; }
}
.results-count { margin: 0 0 0.5rem; color: var(--gold-ink); font-weight: 700; font-size: 0.9rem; min-height: 1.5em; }
.results-more { margin-top: 1.25rem; }
.search-tips { max-width: 40rem; padding: 0.5rem 0; }
.tips-lead { margin: 0; color: var(--ink-2); line-height: 1.95; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--rule-strong);
  border-radius: 2rem;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
}
.chip:hover { border-color: var(--gold); background: var(--paper-2); }
.chip .icon { width: 1rem; height: 1rem; color: var(--ink-2); }
mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 0.06em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ---------------------------------------------------------------- الصفحات والعناوين والقوائم */
.page { max-width: var(--page); margin: 0 auto; padding: 1.4rem 1rem 3rem; }
.page-narrow { max-width: 38rem; }
@media (min-width: 760px) { .page { padding: 2rem 1.5rem 4.5rem; } }
.page h2, .home-sec h2 { margin: 2.4rem 0 0.8rem; font: 700 1.12rem/1.45 var(--ui); color: var(--title-ink); }
.h2-count { margin-inline-start: 0.6rem; font-size: 0.85rem; font-weight: 400; color: var(--ink-2); }
.count { font: 700 0.86rem/1 var(--ui); color: var(--gold-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 50%, transparent);
}
.sec-head h2 { margin: 0 !important; }
.sec-more { font-size: 0.9rem; font-weight: 700; color: var(--gold-ink); text-decoration: none; }
.sec-more:hover { text-decoration: underline; }
.home-sec + .home-sec { margin-top: 2.6rem; }
.home-sec > h2:first-child { margin-top: 0; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: stretch; border-bottom: 1px solid var(--rule); }
.rows > li:first-child { border-top: 1px solid var(--rule); }
.row { flex: 1; min-width: 0; display: flex; gap: 0.75rem; padding: 0.85rem 0.35rem; color: inherit; text-decoration: none; transition: background-color 0.15s; }
.row:hover { background: var(--paper-2); }
.row-n { flex: none; width: 2.4rem; padding-top: 0.5rem; text-align: center; font: 700 0.86rem/1 var(--ui); color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.row-title { font-family: var(--read-font); font-size: calc(1.28rem * var(--read-scale)); line-height: 1.6; color: var(--title-ink); }
.row-line { font-family: var(--read-font); font-size: calc(1.06rem * var(--read-scale)); line-height: 1.75; color: var(--ink-2); }
.row-line-strong { color: var(--title-ink); font-size: calc(1.15rem * var(--read-scale)); }
.row-meta { font-size: 0.82rem; line-height: 1.7; color: var(--gold-ink); }
.row-note { font-size: 0.86rem; line-height: 1.7; color: var(--ink); }
.row-when { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; color: var(--ink-2); }
.row-when .icon { width: 0.95rem; height: 0.95rem; }
.row-action { align-self: center; margin-inline-end: 0.15rem; color: var(--gold-ink); }
.row-action.is-on .star { fill: currentColor; }
.rows-compact .row { padding-block: 0.6rem; }

.entries { list-style: none; margin: 0; padding: 0; }
.entries > li { border-bottom: 1px solid var(--rule); break-inside: avoid; }
.entry { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 0.35rem; color: var(--ink); text-decoration: none; transition: background-color 0.15s; }
.entry:hover { background: var(--paper-2); }
.entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.entry-label { font-weight: 700; color: var(--title-ink); line-height: 1.55; }
.entry-about { font-size: 0.86rem; line-height: 1.65; color: var(--ink-2); }
.entry-kid { padding-inline-start: 1.6rem; }
.entry-kid .entry-label { font-weight: 400; color: var(--ink); }
.entry-chev { width: 1.1rem; height: 1.1rem; color: var(--ink-2); }
.entries-flow { columns: 2 19rem; column-gap: 2.5rem; }
.entries-flow > li:first-child, .entries-index > li:first-child { border-top: 1px solid var(--rule); }
@media (min-width: 760px) { .entries-index { columns: 2 20rem; column-gap: 2.5rem; } .entries-index > li:first-child { border-top: 0; } }

.list-filter-wrap { position: relative; margin-bottom: 1.1rem; max-width: 26rem; }
.list-filter { padding-inline-start: 2.6rem; }
.list-filter::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.list-filter-icon { position: absolute; inset-inline-start: 0.8rem; top: 0.75rem; width: 1.25rem; height: 1.25rem; color: var(--ink-2); pointer-events: none; }
.list-none { margin: 0.8rem 0 0; color: var(--ink-2); }

.year-group + .year-group { margin-top: 0.5rem; }
.year-group h2 { display: flex; align-items: baseline; }

.letters { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0 0 1.25rem; }
.letters a { display: grid; place-items: center; min-width: 2.5rem; height: 2.5rem; border: 1px solid var(--rule); border-radius: var(--radius); color: var(--title-ink); font-weight: 700; text-decoration: none; }
.letters a:hover { border-color: var(--gold); background: var(--paper-2); }
.alpha-letter { scroll-margin-top: 1rem; padding-bottom: 0.4rem; border-bottom: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); font-family: var(--font-amiri) !important; font-size: 1.6rem !important; font-weight: 400 !important; color: var(--gold-ink) !important; }
.alpha-group .rows > li:first-child { border-top: 0; }

.tabs { display: flex; gap: 0.25rem; overflow-x: auto; margin: 0 0 1.25rem; border-bottom: 1px solid var(--rule); scrollbar-width: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font-weight: 700;
  font-size: 0.94rem;
  text-decoration: none;
  white-space: nowrap;
}
.tab:hover { color: var(--title-ink); }
.tab[aria-current='page'] { color: var(--title-ink); border-bottom-color: var(--gold); }
.tab-count { font-size: 0.8rem; color: var(--gold-ink); }

.empty { max-width: 30rem; margin: 0 auto; padding: 2.75rem 1rem; text-align: center; }
.empty-mark { width: 2.75rem; height: 2.75rem; margin: 0 auto; color: var(--gold); stroke-width: 1.2; }
.empty-title { margin: 0.9rem 0 0.35rem; font-weight: 700; font-size: 1.05rem; color: var(--title-ink); }
.empty-text { margin: 0 0 1.25rem; color: var(--ink-2); line-height: 1.85; }

/* ---------------------------------------------------------------- الرئيسة */
.read-on {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem 0.35rem 1.1rem;
  border-block: 3px double var(--rule-strong);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s;
}
.read-on:hover { background: var(--paper-2); }
.read-on-title { font-family: var(--read-font); font-size: calc(1.7rem * var(--read-scale)); line-height: 1.5; color: var(--title-ink); }
.read-on-line { font-family: var(--read-font); font-size: calc(1.15rem * var(--read-scale)); line-height: 1.8; color: var(--ink-2); }
.read-on-meta { margin-top: 0.2rem; font-size: 0.84rem; color: var(--gold-ink); }
.read-before { margin: 0.85rem 0 0; font-size: 0.92rem; color: var(--ink-2); line-height: 2; }
.read-before a { font-family: var(--read-font); font-size: calc(1.06rem * var(--read-scale)); }
.sep, .dot { color: var(--rule-strong); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.suite-strip {
  list-style: none;
  margin: 0 -1rem;
  padding: 0.2rem 1rem 0.9rem;
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 1rem;
  scrollbar-width: thin;
}
.suite-strip > li { flex: none; scroll-snap-align: start; }
.suite-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 8.6rem;
  height: 100%;
  padding: 0.7rem 0.85rem 0.8rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.suite-tile:hover { border-color: var(--gold); background: var(--paper-2); }
.suite-no { font-family: var(--font-amiri); font-size: 2rem; line-height: 1.3; color: var(--gold-ink); }
.suite-maqams { font-weight: 700; font-size: 0.92rem; line-height: 1.5; color: var(--title-ink); }
.suite-meta { font-size: 0.78rem; color: var(--ink-2); }
@media (min-width: 760px) { .suite-strip { margin: 0; padding-inline: 0; } }

.families { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); column-gap: 2.5rem; }
.family { padding: 0.75rem 0.2rem 0.85rem; border-bottom: 1px solid var(--rule); }
.family-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-weight: 700; font-size: 1.05rem; color: var(--title-ink); text-decoration: none; }
.family-head:hover span:first-child { text-decoration: underline; text-underline-offset: 0.32em; }
.family-kids { margin: 0.3rem 0 0; font-size: 0.88rem; line-height: 2; color: var(--ink-2); }
.family-kids a { color: var(--ink); text-decoration: none; }
.family-kids a:hover { text-decoration: underline; }
.family-kids .count { font-weight: 400; font-size: 0.78rem; }

/* ---------------------------------------------------------------- القطعة */
.poem-band .band-inner { flex-direction: column; align-items: stretch; gap: 0.75rem; padding-top: 0.5rem; padding-bottom: 1.6rem; }
.band-row { display: flex; align-items: center; gap: 0.35rem; min-height: 2.75rem; }
.band-pos { flex: 1; min-width: 0; color: var(--on-green-2); font-size: 0.88rem; line-height: 1.6; }
.band-pos a { color: var(--gold-on-green); text-decoration: none; font-weight: 700; }
.band-pos a:hover { text-decoration: underline; }

/* إطار العنوان: خطّان ذهبيّان مزدوجان فوقه وتحته، وفي طرفيه معيّنان */
.cartouche {
  --c: var(--gold-on-green);
  position: relative;
  align-self: center;
  max-width: min(100%, 40rem);
  margin: 0.15rem 1rem 0;
  padding: 0.75rem 1.75rem 0.85rem;
  text-align: center;
  background:
    linear-gradient(var(--c), var(--c)) center top / 100% 1px no-repeat,
    linear-gradient(var(--c), var(--c)) center 4px / 100% 1px no-repeat,
    linear-gradient(var(--c), var(--c)) center calc(100% - 4px) / 100% 1px no-repeat,
    linear-gradient(var(--c), var(--c)) center bottom / 100% 1px no-repeat;
  animation: rule-draw 0.9s var(--ease-out) both;
}
.cartouche::before, .cartouche::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0.6rem;
  height: 0.6rem;
  border: 1px solid var(--c);
  background: var(--green);
  transform: translateY(-50%) rotate(45deg);
  animation: fade-in 0.5s 0.45s var(--ease-out) both;
}
.cartouche::before { inset-inline-start: -0.3rem; }
.cartouche::after { inset-inline-end: -0.3rem; }
@keyframes rule-draw {
  from { background-size: 24% 1px, 24% 1px, 24% 1px, 24% 1px; }
  to { background-size: 100% 1px, 100% 1px, 100% 1px, 100% 1px; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.poem-title {
  margin: 0;
  font-family: var(--read-font);
  font-weight: 400;
  font-size: calc(clamp(1.75rem, 1.3rem + 2.2vw, 2.6rem) * var(--read-scale));
  line-height: 1.55;
  color: var(--on-green);
}
.poem-title mark { background: rgb(217 185 111 / 0.35); }
.rubrics { display: flex; flex-direction: column; gap: 0.15rem; align-items: center; text-align: center; }
.rubric { margin: 0; font-size: 0.92rem; line-height: 1.95; color: var(--gold-on-green); font-weight: 700; }
.rubric a { color: inherit; text-decoration: none; }
.rubric a:hover { text-decoration: underline; text-underline-offset: 0.35em; }
.rubric .dot { color: var(--on-green-2); font-weight: 400; opacity: 0.7; }
.rubric-people { color: var(--on-green-2); font-weight: 400; font-size: 0.88rem; }
.rubric-people a { color: var(--on-green); }

.reader-tools { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--rule); }
.tools-inner { max-width: var(--page); margin: 0 auto; display: flex; align-items: center; gap: 0.1rem; padding: 0.3rem 0.5rem; overflow-x: auto; scrollbar-width: none; }
.tools-gap { flex: 1; }
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex: none;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-2);
  font: 700 0.88rem/1 var(--ui);
}
.tool:hover { background: var(--paper-2); color: var(--ink); }
.tool:disabled { opacity: 0.4; cursor: default; background: transparent; }
.tool[aria-expanded='true'] { background: var(--paper-3); color: var(--ink); }
.tool-fav[aria-pressed='true'] { color: var(--gold-ink); }
.tool-fav[aria-pressed='true'] .star { fill: currentColor; }
.tool-glyph { font-family: var(--font-amiri); font-weight: 400; line-height: 1; color: var(--ink); }
.tool-glyph-sm { font-size: 1.05rem; }
.tool-glyph-lg { font-size: 1.5rem; }
.tool-op { width: 0.8rem; height: 0.8rem; stroke-width: 2.4; margin-top: 0.1rem; }
.tool-label { display: none; }
.size-out { min-width: 2.9rem; text-align: center; font: 700 0.8rem/1 var(--ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tool-size { display: none; }
@media (min-width: 420px) { .tool-size { display: inline; } }
@media (min-width: 760px) { .tool-label { display: inline; } .tools-inner { padding-inline: 1rem; } }
@media (max-width: 379px) { .tool-extra { display: none; } }

.panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  inset-inline: 0.5rem;
  z-index: 25;
  max-width: 27rem;
  max-height: min(70vh, 34rem);
  overflow: auto;
  padding: 0.85rem;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow-panel);
}
@media (min-width: 760px) { .panel { inset-inline-start: max(1rem, calc((100% - var(--page)) / 2 + 1rem)); inset-inline-end: auto; width: 27rem; } }
.panel-font { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.font-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.5rem 0.7rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  text-align: start;
}
.font-opt:hover { border-color: var(--rule-strong); background: var(--paper-2); }
.font-opt[aria-checked='true'] { border-color: var(--gold); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--gold); }
.font-name { font: 700 0.78rem/1.4 var(--ui); color: var(--ink-2); }
.font-opt[aria-checked='true'] .font-name { color: var(--gold-ink); }
.font-sample { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: calc(1.2rem * var(--s, 1)); line-height: 1.9; }
.seg { margin: 0 0 0.9rem; padding: 0; border: 0; min-width: 0; }
.seg legend { margin-bottom: 0.4rem; padding: 0; font: 700 0.82rem/1.4 var(--ui); color: var(--ink-2); }
.seg-opts { display: flex; border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.seg-opt {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.6rem;
  padding: 0.3rem 0.4rem;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
}
.seg-opt + .seg-opt { border-inline-start: 1px solid var(--rule-strong); }
.seg-opt:hover { background: var(--paper-2); }
.seg-opt[aria-pressed='true'] { background: var(--btn-bg); color: var(--btn-ink); font-weight: 700; }
.swatch { width: 0.95rem; height: 0.95rem; border-radius: 50%; border: 1px solid rgb(0 0 0 / 0.28); }
.swatch-day { background: #ffffff; }
.swatch-sepia { background: #f1e4c6; }
.swatch-night { background: #0e1814; border-color: rgb(255 255 255 / 0.35); }
.panel-size { display: flex; align-items: center; gap: 0.2rem; padding-top: 0.2rem; }
.panel-size-label { flex: 1; font: 700 0.82rem var(--ui); color: var(--ink-2); }
.panel-size .link-btn { margin-inline-start: 0.6rem; font-size: 0.85rem; }
.panel-acts { display: none; }
@media (max-width: 379px) {
  .panel-acts { display: flex; gap: 0.5rem; padding-top: 0.75rem; margin-top: 0.25rem; border-top: 1px solid var(--rule); }
  .panel-acts .btn { flex: 1; justify-content: center; }
}

.reader { max-width: var(--page); margin: 0 auto; padding: 1.6rem 1rem 1rem; }
.hl-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; max-width: 36rem; margin: 0 auto 1.25rem; font-size: 0.88rem; color: var(--ink-2); }
.hl-note .icon { width: 1rem; height: 1rem; color: var(--gold-ink); }

/* الأبيات: متتاليةٌ في الضيّق (الصدر إلى اليمين والعجز إلى اليسار)، ومتقابلةٌ إذا اتّسع السطر لشطرين بهذا الحجم */
.verses {
  container: verses / inline-size;
  font-family: var(--read-font);
  font-size: calc(1.25rem * var(--size) * var(--read-scale));
  line-height: var(--read-lh);
  color: var(--ink);
  touch-action: pan-y;
  --gap: 0.6em;
}
.verses-inner { max-width: 30em; margin: 0 auto; }
.v { margin: 0; display: grid; }
.v + .v, .gap + .v { margin-top: var(--gap); }
.hm { display: block; }
.v1 { text-align: center; }
.v2 .hm:first-child, .v3 .hm:first-child, .v4 .hm:first-child { text-align: start; padding-inline-end: 12%; }
.v2 .hm:last-child, .v3 .hm:last-child, .v4 .hm:last-child { text-align: end; padding-inline-start: 12%; }
.v3 .hm:nth-child(2) { text-align: center; padding: 0; }
.gap { height: 0.4em; }
.gap::after { content: ''; display: block; width: 2.5em; margin: 0.4em auto 0; border-top: 1px solid var(--gold); opacity: 0.7; }
[data-layout='side'] .verses { --gap: 0.25em; }
[data-layout='side'] .v2, [data-layout='side'] .v4 { grid-template-columns: 1fr 1fr; column-gap: 2em; }
[data-layout='side'] .v3 { grid-template-columns: 1fr 1fr 1fr; column-gap: 1.5em; }
[data-layout='side'] :is(.v2, .v3, .v4) .hm { text-align: center; padding: 0; }
/* «تلقائيّ» في الشاشة الضيّقة: متقابلان إذا اتّسع العمود لأطول شطرٍ في القطعة بهذا الحجم
   (يقيسه poem.js ويضع data-fit؛ وفواصل الأعمدة هنا كما في حسابه هناك) */
[data-layout='auto'] .verses[data-fit='side'] .verses-inner { --gap: 0.25em; }
[data-layout='auto'] .verses[data-fit='side'] :is(.v2, .v4) { grid-template-columns: 1fr 1fr; column-gap: 1.5em; }
[data-layout='auto'] .verses[data-fit='side'] .v3 { grid-template-columns: 1fr 1fr 1fr; column-gap: 1.2em; }
[data-layout='auto'] .verses[data-fit='side'] :is(.v2, .v3, .v4) .hm { text-align: center; padding: 0; }
@container verses (min-width: 27em) {
  [data-layout='auto'] .verses-inner { --gap: 0.25em; }
  [data-layout='auto'] .v2, [data-layout='auto'] .v4 { grid-template-columns: 1fr 1fr; column-gap: 2em; }
  [data-layout='auto'] .v3 { grid-template-columns: 1fr 1fr 1fr; column-gap: 1.5em; }
  [data-layout='auto'] :is(.v2, .v3, .v4) .hm { text-align: center; padding: 0; }
}

.facts { max-width: 38rem; margin: 2.75rem auto 0; padding-top: 1.2rem; border-top: 3px double var(--rule-strong); }
.facts-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.25rem; }
.fact { display: contents; }
.facts dt { font: 700 0.84rem/1.95 var(--ui); color: var(--gold-ink); }
.facts dd { margin: 0; font-size: 0.95rem; line-height: 1.95; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.code { font-variant-numeric: tabular-nums; letter-spacing: 0.03em; }

.pager { max-width: 38rem; margin: 2.25rem auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.pager-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  min-height: 4.6rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.pager-item:hover { border-color: var(--gold); background: var(--paper-2); }
.pager-next { align-items: flex-end; text-align: end; }
.pager-label { display: inline-flex; align-items: center; gap: 0.2rem; font: 700 0.8rem/1.4 var(--ui); color: var(--gold-ink); }
.pager-label .icon { width: 1rem; height: 1rem; }
.pager-title { max-width: 100%; font-family: var(--read-font); font-size: calc(1.08rem * var(--read-scale)); line-height: 1.6; color: var(--title-ink); }
.pager-item.is-empty { visibility: hidden; }

/* وضع القراءة: لا شيء غير العنوان والأبيات وأدوات الحجم */
.reading .topbar, .reading .tabbar, .reading .band-row, .reading .rubrics, .reading .facts, .reading .hl-note,
.reading .tool-extra, .reading .tool-fav, .reading .tool-label { display: none !important; }
.reading body { padding-bottom: env(safe-area-inset-bottom) !important; }
.reading .poem-band .band-inner { padding: 0.55rem 1rem 0.8rem; }
.reading .cartouche { padding: 0.35rem 1.4rem 0.45rem; animation: none; }
.reading .poem-title { font-size: calc(clamp(1.2rem, 1rem + 1.2vw, 1.7rem) * var(--read-scale)); }
.reading .reader { padding-top: 1.25rem; }

/* ---------------------------------------------------------------- مختاراتي والمزيد والحساب */
.more-list { list-style: none; margin: 0; padding: 0; }
.more-list > li { border-bottom: 1px solid var(--rule); }
.more-list > li:first-child { border-top: 1px solid var(--rule); }
.more-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  min-height: 3.75rem;
  padding: 0.7rem 0.35rem;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: start;
  text-decoration: none;
  transition: background-color 0.15s;
}
.more-item:hover { background: var(--paper-2); }
.more-item > .icon { color: var(--gold-ink); }
.more-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.more-label { font-weight: 700; color: var(--title-ink); }
.more-sub { font-size: 0.85rem; line-height: 1.6; color: var(--ink-2); }
.more-chev { width: 1.1rem; height: 1.1rem; color: var(--ink-2) !important; }
.more-static { cursor: default; }
.more-static:hover { background: none; }
.more-out .more-label { color: var(--danger); }
.more-out > .icon { color: var(--danger); }
.acc-sec + .acc-sec, form + .acc-sec { margin-top: 2.4rem; }
.acc-sec > h2:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- عن الدار */
.page-read { max-width: 44rem; }
.page-read p, .page-read li { line-height: 2; }
.about-marks { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; padding: 0.75rem 0 0.25rem; }
.about-tughra { height: 6.5rem; }
.about-word { height: 3.6rem; }
.about-motto { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; margin: 1.1rem 0 1.75rem; font-family: var(--font-amiri); font-size: 1.45rem; color: var(--gold-ink); text-align: center; }
.about-pillars { font-family: var(--ui); font-size: 0.9rem; color: var(--ink-2); word-spacing: 0.25em; }
.lead { font-size: 1.1rem; color: var(--ink); }
.about-goals { margin: 0; padding-inline-start: 1.2rem; }
.about-goals li::marker { color: var(--gold); }
.about-goals li + li { margin-top: 0.35rem; }
.about-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.about-links a { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.6rem; padding: 0.35rem 0.95rem; border: 1px solid var(--rule-strong); border-radius: 2rem; text-decoration: none; font-weight: 700; font-size: 0.92rem; }
.about-links a:hover { border-color: var(--gold); background: var(--paper-2); }
.link-out { width: 0.95rem; height: 0.95rem; color: var(--ink-2); }
.about-source { margin-top: 2rem; font-size: 0.86rem; color: var(--ink-2); }
.about-back { margin-top: 2rem; text-align: center; }

/* ---------------------------------------------------------------- المشرفون */
.user-list { list-style: none; margin: 0; padding: 0; }
.user-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem 1.5rem; padding: 1rem 0.35rem; border-bottom: 1px solid var(--rule); }
.user-main { flex: 1 1 17rem; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.user-name { font-weight: 700; color: var(--title-ink); }
.user-contact { align-self: flex-start; font-size: 0.92rem; color: var(--ink); }
.user-note { margin: 0.25rem 0 0; font-size: 0.9rem; line-height: 1.8; color: var(--ink-2); }
.user-meta { font-size: 0.8rem; line-height: 1.7; color: var(--ink-2); }
.user-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.user-extra { flex-basis: 100%; }
.user-extra:empty { display: none; }
.tag { display: inline-block; margin-inline-start: 0.45rem; padding: 0.1rem 0.5rem; border-radius: 1rem; background: var(--paper-3); color: var(--gold-ink); font-size: 0.72rem; font-weight: 700; vertical-align: 0.1em; }
.temp-pass { padding: 0.85rem 1rem; border: 1px dashed var(--gold); border-radius: var(--radius); background: var(--paper-2); }
.temp-pass p { margin: 0 0 0.5rem; }
.temp-pass code { font: 700 1.15rem/1.4 var(--ui); letter-spacing: 0.08em; color: var(--title-ink); }

.edit-grid { display: grid; gap: 1.1rem; }
@media (min-width: 760px) { .edit-grid { grid-template-columns: 1fr 1fr; } .edit-grid .span-2 { grid-column: 1 / -1; } }
.field-read input, .field-read textarea { font-family: var(--read-font); font-size: calc(1.12rem * var(--read-scale)); line-height: 2; }
.field-lines textarea { min-height: 14rem; }
.rev-list { list-style: none; margin: 0; padding: 0; }
.rev { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; padding: 0.85rem 0.35rem; border-bottom: 1px solid var(--rule); }
.rev-list > .rev:first-child { border-top: 1px solid var(--rule); }
.rev-main { flex: 1 1 16rem; display: flex; flex-direction: column; gap: 0.1rem; }
.rev-when { font-weight: 700; font-size: 0.9rem; color: var(--title-ink); }
.rev-who, .rev-what { font-size: 0.85rem; color: var(--ink-2); }

/* ---------------------------------------------------------------- باب الدار (الدخول والتسجيل) */
.door { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.door-brand { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem 1.9rem; background: var(--green); text-align: center; }
.door-brand-inner { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.door-tughra { height: 5.2rem; }
.door-word { height: 3.1rem; }
.door-motto { margin: 0.35rem 0 0; font-family: var(--font-amiri); font-size: 1.3rem; line-height: 1.6; color: var(--gold-on-green); }
.door-pillars { margin: 0; font-size: 0.86rem; color: var(--on-green-2); word-spacing: 0.25em; }
.door-panel { display: flex; justify-content: center; padding: 2rem 1.25rem 3rem; background: var(--paper); }
.door-form { width: 100%; max-width: 24rem; }
.door-title { margin: 0; font: 700 1.5rem/1.45 var(--ui); color: var(--title-ink); }
.door-lead { margin: -0.4rem 0 0.4rem; color: var(--ink-2); font-size: 0.95rem; line-height: 1.9; }
.door-switch, .door-about { margin: 0; text-align: center; font-size: 0.92rem; color: var(--ink-2); }
.door-about a { color: var(--ink-2); }
.door-sent { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 900px) {
  .door { grid-template-rows: none; grid-template-columns: 1.05fr 1fr; }
  .door-brand { padding: 3rem; }
  .door-brand-inner { gap: 1.1rem; }
  .door-tughra { height: 11rem; }
  .door-word { height: 5rem; }
  .door-motto { font-size: 1.6rem; }
  .door-panel { align-items: center; padding: 3rem 2.5rem; }
}

/* ---------------------------------------------------------------- الرسائل العابرة */
.toasts {
  position: fixed;
  z-index: 60;
  inset-inline: 0;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 0.9rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  pointer-events: none;
}
#app.bare ~ .toasts, .reading .toasts { bottom: calc(env(safe-area-inset-bottom) + 1.25rem); }
@media (min-width: 760px) { .toasts { bottom: 2rem; } }
.toast {
  max-width: 28rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  background: #062e22;
  color: #f6efdf;
  font-size: 0.92rem;
  line-height: 1.6;
  box-shadow: 0 12px 28px -12px rgb(0 0 0 / 0.5);
  animation: toast-in 0.35s var(--ease-out);
  transition: opacity 0.25s, transform 0.25s;
}
.toast-error { background: #5c1d14; }
.toast.out { opacity: 0; transform: translateY(0.5rem); }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.75rem); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- الطباعة */
@media print {
  .topbar, .tabbar, .reader-tools, .pager, .band-row, .toasts, .hl-note { display: none !important; }
  body { padding: 0 !important; background: #fff; color: #000; }
  .band { background: none !important; color: #000 !important; }
  .pattern::before { display: none; }
  .cartouche { --c: #ad8d49; animation: none; }
  .cartouche::before, .cartouche::after { background: #fff; }
  .poem-title { color: #000; }
  .rubric, .rubric-people, .rubric-people a { color: #555 !important; }
  .verses { font-size: 15pt; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
