/*
 * «حكاياتي» (app/js/darb/mystories.js + شاشات stories / mystory / surprise في app.js).
 * المشغّل مسرح سينمائي غامق دافي بملء الشاشة (زي لوحة الأهل web/story.js)، والرف والمفاجأة على الورق المنوّر.
 * المقاسات vw، ومفيش box-shadow مغبّش على التحديد (LG).
 */
/* ── المشغّل ── */
.ms { position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; background: #140F26; color: #fff; }
.ms-pic, .ms-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.ms-img { object-fit: cover; opacity: 0; transition: opacity 1.1s ease; }
.ms-img.on { opacity: 1; -webkit-animation: msKb0 16s ease-out both; animation: msKb0 16s ease-out both; }
.ms-img.on.k1 { -webkit-animation-name: msKb1; animation-name: msKb1; }
.ms-img.on.k2 { -webkit-animation-name: msKb2; animation-name: msKb2; }
@keyframes msKb0 { from { transform: scale(1.02); } to { transform: scale(1.12) translate(-2%, -1.5%); } }
@keyframes msKb1 { from { transform: scale(1.12) translate(2%, 1%); } to { transform: scale(1.03); } }
@keyframes msKb2 { from { transform: scale(1.04) translate(-1.5%, 1%); } to { transform: scale(1.13) translate(1.5%, -1%); } }
.ms.paused .ms-img.on { -webkit-animation-play-state: paused; animation-play-state: paused; }
.ms-shade { position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; background: linear-gradient(180deg, rgba(14, 10, 28, .35) 0%, rgba(14, 10, 28, 0) 22%, rgba(14, 10, 28, 0) 50%, rgba(14, 10, 28, .85) 100%); }
.ms.at-title .ms-shade, .ms.at-end .ms-shade { background: rgba(14, 10, 28, .68); }

/* الكابشن: كل كلمة بتطلع وتنوّر دهبي وهي بتتقال، وبيطلع فوق التحكم وهو ظاهر */
.ms-cap { position: absolute; left: 7vw; right: 7vw; bottom: 4vw; text-align: center; pointer-events: none; transition: bottom .4s ease; }
.ms:not(.idle) .ms-cap { bottom: 9.5vw; }
.ms-cap p { margin: 0; font-size: 2.7vw; line-height: 1.75; font-weight: 800; color: #fff; text-shadow: 0 .15vw .6vw rgba(0, 0, 0, .6); }
.ms-cap span { display: inline-block; opacity: .16; transform: translateY(.35em); transition: opacity .35s ease, transform .45s cubic-bezier(.34, 1.56, .64, 1), color .3s ease; }
.ms-cap span.on { opacity: 1; transform: none; }
.ms-cap span.now { color: #FFC83D; }
.ms-cap.in p { -webkit-animation: msRise .5s ease both; animation: msRise .5s ease both; }
@keyframes msRise { from { opacity: 0; transform: translateY(1vw); } }

/* زرار التشغيل الكبير وهي واقفة */
.ms-big { position: absolute; left: 50%; top: 44%; width: 7vw; height: 7vw; margin: -3.5vw 0 0 -3.5vw; border-radius: 50%; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 .2vw rgba(255, 255, 255, .55); opacity: 0; transition: opacity .25s; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.ms-big svg { width: 3.2vw; height: 3.2vw; fill: #fff; margin-left: -.3vw; }
.ms.paused:not(.at-title):not(.at-end) .ms-big { opacity: 1; }

/* شاشة البداية والنهاية */
.ms-card { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ms-card > div { pointer-events: auto; text-align: center; }
.ms-open { -webkit-animation: msPop .6s cubic-bezier(.34, 1.56, .64, 1) both; animation: msPop .6s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes msPop { from { opacity: 0; transform: scale(.85); } }
.ms-face { height: 15vw; display: block; margin: 0 auto; filter: drop-shadow(0 .8vw 1.6vw rgba(0, 0, 0, .5)); }
.ms-face:not([src]) { display: none; }
.ms-open small { display: block; color: #FFC83D; font-weight: 800; font-size: 1.4vw; margin-top: .5vw; }
.ms-open h2 { margin: .3vw 0 .2vw; font-size: 3.8vw; font-weight: 900; line-height: 1.3; color: #fff; text-shadow: 0 .25vw 1vw rgba(0, 0, 0, .5); }
.ms-open p { margin: 0 0 1.4vw; color: #E9E2FF; font-size: 1.7vw; }
.ms-go, .ms-btn { display: inline-flex; align-items: center; padding: .9vw 2.2vw .9vw 1.8vw; border-radius: 3vw; font-size: 1.8vw; font-weight: 900; cursor: pointer; }
.ms-go { background: #FFC83D; color: #22195A; box-shadow: 0 .4vw 0 #D08A12; }
.ms-go svg { width: 1.9vw; height: 1.9vw; fill: #22195A; margin-left: .8vw; }
.ms-go em, .ms-btn em { font-style: normal; }
.ms-end h2 { margin: 0 0 .3vw; font-size: 2.8vw; font-weight: 900; color: #fff; }
.ms-end p { margin: 0 0 1vw; color: #E9E2FF; font-size: 1.5vw; }
.ms-cols { display: flex; justify-content: center; }
.ms-cols img { height: 20vw; width: 13.3vw; object-fit: contain; background: #fff; border-radius: .8vw; margin: 0 .5vw; transform: rotate(-2deg); }
.ms-cols img + img { transform: rotate(2deg); }
.ms-acts { margin-top: 1.6vw; display: flex; justify-content: center; }
.ms-btn { margin: 0 .5vw; background: #FFC83D; color: #22195A; box-shadow: 0 .4vw 0 #D08A12; font-size: 1.6vw; }
.ms-btn svg { width: 1.7vw; height: 1.7vw; margin-left: .6vw; }
.ms-btn.ms-ghost { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 0 0 .15vw rgba(255, 255, 255, .4); }

/* التحكم تحت: بيختفي وهي شغالة، وبيرجع مع أي حركة */
.ms-ui { position: absolute; left: 0; right: 0; bottom: 0; padding: 2vw 2.4vw 1.4vw; background: linear-gradient(180deg, rgba(14, 10, 28, 0), rgba(14, 10, 28, .75)); transition: opacity .4s, transform .4s; }
.ms.idle .ms-ui { opacity: 0; transform: translateY(1vw); pointer-events: none; }
.ms.at-title .ms-ui .ms-bars, .ms.at-title .ms-row [data-c="prev"], .ms.at-title .ms-row [data-c="next"], .ms.at-title .ms-row [data-c="play"] { visibility: hidden; }
.ms-bars { display: flex; direction: rtl; }
.ms-seg { flex: 1; height: .32vw; margin: 0 .2vw; border-radius: .2vw; background: rgba(255, 255, 255, .28); overflow: hidden; }
.ms-seg b { display: block; height: 100%; width: 0; background: #FFC83D; transition: width .25s linear; }
.ms-row { display: flex; align-items: center; margin-top: .8vw; }
.ms-b { display: flex; align-items: center; justify-content: center; width: 4vw; height: 4vw; margin-left: .6vw; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }
.ms-b svg { width: 2vw; height: 2vw; fill: #fff; }
.ms-b[data-c="back"] { width: auto; padding: 0 1.4vw 0 1.2vw; border-radius: 2vw; font-size: 1.4vw; font-weight: 800; }
.ms-b[data-c="back"] svg { fill: none; stroke: #fff; margin-left: .4vw; width: 1.6vw; height: 1.6vw; }
.ms-b em { font-style: normal; }
.ms-b[data-c="report"] { width: auto; padding: 0 1.2vw; border-radius: 2vw; font-size: 1.55vw; white-space: nowrap; }
.ms-main { width: 4.8vw; height: 4.8vw; background: #FFC83D; }
.ms-main svg { fill: #22195A; }
.ms-t { font-size: 1.3vw; font-weight: 800; color: #E9E2FF; margin-right: .6vw; }
.ms-ttl { flex: 1; min-width: 0; text-align: left; font-size: 1.3vw; color: #CFC6F0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* التحديد بالريموت: حلقة سادة دهبي من غير ضل مغبّش */
#stage .ms .f.on { outline: .3vw solid #FFC83D; outline-offset: .25vw; }

/* ── الرف: «الحكايات» ── */
.scr.shelf { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: block; padding: 2.6vw 4vw 0; overflow: hidden; background: linear-gradient(180deg, #FFF6E8 0%, #FCEBD3 100%); color: #22195A; text-align: right; }
.shelf-top { display: flex; align-items: center; width: 100%; margin-bottom: 1.4vw; }
.shelf-top h1 { flex: 1; margin: 0; font-size: 3.2vw; font-weight: 900; color: #22195A; text-align: right; }
.shelf-back { display: flex; align-items: center; padding: .8vw 1.6vw .9vw 1.3vw; border-radius: 3vw; background: #22195A; color: #fff; font-size: 1.6vw; font-weight: 900; cursor: pointer; }
.shelf-row h2 { margin: 1.2vw 0 .9vw; font-size: 2vw; font-weight: 900; color: #22195A; }
.shelf-row h2 small { font-size: 1.3vw; font-weight: 700; color: #6B6296; margin-right: .8vw; }
.shelf-row { width: 100%; }
.shelf-list { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; padding: .6vw .4vw 1.4vw; }
.shelf-card { position: relative; flex: none; width: 21vw; margin-left: 1.6vw; border-radius: 1.6vw; background: #fff; box-shadow: 0 .45vw 0 rgba(34, 25, 90, .12); cursor: pointer; transform: rotate(-1deg); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.shelf-card:nth-child(2n) { transform: rotate(1deg); }
.shelf-card .sc-pic { position: relative; height: 13vw; border-radius: 1.6vw 1.6vw 0 0; overflow: hidden; background: #EEE7F7; }
.shelf-card .sc-pic img { width: 100%; height: 100%; object-fit: cover; }
.shelf-card .sc-pic img.sc-face { position: absolute; left: .5vw; bottom: .2vw; width: auto; height: 6vw; object-fit: contain; filter: drop-shadow(0 .3vw .5vw rgba(34, 25, 90, .35)); }
.shelf-card b { display: block; padding: 1vw 1.2vw 1.2vw; font-size: 1.6vw; line-height: 1.4; font-weight: 900; }
.sc-new { position: absolute; z-index: 2; top: -.8vw; right: -.6vw; padding: .3vw 1vw .4vw; border-radius: 1.2vw 1.2vw 1.2vw .4vw; background: #E5486C; color: #fff; font-size: 1.2vw; font-weight: 900; transform: rotate(6deg); }
#stage .shelf .f.on { outline: .3vw solid #22195A; outline-offset: .2vw; box-shadow: 0 0 0 .75vw #FFC83D; transform: rotate(0) translateY(-.4vw); }
.shelf-empty { font-size: 1.6vw; color: #6B6296; padding: 1vw 0; }

/* ── المفاجأة: «حكاية جديدة بطلتها إنتي» ── */
.scr.surp { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(80% 90% at 50% 45%, #FFF3C4 0%, #FCEBD3 60%, #F6D9B6 100%); color: #22195A; text-align: center; }
.surp-card { position: relative; width: 52vw; padding: 2.4vw 3vw 2.6vw; border-radius: 2.4vw; background: #fff; box-shadow: 0 .6vw 0 rgba(34, 25, 90, .14); transform: rotate(-1.2deg); -webkit-animation: msPop .7s cubic-bezier(.34, 1.56, .64, 1) both; animation: msPop .7s cubic-bezier(.34, 1.56, .64, 1) both; }
.surp-card:before { content: ""; position: absolute; top: -1.2vw; left: 50%; width: 8vw; height: 2.2vw; margin-left: -4vw; background: #FFE08A; opacity: .9; transform: rotate(-3deg); }
.surp-pic { position: relative; height: 18vw; margin: 0 0 1.2vw; border-radius: 1.4vw; overflow: hidden; background: #EEE7F7; }
.surp-pic img.bg { width: 100%; height: 100%; object-fit: cover; }
.surp-pic img.face { position: absolute; left: 1vw; bottom: 0; height: 16vw; filter: drop-shadow(0 .4vw .8vw rgba(34, 25, 90, .4)); -webkit-animation: surpBob 2.6s ease-in-out infinite; animation: surpBob 2.6s ease-in-out infinite; }
@keyframes surpBob { 50% { transform: translateY(-.6vw) rotate(-2deg); } }
.surp small { display: inline-block; padding: .3vw 1.2vw .4vw; border-radius: 1.4vw; background: #E5486C; color: #fff; font-size: 1.3vw; font-weight: 900; }
.surp h1 { margin: .6vw 0 .2vw; font-size: 3vw; font-weight: 900; line-height: 1.3; }
.surp .sub { font-size: 1.7vw; color: #4E4585; margin-bottom: 1.4vw; }
.surp-acts { display: flex; justify-content: center; }
.surp-acts .ms-btn { font-size: 1.8vw; }
.surp-acts .ms-ghost { background: #F5F1FB; color: #6A48D6; box-shadow: none; }
#stage .surp .f.on { outline: .3vw solid #22195A; outline-offset: .25vw; }

/* الكارت الكبير للحكاية الأحدث */
.shelf-hero { position: relative; height: 21vw; border-radius: 2vw; overflow: visible; cursor: pointer; box-shadow: 0 .5vw 0 rgba(34, 25, 90, .14); }
.shelf-hero .sh-bg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 2vw; }
.shelf-hero:after { content: ""; position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-radius: 2vw; background: linear-gradient(270deg, rgba(20, 15, 38, .82) 0%, rgba(20, 15, 38, .45) 45%, rgba(20, 15, 38, 0) 75%); }
.shelf-hero .sh-face { position: absolute; z-index: 1; left: 3vw; bottom: 0; height: 19vw; width: auto; filter: drop-shadow(0 .6vw 1vw rgba(0, 0, 0, .45)); }
.sh-txt { position: absolute; z-index: 1; right: 3vw; top: 50%; transform: translateY(-50%); max-width: 46vw; color: #fff; text-align: right; }
.sh-txt .sc-new { position: static; display: inline-block; margin-bottom: .6vw; transform: none; }
.sh-txt small { display: block; color: #FFC83D; font-size: 1.5vw; font-weight: 800; }
.sh-txt h2 { margin: .2vw 0 1vw; font-size: 3vw; font-weight: 900; line-height: 1.3; color: #fff; text-shadow: 0 .2vw .8vw rgba(0, 0, 0, .5); }
.sh-play { display: inline-block; padding: .8vw 2vw .9vw; border-radius: 3vw; background: #FFC83D; color: #22195A; font-size: 1.7vw; font-weight: 900; box-shadow: 0 .4vw 0 #D08A12; }
#stage .shelf .shelf-hero.f.on { transform: none; outline: .3vw solid #22195A; outline-offset: .2vw; box-shadow: 0 0 0 .75vw #FFC83D; }
.shelf-row h2 { margin-top: 1.6vw; }

/* اللمس (موبايل/تابلت): كل الكلام ≥13px على أصغر شاشة (نفس قاعدة touch.css) */
@media (pointer: coarse) {
  html:root .ms-t, html:root .ms-ttl, html:root .ms-open small, html:root .ms-end p, html:root .ms-open p, html:root .sh-txt small,
  html:root .shelf-row h2 small, html:root .sc-new, html:root .surp small, html:root .shelf-empty { font-size: 1.9vw; }
  html:root .ms-b[data-c="back"], html:root .ms-b[data-c="report"], html:root .ms-btn, html:root .ms-go, html:root .shelf-back, html:root .surp .sub, html:root .sh-play { font-size: 2vw; }
  html:root .ms-b { width: 5vw; height: 5vw; }
  html:root .ms-b[data-c="back"], html:root .ms-b[data-c="report"] { width: auto; }
  html:root .ms-main { width: 5.8vw; height: 5.8vw; }
  html:root .ms-cap p { font-size: 3vw; }
  html:root .shelf-card b { font-size: 2vw; }
}

.story-gift .surp-acts { margin-top: 2.2vw; gap: 1.4vw; }
.story-gift .surp-acts .btn { font-size: 1.8vw; margin: 0; }
.scr.shelf .shelf-empty { font-size: max(1.6vw, 14px); color: #4e4585; }

.story-gift .surp-pic { height: 18.6vw; }
.story-gift .surp-pic img.bg { object-fit: contain; background: #fff4db; }
