/* الإصدار الرابع: المصحف المركزي، الفواصل، ومشاهد القصص الرمزية */
.quran-access-grid.three-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mushaf-toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: end; gap: 8px; }
.bookmark-action,
.bookmarks-toggle,
.focus-exit { min-height: 41px; padding: 0 13px; color: var(--green-950); background: var(--gold-soft); border: 1px solid rgba(177, 137, 47, .28); border-radius: 10px; cursor: pointer; font-size: 9px; font-weight: 900; }
.bookmarks-toggle { color: #fff; background: #5d4b28; border-color: transparent; }
.bookmarks-toggle b { display: inline-grid; min-width: 20px; height: 20px; margin-inline-start: 4px; place-items: center; color: #4d3b15; background: #f5df9e; border-radius: 50%; }
.focus-exit { display: none; color: #fff; background: #8b3c2f; border-color: transparent; }
.mushaf-page-controls button:disabled { cursor: not-allowed; opacity: .42; }

.mushaf-bookmarks-panel { position: relative; z-index: 4; margin: 0 0 15px; padding: 18px; background: rgba(255, 253, 247, .97); border: 1px solid #cdbc96; border-radius: 16px; box-shadow: 0 18px 45px rgba(48, 38, 22, .16); }
.mushaf-bookmarks-panel[hidden] { display: none; }
.bookmarks-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.bookmarks-panel-heading h3 { margin: 4px 0 0; font-size: 21px; }
.bookmarks-panel-heading > button { width: 35px; height: 35px; color: var(--green-900); background: var(--green-100); border: 0; border-radius: 50%; cursor: pointer; font-size: 20px; }
.bookmark-label { display: grid; gap: 6px; color: var(--muted); font-size: 9px; font-weight: 800; }
.bookmark-label input { width: 100%; min-height: 42px; padding: 0 12px; color: var(--ink); background: #fff; border: 1px solid #d7c9aa; border-radius: 10px; outline: none; }
.bookmark-label input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(202, 166, 75, .14); }
.mushaf-bookmarks-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.mushaf-bookmarks-list article { position: relative; min-width: 0; }
.bookmark-jump { width: 100%; min-height: 94px; display: grid; gap: 3px; padding: 13px 38px 13px 13px; text-align: right; color: var(--ink); background: #fff9e9; border: 1px solid #dec989; border-radius: 13px; cursor: pointer; }
.bookmark-jump span { color: #86671f; font-size: 8px; font-weight: 900; }
.bookmark-jump b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.bookmark-jump small { color: var(--green-700); font-size: 8px; font-weight: 800; }
.bookmark-remove { position: absolute; top: 9px; left: 9px; width: 24px; height: 24px; color: #8d3d32; background: #fbe9e5; border: 0; border-radius: 50%; cursor: pointer; }
.empty-bookmarks { grid-column: 1 / -1; display: grid; place-items: center; gap: 4px; padding: 22px; text-align: center; color: var(--muted); background: rgba(255,255,255,.55); border: 1px dashed #cfbea0; border-radius: 13px; }
.empty-bookmarks span { font-size: 24px; }
.empty-bookmarks b { color: var(--ink); }
.empty-bookmarks p { margin: 0; font-size: 9px; }
.mushaf-bookmark-ribbon { position: absolute; z-index: 2; top: -8px; left: 22px; width: 31px; min-height: 64px; display: grid; place-items: end center; padding-bottom: 7px; color: #fff7d4; background: #9b3f35; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); font: 700 7px/1 sans-serif; writing-mode: vertical-rl; }

/* قسم القصص */
.stories-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 16px; padding: 34px; color: #fff; background: radial-gradient(circle at 16% 8%, rgba(222,190,104,.26), transparent 35%), linear-gradient(135deg, #082f2a, #0e5145); border-radius: 27px; box-shadow: var(--shadow); }
.stories-hero::after { content: "﴿"; position: absolute; left: 28px; bottom: -72px; color: rgba(255,255,255,.055); font: 190px Georgia, serif; }
.stories-hero h1 { margin: 5px 0 7px; font-size: clamp(34px, 5vw, 62px); }
.stories-hero p { max-width: 720px; margin: 0; color: rgba(255,255,255,.74); line-height: 1.8; }
.stories-hero .kicker { color: #ecd58f; }
.stories-hero-badge { position: relative; z-index: 1; flex: 0 0 auto; padding: 10px 14px; color: #3d2f12; background: #f0d98f; border-radius: 999px; font-size: 9px; font-weight: 900; }
.stories-principle { display: grid; grid-template-columns: auto 1fr; gap: 13px; margin-bottom: 15px; padding: 15px 18px; color: #5d4a2a; background: #fff8e6; border: 1px solid #e4cf91; border-radius: 15px; }
.stories-principle b { color: #80611d; }
.stories-principle p { margin: 0; font-size: 10px; line-height: 1.7; }
.story-filter { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.story-filter button { min-height: 39px; padding: 0 15px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 9px; font-weight: 900; }
.story-filter button.active { color: #fff; background: var(--green-900); border-color: var(--green-900); }
.story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.story-card { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 21px; box-shadow: 0 10px 30px rgba(23, 55, 47, .08); }
.story-card-visual { position: relative; overflow: hidden; height: 210px; background: #102f35; isolation: isolate; }
.story-visual-badge { position: absolute; z-index: 12; top: 13px; right: 13px; padding: 6px 8px; color: #fff4ca; background: rgba(6,30,27,.74); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; backdrop-filter: blur(8px); font-size: 7px; font-weight: 900; }
.story-card-visual > button { position: absolute; z-index: 13; right: 50%; bottom: 20px; width: 48px; height: 48px; transform: translateX(50%); color: #123c33; background: #f2d786; border: 5px solid rgba(255,255,255,.22); border-radius: 50%; cursor: pointer; font-size: 17px; box-shadow: 0 8px 25px rgba(0,0,0,.25); }
.story-card-copy { padding: 18px; }
.story-card-copy > div { display: flex; justify-content: space-between; gap: 10px; color: #9a7726; font-size: 8px; font-weight: 900; }
.story-card-copy h2 { margin: 8px 0 5px; font-size: 24px; }
.story-card-copy p { min-height: 53px; margin: 0 0 14px; color: var(--muted); font-size: 10px; line-height: 1.75; }
.story-card-copy > button { padding: 0; color: var(--green-700); background: transparent; border: 0; cursor: pointer; font-size: 9px; font-weight: 900; }

.story-dialog { width: min(940px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; color: var(--ink); background: #f8f3e8; border: 1px solid #cbb98d; border-radius: 24px; box-shadow: 0 30px 90px rgba(0,0,0,.42); }
.story-dialog::backdrop { background: rgba(2, 24, 21, .78); backdrop-filter: blur(8px); }
.story-dialog-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 22px; }
.story-dialog-toolbar span { color: #876719; font-size: 8px; font-weight: 900; }
.story-dialog-toolbar h2 { margin: 3px 0 0; font-size: 25px; }
.story-dialog-toolbar button { width: 39px; height: 39px; color: var(--green-900); background: #e8e0ce; border: 0; border-radius: 50%; cursor: pointer; font-size: 22px; }
.story-stage { position: relative; overflow: hidden; height: min(52vh, 470px); margin: 0 18px; background: #102f35; border: 7px solid #eee2c4; border-radius: 19px; box-shadow: inset 0 0 60px rgba(0,0,0,.2); isolation: isolate; }
.story-stage.paused *, .story-stage.paused *::before, .story-stage.paused *::after { animation-play-state: paused !important; }
.story-timeline { height: 4px; margin: 12px 22px 0; overflow: hidden; background: #dfd3ba; border-radius: 999px; }
.story-timeline i { display: block; width: 0; height: 100%; background: #b89032; }
.story-caption { min-height: 88px; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 14px 22px 8px; }
.story-caption span { min-width: 46px; padding: 7px 8px; text-align: center; color: #6d551b; background: #f0dfac; border-radius: 999px; font-size: 8px; font-weight: 900; }
.story-caption p { margin: 0; font: 21px/1.7 "Amiri", "Traditional Arabic", serif; }
.story-dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 22px 14px; }
.story-dialog-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }
.story-dialog-actions button, .story-dialog-actions a { min-height: 41px; display: inline-flex; align-items: center; justify-content: center; padding: 0 15px; border-radius: 10px; font-size: 9px; font-weight: 900; }
.story-dialog-actions button { color: #fff; background: var(--green-900); border: 0; cursor: pointer; }
.story-dialog-actions #storySoundBtn { color: #5d4611; background: var(--gold-soft); border: 1px solid #dfc57c; }
.story-dialog-actions a { color: #5d4611; background: var(--gold-soft); text-decoration: none; }
.story-reading { margin: 8px 22px 18px; padding: 22px; background: rgba(255,255,255,.7); border: 1px solid #ded3ba; border-radius: 18px; }
.story-reading > div:first-child { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 14px; }
.story-reading > div:first-child span { color: #9a7726; font-size: 8px; font-weight: 900; }
.story-reading h3 { margin: 2px 0 0; font-size: 22px; }
.story-narrative { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.story-chapter-card { min-width: 0; padding: 17px; text-align: right; color: var(--ink); background: #fffaf0; border: 1px solid #dfd2b7; border-radius: 14px; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.story-chapter-card:hover { transform: translateY(-2px); border-color: #bc963d; box-shadow: 0 10px 24px rgba(77,57,23,.09); }
.story-chapter-card.active { background: #f4e8bd; border-color: #b78b26; box-shadow: inset 4px 0 #0b4f43; }
.story-chapter-card span { color: #9a7726; font-size: 7px; font-weight: 900; }
.story-chapter-card h4 { margin: 5px 0 7px; color: var(--green-950); font-size: 18px; }
.story-chapter-card p { margin: 0 0 11px; color: #594f43; font-size: 10px; line-height: 1.85; }
.story-chapter-card small { color: #80611d; font-size: 8px; font-weight: 900; }
.story-method-note { margin: 0; padding: 12px 22px 18px; color: var(--muted); border-top: 1px solid #ded3ba; font-size: 8px; }

/* لقطات واقعية مولّدة: حركة كاميرا هادئة بدل الرسومات */
.story-real-image { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.035); animation: story-camera 14s ease-in-out infinite alternate; }
.story-card-visual .story-real-image { filter: saturate(.9) contrast(1.04) brightness(.92); }
.story-stage .story-real-image { filter: saturate(.94) contrast(1.035) brightness(.96); animation-duration: 18s; }
.story-cinematic-vignette { z-index: 8; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 38%, rgba(2,13,14,.5) 115%), linear-gradient(180deg, rgba(0,0,0,.18), transparent 38%, rgba(0,0,0,.3)); }
.story-cinematic-grain { z-index: 9; inset: -20%; pointer-events: none; opacity: .13; mix-blend-mode: soft-light; background: repeating-radial-gradient(circle at 30% 40%, rgba(255,255,255,.25) 0 1px, transparent 1px 4px); animation: story-grain .55s steps(2) infinite; }
.story-card-visual > button { backdrop-filter: blur(7px); transition: transform .2s ease, background .2s ease; }
.story-card-visual > button:hover { transform: translateX(50%) scale(1.08); background: #ffe8a4; }

@keyframes story-camera { from { transform: scale(1.035) translate3d(-.7%, -.3%, 0); } to { transform: scale(1.095) translate3d(.8%, .5%, 0); } }
@keyframes story-grain { 0% { transform: translate3d(-1%, 1%, 0); } 50% { transform: translate3d(1%, -1%, 0); } 100% { transform: translate3d(.5%, .8%, 0); } }

/* العناصر البصرية الرمزية المشتركة */
.story-card-visual > div,
.story-stage > div { position: absolute; }
.scene-card-sea .story-card-visual,
.scene-sea { background: linear-gradient(#173c52 0 48%, #b99856 49% 100%); }
.scene-sky { inset: 0 0 52%; background: radial-gradient(circle at 50% 80%, rgba(255,223,146,.25), transparent 34%), linear-gradient(#102d43, #1d5268); }
.scene-sky i { position: absolute; width: 2px; height: 2px; background: #fff7d3; border-radius: 50%; box-shadow: 40px 15px #fff7d3, 95px 38px #fff7d3, 170px 20px #fff7d3, 230px 55px #fff7d3; animation: stars 2.8s ease-in-out infinite alternate; }
.scene-sky i:nth-child(1) { top: 17%; right: 18%; }.scene-sky i:nth-child(2) { top: 42%; left: 21%; animation-delay: .8s; }.scene-sky i:nth-child(3) { top: 12%; left: 45%; animation-delay: 1.4s; }
.scene-moon { z-index: 2; top: 10%; left: 12%; width: 44px; height: 44px; background: #f3dda0; border-radius: 50%; box-shadow: 0 0 34px rgba(243,221,160,.55); }
.sea-wall { z-index: 4; bottom: 0; width: 39%; height: 60%; background: repeating-radial-gradient(ellipse at center, #1e8390 0 9px, #145f70 10px 18px); filter: drop-shadow(0 0 12px rgba(0,0,0,.2)); animation: sea-pulse 3s ease-in-out infinite alternate; }
.sea-wall::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent); animation: water-shimmer 2.2s linear infinite; }
.sea-wall-right { right: 0; border-radius: 0 70% 0 0; transform-origin: right bottom; }.sea-wall-left { left: 0; border-radius: 70% 0 0 0; transform-origin: left bottom; animation-delay: .3s; }
.sea-path { z-index: 3; right: 37%; bottom: 0; width: 26%; height: 58%; background: linear-gradient(160deg, #c9aa63, #765b31); clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); }
.scene-light { z-index: 5; right: 44%; bottom: 0; width: 12%; height: 67%; background: linear-gradient(transparent, rgba(255,231,163,.55)); filter: blur(10px); animation: light-breathe 2s ease-in-out infinite alternate; }

.scene-card-flood .story-card-visual,
.scene-flood { background: linear-gradient(#1b2730 0 45%, #285467 46% 100%); }
.storm-clouds { z-index: 3; inset: -8% 0 auto; height: 48%; background: radial-gradient(ellipse at 15% 65%, #53606a 0 18%, transparent 19%), radial-gradient(ellipse at 45% 45%, #3d4a54 0 26%, transparent 27%), radial-gradient(ellipse at 78% 66%, #59646b 0 24%, transparent 25%); animation: clouds-drift 7s ease-in-out infinite alternate; }
.rain-layer { z-index: 4; inset: 0; opacity: .48; background: repeating-linear-gradient(105deg, transparent 0 15px, rgba(210,235,242,.6) 16px 18px, transparent 19px 31px); background-size: 100% 85px; animation: rain-fall .65s linear infinite; }
.ark-silhouette { z-index: 7; right: 29%; bottom: 30%; width: 42%; height: 17%; background: #321f18; border-radius: 6% 6% 55% 55%; animation: ark-rock 3.8s ease-in-out infinite; }
.ark-silhouette::before { content: ""; position: absolute; right: 18%; bottom: 82%; width: 64%; height: 75%; background: #432a1d; clip-path: polygon(50% 0, 100% 65%, 87% 100%, 13% 100%, 0 65%); }
.ark-silhouette i { position: absolute; right: 49%; bottom: 100%; width: 4px; height: 52px; background: #2d211c; }
.flood-wave { z-index: 6; right: -10%; bottom: -25%; width: 120%; height: 52%; background: repeating-radial-gradient(ellipse at 50% 0, #3f7f91 0 22px, #285b70 23px 44px); border-radius: 50% 50% 0 0; animation: wave-shift 3s ease-in-out infinite alternate; }
.wave-back { z-index: 5; bottom: -17%; opacity: .75; animation-delay: -.8s; }.wave-front { filter: brightness(.85); }

.scene-card-barrier .story-card-visual,
.scene-barrier { background: linear-gradient(#291d2a 0 48%, #492f25 100%); }
.mountain { z-index: 3; bottom: 0; width: 46%; height: 93%; background: linear-gradient(130deg, #473b42, #16171c); }
.mountain-right { right: -4%; clip-path: polygon(74% 0, 100% 21%, 100% 100%, 0 100%, 39% 38%); }.mountain-left { left: -4%; clip-path: polygon(28% 0, 61% 37%, 100% 100%, 0 100%, 0 18%); }
.iron-barrier { z-index: 5; right: 33%; bottom: 0; width: 34%; height: 72%; display: flex; justify-content: space-around; padding: 0 8px; background: linear-gradient(90deg, #322c2c, #8a6942, #3e3431); clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%); }
.iron-barrier i { width: 13%; height: 100%; background: linear-gradient(90deg, #2b292b, #a17c50, #292728); }
.barrier-glow { z-index: 4; right: 35%; bottom: 0; width: 30%; height: 75%; background: #d27b38; filter: blur(24px); opacity: .45; animation: forge-glow 1.6s ease-in-out infinite alternate; }
.forge-sparks { z-index: 8; right: 37%; bottom: 12%; width: 26%; height: 60%; }
.forge-sparks i { position: absolute; bottom: 0; width: 4px; height: 4px; background: #ffd783; border-radius: 50%; box-shadow: 0 0 8px #ff9d3b; animation: spark-rise 1.8s linear infinite; }
.forge-sparks i:nth-child(1){right:8%}.forge-sparks i:nth-child(2){right:28%;animation-delay:.4s}.forge-sparks i:nth-child(3){right:52%;animation-delay:.8s}.forge-sparks i:nth-child(4){right:74%;animation-delay:1.1s}.forge-sparks i:nth-child(5){right:90%;animation-delay:.2s}

.scene-card-cave .story-card-visual,
.scene-cave { background: linear-gradient(#8b6844, #2d261f); }
.cave-sun { z-index: 1; top: 10%; right: 14%; width: 58px; height: 58px; background: #f5d377; border-radius: 50%; box-shadow: 0 0 60px #f2bd50; animation: sun-drift 6s ease-in-out infinite alternate; }
.cave-rock { z-index: 5; bottom: 0; width: 57%; height: 100%; background: linear-gradient(140deg, #564536, #1e1b19); }
.cave-rock-right { right: -16%; clip-path: polygon(23% 0,100% 0,100% 100%,0 100%,36% 50%); }.cave-rock-left { left: -17%; clip-path: polygon(0 0,75% 0,59% 52%,100% 100%,0 100%); }
.cave-opening { z-index: 3; right: 31%; bottom: 0; width: 38%; height: 74%; background: radial-gradient(ellipse at 50% 85%, #291f18 0 44%, #060707 45% 100%); border-radius: 50% 50% 0 0; }
.cave-opening i { position: absolute; right: 46%; bottom: 8%; width: 8%; height: 43%; background: linear-gradient(transparent,#e0bd6f); filter: blur(9px); opacity: .5; }
.cave-rays { z-index: 2; inset: 0; background: conic-gradient(from 215deg at 15% 20%, transparent, rgba(255,222,139,.25), transparent 27%); animation: light-breathe 3s ease-in-out infinite alternate; }

.scene-card-birds .story-card-visual,
.scene-birds { background: linear-gradient(#d89667 0 58%, #9b6b44 59% 100%); }
.dawn-sky { inset: 0; background: radial-gradient(circle at 18% 20%, #f6d995 0 8%, transparent 23%), linear-gradient(#8f6780,#d69868 63%,#a46d45); }
.sanctuary-silhouette { z-index: 5; right: 40%; bottom: 12%; width: 20%; height: 28%; background: #161514; box-shadow: inset 0 6px #b8953d; }
.bird-flock { z-index: 7; inset: 6% 0 28%; }
.bird-flock i { position: absolute; width: 24px; height: 9px; border-top: 3px solid #1e2524; border-radius: 50%; animation: birds-fly 5s linear infinite; }
.bird-flock i::after { content:""; position:absolute; left:-15px; top:-3px; width:20px; height:8px; border-top:3px solid #1e2524; border-radius:50%; transform:rotate(-12deg); }
.bird-flock i:nth-child(1){top:8%;left:-12%;}.bird-flock i:nth-child(2){top:30%;left:-28%;animation-delay:.7s}.bird-flock i:nth-child(3){top:52%;left:-18%;animation-delay:1.4s}.bird-flock i:nth-child(4){top:19%;left:-45%;animation-delay:2s}.bird-flock i:nth-child(5){top:66%;left:-36%;animation-delay:2.7s}.bird-flock i:nth-child(6){top:42%;left:-52%;animation-delay:3.3s}
.desert-haze { z-index: 6; right: 0; bottom: 0; width: 100%; height: 28%; background: repeating-radial-gradient(ellipse at 30% 100%, rgba(244,209,143,.35) 0 20%, transparent 21% 36%); animation: haze 4s ease-in-out infinite alternate; }

.scene-card-well .story-card-visual,
.scene-well { background: radial-gradient(circle at 50% 15%, #2f4d67, #111827 48%, #080b10); }
.well-night { inset: 0; }
.well-night i { position:absolute;width:3px;height:3px;background:#f8e9b0;border-radius:50%;box-shadow:34px 18px #f8e9b0,88px 45px #f8e9b0,150px 12px #f8e9b0;animation:stars 2s infinite alternate;}
.well-night i:nth-child(1){top:11%;right:12%}.well-night i:nth-child(2){top:25%;left:18%;animation-delay:.6s}.well-night i:nth-child(3){top:7%;left:45%;animation-delay:1.2s}.well-night i:nth-child(4){top:37%;right:33%;animation-delay:1.7s}
.well-rim { z-index: 5; right: 23%; bottom: 0; width: 54%; height: 37%; background: linear-gradient(#9b7b55,#3d2b20); clip-path: polygon(12% 0,88% 0,100% 100%,0 100%); }
.well-depth { z-index: 6; right: 32%; bottom: 0; width: 36%; height: 30%; background: radial-gradient(ellipse at 50% 0,#0b1115,#020303 78%); border-radius: 50% 50% 0 0; }
.well-depth i { position:absolute;right:45%;bottom:0;width:10%;height:100%;background:linear-gradient(transparent,rgba(237,202,115,.45));filter:blur(7px); }
.well-rope { z-index: 7; top: 0; right: 51%; width: 3px; height: 76%; background: repeating-linear-gradient(#a88754 0 7px,#5a3e24 8px 12px); animation: rope-sway 3s ease-in-out infinite alternate; transform-origin: top; }
.hope-light { z-index: 4; top: -20%; right: 40%; width: 20%; height: 110%; background: linear-gradient(rgba(247,218,146,.35), transparent); filter: blur(12px); animation: light-breathe 2.5s ease-in-out infinite alternate; }

@keyframes story-progress { to { width: 100%; } }
@keyframes stars { to { opacity: .35; transform: scale(.7); } }
@keyframes sea-pulse { to { transform: scaleX(1.035) translateY(-5px); } }
@keyframes water-shimmer { to { transform: translateX(100%); } }
@keyframes light-breathe { to { opacity: .35; } }
@keyframes clouds-drift { to { transform: translateX(4%); filter: brightness(.8); } }
@keyframes rain-fall { to { background-position: -30px 85px; } }
@keyframes ark-rock { 0%,100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(2deg) translateY(-10px); } }
@keyframes wave-shift { to { transform: translateX(-4%) translateY(-8px); } }
@keyframes forge-glow { to { opacity: .8; } }
@keyframes spark-rise { to { transform: translate(var(--spark-x, 18px), -180px); opacity: 0; } }
@keyframes sun-drift { to { transform: translateX(-36px); opacity: .75; } }
@keyframes birds-fly { to { transform: translateX(1500%); } }
@keyframes haze { to { transform: translateX(5%); opacity: .55; } }
@keyframes rope-sway { to { transform: rotate(2.5deg); } }

/* رفيق المسلم: خطة يومية، ختمة، جمعة، وسفر */
.companion-feature { color: #fff; background: linear-gradient(145deg, #0a4c41, #08332d); border-color: transparent; }
.companion-feature h3, .companion-feature b { color: #fff; }
.companion-feature p { color: rgba(255,255,255,.72); }
.companion-feature .feature-icon { color: #4d3a0c; background: #f0d785; }
.companion-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 18px; padding: 38px; color: #fff; background: radial-gradient(circle at 12% 10%, rgba(235,205,120,.3), transparent 34%), linear-gradient(135deg, #073a32, #0d5a4c); border-radius: 28px; box-shadow: var(--shadow); }
.companion-hero::after { content: "✦"; position: absolute; left: 32%; top: -70px; color: rgba(255,255,255,.055); font-size: 230px; }
.companion-hero > div { position: relative; z-index: 1; }
.companion-hero h1 { margin: 7px 0 10px; font-size: clamp(38px, 5.8vw, 70px); line-height: 1.05; }
.companion-hero h1 em { color: #f0d785; font-style: normal; }
.companion-hero p { max-width: 670px; margin: 0; color: rgba(255,255,255,.72); line-height: 1.8; }
.companion-day-card { flex: 0 0 245px; display: grid; gap: 6px; padding: 21px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 19px; backdrop-filter: blur(12px); }
.companion-day-card span { color: #f4dc92; font-size: 9px; font-weight: 900; }
.companion-day-card strong { font: 700 23px/1.4 "Amiri", serif; }
.companion-day-card small { color: rgba(255,255,255,.6); font-size: 8px; }
.companion-overview, .companion-guides { display: grid; grid-template-columns: 1.12fr .88fr; gap: 16px; margin-bottom: 16px; }
.daily-plan-card, .khatma-card, .friday-guide, .travel-guide { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 14px 38px rgba(21,57,48,.075); }
.companion-card-heading, .guide-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 18px; }
.companion-card-heading span, .guide-heading span { color: #9a7726; font-size: 8px; font-weight: 900; }
.companion-card-heading h2, .guide-heading h2 { margin: 4px 0 0; font-size: 25px; }
.companion-card-heading > b, .guide-heading > b { padding: 7px 10px; color: #755a1c; background: #fbf1d1; border-radius: 999px; font-size: 8px; }
.companion-card-heading > button { padding: 8px 10px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 8px; font-weight: 800; }
.daily-progress-row { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; margin-bottom: 18px; padding: 16px; background: #f7f2e6; border-radius: 16px; }
.daily-progress-ring { --daily-progress: 0deg; width: 92px; aspect-ratio: 1; display: grid; place-content: center; text-align: center; background: radial-gradient(circle, #f7f2e6 57%, transparent 59%), conic-gradient(#c59c3a var(--daily-progress), #ddd3bd 0); border-radius: 50%; }
.daily-progress-ring strong { color: var(--green-950); font-size: 22px; }
.daily-progress-ring small { color: var(--muted); font-size: 7px; font-weight: 800; }
.daily-progress-row > div:last-child b { color: var(--green-950); font-size: 14px; }
.daily-progress-row > div:last-child p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.65; }
.daily-tasks { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.daily-tasks label, .friday-actions label { display: flex; align-items: center; gap: 10px; padding: 13px; background: #fffdf7; border: 1px solid #e2d7c0; border-radius: 13px; cursor: pointer; }
.daily-tasks input, .friday-actions input { width: 19px; height: 19px; accent-color: #0a5145; }
.daily-tasks span, .friday-actions span { display: grid; gap: 2px; }
.daily-tasks b, .friday-actions b { font-size: 10px; }
.daily-tasks small, .friday-actions small { color: var(--muted); font-size: 7px; }
.daily-shortcuts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.daily-shortcuts button { min-height: 37px; padding: 0 12px; color: var(--green-800); background: #e8f2ed; border: 0; border-radius: 9px; cursor: pointer; font-size: 8px; font-weight: 900; }
.khatma-card { color: #fff; background: linear-gradient(155deg, #123f38, #082e29); border-color: transparent; }
.khatma-card .companion-card-heading h2 { color: #fff; }
.khatma-card .companion-card-heading > b { color: #f4dd98; background: rgba(255,255,255,.1); }
.khatma-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.khatma-fields label { display: grid; gap: 7px; color: rgba(255,255,255,.68); font-size: 8px; font-weight: 800; }
.khatma-fields input { width: 100%; height: 46px; padding: 0 12px; color: #fff; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.17); border-radius: 11px; outline: none; font-size: 14px; }
.khatma-fields small { margin-top: -31px; margin-inline-start: 12px; pointer-events: none; color: rgba(255,255,255,.5); }
.khatma-result { margin: 22px 0 14px; }
.khatma-result span { color: #e9cf7b; font-size: 8px; font-weight: 900; }
.khatma-result strong { display: block; margin: 3px 0; color: #fff; font-size: 30px; }
.khatma-result p { margin: 0; color: rgba(255,255,255,.62); font-size: 9px; }
.khatma-track { height: 7px; overflow: hidden; background: rgba(255,255,255,.12); border-radius: 999px; }
.khatma-track i { display: block; width: 0; height: 100%; background: #e9cd76; border-radius: inherit; transition: width .3s ease; }
.khatma-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 17px; }
.khatma-actions button { min-height: 42px; padding: 0 9px; color: #123d34; background: #ecd587; border: 0; border-radius: 10px; cursor: pointer; font-size: 8px; font-weight: 900; }
.khatma-actions button:last-child { grid-column: 1 / -1; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); }
.khatma-actions button:disabled { cursor: default; opacity: .55; }
.khatma-note { margin: 13px 0 0; color: rgba(255,255,255,.55); font-size: 8px; line-height: 1.6; }
.companion-guides { grid-template-columns: .9fr 1.1fr; }
.friday-guide { background: linear-gradient(180deg, #fff, #fffaf0); }
.friday-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.friday-kahf-button { width: 100%; min-height: 44px; margin-top: 13px; color: #fff; background: var(--green-900); border: 0; border-radius: 11px; cursor: pointer; font-size: 9px; font-weight: 900; }
.guide-sources { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; padding-top: 13px; border-top: 1px solid #e4dac5; }
.guide-sources a { color: #80621c; font-size: 8px; font-weight: 900; text-decoration: none; }
.travel-rulings { display: grid; gap: 8px; }
.travel-rulings details { overflow: hidden; background: #f8f5ed; border: 1px solid #e1d8c5; border-radius: 12px; }
.travel-rulings summary { display: flex; align-items: center; gap: 10px; padding: 13px; cursor: pointer; color: var(--green-950); font-size: 10px; font-weight: 900; list-style: none; }
.travel-rulings summary span { width: 28px; height: 28px; display: grid; place-items: center; color: #795d18; background: #f2dfaa; border-radius: 8px; font-size: 8px; }
.travel-rulings details p { margin: 0; padding: 0 51px 15px 15px; color: var(--muted); font-size: 9px; line-height: 1.8; }
.travel-warning { margin-top: 12px; padding: 13px; color: #70463e; background: #fff0eb; border: 1px solid #edc9bd; border-radius: 12px; }
.travel-warning b { font-size: 10px; }
.travel-warning p { margin: 4px 0 0; font-size: 8px; line-height: 1.7; }

@media (max-width: 920px) {
  .companion-overview, .companion-guides { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .companion-hero { align-items: stretch; flex-direction: column; padding: 27px 20px; }
  .companion-day-card { flex-basis: auto; }
  .daily-plan-card, .khatma-card, .friday-guide, .travel-guide { padding: 18px; }
  .daily-tasks { grid-template-columns: 1fr; }
  .daily-progress-row { grid-template-columns: 1fr; text-align: center; }
  .daily-progress-ring { margin: auto; }
  .khatma-fields, .khatma-actions { grid-template-columns: 1fr; }
  .khatma-actions button:last-child { grid-column: auto; }
}

@media (max-width: 1180px) {
  .quran-access-grid.three-tools, .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mushaf-toolbar-actions { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .quran-access-grid.three-tools, .story-grid { grid-template-columns: 1fr; }
  .mushaf-toolbar-actions, .mushaf-page-controls { width: 100%; }
  .bookmark-action, .bookmarks-toggle { flex: 1; }
  .mushaf-bookmarks-list { grid-template-columns: 1fr; }
  .stories-hero { display: block; padding: 25px 20px; }
  .stories-hero-badge { display: inline-block; margin-top: 16px; }
  .stories-principle { grid-template-columns: 1fr; }
  .story-card-visual { height: 190px; }
  .story-dialog { width: calc(100% - 14px); max-height: calc(100dvh - 14px); border-radius: 18px; }
  .story-stage { height: 42vh; margin: 0 8px; border-width: 4px; }
  .story-caption { grid-template-columns: 1fr; min-height: 116px; padding-inline: 14px; }
  .story-caption span { width: max-content; }
  .story-caption p { font-size: 18px; }
  .story-dialog-actions { align-items: stretch; flex-direction: column; padding-inline: 14px; }
  .story-dialog-actions > div, .story-dialog-actions > a { width: 100%; }
  .story-dialog-actions button { flex: 1; }
  .story-reading { margin-inline: 10px; padding: 16px; }
  .story-reading > div:first-child { align-items: start; flex-direction: column; }
  .story-narrative { grid-template-columns: 1fr; }
}

/* هاتف أفقي: صفحة واحدة مكبّرة بلا أي شريط يغطي الآيات */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1000px) {
  body.mushaf-focus { overflow: hidden; background: #574b39; }
  body.mushaf-focus .desktop-rail,
  body.mushaf-focus .topbar,
  body.mushaf-focus .bottom-nav,
  body.mushaf-focus footer { display: none !important; }
  body.mushaf-focus .app-shell,
  body.mushaf-focus main { width: 100%; max-width: none; min-height: 100%; margin: 0 !important; padding: 0 !important; }
  body.mushaf-focus #quranView { position: fixed; z-index: 1000; inset: 0; display: block; overflow: hidden; padding: 0 !important; background: #574b39; }
  body.mushaf-focus #quranView > .quran-intro,
  body.mushaf-focus #quranView > .quran-access-suite { display: none; }
  body.mushaf-focus .mushaf-studio { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 5px; margin: 0; padding: max(5px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); overflow: hidden; background: #574b39; border: 0; border-radius: 0; box-shadow: none; }
  body.mushaf-focus .mushaf-studio-toolbar { min-height: 40px; align-items: center; flex-direction: row; gap: 8px; margin: 0; }
  body.mushaf-focus .mushaf-studio-toolbar > div:first-child { display: none; }
  body.mushaf-focus .mushaf-toolbar-actions { width: 100%; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 5px; }
  body.mushaf-focus .mushaf-page-controls { width: auto; flex: 1; align-items: center; justify-content: center; }
  body.mushaf-focus .mushaf-page-controls button,
  body.mushaf-focus .bookmark-action,
  body.mushaf-focus .bookmarks-toggle,
  body.mushaf-focus .focus-exit { min-height: 36px; padding: 0 9px; border-radius: 8px; font-size: 8px; }
  body.mushaf-focus .mushaf-page-controls label { display: flex; align-items: center; gap: 4px; color: #f4e6bd; }
  body.mushaf-focus .mushaf-page-controls input { width: 58px; height: 36px; }
  body.mushaf-focus .focus-exit { display: block; }
  body.mushaf-focus .bookmark-action span { display: none; }
  body.mushaf-focus .mushaf-spread { min-height: 0; height: 100%; grid-template-columns: 1fr; padding: 3px; overflow: hidden; border-radius: 9px; box-shadow: none; }
  body.mushaf-focus .mushaf-page { height: 100%; padding: 33px clamp(24px, 7vw, 72px) 16px; overflow-y: auto; overscroll-behavior: contain; border-width: 5px; border-radius: 5px; scrollbar-width: thin; }
  body.mushaf-focus .mushaf-page:nth-child(2) { display: none; }
  body.mushaf-focus .mushaf-page-header { top: 8px; right: 16px; left: 16px; font-size: 7px; }
  body.mushaf-focus .mushaf-page-text { font-size: clamp(20px, 4.8vh, 29px); line-height: 1.78; }
  body.mushaf-focus .mushaf-surah-name { margin: 2px 0 5px; padding: 2px; font-size: 16px; }
  body.mushaf-focus .mushaf-page-text .ayah-num { min-width: 21px; height: 21px; font-size: 9px; }
  body.mushaf-focus .mushaf-bookmark-ribbon { left: 10px; width: 24px; min-height: 48px; }
  body.mushaf-focus .mushaf-assist-controls,
  body.mushaf-focus .mushaf-source-note { display: none; }
  body.mushaf-focus .mushaf-bookmarks-panel { position: fixed; z-index: 1003; top: 50px; right: max(10px, env(safe-area-inset-right)); bottom: 8px; width: min(390px, 78vw); margin: 0; overflow: auto; }
  body.mushaf-focus .mushaf-bookmarks-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .story-card-visual *, .story-stage *, .story-timeline i { animation: none !important; }
}
