/* ركّز v99 — تصميم المكتبة والقارئ. يعتمد على متغيرات upgrade-v97.css */

/* الرفوف: رف بعرض كامل، وبطاقات في شبكة متجاوبة */
html body #shelves-grid95{ display:grid!important; grid-template-columns:1fr!important; gap:var(--r97-s6,1.5rem)!important; max-width:1100px; margin-inline:auto; }
#shelves-grid95 .shelf-card{ padding:var(--r97-s5,1.25rem)!important; border-radius:var(--r97-r-lg,22px)!important; }
#shelves-grid95 .shelf-title{ display:flex!important; align-items:center; gap:.55rem; margin-bottom:var(--r97-s4,1rem)!important; }
#shelves-grid95 .shelf-title .count99{ margin-inline-start:auto; font-size:.78rem; font-weight:700; color:var(--text-muted); background:var(--fill); padding:.2rem .65rem; border-radius:99px; }
#view-library .shelf-list{ display:grid!important; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:var(--r97-gap,1rem)!important; list-style:none; margin:0; padding:0; }
#view-library .shelf-list > li{ margin:0!important; min-width:0; display:flex; }
#view-library .shelf-list > li[hidden],#view-library .shelf-list > li.over99{ display:none!important; }
#view-library .shelf-list > .shelf-empty{ grid-column:1/-1; }
.more99{ display:flex!important; margin:var(--r97-s4,1rem) auto 0; }

/* البطاقة */
.card99{
  width:100%; display:flex; flex-direction:column; align-items:stretch; gap:.45rem; text-align:start;
  padding:1rem 1.05rem; border-radius:var(--r97-r-md,16px); border:1px solid var(--line); background:var(--field);
  color:var(--text-main); font:inherit; cursor:pointer; min-height:170px;
  transition:transform var(--r97-dur,.2s) var(--r97-ease,ease),box-shadow var(--r97-dur,.2s),border-color var(--r97-dur,.2s);
}
.card99:hover{ transform:translateY(-2px); border-color:var(--line-strong); box-shadow:0 10px 26px rgba(0,0,0,.1); }
.card99:active{ transform:scale(.99); }
.card99-top{ display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; font-size:.74rem; color:var(--text-muted); font-weight:700; }
.card99-min{ margin-inline-start:auto; white-space:nowrap; }
.card99-read{ color:var(--r97-success,#15803d); font-weight:800; }
.card99.is-read{ opacity:.82; }
.card99-title{ font-size:1rem; font-weight:800; line-height:1.55; }
.card99-sum{ color:var(--text-muted); font-size:.86rem; line-height:1.7; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.card99-cta{ margin-top:auto; display:inline-flex; align-items:center; gap:.3rem; font-size:.84rem; font-weight:800; color:var(--accent-ink,var(--text-main)); }
.card99-cta .ic{ width:1rem; height:1rem; }
html[dir="rtl"] .card99-cta .ic{ transform:none; }

/* وسوم التصنيفات (ألوان هادئة متميزة) */
.tag99{ display:inline-block; padding:.12rem .55rem; border-radius:99px; font-size:.72rem; font-weight:800; background:var(--fill); color:var(--text-main); border:1px solid var(--line); white-space:nowrap; }
.tag99-study{ background:rgba(37,99,235,.1); color:#1d4ed8; border-color:rgba(37,99,235,.25); }
.tag99-exams{ background:rgba(220,38,38,.09); color:#b91c1c; border-color:rgba(220,38,38,.25); }
.tag99-mindset{ background:rgba(124,58,237,.1); color:#6d28d9; border-color:rgba(124,58,237,.25); }
.tag99-time{ background:rgba(217,119,6,.11); color:#b45309; border-color:rgba(217,119,6,.28); }
.tag99-digital{ background:rgba(8,145,178,.1); color:#0e7490; border-color:rgba(8,145,178,.25); }
.tag99-wellbeing{ background:rgba(22,163,74,.1); color:#15803d; border-color:rgba(22,163,74,.25); }
.tag99-life{ background:rgba(219,39,119,.09); color:#be185d; border-color:rgba(219,39,119,.25); }
:root[data-theme="dark"] .tag99-study{ color:#93c5fd } :root[data-theme="dark"] .tag99-exams{ color:#fca5a5 }
:root[data-theme="dark"] .tag99-mindset{ color:#c4b5fd } :root[data-theme="dark"] .tag99-time{ color:#fcd34d }
:root[data-theme="dark"] .tag99-digital{ color:#67e8f9 } :root[data-theme="dark"] .tag99-wellbeing{ color:#86efac }
:root[data-theme="dark"] .tag99-life{ color:#f9a8d4 }

/* «ابدأ من هنا» */
.featured99{ max-width:1100px; margin:0 auto var(--r97-s6,1.5rem); padding:var(--r97-s5,1.25rem); border-radius:var(--r97-r-lg,22px); background:var(--glass); border:1px solid var(--edge); box-shadow:var(--shadow); }
.featured99[hidden]{ display:none!important; }
.featured99-head{ display:flex; align-items:center; gap:.75rem; flex-wrap:wrap; margin-bottom:var(--r97-s4,1rem); }
.featured99-head h3{ font-size:1.1rem; font-weight:800; margin:0; }
.featured99-head small{ color:var(--text-muted); font-weight:700; font-size:.8rem; }
.progress99{ flex:1; min-width:120px; max-width:240px; height:8px; border-radius:99px; background:var(--fill); overflow:hidden; margin-inline-start:auto; }
.progress99 i{ display:block; height:100%; background:var(--accent,#111); border-radius:inherit; }
.featured99-list{ list-style:none; margin:0; padding:0; display:grid; gap:var(--r97-gap,1rem); grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); }
.featured99-list > li{ display:flex; }
.feat99 .card99{ border-color:var(--line-strong); background:var(--glass-strong); }
.feat99-label{ align-self:flex-start; font-size:.72rem; font-weight:800; padding:.18rem .6rem; border-radius:99px; background:var(--accent,#111); color:var(--on-accent,#fff); }
:root[data-theme="dark"][data-palette="monochrome"] .feat99-label{ color:#111; }
.feat99-why{ font-size:.76rem; color:var(--text-muted); font-weight:700; }

/* نتائج البحث بالشبكة نفسها */
#lib-results95 .shelf-list{ max-width:1100px; margin-inline:auto; }

/* القارئ */
#article-modal .modal-card.reader99{
  position:relative; width:min(760px,calc(100% - 1.5rem)); max-width:760px!important; max-height:calc(100dvh - 2rem);
  overflow-y:auto; overscroll-behavior:contain; padding:1.6rem clamp(1.1rem,4vw,2.4rem) 0!important; text-align:start;
}
.reader99 .readbar99{ position:sticky; top:-1.6rem; margin:-1.6rem calc(-1 * clamp(1.1rem,4vw,2.4rem)) 1.1rem; height:4px; background:var(--fill); z-index:3; }
.reader99 .readbar99 i{ display:block; height:100%; width:0; background:var(--accent,#111); transition:width .15s linear; }
.reader99-x{ position:sticky!important; top:.2rem; float:left; z-index:4; margin-inline-start:.5rem; background:var(--glass-strong)!important; }
.reader99 #art-title{ font-size:clamp(1.3rem,1.1rem + 1vw,1.7rem); line-height:1.5; font-weight:800; margin-bottom:.4rem; }
.reader99 #art-meta{ display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; color:var(--text-muted); font-size:.82rem; font-weight:700; margin-bottom:1rem; }
.reader99 #art-body{ font-size:1.06rem; line-height:2; }
.reader99 #art-body .lead99{ font-size:1.1rem; font-weight:700; color:var(--text-main); border-inline-start:4px solid var(--accent,#111); padding-inline-start:.85rem; margin:0 0 1.1rem; }
.reader99 #art-body h4{ font-size:1.15rem; margin:1.5rem 0 .45rem; }
.reader99 #art-body li{ margin:.35rem 0; }
.reader99 #art-body .tip{ border-inline-start:4px solid var(--r97-success,#15803d); }
.reader99-extra{ margin-top:1.4rem; padding-top:1.1rem; border-top:1px solid var(--line); }
.reader99-actions{ display:flex; gap:.6rem; flex-wrap:wrap; }
.reader99-actions .btn{ flex:1 1 180px; }
.rel99-title{ margin:1.2rem 0 .6rem; font-size:1rem; font-weight:800; }
.rel99{ list-style:none; margin:0; padding:0; display:grid; gap:.5rem; }
.rel99 button{ width:100%; display:flex; align-items:center; gap:.6rem; padding:.7rem .85rem; min-height:48px; border-radius:var(--r97-r-md,16px); border:1px solid var(--line); background:var(--field); color:var(--text-main); font:inherit; text-align:start; cursor:pointer; }
.rel99 button:hover{ background:var(--fill); }
.rel99 b{ flex:1; font-size:.92rem; }
.rel99 small{ color:var(--text-muted); font-weight:700; white-space:nowrap; }
.reader99 .set-actions{ position:sticky; bottom:0; margin:1.2rem calc(-1 * clamp(1.1rem,4vw,2.4rem)) 0; padding:.8rem clamp(1.1rem,4vw,2.4rem) calc(.8rem + env(safe-area-inset-bottom,0px)); background:var(--glass-strong); border-top:1px solid var(--line); -webkit-backdrop-filter:var(--blur); backdrop-filter:var(--blur); z-index:3; }
@media (max-width:560px){
  #article-modal{ align-items:flex-end!important; padding:0!important; }
  #article-modal .modal-card.reader99{ width:100%; max-height:94dvh; border-radius:22px 22px 0 0!important; }
  .reader99 #art-body{ font-size:1.02rem; }
}
