/* المنصة التعليمية — nezakr-style trial (preview only).
   Palette: deep navy + gold + a sparing green, on warm paper.
   No gradients as colour washes; no generic teal/amber. */
:root {
  --navy: #1a2b4a;
  --navy-dark: #12203a;
  --navy-soft: #e8ecf3;
  --gold: #a87b1f;
  --gold-strong: #c9a227;
  --gold-soft: #f6ecd2;
  --green: #1e6b41;
  --ink: #1d2733;
  --muted: #5b6673;
  --line: #e4ddcc;
  --bg: #f7f4ec;
  --card: #fffdf8;
  --radius: 10px;
}
html[data-theme="dark"] {
  --ink: #ece7d9;
  --muted: #9aa7b5;
  --line: #26333f;
  --bg: #0e1622;
  --card: #16222f;
  --navy-soft: #1c2c42;
  --gold-soft: #3a2f14;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Cairo", "Noto Kufi Arabic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
html[data-theme="dark"] a { color: #d8c27a; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }

/* Top ticker strip */
.ticker {
  background: var(--navy-dark);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  overflow: hidden;
  font-size: 0.9rem;
  cursor: pointer;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-label {
  background: var(--gold-strong);
  color: var(--navy-dark);
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 4px;
  white-space: nowrap;
  flex: none;
  position: relative;
  z-index: 2;
  text-decoration: none;
}
.ticker-label:hover { background: #d9b73c; text-decoration: none; }
.ticker-track {
  display: flex;
  gap: 2.5rem;
  white-space: nowrap;
  animation: tick 55s linear infinite;
}
.ticker-item { opacity: 0.95; }

/* News page */
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.news-card h3 { font-size: 1.05rem; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.news-card p { margin: 0; color: var(--ink); line-height: 1.7; }
.news-date { font-size: 0.85rem; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(50%); } }

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 46px; height: 46px; border-radius: 50%; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.15rem; }
.brand-text small { color: var(--muted); font-size: 0.8rem; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  color: var(--ink);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
}
.main-nav a.active, .main-nav a:hover {
  background: var(--navy-soft);
  color: var(--navy);
  text-decoration: none;
}
html[data-theme="dark"] .main-nav a.active, html[data-theme="dark"] .main-nav a:hover { color: #d8c27a; }
.header-search { margin-inline-start: auto; display: flex; gap: 6px; }
.header-search input, .hero-search input, .filters input, .filters select, .form input, .form select, .form textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--card);
  color: var(--ink);
  width: 100%;
}
.header-search input { width: 220px; }

/* Buttons */
.btn {
  display: inline-block;
  border: 1px solid var(--navy);
  border-radius: 8px;
  padding: 10px 22px;
  font-weight: 800;
  cursor: pointer;
  background: transparent;
  color: var(--navy);
  text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
html[data-theme="dark"] .btn-primary { background: #2c4a73; }
.btn-ghost { background: var(--card); }

/* Hero — solid deep navy with a faint ruled texture and a gold rule.
   No colour gradient wash. */
.hero {
  background-color: var(--navy);
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 16px);
  color: #fff;
  border-top: 3px solid var(--gold-strong);
  border-radius: 12px;
  padding: 40px 32px;
  margin: 24px 0 18px;
}
.hero-kicker { margin: 0 0 10px; color: var(--gold-strong); font-weight: 800; letter-spacing: 0.02em; }
.hero h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 900; line-height: 1.3; }
.hero-sub { max-width: 640px; color: rgba(255,255,255,0.88); margin: 12px 0 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn-primary { background: var(--gold-strong); border-color: var(--gold-strong); color: var(--navy-dark); }
.hero-actions .btn-primary:hover { background: #d9b73c; }
.hero-actions .btn-ghost { border-color: rgba(255,255,255,0.7); color: #fff; background: transparent; }
.hero-search { display: flex; gap: 8px; max-width: 560px; margin-top: 20px; }
.hero-search input { border: none; }
.hero-search button {
  border: none; border-radius: 8px; padding: 9px 20px;
  background: var(--gold-strong); color: var(--navy-dark); font-weight: 800; cursor: pointer;
}

/* Stats bar — one hairline-divided strip, not four identical boxes */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 8px;
}
.stat { padding: 18px 10px; text-align: center; }
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat strong { display: block; font-size: 1.9rem; color: var(--navy); line-height: 1.2; }
html[data-theme="dark"] .stat strong { color: var(--gold-strong); }
.stat span { color: var(--muted); font-size: 0.95rem; }

/* Blocks */
.block { margin: 34px 0; }
.block-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.block-head h2 { font-size: 1.45rem; padding-bottom: 8px; border-bottom: 3px solid var(--gold-strong); }
.block-head p { margin: 0; color: var(--muted); }
.more { margin-inline-start: auto; font-weight: 800; }

.stage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stage-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  color: var(--ink);
  cursor: pointer;
}
.stage-card:hover { border-color: var(--navy); background: var(--navy-soft); text-decoration: none; }
.stage-card .stage-ico {
  width: 46px; height: 46px; margin: 0 auto 10px;
  border: 1.5px solid var(--gold-strong); border-radius: 50%;
  display: grid; place-items: center; color: var(--navy);
}
.stage-card .stage-ico svg { width: 22px; height: 22px; }
html[data-theme="dark"] .stage-card .stage-ico { color: var(--gold-strong); }
.stage-card strong { display: block; font-size: 1.1rem; margin: 6px 0 2px; line-height: 1.4; }
.stage-card span { color: var(--muted); font-size: 0.9rem; }

/* File cards — hairline borders, no shadows; real cover image on top,
   typographic cover underneath for files without a thumbnail. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.file-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.file-card:hover { border-color: var(--navy); }
.file-cover {
  height: 150px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.cover-type {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  gap: 2px; padding: 14px;
  color: #fff;
}
.cover-type strong { font-size: 1.05rem; line-height: 1.4; }
.cover-type span { font-size: 0.85rem; opacity: 0.85; }
.cover-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
}
.file-cover .sec-badge {
  position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2;
  background: var(--navy); color: #fff;
  font-size: 0.75rem; font-weight: 800;
  padding: 2px 10px; border-radius: 4px;
}
.file-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.file-body h3 { font-size: 0.98rem; }
.file-meta { color: var(--muted); font-size: 0.85rem; }
.file-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.file-actions .btn { padding: 6px 14px; font-size: 0.9rem; }
.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.9rem;
}
.icon-btn.saved { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }

/* Picks (latest per section) */
.pick-group { margin-bottom: 18px; }
.pick-group h3 {
  font-size: 1.1rem; margin-bottom: 10px;
  border-inline-start: 3px solid var(--gold-strong);
  padding-inline-start: 10px;
}

/* Collections */
.collections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.collection-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold-strong);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--ink);
}
.collection-card:hover { border-color: var(--navy); border-top-color: var(--navy); text-decoration: none; }
.collection-card strong { display: block; font-size: 1.1rem; }
.collection-card span { color: var(--muted); font-size: 0.9rem; }

/* Sources */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.source-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--ink);
}
.source-card:hover { border-color: var(--navy); text-decoration: none; }
.source-card strong { display: block; }
.source-card strong::after { content: " ↗"; color: var(--gold); font-size: 0.85em; }
.source-card span { color: var(--muted); font-size: 0.9rem; }

/* Browse filters */
.page-head { margin: 26px 0 14px; }
.page-head h1 { font-size: 1.7rem; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.filters {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 800;
}
.pill:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
/* Active tab is intentionally identical to the قراءة button — no extra marker. */
html[data-theme="dark"] .pill { background: #2c4a73; border-color: #2c4a73; }
html[data-theme="dark"] .pill:hover { background: #24405f; border-color: #24405f; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.filter-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* Store / forms */
.store-card {
  display: flex; gap: 20px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.store-icon {
  width: 84px; height: 84px; border-radius: 18px; flex: none;
  background: var(--navy); color: #fff;
  border: 2px solid var(--gold-strong);
  display: grid; place-items: center;
  font-size: 3rem; font-weight: 900;
}
.form {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 560px;
}
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 0.95rem; }
.form-msg { margin: 0; font-weight: 700; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: #b91c1c; }
.switch-row { flex-direction: row !important; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); }

/* Footer */
.site-footer {
  border-top: 3px solid var(--gold-strong);
  background: var(--card);
  margin-top: 40px;
  padding: 28px 0 90px;
}
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 20px; }
.footer-inner nav, .footer-inner .social { display: flex; flex-direction: column; gap: 6px; }
.footer-inner p { color: var(--muted); margin: 6px 0 0; }

/* Mobile nav */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; right: 0; left: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 50;
  justify-content: space-around;
  padding: 6px 4px;
}
.mobile-nav a {
  color: var(--ink); font-size: 0.78rem; font-weight: 700; padding: 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.mobile-nav a svg { width: 20px; height: 20px; }
.mobile-nav a.active { color: var(--navy); }
html[data-theme="dark"] .mobile-nav a.active { color: var(--gold-strong); }

/* The hidden attribute must win over display rules (e.g. .reader uses display:grid). */
[hidden] { display: none !important; }

/* Reader modal */
.reader {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  display: grid; place-items: center; padding: 16px;
}
.reader-box {
  background: var(--card);
  border-radius: var(--radius);
  width: min(920px, 100%);
  height: min(640px, 92vh);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}
.reader-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.reader-head button { border: none; background: none; font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.reader iframe { flex: 1; border: none; width: 100%; }
.reader-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Toast */
.toast {
  position: fixed; bottom: 76px; right: 50%; transform: translateX(50%);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; z-index: 120;
  font-weight: 700;
}

@media (max-width: 720px) {
  .main-nav, .header-search { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-inline-start: none; border-top: 1px solid var(--line); }
  .stat:nth-child(4) { border-top: 1px solid var(--line); }
  .stage-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; }
  .mobile-nav { display: flex; }
  .hero { padding: 28px 18px; }
  .ticker-track { animation-duration: 35s; }
}

/* ===== 2026-12-05 fixes ===== */
/* Search + social icon row under the stage list (same as the app) */
.quick-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 4px;
}
.quick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 8px 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); font-weight: 700; font-size: 0.82rem; text-align: center;
}
.quick-btn:hover { border-color: var(--navy); text-decoration: none; }
.quick-btn svg { width: 26px; height: 26px; flex: none; }
.quick-search { background: var(--navy); border-color: var(--navy); color: #fff; }
.quick-search:hover { background: var(--navy-dark); }
.quick-play svg { color: #01875f; }
.quick-whatsapp svg { color: #25d366; }
.quick-telegram svg { color: #229ed9; }
.quick-facebook svg { color: #1877f2; }
.quick-youtube svg { color: #ff0000; }
html[data-theme="dark"] .quick-search { background: #2c4a73; border-color: #2c4a73; }
#view-browse .quick-row { margin: 0 0 14px; }
.static-page main > .quick-row { margin: 18px 0 0; }

/* Footer: 4 columns + legal links */
.footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr; }
.footer-mail a { color: var(--navy); font-weight: 700; }
html[data-theme="dark"] .footer-mail a { color: var(--gold-strong); }
.footer-copy { color: var(--muted); font-size: 0.85rem; margin-top: 18px; text-align: center; }

/* Reader: long titles never overlap the close button; actions wrap evenly */
.reader-head { gap: 12px; align-items: flex-start; }
#readerTitle {
  flex: 1; min-width: 0; font-size: 1rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.reader-head button {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--navy-soft); display: grid; place-items: center; line-height: 1;
}
.reader-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.reader-actions .btn { justify-content: center; text-align: center; width: 100%; white-space: nowrap; }

/* Request form choices */
.choice-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.choice-group legend { font-weight: 700; font-size: 0.95rem; padding: 0 6px; }
.form label.choice { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; }
.form-note { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--gold-soft); font-weight: 700; }
.form-note a { text-decoration: underline; }

/* Static pages (about, privacy, terms, contact, disclaimer, 404) */
.page-nav { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.page-nav a { color: var(--ink); font-weight: 700; font-size: 0.95rem; padding: 4px 2px; }
.page-nav a:hover { color: var(--navy); }
.legal {
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--gold-strong);
  border-radius: var(--radius); padding: 24px 28px; margin-top: 26px; line-height: 1.95;
}
.legal h1 { font-size: 1.8rem; margin-bottom: 2px; }
.legal-updated { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.legal-lead { font-size: 1.08rem; font-weight: 600; }
.legal section { margin-top: 20px; }
.legal h2 { font-size: 1.25rem; padding-bottom: 6px; border-bottom: 2px solid var(--line); margin-bottom: 8px; }
.legal ul { padding-inline-start: 22px; margin: 6px 0; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--navy); font-weight: 700; text-decoration: underline; }
html[data-theme="dark"] .legal a { color: var(--gold-strong); }
.legal .btn { text-decoration: none; }
.legal .btn-primary { color: #fff; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.legal a.contact-card {
  display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; line-height: 1.6;
}
.legal a.contact-card:hover { border-color: var(--navy); }
.contact-card strong { display: block; }
.contact-card span span { display: block; color: var(--muted); font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.contact-card em { font-style: normal; color: var(--navy); font-size: 0.85rem; font-weight: 800; }
.contact-ico { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-soft); color: var(--navy); }
.contact-ico svg { width: 24px; height: 24px; }
.contact-whatsapp .contact-ico { color: #25d366; } .contact-telegram .contact-ico { color: #229ed9; }
.contact-facebook .contact-ico { color: #1877f2; } .contact-youtube .contact-ico { color: #ff0000; } .contact-play .contact-ico { color: #01875f; }
.static-page .site-footer { padding-bottom: 28px; }

@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-inner > div:first-child { grid-column: 1 / -1; }
  .quick-row { gap: 6px; }
  .quick-btn { min-height: 58px; font-size: 0.72rem; padding: 6px 2px; }
  .quick-btn svg { width: 24px; height: 24px; }
  .reader { padding: 8px; }
  .reader-box { height: 94vh; }
  .reader-head { padding: 10px 12px; }
  .reader-actions { padding: 10px 12px; }
  .reader-actions .btn { padding-inline: 6px; font-size: 0.9rem; }
  .static-page .header-inner { flex-wrap: wrap; }
  .page-nav { width: 100%; justify-content: space-between; }
  .page-nav a { font-size: 0.88rem; }
  .legal { padding: 18px 16px; }
  .legal h1 { font-size: 1.5rem; }
}
@media (max-width: 360px) {
  .quick-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.form input[type="radio"], .form input[type="checkbox"] { width: 20px; height: 20px; padding: 0; margin: 0; flex: none; accent-color: var(--navy); }
.form label.choice { white-space: nowrap; }
.switch-row span { white-space: nowrap; }
@media (max-width: 720px) {
  .page-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; text-align: center; }
  .page-nav a { font-size: 0.8rem; padding: 4px 0; white-space: nowrap; }
}

/* Reader: Drive pop-out guard + app buttons */
.reader-frame { position: relative; flex: 1; min-height: 0; display: flex; }
.reader-frame iframe { flex: 1; width: 100%; height: 100%; border: none; }
.frame-guard {
  position: absolute; top: 0; right: 0; width: 72px; height: 64px;
  background: transparent; z-index: 2; cursor: default; touch-action: pan-y;
}
.btn-app { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.play-ico { width: 1.1em; height: 1.1em; flex: none; display: block; }
.reader-actions { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.file-actions { flex-wrap: wrap; }
.file-actions .btn-app { flex: 1 1 auto; justify-content: center; }
.file-actions .btn { padding: 6px 10px; }
@media (max-width: 720px) {
  .file-actions .btn { font-size: 0.85rem; padding: 6px 8px; }
}
@media (min-width: 721px) {
  .file-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .file-actions [data-open] { order: 1; justify-content: center; }
  .file-actions .icon-btn { order: 2; justify-content: center; text-align: center; }
  .file-actions .btn-app { order: 3; grid-column: 1 / -1; }
}

/* ---------- AdSense slots (2026-12-05) — reserved space only when a unit will load ---------- */
.ad-slot { display: block; height: 0; margin: 0; overflow: hidden; }
html.alm-ads-on .ad-slot.ad-ready, html.alm-ads-on .ad-slot[data-alm-filled] {
  height: auto; overflow: visible; min-height: 280px; margin: 36px auto; max-width: 970px;
  padding-top: 22px; position: relative; text-align: center; clear: both;
}
html.alm-ads-on .ad-slot.ad-ready::before, html.alm-ads-on .ad-slot[data-alm-filled]::before {
  content: "إعلان"; position: absolute; top: 0; inset-inline-start: 0; font-size: 0.72rem; color: var(--muted); letter-spacing: .02em;
}
@media (min-width: 768px) { html.alm-ads-on .ad-slot.ad-ready, html.alm-ads-on .ad-slot[data-alm-filled] { min-height: 250px; } }
html.alm-ads-on .ad-slot.ad-compact.ad-ready, html.alm-ads-on .ad-slot.ad-compact[data-alm-filled] {
  min-height: 112px; margin: 0; padding: 18px 16px 4px; max-width: none; flex: 0 0 auto; border-bottom: 1px solid var(--line);
}
html.alm-ads-on .ad-slot.ad-compact::before { inset-inline-start: 16px; top: 2px; }
.ad-slot ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }

/* ---------- original intro text on list views ---------- */
.intro { background: var(--card, #fff); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 10px 0 18px; line-height: 1.9; }
.intro h2 { font-size: 1.15rem; margin: 0 0 6px; }
.intro p { margin: 0 0 8px; color: var(--ink); }
.intro p:last-child { margin-bottom: 0; }
.intro ul { margin: 6px 0 0; padding-inline-start: 20px; }
.about-block p { line-height: 1.95; }
html.alm-ads-on .ad-slot.ad-after-form.ad-ready, html.alm-ads-on .ad-slot.ad-after-form[data-alm-filled] { margin-top: 56px; }

/* ---------- theme toggle button ---------- */
.theme-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; margin-inline-start: auto; }
.header-search + .theme-btn { margin-inline-start: 0; }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .ico-moon { display: none; }
html[data-theme="light"] .theme-btn .ico-sun { display: none; }
html[data-theme="light"] .theme-btn .ico-moon { display: inline; }
html[data-theme="dark"] .theme-btn { color: var(--gold-strong); }
@media (max-width: 720px) { .theme-btn { margin-inline-start: auto !important; padding: 6px 10px; } }

/* ---------- search autocomplete ---------- */
.ac-host { position: relative; }
.ac-list { position: absolute; top: calc(100% + 4px); inset-inline: 0; min-width: 260px; z-index: 150; list-style: none; margin: 0; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.18); max-height: 60vh; overflow-y: auto; text-align: start; }
.header-search .ac-list { inset-inline-end: auto; width: 340px; max-width: 92vw; }
.ac-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; line-height: 1.5; }
.ac-list li strong { font-size: .95rem; color: var(--ink); font-weight: 700; }
.ac-list li span { font-size: .8rem; color: var(--muted); }
.ac-list li.on, .ac-list li:hover { background: var(--navy-soft, #e8ecf3); }
.ac-list li.ac-empty { cursor: default; color: var(--muted); }
.search-label.ac-host { display: block; }
html[data-theme="dark"] .ac-list { box-shadow: 0 10px 28px rgba(0,0,0,.5); }

/* ad preview (local QA only; never loads AdSense) */
html.alm-ads-preview .ad-slot.ad-ready { outline: 2px dashed #c9a227; outline-offset: 4px; }
html.alm-ads-preview .ad-slot.ad-ready::after { content: "مساحة إعلان (معاينة)"; display: grid; place-items: center; min-height: inherit; color: var(--muted); font-size: .85rem; }
html[data-theme="dark"] .btn-ghost, html[data-theme="dark"] .icon-btn { color: var(--ink); border-color: #3a4a5c; background: transparent; }
html[data-theme="dark"] .reader-actions .btn-ghost { color: #ece7d9; border-color: #4a5a6c; }
html[data-theme="dark"] #headerSearchBtn { background: #2c4a73; color: #fff; border-color: #2c4a73; }
@media (max-width: 720px) { .static-page .page-nav { order: 2; width: 100%; } .static-page .theme-btn { order: 1; } }

/* section badge on cards = same navy + white text as the «قراءة» button (.btn-primary), light and dark */
.file-cover .sec-badge { background: var(--navy); color: #fff; font-weight: 800; }
html[data-theme="dark"] .file-cover .sec-badge { background: #2c4a73; color: #fff; }
