/* الدرس التفاعلي: كتاب مفتوح يتحول الجزء المضغوط منه إلى لوحة شرح جانبية (ورقة سفلية على الجوال). */
.book-h{font-family:var(--font-head);color:var(--maroon);font-size:1.3rem;margin-bottom:12px}
.book-rules{padding-inline-start:22px;line-height:2;margin-bottom:10px}
.book-quota{background:#fff8e7;border:1px solid var(--gold);color:var(--maroon-deep);border-radius:12px;padding:8px 14px;margin-bottom:16px;font-weight:700}
.book-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}
.book-fields label{display:flex;flex-direction:column;gap:6px;font-weight:700;color:var(--maroon)}
.book-fields select{font:inherit;padding:10px 12px;border-radius:12px;border:1.5px solid var(--line);background:var(--card);color:var(--ink)}
.book-pick{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:14px}
.book-pick .btn{flex:1 1 150px}
.book-thumbs{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:16px}
.book-thumb{position:relative;width:84px;height:112px;border-radius:10px;overflow:hidden;border:1.5px solid var(--line);background:var(--bg-soft)}
.book-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.book-thumb button{position:absolute;top:4px;inset-inline-end:4px;width:26px;height:26px;border-radius:50%;border:0;background:var(--maroon-deep);color:#fff;cursor:pointer;font-size:14px;line-height:1}
.book-thumb span{position:absolute;bottom:0;inset-inline:0;background:rgba(66,9,29,.75);color:#fff;font-size:.75rem;text-align:center;line-height:1.6}
.book-small{font-size:.85rem;color:var(--muted);line-height:1.7;margin-top:10px}
.book-center{text-align:center}
#stepWork progress{width:100%;height:14px;accent-color:var(--maroon);margin-bottom:12px}

.book-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;background:var(--card);border-radius:var(--radius);padding:12px 16px;box-shadow:var(--shadow)}
.book-toggle{display:flex;align-items:center;gap:8px;cursor:pointer;font-weight:500}
.book-toggle input{width:18px;height:18px;accent-color:var(--maroon)}
.book-pager{display:flex;align-items:center;gap:10px;font-variant-numeric:tabular-nums}
.book-pager button{width:44px;height:44px;border-radius:50%;border:1.5px solid var(--line);background:var(--card);cursor:pointer;font-size:20px;line-height:1;color:var(--maroon)}
.book-pager button:disabled{opacity:.35;cursor:default}
.book-pages{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;border-radius:8px;box-shadow:0 18px 40px -22px rgba(66,9,29,.55);background:#fff}
.book-pages::-webkit-scrollbar{display:none}
.book-page{flex:0 0 100%;position:relative;scroll-snap-align:start;margin:0;line-height:0;contain:layout paint}
.book-page img{width:100%;height:auto;display:block}
@media(min-width:900px){.book-page{flex-basis:50%}.book-page+.book-page{box-shadow:inset 14px 0 18px -14px rgba(0,0,0,.35)}}
.book-spot{position:absolute;border:0;background:transparent;padding:0;cursor:pointer;border-radius:8px}
.book-spot::after,.book-spot::before{content:"";position:absolute;top:-5px;inset-inline-start:-5px;width:14px;height:14px;border-radius:50%;background:var(--gold)}
.book-spot::after{box-shadow:0 0 0 3px rgba(201,168,76,.35)}
/* The ring pulses with transform and opacity only, which phones animate without repainting the page photo. */
.book-spot::before{opacity:.5;animation:book-pulse 2.2s ease-out infinite;will-change:transform,opacity}
.book-spot:hover,.book-spot:focus-visible{background:rgba(201,168,76,.18);outline:2px solid var(--gold-dark)}
.book-pages.spots-off .book-spot::after,.book-pages.spots-off .book-spot::before{display:none}
.book-pages.spots-off .book-spot:hover{background:transparent;outline:0}
@keyframes book-pulse{to{transform:scale(2.4);opacity:0}}
#btnNew{margin-top:16px}

.book-veil{position:fixed;inset:0;background:rgba(36,20,25,.5);z-index:1200;display:flex;align-items:flex-end;padding-top:7vh}
.book-sheet{background:var(--card);width:100%;height:100%;overflow-y:auto;border-radius:20px 20px 0 0;padding:18px 16px 28px;display:flex;flex-direction:column;gap:14px;animation:book-rise .28s ease-out}
@media(min-width:900px){.book-veil{padding-top:0;align-items:stretch;background:rgba(36,20,25,.3)}.book-sheet{width:min(100%,560px);margin-inline-start:auto;border-radius:0;animation-name:book-slide}}
@keyframes book-rise{from{transform:translateY(40px)}}
@keyframes book-slide{from{transform:translateX(-40px)}}
.book-sheet-head{display:flex;align-items:flex-start;gap:10px}
.book-sheet-head h2{flex:1;min-width:0;font-family:var(--font-head);font-size:1.25rem;color:var(--maroon-deep);line-height:1.5}
.book-back{border:1.5px solid var(--line);background:transparent;border-radius:999px;padding:6px 14px;cursor:pointer;white-space:nowrap;font:inherit;font-size:.9rem;color:var(--maroon)}
.book-crop{position:relative;overflow:hidden;border-radius:12px;border:2px solid var(--gold);background:#fff;margin:0 auto;flex:none;animation:book-lift .45s cubic-bezier(.2,.9,.3,1.2)}
.book-crop img{position:absolute;max-width:none;height:auto}
@keyframes book-lift{from{transform:scale(.6) rotate(-2deg)}}
.book-loading{padding:24px;text-align:center;color:var(--muted)}
#sheetBody{display:flex;flex-direction:column;gap:14px}
#sheetBody[hidden]{display:none}
.book-verify{border-radius:10px;padding:8px 12px;font-size:.9rem;font-weight:700;background:var(--bg-soft);color:var(--muted)}
.book-verify.ok{background:var(--success-bg);color:var(--success)}
.book-verify.fixed{background:#fff3d6;color:#5c4300}
.book-notes{background:#fff3d6;color:#5c4300;border-radius:12px;padding:10px 14px;line-height:1.8}
.book-notes ul,.book-box ul{padding-inline-start:20px}
.book-box{border:1.5px solid var(--line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px}
.book-box h3{font-family:var(--font-head);font-size:1rem;color:var(--maroon)}
#steps{list-style:none;display:flex;flex-direction:column;gap:8px}
#steps li{background:var(--bg-soft);border-radius:10px;padding:8px 12px;line-height:1.8}
#steps li b{color:var(--maroon);margin-inline-end:6px}
.book-box .btn{align-self:flex-start}
.book-listen{align-self:flex-start;border:1.5px solid var(--line);background:var(--card);border-radius:999px;padding:6px 16px;cursor:pointer;font:inherit;color:var(--maroon)}
.book-formula{text-align:center;font-size:1.25rem;font-family:"Cambria Math","Times New Roman",serif}
.book-slider{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px;align-items:center;font-size:.92rem;margin-bottom:8px}
.book-slider input{grid-column:1/-1;width:100%;accent-color:var(--maroon)}
.book-slider output{direction:ltr;font-variant-numeric:tabular-nums}
.book-out{background:var(--bg-soft);border-radius:12px;padding:8px 12px;display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 12px}
.book-out strong{font-size:1.2rem;font-variant-numeric:tabular-nums}
.book-out em{font-style:normal;font-size:.85rem;font-weight:700}
.book-out em.up{color:var(--success)}.book-out em.down{color:var(--danger)}.book-out em.same{color:var(--muted)}
.book-dots{line-height:1.9;font-size:.95rem}
.book-dots span{color:var(--maroon);letter-spacing:3px;word-break:break-all}
.book-why{background:#fff8e7;color:var(--maroon-deep);border-radius:12px;padding:10px 14px;line-height:1.8}
.book-chips{display:flex;flex-wrap:wrap;gap:8px}
.book-chip{border:1.5px solid var(--line);background:var(--bg-soft);border-radius:999px;padding:6px 14px;cursor:pointer;font:inherit;font-size:.9rem;color:var(--ink)}
.book-chat{display:flex;flex-direction:column;gap:8px}
.book-q,.book-a{border-radius:14px;padding:8px 14px;max-width:94%;line-height:1.8}
.book-q{background:var(--maroon);color:#fff;align-self:flex-start}
.book-a{background:var(--bg-soft);align-self:flex-end}
.book-ask{display:flex;gap:8px}
.book-ask input,#reportForm input{flex:1;min-width:0;font:inherit;padding:10px 12px;border-radius:12px;border:1.5px solid var(--line);background:var(--card);color:var(--ink)}
.book-report-btn{align-self:flex-start;border:0;background:transparent;color:var(--danger);font:inherit;font-weight:700;cursor:pointer;text-decoration:underline;padding:0}
#reportForm{display:flex;flex-direction:column;gap:8px}
#reportForm[hidden]{display:none}
.book-fix{background:var(--bg-soft);border-radius:10px;padding:8px 12px;line-height:1.8;margin-top:6px}
.book-sheet :focus-visible,.book-pager button:focus-visible{outline:3px solid var(--gold-dark);outline-offset:2px}
.book-saved{border-bottom:1.5px solid var(--line);padding-bottom:16px;margin-bottom:18px}
.book-saved ul{list-style:none;display:flex;flex-direction:column;gap:8px}
.book-saved li{display:flex;gap:8px;align-items:stretch}
.book-saved-open{flex:1;min-width:0;text-align:start;font:inherit;font-weight:700;color:var(--maroon);background:var(--bg-soft);border:1.5px solid var(--line);border-radius:12px;padding:10px 14px;cursor:pointer;line-height:1.6}
.book-saved-remove{flex:none;font:inherit;font-size:.85rem;color:var(--danger);background:transparent;border:1.5px solid var(--line);border-radius:12px;padding:0 12px;cursor:pointer}
#liveTools{display:flex;flex-direction:column;gap:14px}
#liveTools[hidden],.book-crop[hidden]{display:none}
#checks{list-style:none;padding:0;display:flex;flex-direction:column;gap:6px}
#checks li{border-radius:10px;padding:6px 12px;line-height:1.8}
#checks li.ok{background:var(--success-bg);color:var(--success)}
#checks li.bad{background:#fff3d6;color:#5c4300;font-weight:700}
.book-page-text{flex-basis:100%;line-height:1.8;padding:18px;display:flex;flex-direction:column;gap:10px;background:var(--card)}
.book-page-text h3{font-family:var(--font-head);color:var(--maroon)}
.book-locating{cursor:progress;opacity:.75}
.book-pages{overscroll-behavior-x:contain}
.book-pdf-range{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px;background:var(--bg-soft);border-radius:12px;padding:12px;margin-bottom:14px}
.book-pdf-range[hidden]{display:none}
.book-pdf-range p{flex:1 1 100%;font-weight:700;color:var(--maroon-deep);line-height:1.7}
.book-pdf-range label{display:flex;flex-direction:column;gap:4px;font-size:.9rem;font-weight:700;color:var(--maroon)}
.book-pdf-range input{font:inherit;width:96px;padding:8px 10px;border-radius:10px;border:1.5px solid var(--line);background:var(--card);color:var(--ink)}
/* المشهد المتحرك: مسرح داكن يعطي العناصر عمقاً، والتحكم تحته بأزرار كبيرة تناسب الإصبع. */
@media(min-width:900px){.book-sheet{width:min(100%,680px)}}
.book-stage{position:relative;border-radius:18px;overflow:hidden;background:radial-gradient(120% 90% at 50% 35%,#27408f 0%,#162a66 45%,#0b1638 100%);color:#fff;display:flex;flex-direction:column;flex:none;animation:book-lift .45s cubic-bezier(.2,.9,.3,1.2)}
.book-stage[hidden]{display:none}
.book-stage canvas{display:block;width:100%;height:min(42vh,350px);touch-action:pan-y;cursor:grab}
.book-stage canvas:active{cursor:grabbing}
.book-stage-count{position:absolute;top:10px;inset-inline-start:12px;background:rgba(255,255,255,.16);border-radius:999px;padding:2px 12px;font-size:.85rem;font-weight:700;font-variant-numeric:tabular-nums;direction:ltr}
.book-stage-cap{padding:4px 16px 0;line-height:1.8;font-weight:500;min-height:3.6em}
.book-stage-info{margin:8px 16px 0;background:rgba(244,211,94,.16);border:1px solid rgba(244,211,94,.55);border-radius:12px;padding:8px 12px;line-height:1.7;font-size:.92rem}
.book-stage-act{margin:10px 16px 0;align-self:center;border:0;border-radius:999px;background:var(--gold);color:var(--maroon-deep);font:inherit;font-weight:800;padding:10px 26px;cursor:pointer;animation:book-nudge 1.4s ease-in-out infinite}
.book-stage-ctl{display:flex;gap:8px;padding:12px 16px 4px}
.book-stage-ctl button{flex:1;min-height:44px;border:1px solid rgba(255,255,255,.35);background:rgba(255,255,255,.1);color:#fff;border-radius:12px;font:inherit;font-weight:700;cursor:pointer}
.book-stage-ctl button:disabled{opacity:.4;cursor:default}
.book-stage-hint{padding:4px 16px 12px;font-size:.8rem;color:rgba(255,255,255,.72);line-height:1.6}
.book-stage [hidden]{display:none}
.book-stage :focus-visible{outline:3px solid var(--gold);outline-offset:2px}
@keyframes book-nudge{50%{transform:scale(1.06)}}
.book-plot{display:block;width:100%;height:190px}
#modelSlot:empty{display:none}
@media(prefers-reduced-motion:reduce){.book-stage,.book-stage-act{animation:none}}
/* المحاكاة: إطار معزول يملأ عرض اللوحة، وارتفاعه يتبع محتواه. */
.book-sim{border-radius:18px;overflow:hidden;background:#0f1d4d;color:#fff;display:flex;flex-direction:column;flex:none}
.book-sim[hidden],.book-sim [hidden]{display:none}
.book-sim h3{font-family:var(--font-head);font-size:1.05rem;padding:12px 16px 0;color:var(--gold-light)}
.book-sim-guide{padding:4px 16px 8px;line-height:1.7;font-size:.92rem;color:rgba(255,255,255,.85)}
.book-sim-wait{padding:14px 16px;line-height:1.8;color:rgba(255,255,255,.85)}
.book-sim-frame{display:block;width:100%;height:420px;border:0}
.book-sim .btn{margin:0 16px 14px;align-self:flex-start;background:var(--gold);color:var(--maroon-deep);border-color:var(--gold)}

/* الدروس الثلاثية الأبعاد الجاهزة */
.book-ready { margin: 1rem 0 1.25rem; padding: 1rem; border: 1px solid var(--gold-light); border-radius: var(--radius-sm); background: var(--bg-soft); }
.book-ready-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: .5rem; }
.book-ready-links a { display: flex; flex-direction: column; gap: .15rem; min-height: 64px; justify-content: center; padding: .5rem .75rem; border-radius: var(--radius-sm); background: var(--card); border: 1.5px solid var(--maroon); color: var(--maroon); text-decoration: none; }
.book-ready-links a span { font-size: .85rem; color: var(--ink); }
@media (max-width: 520px) { .book-ready-links { grid-template-columns: 1fr; } }
