/* =====================================================================
   جولة 82: صندوق الحوار (Undertale) · أشرطة المشهد 300ms · زر التخطي المطوّل · المصعد · لوحة الإيقاف · صفحة «عن اللعبة»
   ===================================================================== */

/* ---------- صندوق الحوار: انتقل لـcss/dlg.css (جولة 84) ---------- */

/* ---------- المشهد: الأشرطة 300ms + زر التخطي المطوّل ---------- */
body.st82 .mtc-bar { transition: height .3s cubic-bezier(.2, .8, .2, 1); }
body.st82 .mtc-skip { display: none; }
.cs-skip { position: fixed; z-index: 170; top: calc(12vh + 10px); left: 14px; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 12px; border-radius: 999px;
  background: #000c; color: #ddd; border: 1px solid #ffffff40; font: inherit; font-size: .88rem; cursor: pointer; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.cs-skip i { position: absolute; inset: 0; transform-origin: right; transform: scaleX(0); background: #e2342e55; }
.cs-skip span { position: relative; } .cs-skip b { position: relative; font-weight: 700; letter-spacing: -2px; }
.cs-skip.hold i { transform: scaleX(1); transition: transform 1s linear; }
@media (pointer: coarse) and (max-height: 500px) { .cs-skip { top: calc(9vh + 8px); } }

/* ---------- المصعد (نهاية الدرس) ---------- */
.elv { position: fixed; inset: 0; z-index: 155; background: #050506; display: grid; place-items: center; opacity: 0; transition: opacity .5s; touch-action: none; }
.elv.on { opacity: 1; }
/* جولة 84: الكابينة بإطار حديد وظل، وتملأ الشاشة العرضية بالجوال */
.elv-cab { position: relative; padding: 6px; background: linear-gradient(#24272c, #15171a); border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 30px 80px #000, inset 0 1px 0 #ffffff14; }
.elv canvas { display: block; width: min(88vw, calc(84vh * 4 / 3), 980px); aspect-ratio: 4 / 3; image-rendering: pixelated; border-radius: 2px; }
.elv.shk .elv-cab { animation: elv-shk .12s steps(2) infinite; }
.elv.shk.hard .elv-cab { animation-duration: .07s; }
@keyframes elv-shk { 0% { transform: translate(0, 0); } 50% { transform: translate(0, 1px); } 100% { transform: translate(1px, 0); } }
/* لوحة المصعد: لوح ستيل بزرين دائريين ▲ ▼ */
.elv-ch { position: absolute; z-index: 2; top: 50%; right: max(18px, env(safe-area-inset-right)); transform: translate(12px, -50%); display: grid; gap: 12px; padding: 14px 14px 16px; width: 176px;
  background: linear-gradient(100deg, #3a3e45, #26292e 45%, #34383e); border-radius: 8px; box-shadow: 0 0 0 1px #0b0c0e, inset 0 1px 0 #ffffff22, 0 16px 40px #000c;
  opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
.elv-ch::before, .elv-ch::after { content: ''; position: absolute; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #8a9098, #2b2e33); }
.elv-ch::before { left: 7px; } .elv-ch::after { right: 7px; }
.elv-ch.on { opacity: 1; pointer-events: auto; transform: translate(0, -50%); }
.elv-pn-h { text-align: center; font-size: .78rem; letter-spacing: .12em; color: #9aa1aa; padding-bottom: 6px; border-bottom: 1px solid #ffffff12; }
.elv-ch button { display: flex; align-items: center; gap: 12px; padding: 0; min-height: 56px; border: 0; background: none; color: #e8e2d6; font: inherit; font-weight: 700; font-size: .98rem; text-align: start; cursor: pointer; }
.elv-ch button i { flex: 0 0 auto; display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; font-style: normal; font-size: 1.05rem; color: #c9c3b6;
  background: radial-gradient(circle at 50% 40%, #2c2f35, #15171a 70%); box-shadow: 0 0 0 3px #1a1c20, 0 0 0 5px #4a4f57, inset 0 2px 3px #00000099; transition: color .15s, box-shadow .15s, transform .08s; }
.elv-ch button:hover i, .elv-ch button:focus-visible i { color: #fff4d6; box-shadow: 0 0 0 3px #1a1c20, 0 0 0 5px #8a8f98, 0 0 18px #ffe9b066, inset 0 2px 3px #00000099; }
.elv-ch button:focus-visible { outline: none; } .elv-ch button:focus-visible span { text-decoration: underline; text-underline-offset: 4px; }
.elv-ch button.down i { color: #ff6b5e; }
.elv-ch button.down:hover i, .elv-ch button.down:focus-visible i { color: #fff; background: radial-gradient(circle at 50% 40%, #a1201b, #4a0b09 70%); box-shadow: 0 0 0 3px #1a1c20, 0 0 0 5px #e2342e, 0 0 22px #e2342eaa, inset 0 2px 3px #00000099; }
.elv-ch button:active i { transform: scale(.94); }
.elv-ch.near { box-shadow: 0 0 0 1px #0b0c0e, inset 0 1px 0 #ffffff22, 0 16px 40px #000c, 0 0 0 2px #ffe9b033; }
.elv-ch.c-up .up i { color: #fff4d6; box-shadow: 0 0 0 3px #1a1c20, 0 0 0 5px #fff4d6, 0 0 20px #ffe9b0; }
.elv-ch.c-down .down i { color: #fff; background: #c8141f; box-shadow: 0 0 0 3px #1a1c20, 0 0 0 5px #ff3b3b, 0 0 24px #ff3b3b; }
body.touch .elv-ch { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); right: 50%; width: auto; grid-auto-flow: column; transform: translate(50%, 10px); padding: 10px 16px; gap: 22px; }
body.touch .elv-ch.on { transform: translate(50%, 0); }
body.touch .elv-pn-h { display: none; }
@media (max-height: 520px) { .elv canvas { width: min(70vw, calc(80vh * 4 / 3)); } }
.elv-end { position: absolute; inset: 0; display: grid; place-items: center; background: #000; color: #e8e2d6; font-size: clamp(1.4rem, 5vw, 2.4rem); letter-spacing: 3px; opacity: 0; transition: opacity 1.4s; pointer-events: none; z-index: 3; }
.elv-end.on { opacity: 1; pointer-events: auto; }
.elv-end small { display: block; margin-top: 14px; font-size: .9rem; letter-spacing: 0; color: #ff8f8a; text-align: center; opacity: 0; transition: opacity .8s .9s; }
.elv-end.on small { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .elv.shk .elv-cab { animation: none; } }

/* ---------- لوحة الإيقاف والخروج ---------- */
/* فوق بالنص يسار المؤقت — بعيد عن الجويستيك وزر الفعل وعدّاد المولدات */
.fzp-btn { position: fixed; z-index: 120; top: max(8px, env(safe-area-inset-top)); left: max(8px, calc(50% - 168px)); width: 44px; height: 44px; border-radius: 10px;
  display: none; place-items: center; background: #000a; border: 1px solid #ffffff38; color: #e8e2d6; padding: 0; cursor: pointer; }
.fzp-btn svg { width: 20px; height: 20px; } .fzp-btn i { display: flex; gap: 4px; } .fzp-btn i::before, .fzp-btn i::after { content: ''; width: 4px; height: 16px; background: currentColor; border-radius: 1px; }
body.fzp-live.touch .fzp-btn { display: grid; }
body.mtc-on .fzp-btn, body.fzp-open .fzp-btn { display: none !important; }
.fzp { position: fixed; inset: 0; z-index: 9500; display: grid; place-items: center; background: #000000; background: rgba(0, 0, 0, 0); transition: background .22s; }
.fzp.on { background: rgba(4, 6, 6, .58); backdrop-filter: blur(2px) saturate(.6); -webkit-backdrop-filter: blur(2px) saturate(.6); }
.fzp-crt { position: relative; width: min(380px, 90vw); padding: 18px 18px 16px; background: #050a07; color: #b9f5c8; border: 2px solid #2f6b41; border-radius: 14px;
  box-shadow: 0 0 0 4px #000, 0 0 40px #2bff7a22 inset, 0 20px 50px #000; font-family: inherit; transform: scale(.94) translateY(8px); opacity: 0; transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .22s; overflow: hidden; }
.fzp.on .fzp-crt { transform: none; opacity: 1; }
.fzp-crt::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, #0000 0 2px, #00000038 2px 3px); mix-blend-mode: multiply; }
.fzp-crt::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 50%, #0000 60%, #000a); }
.fzp-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: .78rem; letter-spacing: 2px; color: #6fd48c; }
.fzp-h b { font-size: 1.15rem; letter-spacing: 1px; color: #d8ffe2; text-shadow: 0 0 8px #2bff7a66; }
.fzp-live { margin: -4px 0 12px; padding: 7px 10px; border: 1px dashed #e2b04a88; border-radius: 8px; color: #ffd98a; font-size: .84rem; }
.fzp-list { display: grid; gap: 8px; position: relative; z-index: 1; }
.fzp-b { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 9px; border: 1px solid #2f6b41; background: #0a160e; color: #d8ffe2;
  font: inherit; font-size: 1rem; text-align: start; cursor: pointer; }
.fzp-b:hover, .fzp-b:focus-visible { background: #133a20; border-color: #4fd17a; outline: none; }
.fzp-b kbd { margin-inline-start: auto; font: inherit; font-size: .72rem; padding: 2px 6px; border-radius: 5px; border: 1px solid #2f6b41; color: #6fd48c; }
.fzp-b.out { border-color: #6b2f2f; background: #160a0a; color: #ffc9c4; } .fzp-b.out:hover { background: #3a1313; border-color: #e2342e; }
.fzp-b.yes { border-color: #e2342e; background: #3a1313; color: #fff; justify-content: center; } .fzp-b.no { justify-content: center; }
.fzp-q { margin: 2px 2px 10px; color: #ffd0cc; line-height: 1.7; }
.fzp-row { display: flex; gap: 8px; } .fzp-row .fzp-b { flex: 1; }
@media (prefers-reduced-motion: reduce) { .fzp, .fzp-crt { transition: none; } }

/* ---------- صفحة «عن اللعبة» ---------- */
.ab { display: grid; gap: 22px; }
.ab-hero { position: relative; display: grid; justify-items: center; gap: 8px; padding: 26px 16px 20px; border-radius: 16px; overflow: hidden; text-align: center;
  background: radial-gradient(120% 120% at 50% 0%, #2a0b0d 0%, #0b0b0e 62%); border: 1px solid #ffffff14; }
.ab-hero::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, #0000 0 2px, #0000002e 2px 3px); pointer-events: none; }
.ab-hero img { max-width: min(320px, 72%); max-height: 120px; object-fit: contain; filter: drop-shadow(0 6px 18px #e2342e44); }
.ab-hero .ab-logo-t { font-size: clamp(1.6rem, 6vw, 2.3rem); font-weight: 900; letter-spacing: 1px; color: #f3ece0; }
.ab-hero p { margin: 0; color: #c9bfae; max-width: 52ch; line-height: 1.8; position: relative; z-index: 1; }
.ab-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ab-nav a { padding: 6px 12px; border-radius: 999px; border: 1px solid #ffffff22; color: #e8e2d6; text-decoration: none; font-size: .9rem; }
.ab-nav a:hover { border-color: #e2342e; color: #fff; }
.ab-sec { scroll-margin-top: 12px; }
.ab-sec > h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 1.1rem; color: #f3ece0; }
.ab-sec > h3::before { content: ''; width: 4px; height: 1.05em; border-radius: 2px; background: #e2342e; }
.ab-sec > p { margin: 0 0 8px; line-height: 1.9; color: #d6cdbf; }
.ab-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.ab-card { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: #121216; border: 1px solid #ffffff12; min-width: 0; }
.ab-av { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: #1d1d24; color: #e2342e; font-weight: 900; font-size: 1.3rem; }
.ab-av img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.ab-c { min-width: 0; display: grid; gap: 2px; }
.ab-c b { color: #f3ece0; overflow-wrap: anywhere; } .ab-c span { color: #b8ae9e; font-size: .9rem; line-height: 1.5; }
.ab-c a, .ab-lic a { color: #ff8f8a; font-size: .86rem; text-decoration: none; overflow-wrap: anywhere; } .ab-c a:hover, .ab-lic a:hover { text-decoration: underline; }
.ab-lic { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.ab-lic li { padding: 12px 14px; border-radius: 12px; background: #101014; border: 1px solid #ffffff12; display: grid; gap: 4px; }
.ab-lic .ab-lt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; } .ab-lic b { color: #f3ece0; }
.ab-lic em { font-style: normal; font-size: .76rem; padding: 2px 8px; border-radius: 999px; background: #1f2a1f; color: #a8e6b5; border: 1px solid #2f6b41; }
.ab-lic span { color: #b8ae9e; font-size: .9rem; line-height: 1.6; }

/* ---------- جولة 84: لوحة الإيقاف أبسط · «الإعدادات» = نفس صفحة القائمة فوق اللعبة ---------- */
.fzp-h { justify-content: center; margin-bottom: 14px; }
.fzp.under .fzp-crt { opacity: 0; pointer-events: none; }
.fzp-set { position: fixed; inset: 0; z-index: 9600; display: grid; place-items: center; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(4, 6, 6, .62); opacity: 0; transition: opacity .18s; }
.fzp-set.on { opacity: 1; }
.fzp-set > .panel { position: relative; margin: 0; width: min(760px, 100%); max-height: calc(100dvh - 16px); overflow: auto; overscroll-behavior: contain; }
.fzp-set .set-group[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .fzp-set { transition: none; } }

/* ---------- جولة 85: الدرس — الحارس يلحقك: إنذار أحمر يدور + حواف تنبض حسب قربه · مسكك: وميض أحمر ---------- */
body.mt-alarm #scr-game::before { content: ''; position: absolute; inset: 0; z-index: 40; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(170, 0, 0, calc(.26 + var(--mt-dg, 0) * .4)) 100%);
  animation: mtAlarm 1.1s ease-in-out infinite; }
body.mt-alarm #scr-game::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; z-index: 41; pointer-events: none;
  background: linear-gradient(90deg, transparent, #ff2a2a, transparent) 0 0 / 40% 100% no-repeat; animation: mtSweep 1.1s linear infinite; box-shadow: 0 0 18px #ff2a2a; }
@keyframes mtAlarm { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes mtSweep { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.mt-caught { position: fixed; inset: 0; z-index: 150; pointer-events: none; background: radial-gradient(circle, rgba(255, 30, 30, .15), rgba(120, 0, 0, .75)); opacity: 0; }
.mt-caught.on { animation: mtCaught .9s ease-out; }
@keyframes mtCaught { 0% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { body.mt-alarm #scr-game::before, body.mt-alarm #scr-game::after { animation: none; } }

/* جولة 85: نهاية الدرس ⇐ المصعد بدون قطع: سواد ناعم تحت المصعد (155) وفوق اللعبة */
.fz-cover { position: fixed; inset: 0; z-index: 154; background: #000; opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.fz-cover.on { opacity: 1; pointer-events: auto; }
.fz-cover[hidden] { display: none; }
