*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font-family:'Cairo',system-ui,sans-serif;background:#2b2d3a;color:#fff;display:flex;flex-direction:column;overflow:hidden;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
button{font:inherit;cursor:pointer;border:0;border-radius:12px;background:#3a3d50;color:#fff;min-width:44px;height:44px;font-size:20px}
button:active{background:#505474}
.rd-hd{display:flex;flex-direction:column;gap:6px;padding:calc(8px + env(safe-area-inset-top)) 10px 8px;background:#1f2030;flex:0 0 auto}
.rd-top,.rd-tools{display:flex;align-items:center;gap:8px}
.rd-tools{justify-content:space-between}
.rd-nav{min-height:44px;padding:0 14px;border-radius:12px;border:1px solid #ffffff40;background:#2b2d3a;color:#fff;font:700 15px Cairo,system-ui;cursor:pointer}
.rd-x{background:#e0443a;border-color:#e0443a;min-width:48px;padding:0}
.rd-home{min-height:40px;display:inline-flex;align-items:center;padding:0 14px;border-radius:12px;background:#4a1fe0;color:#fff;text-decoration:none;font-weight:700;font-size:14px}
.rd-title{flex:1 1 0;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700;font-size:15px;text-align:center}
.rd-zoom{display:flex;gap:6px}
.rd-stage{flex:1 1 0;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-gutter:stable;position:relative;display:flex;justify-content:safe center;align-items:flex-start;padding:10px;perspective:1400px;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y pinch-zoom}
.rd-page{background:#fff;box-shadow:0 6px 24px rgba(0,0,0,.45);flex:0 0 auto;transform-origin:center}
.rd-page canvas{display:block;max-width:none}
.rd-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-weight:700;z-index:2;background:#2b2d3a}
.rd-loading.hide{display:none}
@keyframes flipNext{from{transform:rotateY(35deg) translateX(-40px);opacity:.2}to{transform:none;opacity:1}}
@keyframes flipPrev{from{transform:rotateY(-35deg) translateX(40px);opacity:.2}to{transform:none;opacity:1}}
.rd-page.flip-next{animation:flipNext .28s ease-out}
.rd-page.flip-prev{animation:flipPrev .28s ease-out}
.rd-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px calc(8px + env(safe-area-inset-bottom));background:#1f2030;flex:0 0 auto}
.rd-foot #prev,.rd-foot #next{flex:0 0 64px}
.rd-pager{display:flex;align-items:center;gap:6px;font-weight:700}
.rd-pager input{width:70px;height:40px;border-radius:10px;border:0;text-align:center;font:inherit;font-size:16px;background:#3a3d50;color:#fff;-moz-appearance:textfield;user-select:text}
.rd-pager input::-webkit-outer-spin-button,.rd-pager input::-webkit-inner-spin-button{-webkit-appearance:none}
.rd-panel{position:fixed;inset:0;background:#1f2030f5;z-index:20;display:flex;flex-direction:column;padding:12px}
.rd-panel[hidden]{display:none}
.rd-panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;font-size:17px}
.rd-list{overflow:auto;flex:1 1 0;display:flex;flex-direction:column;gap:6px}
.rd-list button{height:auto;min-height:44px;text-align:right;font-size:15px;padding:10px 12px;display:flex;justify-content:space-between;gap:10px}
.rd-list .pg{opacity:.7;flex:0 0 auto}
.rd-list .snip{font-size:13px;opacity:.85;display:block;margin-top:2px;font-weight:400}
.rd-status{font-size:13px;opacity:.8;margin:8px 2px}
#searchForm{display:flex;gap:8px}
#searchInput{flex:1 1 0;min-width:0;height:44px;border-radius:12px;border:0;padding:0 12px;font:inherit;font-size:16px;background:#3a3d50;color:#fff;user-select:text}
mark{background:#ffd54a;color:#111;border-radius:3px}
@media print{html,body{display:none!important}}
#noteForm{display:flex;flex-direction:column;gap:10px}
#noteForm textarea{border-radius:12px;border:0;padding:12px;font:inherit;font-size:16px;background:#3a3d50;color:#fff;user-select:text;resize:vertical}
#noteForm input{width:90px;height:40px;border-radius:10px;border:0;padding:0 8px;font-size:16px;background:#3a3d50;color:#fff;margin-inline-start:8px}
#noteForm button{min-height:46px;border:0;border-radius:12px;background:#4a1fe0;color:#fff;font:700 16px Cairo,system-ui}

.rd-ld{width:70%;max-width:280px;text-align:center}
.rd-bar{height:6px;border-radius:6px;background:#3a3d50;margin-top:12px;overflow:hidden}
.rd-bar i{display:block;height:100%;width:0;background:#7c6bff;transition:width .2s}

/* وضع الفتح المؤقت — علامة مائية خفيفة + نافذة ودّية */
.prot-wm{position:fixed;inset:0;z-index:60;pointer-events:none;overflow:hidden}
.prot-wm span{position:absolute;white-space:nowrap;font-size:10px;line-height:1;font-weight:600;letter-spacing:.06em;color:#111;background:rgba(255,255,255,.42);border-radius:5px;padding:3px 6px;opacity:.30}
.prot-wm span:nth-child(1){top:calc(6px + env(safe-area-inset-top,0px));inset-inline-start:6px}
.prot-wm span:nth-child(2){bottom:calc(6px + env(safe-area-inset-bottom,0px));inset-inline-start:6px}
.prot-wm span:nth-child(3){bottom:calc(6px + env(safe-area-inset-bottom,0px));inset-inline-end:6px}
.prot-wm span:nth-child(4){top:calc(6px + env(safe-area-inset-top,0px));inset-inline-end:6px}
.promo-mask{position:fixed;inset:0;z-index:10000;background:rgba(12,20,16,.55);display:flex;align-items:center;justify-content:center;padding:16px}
.promo-mask[hidden]{display:none}
.promo-dlg{background:#fff;border-radius:18px;max-width:360px;width:100%;padding:20px 18px 16px;text-align:center;box-shadow:0 18px 50px rgba(0,0,0,.28);font-family:inherit}
.promo-emoji{font-size:34px;line-height:1;margin-bottom:6px}
.promo-dlg b{display:block;font-size:18px;margin-bottom:6px;color:#0f172a}
.promo-dlg p{margin:0 0 14px;font-size:14px;line-height:1.6;color:#334155}
.promo-acts{display:flex;flex-direction:column;gap:8px}
.promo-acts .btn,.promo-acts a{display:block;text-align:center;padding:11px 14px;border-radius:12px;font-weight:800;text-decoration:none;font-size:14px}
.promo-acts .btn-gold{background:#d4a017;color:#1a1206}
.promo-acts .btn-ghost{background:#eef2f0;color:#0f5132;border:0}
body.promo-lock{overflow:hidden}

/* mobile: tools row was overflowing at 375px */
@media (max-width:560px){
  .rd-hd{padding:calc(6px + env(safe-area-inset-top)) 8px 6px;gap:4px}
  .rd-tools{flex-wrap:wrap;justify-content:flex-start;row-gap:6px}
  .rd-home{font-size:13px;padding:0 10px;min-height:38px}
  .rd-title{font-size:14px}
  .rd-stage{padding:6px}
}

/* العلامة المائية كانت بتتقاطع مع زرا رجوع/إغلاق في الهيدر */
#reader .prot-wm span:nth-child(1),
#reader .prot-wm span:nth-child(4){display:none}

/* العلامة المائية تحت كانت بتتراكب على زراير السابق/التالي */
#reader .prot-wm span:nth-child(2),
#reader .prot-wm span:nth-child(3){bottom:calc(86px + env(safe-area-inset-bottom,0px))}
/* DRILL-BTN-1203: icon-only on the reader toolbar so the row never wraps at 375px */
#btnDrill{font-size:0;min-width:44px;padding:0 8px}
#btnDrill::before{content:"🎯";font-size:20px}

/* DRILL-BTN-1203b: on narrow screens the home link becomes an icon so the toolbar stays one row */
@media (max-width:460px){
  #btnHome{font-size:0;min-width:44px;padding:0 10px;text-align:center}
  #btnHome::before{content:"\1F3E0";font-size:18px}
  #btnDrill{min-width:40px;padding:0 6px}
}

.rd-title{display:flex;align-items:center;gap:8px;justify-content:center;min-width:0}
.rd-title .rd-cv{width:26px;height:34px;border-radius:4px;object-fit:cover;flex:none}

/* v20261203a - عنوان القارئ: ellipsis من الآخر ومش بيتقطع من الأول */
.rd-title{justify-content:flex-start!important}
.rd-title .rd-t{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:start;direction:rtl}
