/* مكتبة القصص + قارئ القصة */
.sb-lib { margin: 6px 0 18px; }
.sb-feat { position: relative; display: block; width: 100%; aspect-ratio: 16/9; border: 0; padding: 0; border-radius: 22px; overflow: hidden; cursor: pointer; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.sb-feat-img { width: 100%; height: 100%; object-fit: cover; animation: sbKbA 18s ease-in-out infinite alternate; }
.sb-feat-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0) 58%); }
.sb-feat-txt { position: absolute; inset-inline: 16px; bottom: 14px; color: #fff; text-align: start; display: flex; flex-direction: column; gap: 6px; }
.sb-feat-txt .chip { align-self: flex-start; background: rgba(255,255,255,.22); color: #fff; backdrop-filter: blur(6px); }
.sb-feat-txt b { font-size: clamp(20px, 5.2vw, 30px); line-height: 1.35; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.sb-feat-play { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: var(--c); color: #fff; font-weight: 800; padding: 8px 16px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0,0,0,.25); animation: sbPulse 2.2s ease-in-out infinite; }
.sb-feat-play svg { width: 18px; height: 18px; }
.sb-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.sb-chips button { flex: none; border: 2px solid rgba(0,0,0,.08); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.sb-chips button.on { background: #2b2d42; color: #fff; border-color: #2b2d42; }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.sb-card { border: 0; background: #fff; border-radius: 18px; padding: 0 0 10px; overflow: hidden; text-align: start; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 4px; transition: transform .2s; font: inherit; }
.sb-card:active { transform: scale(.97); }
.sb-card[hidden] { display: none; }
.sb-cover { position: relative; display: block; aspect-ratio: 16/10; overflow: hidden; border-bottom: 4px solid var(--c); }
.sb-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.sb-card:hover .sb-cover img { transform: scale(1.06); }
.sb-done { position: absolute; top: 8px; inset-inline-end: 8px; background: #ffc83d; color: #7a4b00; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; }
.sb-card b { padding: 0 12px; font-size: 16px; line-height: 1.5; }
.sb-meta { padding: 0 12px; font-size: 13px; color: #6b7280; }

/* القارئ */
html.sb-lock, html.sb-lock body { overflow: hidden; }
.sb { position: fixed; inset: 0; z-index: 9000; background: radial-gradient(120% 90% at 50% 0%, #1e2a3a, #0b1018); color: #fff; display: flex; flex-direction: column; animation: sbIn .35s ease; }
.sb-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px calc(6px); padding-top: max(10px, env(safe-area-inset-top)); }
.sb-top b { flex: 1; text-align: center; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-x, .sb-play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 16px; font-weight: 900; cursor: pointer; }
.sb-play { background: var(--c); box-shadow: 0 0 0 0 var(--c); animation: sbRing 2s infinite; }
.sb.paused .sb-play { animation: none; }
.sb-bar { height: 4px; background: rgba(255,255,255,.12); margin: 0 14px; border-radius: 4px; overflow: hidden; }
.sb-bar i { display: block; height: 100%; width: 0; background: var(--c); transition: width .5s ease; }
.sb-host { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.sb-host .sw-dots { order: 2; display: flex; justify-content: center; gap: 6px; padding: 8px 0 max(10px, env(safe-area-inset-bottom)); }
.sb-host .sw-dot { width: 8px; height: 8px; border-radius: 4px; border: 0; background: rgba(255,255,255,.3); padding: 0; transition: width .3s, background .3s; }
.sb-host .sw-dot.on { width: 22px; background: var(--c); }
.sb-host .sw-dot.ok { background: rgba(255,255,255,.65); }
.sb-host .sw-track { order: 1; flex: 1; min-height: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.sb-host .sw-track::-webkit-scrollbar { display: none; }
.sb-host .sw-slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; }
.sb-page { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 10px 14px; max-width: 980px; margin: 0 auto; width: 100%; }
.sb-art { position: relative; border-radius: 22px; overflow: hidden; aspect-ratio: 16/9; box-shadow: 0 18px 40px rgba(0,0,0,.45); cursor: pointer; flex: none; }
.sb-art img { width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; }
.sb-page.live .sb-art img.kb-a { animation: sbKbA 9s ease-in-out forwards; }
.sb-page.live .sb-art img.kb-b { animation: sbKbB 9s ease-in-out forwards; }
.sb-page.live .sb-art img.kb-c { animation: sbKbC 9s ease-in-out forwards; }
.sb-page.live .sb-art img.kb-d { animation: sbKbD 9s ease-in-out forwards; }
.sb-glow { position: absolute; inset: 0; background: radial-gradient(60% 50% at 30% 20%, rgba(255,240,200,.28), transparent 70%); mix-blend-mode: screen; animation: sbGlow 6s ease-in-out infinite alternate; pointer-events: none; }
.sb-motes { position: absolute; inset: 0; pointer-events: none; }
.sb-motes i { position: absolute; bottom: -10px; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,220,.85); box-shadow: 0 0 10px rgba(255,240,180,.9); opacity: 0; }
.sb-page.live .sb-motes i { animation: sbMote 7s linear infinite; }
.sb-motes i:nth-child(1) { left: 12%; animation-delay: 0s; } .sb-motes i:nth-child(2) { left: 28%; animation-delay: 1.4s; width: 6px; height: 6px; }
.sb-motes i:nth-child(3) { left: 46%; animation-delay: 2.6s; } .sb-motes i:nth-child(4) { left: 63%; animation-delay: .7s; width: 5px; height: 5px; }
.sb-motes i:nth-child(5) { left: 78%; animation-delay: 3.4s; } .sb-motes i:nth-child(6) { left: 90%; animation-delay: 2s; width: 6px; height: 6px; }
.sb-text { position: relative; background: #fffdf7; color: #2b2d42; border-radius: 20px; padding: 16px 18px 26px; box-shadow: 0 10px 26px rgba(0,0,0,.3); transform: translateY(14px); opacity: 0; transition: transform .5s .15s, opacity .5s .15s; }
.sb-page.live .sb-text { transform: none; opacity: 1; }
.sb-line { margin: 0; font-family: 'Amiri', 'Baloo Bhaijaan 2', serif; font-size: clamp(22px, 5.4vw, 34px); line-height: 1.9; text-align: center; }
.sb-line.en { font-family: 'Baloo Bhaijaan 2', system-ui, sans-serif; font-size: clamp(19px, 4.4vw, 28px); line-height: 1.6; }
.sb-line .w { display: inline-block; padding: 0 2px; border-radius: 8px; transition: color .15s, background .15s, transform .15s; }
.sb-line .w.said { color: #6b7280; }
.sb-line .w.on { color: #fff; background: var(--c); transform: translateY(-2px) scale(1.06); }
.sb-pg { position: absolute; bottom: 6px; inset-inline-end: 14px; font-size: 12px; color: #9aa0a6; }
.sb-end { justify-content: center; }
.sb-endc { background: #fffdf7; color: #2b2d42; border-radius: 26px; padding: 22px 18px; text-align: center; box-shadow: 0 18px 40px rgba(0,0,0,.4); }
.sb-burst { font-size: 54px; color: #ffc83d; animation: sbPop .8s cubic-bezier(.2,1.6,.4,1) both; text-shadow: 0 4px 14px rgba(255,180,0,.5); }
.sb-endc h3 { margin: 4px 0 8px; font-size: 24px; }
.sb-moral { font-family: 'Amiri', serif; font-size: 22px; line-height: 1.8; color: var(--c); font-weight: 700; margin: 0 0 12px; }
.sb-q { font-weight: 700; margin: 0 0 10px; }
.sb-opts { display: grid; gap: 10px; }
.sb-opts button, .sb-endb button { border: 0; border-radius: 14px; padding: 12px; font: inherit; font-weight: 800; cursor: pointer; background: #f1f3f6; }
.sb-opts button.ok { background: #2fa36b; color: #fff; animation: sbPop .4s both; }
.sb-opts button.no { background: #ffe3e3; color: #b42318; animation: sbShake .4s; }
.sb-fb { min-height: 26px; margin: 8px 0; font-weight: 800; }
.sb-endb { display: flex; gap: 10px; justify-content: center; }
.sb-endb .sb-close2 { background: var(--c); color: #fff; }
@media (min-width: 900px) and (min-height: 700px) { .sb-page { flex-direction: row; align-items: center; } .sb-art { flex: 1.5; } .sb-text { flex: 1; } .sb-line { text-align: start; } }
@media (max-height: 640px) { .sb-art { max-height: 46vh; aspect-ratio: auto; } }

@keyframes sbIn { from { opacity: 0; transform: scale(1.03); } to { opacity: 1; transform: none; } }
@keyframes sbKbA { from { transform: scale(1) translate(0,0); } to { transform: scale(1.12) translate(-2%, -1%); } }
@keyframes sbKbB { from { transform: scale(1.12) translate(2%, 0); } to { transform: scale(1) translate(0,0); } }
@keyframes sbKbC { from { transform: scale(1.04) translate(-2%, 1%); } to { transform: scale(1.14) translate(2%, -1%); } }
@keyframes sbKbD { from { transform: scale(1.1) translate(0, -2%); } to { transform: scale(1.02) translate(0, 1%); } }
@keyframes sbGlow { from { opacity: .4; } to { opacity: 1; } }
@keyframes sbMote { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-260px) translateX(20px) scale(1); opacity: 0; } }
@keyframes sbPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes sbRing { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); } 100% { box-shadow: 0 0 0 14px rgba(255,255,255,0); } }
@keyframes sbPop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes sbShake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .sb-art img, .sb-feat-img, .sb-motes i, .sb-glow { animation: none !important; } }
/* عرض بدون نص: الصورة بس + صوت الراوي */
.sb-text { display: none !important; }
.sb-page { padding: 8px 10px; }
.sb-art { width: 100%; max-height: calc(100vh - 150px); }
.sb-page.live .sb-art img.kb-a, .sb-page.live .sb-art img.kb-b, .sb-page.live .sb-art img.kb-c, .sb-page.live .sb-art img.kb-d { animation-duration: 20s; }

/* وضع الفيلم السينمائي */
.sb-film-mode { background: #000; }
.sb-film { position: absolute; inset: 0; overflow: hidden; cursor: pointer; background: #000; }
.sb-layer { position: absolute; inset: 0; opacity: 0; transition: opacity .75s ease; will-change: opacity; }
.sb-layer.slow { transition-duration: 1.4s; }
.sb-film-mode.ims .sb-layer { transition-duration: .45s; }
.sb-layer.on { opacity: 1; }
.sb-layer .sb-bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(30px) brightness(.5) saturate(1.2); }
.sb-layer .sb-fg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.sb-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(255,240,210,.9), rgba(255,220,170,0) 70%); opacity: 0; pointer-events: none; }
.sb-film-mode.flash .sb-flash { animation: sbFlash 1.1s ease-out; }
@keyframes sbFlash { 0% { opacity: 0; } 25% { opacity: .75; } 100% { opacity: 0; } }
.sb-vig { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }
.sb-grain { position: absolute; inset: -50%; pointer-events: none; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); animation: sbGrain 1s steps(6) infinite; }
@keyframes sbGrain { 0% { transform: translate(0,0); } 33% { transform: translate(-3%,2%); } 66% { transform: translate(2%,-3%); } 100% { transform: translate(0,0); } }
.sb-film .sb-motes { position: absolute; inset: 0; pointer-events: none; }
.sb-film .sb-motes i { position: absolute; bottom: -10px; width: 5px; height: 5px; border-radius: 50%; background: rgba(255,236,190,.8); box-shadow: 0 0 8px rgba(255,220,150,.9); animation: sbMote 11s linear infinite; opacity: 0; }
.sb-film .sb-motes i:nth-child(odd) { width: 3px; height: 3px; animation-duration: 14s; }
.sb-film .sb-motes i:nth-child(1){left:6%;animation-delay:0s}.sb-film .sb-motes i:nth-child(2){left:14%;animation-delay:3s}.sb-film .sb-motes i:nth-child(3){left:23%;animation-delay:6s}.sb-film .sb-motes i:nth-child(4){left:31%;animation-delay:1.5s}.sb-film .sb-motes i:nth-child(5){left:40%;animation-delay:8s}.sb-film .sb-motes i:nth-child(6){left:48%;animation-delay:4.5s}.sb-film .sb-motes i:nth-child(7){left:57%;animation-delay:10s}.sb-film .sb-motes i:nth-child(8){left:65%;animation-delay:2s}.sb-film .sb-motes i:nth-child(9){left:73%;animation-delay:7s}.sb-film .sb-motes i:nth-child(10){left:81%;animation-delay:5s}.sb-film .sb-motes i:nth-child(11){left:89%;animation-delay:9s}.sb-film .sb-motes i:nth-child(12){left:95%;animation-delay:12s}.sb-film .sb-motes i:nth-child(13){left:36%;animation-delay:11s}
@keyframes sbMote { 0% { transform: translate(0,0); opacity: 0; } 10% { opacity: .9; } 90% { opacity: .6; } 100% { transform: translate(30px,-105vh); opacity: 0; } }
.sb-bars span { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height 1.2s ease; z-index: 1; }
.sb-bars span:first-child { top: 0; } .sb-bars span:last-child { bottom: 0; }
@media (orientation: landscape) { .sb-bars span { height: 6vh; } }
.sb-film-mode.opening .sb-bars span { height: 50vh; transition: none; }
.sb-film-mode .sb-top { position: relative; z-index: 3; background: linear-gradient(rgba(0,0,0,.55), transparent); padding-bottom: 18px; transition: opacity .6s; }
.sb-film-mode:not(.paused) .sb-top { opacity: .35; } .sb-film-mode .sb-top:hover { opacity: 1; }
.sb-film-mode .sb-bar { position: absolute; z-index: 3; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); margin: 0 18px; height: 3px; }
.sb-film-mode .sb-bar i { transition: none; }
.sb-cap { position: absolute; z-index: 2; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 22px; transition: opacity 1s, transform 1s; pointer-events: none; text-align: center; }
.sb-cap small { font-size: 13px; letter-spacing: 3px; color: #ffd98a; text-transform: uppercase; opacity: .9; }
.sb-cap b { font-size: clamp(24px, 6vw, 46px); line-height: 1.35; text-shadow: 0 4px 24px rgba(0,0,0,.8); animation: sbCapIn 1.4s ease both; }
@keyframes sbCapIn { from { letter-spacing: .3em; opacity: 0; filter: blur(6px); } to { letter-spacing: normal; opacity: 1; filter: none; } }
.sb-cap.off { opacity: 0; transform: translateY(-40%); }
.sb-film-mode.paused .sb-film::after { content: '▶'; z-index: 3; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 76px; height: 76px; border-radius: 50%; background: rgba(0,0,0,.5); display: grid; place-items: center; font-size: 30px; }
@media (prefers-reduced-motion: reduce) { .sb-grain, .sb-film .sb-motes i { animation: none !important; display: none; } }
/* شريط التقديم والتأخير */
.sb-nav { position: absolute; z-index: 4; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.sb-film-mode .sb-nav .sb-bar { position: relative; left: auto; right: auto; bottom: auto; flex: 1; margin: 0; height: 6px; cursor: pointer; overflow: visible; background: rgba(255,255,255,.25); }
.sb-film-mode .sb-nav .sb-bar::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; bottom: -12px; }
.sb-nav .sb-bar i { border-radius: 4px; }
.sb-nav button { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 18px; line-height: 40px; cursor: pointer; backdrop-filter: blur(4px); }
.sb-nav button:active { transform: scale(.92); }
