/* 🌀 الهروب إلى المركز — نيون بنفسجي مثل باقي الموقع */
body { margin: 0; min-height: 100vh; font-family: Almarai, Tahoma, sans-serif; }
.mz-screen { display: none; max-width: 520px; margin: 0 auto; padding: 64px 12px 28px; box-sizing: border-box; }
.mz-screen.on { display: block; }
.mz-head { text-align: center; margin-bottom: 10px; }
.mz-head h1 { margin: 0; font-size: 1.7rem; text-shadow: 0 0 14px #a855f7, 0 0 30px #ec4899; }
.mz-head p { margin: 6px 0 0; color: var(--nx-muted, #b9b2dc); }
.mz-card { background: rgba(34, 18, 79, .78); border: 1px solid rgba(168, 85, 247, .45); border-radius: 18px; padding: 14px; margin: 12px 0; box-shadow: 0 0 22px -8px #a855f7; }
.mz-card h2 { margin: 0 0 8px; font-size: 1.1rem; }
.mz-small { font-size: .85rem; color: var(--nx-muted, #b9b2dc); margin: 4px 0 10px; line-height: 1.6; }
.mz-center { text-align: center; }
.mz-btn, .mz-levels button, .mz-pad button, .mz-pulse {
  font: inherit; color: #fff; border: 1px solid rgba(34, 211, 238, .55); background: rgba(34, 211, 238, .12);
  border-radius: 14px; padding: 11px 14px; cursor: pointer; touch-action: manipulation;
}
.mz-btn:active, .mz-levels button:active, .mz-pad button:active { transform: scale(.96); }
.mz-wide { display: block; width: 100%; margin-top: 10px; }
.mz-btn small { display: block; font-size: .75rem; color: var(--nx-muted, #b9b2dc); }
.mz-go { background: linear-gradient(90deg, #ec4899, #a855f7); border-color: transparent; font-weight: 700; }
.mz-ghost { background: transparent; border-color: rgba(255, 255, 255, .2); }
.mz-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mz-levels button { font-weight: 700; padding: 11px 4px; white-space: nowrap; font-size: .95rem; }
.mz-shapes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mz-shapes button { background: rgba(255, 255, 255, .05); border: 2px solid transparent; border-radius: 12px; padding: 4px; cursor: pointer; }
.mz-shapes button img { width: 100%; aspect-ratio: 1; display: block; }
.mz-shapes button.on { border-color: #22d3ee; box-shadow: 0 0 12px #22d3ee; }
.mz-list { display: grid; gap: 6px; margin-top: 10px; }
.mz-list button { text-align: right; }
.mz-code { display: flex; gap: 8px; margin-top: 10px; }
.mz-code input { flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; text-align: center; letter-spacing: 4px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(0, 0, 0, .25); color: #fff; padding: 8px; }
.mz-top { margin: 0; padding-inline-start: 22px; line-height: 1.9; }
.mz-pill { display: inline-block; font-size: .8rem; padding: 3px 10px; border-radius: 99px; background: rgba(168, 85, 247, .25); border: 1px solid rgba(168, 85, 247, .6); }
.mz-bigcode { font-size: 2.2rem; letter-spacing: 8px; text-align: center; font-weight: 800; text-shadow: 0 0 14px #22d3ee; margin-bottom: 10px; }
.mz-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.mz-row .mz-btn { flex: 1; }
/* old */ .mz-players { list-style: none; padding: 0; margin: 12px 0 4px; display: grid; gap: 6px; }
.mz-players li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); border-inline-start: 4px solid var(--c, #fff); }
.mz-players img { width: 30px; height: 30px; }

#play.on { padding-top: 56px; }
.mz-hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mz-hud-box { text-align: center; min-width: 70px; }
.mz-hud-box span { display: block; font-size: .7rem; color: var(--nx-muted, #b9b2dc); }
.mz-hud-box b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.mz-pulse { padding: 8px 12px; border-color: #facc15; background: rgba(250, 204, 21, .12); }
.mz-pulse[disabled] { opacity: .4; }
.mz-bars { display: grid; gap: 3px; margin-bottom: 6px; }
.mz-bar { display: flex; align-items: center; gap: 6px; font-size: .75rem; }
.mz-bar img { width: 18px; height: 18px; }
.mz-bar .tr { flex: 1; height: 7px; border-radius: 9px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.mz-bar .tr i { display: block; height: 100%; background: var(--c, #22d3ee); box-shadow: 0 0 8px var(--c, #22d3ee); transition: width .2s; }
.mz-bar .nm { width: 74px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mz-stage { position: relative; width: 100%; max-width: min(96vw, 62vh); margin: 0 auto; }
#board { display: block; width: 100%; aspect-ratio: 1; border-radius: 14px; touch-action: none; box-shadow: 0 0 30px -6px #a855f7; }
.mz-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 5rem; font-weight: 800; text-shadow: 0 0 20px #ec4899; background: rgba(10, 4, 24, .45); border-radius: 14px; }
.mz-pad { display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 50px); gap: 6px; justify-content: center; margin: 10px auto 0; direction: ltr; }
.mz-pad button { padding: 0; font-size: 1.3rem; }
.mz-pad [data-d="1"] { grid-column: 2; grid-row: 1; }
.mz-pad [data-d="8"] { grid-column: 1; grid-row: 2; }
.mz-pad [data-d="4"] { grid-column: 2; grid-row: 2; }
.mz-pad [data-d="2"] { grid-column: 3; grid-row: 2; }
.mz-score { font-size: 2.6rem; font-weight: 800; color: #facc15; text-shadow: 0 0 16px #facc15; margin: 6px 0; }
.mz-res { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; text-align: right; }
.mz-res li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.mz-res li.me { outline: 2px solid #22d3ee; }
.mz-res img { width: 26px; height: 26px; }
.mz-res .sc { margin-inline-start: auto; font-weight: 700; color: #facc15; }
html.sp-watching #menu, html.sp-watching .mz-pad, html.sp-watching #pulseBtn { display: none !important; }

/* غرفة الانتظار + الأدوات */
#lobby #chHost .ch-lobby { position: static; inset: auto; background: none; padding: 0; }
.mz-seatmap { position: relative; width: 100%; max-width: 300px; aspect-ratio: 1; margin: 6px auto; border-radius: 16px; border: 2px solid rgba(168, 85, 247, .6); box-shadow: 0 0 18px -6px #a855f7 inset; background: radial-gradient(circle at 50% 50%, rgba(250, 204, 21, .35) 0 8%, transparent 9%), repeating-linear-gradient(0deg, rgba(168, 85, 247, .12) 0 2px, transparent 2px 28px), repeating-linear-gradient(90deg, rgba(168, 85, 247, .12) 0 2px, transparent 2px 28px); }
.mz-seatmap .ex { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 1.4rem; }
.mz-seat { position: absolute; width: 46%; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .78rem; text-align: center; }
.mz-seat img { width: 40px; height: 40px; filter: drop-shadow(0 0 6px var(--c)); }
.mz-seat b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c); }
.mz-seat.empty { opacity: .55; }
.mz-seat.free { cursor: pointer; }
.mz-seat.free:hover, .mz-seat.free:active { opacity: 1; }
.mz-seat[data-s="0"] { left: 2%; top: 3%; } .mz-seat[data-s="1"] { right: 2%; top: 3%; }
.mz-seat[data-s="2"] { right: 2%; bottom: 3%; } .mz-seat[data-s="3"] { left: 2%; bottom: 3%; }
.mz-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.mz-tool { font: inherit; color: #fff; text-align: right; border-radius: 14px; padding: 9px 10px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .04); cursor: pointer; }
.mz-tool b { display: block; }
.mz-tool small { display: block; font-size: .72rem; color: var(--nx-muted, #b9b2dc); line-height: 1.4; }
.mz-tool.on { border-color: #4ade80; background: rgba(74, 222, 128, .12); box-shadow: 0 0 10px -4px #4ade80; }
.mz-tool[disabled] { cursor: default; }
.mz-toolbtns { display: flex; gap: 6px; }
.mz-toolbtns button { padding: 8px 10px; }
.mz-toolbtns [hidden] { display: none; }
.mz-boost { border-color: #22d3ee; background: rgba(34, 211, 238, .12); }
.mz-freeze { border-color: #7dd3fc; background: rgba(125, 211, 252, .12); }

/* زر «جاهز» تحت اسم اللاعب */
.mz-ready { font: inherit; font-weight: 800; font-size: .95rem; color: #fff; border: 2px solid #facc15; background: rgba(250, 204, 21, .18); border-radius: 99px; padding: 6px 16px; cursor: pointer; animation: mzPulse 1.2s ease-in-out infinite; }
.mz-ready.on { border-color: #4ade80; background: rgba(74, 222, 128, .22); animation: none; }
@keyframes mzPulse { 50% { box-shadow: 0 0 14px #facc15; transform: scale(1.06); } }

/* 🌍 اختيار العالم */
.mz-worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.mz-world { position: relative; padding: 0; border-radius: 14px; overflow: hidden; border: 2px solid rgba(255,255,255,.12); background: #120a26; cursor: pointer; aspect-ratio: 1; color: #fff; font: inherit; }
.mz-world img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mz-world b { position: absolute; inset: auto 0 0 0; font-size: .72rem; padding: 4px 2px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.mz-world.on { border-color: #facc15; box-shadow: 0 0 14px #facc15; }
.mz-world.rnd { display: grid; place-items: center; background: radial-gradient(circle, #3b1d8f, #120a26); }
.mz-world .dice { font-size: 2rem; }
.mz-lite { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: .85rem; color: var(--nx-muted, #b9b2dc); }
.mz-lite input { width: 18px; height: 18px; accent-color: #facc15; }

/* 🎬 العد السينمائي */
.mz-count { background: radial-gradient(circle, rgba(20,6,40,.25), rgba(6,2,14,.7)) !important; overflow: hidden; }
.mz-count b { position: relative; font-size: 7rem; font-weight: 900; color: #fff; text-shadow: 0 0 18px #ec4899, 0 0 46px #a855f7; animation: mzCount .9s cubic-bezier(.2,1.4,.4,1) both; }
.mz-count b.go { font-size: 3.6rem; color: #fde047; text-shadow: 0 0 20px #f59e0b, 0 0 50px #ef4444; animation: mzGo .6s ease-out both; }
.mz-count .ring { position: absolute; left: 50%; top: 50%; width: 70%; aspect-ratio: 1; border-radius: 50%; border: 6px solid rgba(236,72,153,.8); box-shadow: 0 0 30px #ec4899; transform: translate(-50%, -50%); animation: mzRing .9s ease-in both; }
@keyframes mzCount { from { transform: scale(2.4); opacity: 0; filter: blur(6px); } 40% { opacity: 1; filter: blur(0); } to { transform: scale(1); } }
@keyframes mzRing { from { width: 95%; opacity: 1; } to { width: 20%; opacity: 0; } }
@keyframes mzGo { from { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; } to { transform: scale(1); opacity: 1; } }

/* 🏁 احتفال الوصول */
.mz-arrive { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.mz-arrive b { font-size: 2.8rem; font-weight: 900; color: #fde047; text-shadow: 0 0 18px #f59e0b, 0 0 40px #ec4899; opacity: 0; }
.mz-arrive.go b { animation: mzArrive 1.6s ease-out both; }
@keyframes mzArrive { 0% { transform: scale(.3) rotate(-8deg); opacity: 0; } 25% { transform: scale(1.25) rotate(3deg); opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.1) translateY(-20px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mz-count b, .mz-count .ring, .mz-arrive.go b { animation-duration: .01s; } }

/* ▶️ اختيار الصعوبة + زر «ابدأ اللعب» تحتها */
[data-for="solo"] button.on { border-color: #facc15; background: rgba(250, 204, 21, .2); box-shadow: 0 0 12px -2px #facc15; }
.mz-startbtn { font-size: 1.15rem; font-weight: 900; padding: 14px; animation: mzStartPulse 1.4s ease-in-out infinite; }
/* (قديم) */
.mz-start { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; justify-items: center; text-align: center; padding: 16px; background: rgba(8,4,20,.55); border-radius: 14px; }
.mz-start button { font: inherit; font-size: 1.5rem; font-weight: 900; color: #fff; border: 0; border-radius: 99px; padding: 16px 34px; cursor: pointer; background: linear-gradient(90deg, #ec4899, #a855f7); box-shadow: 0 0 26px #ec4899; animation: mzStartPulse 1.3s ease-in-out infinite; }
.mz-start small { color: #e9d5ff; font-size: .85rem; max-width: 260px; line-height: 1.6; }
@keyframes mzStartPulse { 50% { transform: scale(1.06); box-shadow: 0 0 40px #a855f7; } }
#play { touch-action: none; }

/* 🐞 تصليح (علي 25/11 «الرقم معلق»): display:grid كان يغطي على hidden فيظل العد ظاهر */
.mz-count[hidden], .mz-arrive[hidden], .mz-start[hidden], [hidden] { display: none !important; }

/* 🧭 شاشة التجهيز الوحدة */
.mz-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 4px; position: sticky; top: 52px; z-index: 5; }
.mz-modes button { font: inherit; font-weight: 800; color: #fff; border-radius: 14px; padding: 12px 4px; border: 1px solid rgba(255,255,255,.18); background: rgba(34,18,79,.92); cursor: pointer; white-space: nowrap; font-size: .95rem; }
.mz-modes button.on { border-color: #facc15; background: linear-gradient(180deg, rgba(250,204,21,.28), rgba(34,18,79,.95)); box-shadow: 0 0 14px -3px #facc15; }
.mz-link { font: inherit; font-size: .85rem; color: #fde047; background: none; border: 0; text-decoration: underline; cursor: pointer; }
.mz-spacer { height: 120px; }
.mz-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(10,4,26,.96) 30%); }
.mz-dock > * { max-width: 496px; margin-left: auto; margin-right: auto; }
.mz-summary { text-align: center; font-size: .8rem; color: #e9d5ff; margin-bottom: 6px; }
.mz-dock .mz-startbtn { margin-top: 0; }
#menu:not(.on) ~ .mz-dock, .mz-screen:not(.on) .mz-dock { display: none; }
/* 📖 الشرح */
.mz-tut { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(6,2,16,.78); padding: 16px; }
.mz-tut-card { max-width: 340px; width: 100%; text-align: center; background: #1d0f47; border: 1px solid rgba(250,204,21,.5); border-radius: 20px; padding: 18px; box-shadow: 0 0 30px -8px #a855f7; }
.mz-tut-card .ic { font-size: 3rem; }
.mz-tut-card h3 { margin: 6px 0; }
.mz-tut-card p { color: #e9d5ff; line-height: 1.7; margin: 0 0 10px; }
.mz-tut-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.mz-tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.25); }
.mz-tut-dots i.on { background: #facc15; }
/* ⏸️ الإيقاف */
.mz-pause { padding: 8px 10px; }
.mz-pausecover { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; justify-items: center; background: rgba(8,4,20,.8); border-radius: 14px; }
.mz-pausecover b { font-size: 2rem; }
/* أزرار النهاية */
.mz-endbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.mz-endbtns .mz-go { grid-column: 1 / -1; font-size: 1.1rem; padding: 14px; }
.mz-endbtns a.mz-btn { text-decoration: none; text-align: center; }
/* أسهم أكبر للإبهام + تأثير ضغط */
.mz-pad { grid-template-columns: repeat(3, 68px); grid-template-rows: repeat(2, 58px); gap: 8px; }
.mz-pad button { font-size: 1.5rem; transition: transform .08s, background .08s; }
.mz-pad button:active { transform: scale(.9); background: rgba(34,211,238,.35); }

/* 🔊🎤 صف التحكم: الأسهم بالنص والصوت على اليمين، كل واحد بمكانه (علي 26/11) */
.mz-ctrl { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; direction: ltr; margin: 10px 0 0; }
.mz-ctrl .mz-pad { grid-column: 2; margin: 0; }
.mz-voice { grid-column: 3; justify-self: start; margin-left: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mz-voice:empty, .mz-voice[data-cv="off"] .cv-talking { display: none; }

/* 📏 الجولة كاملة بشاشة وحدة بدون نزول (علي 26/11): المتاهة تاخذ اللي يبقى من الارتفاع، وتبقى مربعة */
#play.on { display: flex; flex-direction: column; height: 100dvh; padding-top: 50px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
#play.on > * { flex: none; }
#play.on .mz-stage { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; container-type: size; display: flex; justify-content: center; align-items: center; }
#play.on #board { width: min(100cqw, 100cqh); height: auto; max-width: none; }
@media (max-height: 760px) { #play .mz-small { display: none; } }
/* الجوال بالعرض: المتاهة جهة، والوقت والأسهم والصوت جهة */
@media (orientation: landscape) and (max-height: 560px) {
  #play.on { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 42%); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "stage hud" "stage bars" "stage ctrl"; column-gap: 16px; max-width: 980px; padding: 46px 12px calc(8px + env(safe-area-inset-bottom)); }
  #play .mz-hud { grid-area: hud; } #play .mz-bars { grid-area: bars; }
  #play.on .mz-stage { grid-area: stage; height: 100%; }
  #play .mz-ctrl { grid-area: ctrl; margin: 0; align-self: center; }
  #play .mz-small { display: none; }
}

/* 👁️ علي 27/11: زر المشاهدة جنب زر الإيقاف فوق */
.mz-eye-wrap { display: inline-flex; align-items: center; gap: 6px; }
