/* ============================================================
   مادارا ضد الزومبي — التنسيقات (RTL، جوال أولاً)
   ============================================================ */
:root {
  --red: #dc2626;
  --red-2: #ef4444;
  --blue: #2563eb;
  --green: #22c55e;
  --amber: #f59e0b;
  --bg: #0f172a;
  --bg-2: #0b1024;
  --fg: #ffffff;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(15, 23, 42, 0.72);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font-ar: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'Orbitron', 'Cairo', monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: radial-gradient(120% 90% at 50% 0%, #1a1030 0%, var(--bg-2) 45%, #05060c 100%);
  color: var(--fg); font-family: var(--font-ar);
  overflow: hidden; overscroll-behavior: none; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stagewrap {
  position: relative; aspect-ratio: 16 / 9;
  width: min(100vw, calc(100vh * 16 / 9));
  max-height: 100vh;
  font-size: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden;
  background: #05060c;
}
@supports (container-type: size) {
  #stagewrap { container-type: size; font-size: 1.55cqw; }
}
#cv { display: block; width: 100%; height: 100%; image-rendering: auto; }
.hud, .wbar, .currw { display: none; }
.hud.show, .wbar.show, .currw.show { display: flex; }
.hud {
  position: absolute; inset: 0 0 auto 0; z-index: 6;
  align-items: flex-start; justify-content: space-between;
  gap: 0.6em; padding: 0.7em 0.8em; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 6, 12, 0.82), rgba(5, 6, 12, 0));
}
.hud button, .wbar button, .tbtn { pointer-events: auto; }

/* ---------- شريط الحالة العلوي ---------- */
.hleft, .hmid, .hright { display: flex; flex-direction: column; gap: 0.35em; }
.hright { align-items: flex-end; }
.hmid { flex: 1; align-items: center; }
.lives { display: flex; gap: 0.25em; }
.heart { width: 1.5em; height: 1.5em; color: var(--red-2); filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6)); }
.heart svg { width: 100%; height: 100%; }
.heart.off { color: #3f4658; filter: none; opacity: 0.7; }
.hpwrap {
  position: relative; width: 15em; height: 1.5em; border-radius: 0.4em;
  background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); overflow: hidden;
}
.hpbar {
  height: 100%; width: 100%; border-radius: 0.35em;
  background: linear-gradient(90deg, #16a34a, #22c55e 60%, #4ade80);
  transition: width 0.18s ease;
}
.hpbar.low { background: linear-gradient(90deg, #b91c1c, #ef4444 60%, #f87171); animation: pulse 0.7s infinite; }
.hpwrap span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-num); font-size: 0.82em; font-weight: 700;
  text-shadow: 0 1px 3px #000; letter-spacing: 0.02em;
}
.stage { font-size: 0.95em; font-weight: 700; color: #fecaca; text-shadow: 0 1px 4px #000; }
.goalwrap {
  position: relative; width: 17em; height: 1.15em; border-radius: 0.4em;
  background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); overflow: hidden;
}
.goalbar { height: 100%; background: linear-gradient(90deg, #b45309, #f59e0b, #fbbf24); transition: width 0.2s ease; }
.goalwrap span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-num); font-size: 0.7em; font-weight: 700; text-shadow: 0 1px 3px #000;
}
.nextunlock { font-size: 0.78em; color: #fcd34d; text-shadow: 0 1px 3px #000; }
.kpi {
  display: flex; align-items: center; gap: 0.4em; font-size: 0.8em; color: var(--muted);
  background: var(--glass); border: 1px solid var(--line); border-radius: 0.5em; padding: 0.05em 0.5em;
}
.kpi b { font-family: var(--font-num); color: #fff; }
.hbtns { display: flex; gap: 0.35em; }
.hbtns button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3em;
  min-width: 2.4em; height: 2.2em; padding: 0 0.5em;
  background: var(--glass); color: #e2e8f0; border: 1px solid var(--line);
  border-radius: 0.5em; font-family: var(--font-ar); font-size: 0.8em; font-weight: 700;
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease;
}
.hbtns button:hover { transform: translateY(-2px); background: rgba(37, 99, 235, 0.28); }
.hbtns button.on { background: rgba(34, 197, 94, 0.3); border-color: rgba(34, 197, 94, 0.5); }
.hbtns svg { width: 1.15em; height: 1.15em; }
.fpsbox {
  font-family: var(--font-num); font-size: 0.68em; color: #64748b;
  border: 1px solid var(--line); border-radius: 0.4em; padding: 0.05em 0.4em;
}

/* ---------- شريط الأسلحة والأوامر السفلية ---------- */
.wbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 12;
  display: flex; gap: 0.35rem; padding: 0.35rem 0.4rem;
  overflow-x: auto; overflow-y: hidden;
  background: linear-gradient(180deg, rgba(5, 6, 12, 0.35), rgba(5, 6, 12, 0.92));
  backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  direction: rtl; scrollbar-width: none;
}
.wbar::-webkit-scrollbar { display: none; }
.slot {
  position: relative; flex: 0 0 auto; width: 84px; min-height: 56px;
  display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto;
  gap: 0 0.25rem; align-items: center; text-align: right;
  padding: 0.3rem 0.4rem; cursor: pointer;
  background: rgba(15, 23, 42, 0.7); border: 1px solid var(--line); border-radius: 10px;
  color: #e2e8f0; font-family: var(--font-ar);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.slot:hover { transform: translateY(-3px); }
.slot .ico { grid-row: span 2; display: grid; place-items: center; }
.slot .ico svg { width: 24px; height: 24px; }
.slot .nm { font-size: 12px; font-weight: 700; white-space: nowrap; }
.slot .dm, .slot .am { font-family: var(--font-num); font-size: 10px; color: var(--muted); }
.slot.active {
  border-color: rgba(239, 68, 68, 0.75); box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.4), 0 6px 20px rgba(220, 38, 38, 0.35);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.55), rgba(15, 23, 42, 0.85));
}
.slot.locked { opacity: 0.5; filter: grayscale(0.7); }
.slot .lk {
  position: absolute; inset-inline-end: 0.35rem; top: 0.25rem;
  font-size: 9px; color: #fca5a5; font-family: var(--font-num);
}
.currw {
  position: fixed; bottom: 4.4rem; inset-inline-start: 0.7rem; z-index: 11;
  align-items: center; gap: 0.5rem; padding: 0.3rem 0.6rem;
  background: var(--glass); border: 1px solid var(--line); border-radius: 10px;
  backdrop-filter: blur(10px); font-size: 13px; color: var(--muted);
}
.currw b { color: #fff; font-size: 15px; }
.currw .am { font-family: var(--font-num); color: #fcd34d; font-size: 15px; }
.currw .am.empty { color: #ef4444; animation: pulse 0.6s infinite; }
.currw i { font-style: normal; font-size: 11px; color: #cbd5e1; }
.currw .merge {
  font-style: normal; font-size: 10px; font-weight: 700; color: #052e16;
  background: linear-gradient(180deg,#86efac,#22c55e); border-radius: 999px;
  padding: 0.15rem 0.5rem; box-shadow: 0 0 12px rgba(34,197,94,0.45);
}

/* ---------- أزرار اللمس ---------- */
.touch {
  position: fixed; bottom: 3.6rem; left: 0; right: 0; z-index: 11;
  display: none; align-items: flex-end; justify-content: space-between;
  padding: 0 0.6rem; direction: ltr; pointer-events: none;
}
.touch.show { display: flex; }
.tpad, .tacts { display: flex; align-items: flex-end; gap: 0.5rem; pointer-events: none; }
.tbtn {
  pointer-events: auto; cursor: pointer;
  display: inline-grid; place-items: center; gap: 2px;
  min-width: 66px; height: 66px; padding: 6px;
  background: rgba(15, 23, 42, 0.6); color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 16px;
  backdrop-filter: blur(9px); font-family: var(--font-ar); font-weight: 700; font-size: 13px;
  transition: transform 0.1s ease, background 0.12s ease, box-shadow 0.12s ease;
  touch-action: none;
}
.tbtn svg { width: 30px; height: 30px; }
.tbtn:active, .tbtn.on { transform: scale(0.94); background: rgba(37, 99, 235, 0.4); }
.tbtn.prone { min-width: 78px; height: 58px; }
.tbtn.mini { min-width: 62px; height: 52px; font-size: 12px; }
.tbtn.fire {
  min-width: 104px; height: 104px; border-radius: 50%; font-size: 16px;
  background: radial-gradient(circle at 35% 30%, rgba(239, 68, 68, 0.95), rgba(127, 29, 29, 0.9));
  border-color: rgba(252, 165, 165, 0.55);
  box-shadow: 0 10px 30px rgba(220, 38, 38, 0.45), inset 0 0 24px rgba(0, 0, 0, 0.4);
}
.tbtn.fire:active, .tbtn.fire.on { transform: scale(0.92); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.22); }
body.hastouch .currw { display: none; }
body.hastouch .wbar .slot { width: 74px; min-height: 50px; }

/* ---------- شريط الأسلحة السفلي ---------- */
.wbar {
  position: absolute; left: 50%; bottom: 0.55em; transform: translateX(-50%);
  z-index: 6; gap: 0.32em; padding: 0.35em;
  background: rgba(5, 6, 12, 0.66); border: 1px solid var(--line);
  border-radius: 0.7em; backdrop-filter: blur(10px);
  max-width: 97%; overflow-x: auto; scrollbar-width: none;
}
.wbar::-webkit-scrollbar { display: none; }
.slot {
  position: relative; display: grid; gap: 0.05em; place-items: center;
  min-width: 4.6em; padding: 0.28em 0.4em 0.34em;
  background: rgba(255, 255, 255, 0.04); color: #cbd5e1;
  border: 1px solid var(--line); border-radius: 0.5em;
  font-family: var(--font-ar); cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.slot:hover { transform: translateY(-3px); background: rgba(255, 255, 255, 0.09); }
.slot .ico { width: 1.7em; height: 1.7em; display: block; }
.slot .ico svg { width: 100%; height: 100%; }
.slot .nm { font-size: 0.72em; font-weight: 700; color: #e2e8f0; white-space: nowrap; }
.slot .dm { font-family: var(--font-num); font-size: 0.62em; color: var(--muted); }
.slot .am { font-family: var(--font-num); font-size: 0.66em; color: #7dd3fc; }
.slot.active {
  background: rgba(220, 38, 38, 0.26); border-color: rgba(239, 68, 68, 0.75);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35), 0 6px 18px rgba(220, 38, 38, 0.28);
}
.slot.locked { opacity: 0.42; filter: grayscale(0.75); }
.slot .lk {
  position: absolute; top: -0.45em; right: -0.3em;
  font-family: var(--font-num); font-size: 0.55em; font-weight: 700;
  background: #7f1d1d; color: #fecaca; border-radius: 0.6em; padding: 0 0.4em;
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.slot.locked .lk { background: #1e293b; color: #94a3b8; border-color: var(--line); }

/* ---------- السلاح الحالي ---------- */
.currw {
  position: absolute; right: 0.8em; bottom: 0.55em; z-index: 6;
  align-items: center; gap: 0.5em; padding: 0.3em 0.6em;
  background: var(--glass); border: 1px solid var(--line); border-radius: 0.6em;
  backdrop-filter: blur(10px);
}
.currw .lbl { font-size: 0.66em; color: var(--muted); }
.currw b { font-size: 0.9em; }
.currw i { font-style: normal; font-size: 0.7em; color: var(--muted); }
.currw .am {
  font-family: var(--font-num); font-size: 1.02em; color: #7dd3fc;
  padding-left: 0.4em; border-left: 1px solid var(--line);
}
.currw .merge {
  font-style: normal; font-size: 0.6em; font-weight: 700; color: #052e16;
  background: linear-gradient(180deg,#86efac,#22c55e); border-radius: 999px;
  padding: 0.12em 0.5em; box-shadow: 0 0 0.6em rgba(34,197,94,0.45);
}
.currw .am.empty { color: #f87171; animation: pulse 0.8s infinite; }

/* ---------- أزرار اللمس ---------- */
.touch { position: absolute; inset: 0; z-index: 7; display: none; pointer-events: none; }
.touch.show { display: block; }
.tpad, .tacts { position: absolute; bottom: 0.6em; display: flex; gap: 0.45em; align-items: flex-end; }
.tpad { left: 0.7em; }
.tacts { right: 0.7em; }
.tbtn {
  pointer-events: auto; display: grid; place-items: center;
  width: 4.2em; height: 4.2em; border-radius: 1em;
  background: rgba(15, 23, 42, 0.62); color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: var(--font-ar); font-size: 0.76em; font-weight: 700;
  backdrop-filter: blur(8px); cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease;
}
.tbtn svg { width: 2em; height: 2em; }
.tbtn.on, .tbtn:active { transform: scale(0.94); background: rgba(37, 99, 235, 0.45); }
.tbtn.prone { width: 3.4em; height: 3.4em; font-size: 0.68em; }
.tbtn.mini { width: 3.5em; height: 3.5em; font-size: 0.68em; }
.tbtn.fire {
  width: 5.4em; height: 5.4em; font-size: 0.86em;
  background: rgba(220, 38, 38, 0.42); border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 22px rgba(220, 38, 38, 0.35);
}
.tbtn.fire.on, .tbtn.fire:active { background: rgba(239, 68, 68, 0.75); transform: scale(0.93); }

/* ---------- اللافتات والتنبيهات ---------- */
.banner {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, -14px) scale(0.96);
  z-index: 9; display: flex; align-items: center; gap: 0.7em;
  padding: 0.6em 0.9em; max-width: 88%;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.92));
  border: 1px solid rgba(250, 204, 21, 0.45); border-radius: 0.8em;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.banner .bico { width: 2.6em; height: 2.6em; flex: 0 0 auto; }
.banner .bico svg { width: 100%; height: 100%; }
.banner .btxt { display: grid; gap: 0.15em; }
.banner .btxt b { font-size: 0.95em; color: #fde68a; }
.banner .btxt span { font-size: 0.74em; color: var(--muted); }
.toast {
  position: absolute; left: 50%; bottom: 8.5em; transform: translate(-50%, 8px);
  z-index: 9; padding: 0.4em 0.8em; border-radius: 0.5em;
  background: rgba(15, 23, 42, 0.92); border: 1px solid var(--line);
  font-size: 0.78em; font-weight: 700; color: #e2e8f0;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.lock { border-color: rgba(148, 163, 184, 0.5); color: #cbd5e1; }
.toast.overlord { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }

/* ---------- مقدمة المرحلة ---------- */
.intro {
  position: absolute; inset: 0; z-index: 8; display: none;
  place-items: center; background: rgba(5, 6, 12, 0.55); backdrop-filter: blur(3px);
}
.intro.show { display: grid; }
.intro .ibox { display: grid; place-items: center; gap: 0.2em; text-align: center; }
.intro .icount {
  font-family: var(--font-num); font-size: 3.4em; font-weight: 900; color: #f87171;
  text-shadow: 0 0 26px rgba(239, 68, 68, 0.75); line-height: 1;
  animation: pulse 1s infinite;
}
.intro h2 { margin: 0.2em 0 0; font-size: 1.7em; }
.intro p { margin: 0; color: var(--muted); font-size: 0.9em; }
.intro .iz { color: #fca5a5; font-size: 0.8em; }

/* ---------- الشاشات والألواح ---------- */
.screen {
  position: absolute; inset: 0; z-index: 22; display: none; place-items: center;
  padding: 1em; overflow: auto; background: rgba(3, 4, 9, 0.84); backdrop-filter: blur(7px);
}
.screen.show { display: grid; animation: fadeIn 0.25s ease both; }
.screen.dim { background: rgba(3, 4, 9, 0.62); }
.panel {
  width: min(48em, 100%); padding: 1.2em 1.3em 1.4em;
  background: linear-gradient(180deg, rgba(26, 32, 56, 0.96), rgba(11, 16, 36, 0.97));
  border: 1px solid var(--line); border-radius: 1em; box-shadow: var(--shadow);
  animation: fadeUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.panel.small { width: min(30em, 100%); text-align: center; }
.panel h2 { margin: 0 0 0.5em; font-size: 1.5em; font-weight: 900; }
.panel h2.ok { color: #86efac; text-shadow: 0 0 22px rgba(34, 197, 94, 0.4); }
.panel h2.bad { color: #fca5a5; text-shadow: 0 0 22px rgba(220, 38, 38, 0.45); }
.title {
  margin: 0.1em 0 0.2em; font-size: 2.4em; font-weight: 900; line-height: 1.15;
  background: linear-gradient(92deg, #fff 0%, #fca5a5 35%, #dc2626 70%, #7f1d1d 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(220, 38, 38, 0.25);
}
.title em { font-style: normal; font-size: 0.55em; color: #94a3b8; -webkit-text-fill-color: #94a3b8; }
.sub { margin: 0 0 0.8em; color: var(--muted); font-size: 0.95em; }
.hint { margin: 0.9em 0 0; color: #94a3b8; font-size: 0.82em; line-height: 1.7; }
.hint b { color: #e2e8f0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9em, 1fr)); gap: 0.5em; margin-bottom: 0.9em; }
.stat {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5em;
  padding: 0.4em 0.7em; background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line); border-radius: 0.6em; font-size: 0.82em; color: var(--muted);
}
.stat b { font-family: var(--font-num); color: #fff; font-size: 1.05em; }
.wlist { display: grid; gap: 0.3em; margin-bottom: 1em; }
.wrow {
  display: grid; grid-template-columns: 1.6em 1fr 4.5em 7em; align-items: center; gap: 0.5em;
  padding: 0.32em 0.6em; background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line); border-radius: 0.55em; font-size: 0.8em; color: #94a3b8;
}
.wrow.un { border-color: rgba(34, 197, 94, 0.35); color: #e2e8f0; }
.wrow .wi svg { width: 1.3em; height: 1.3em; }
.wrow .wn { font-weight: 700; }
.wrow .wd { font-family: var(--font-num); }
.wrow .wl { font-size: 0.9em; color: #fcd34d; }
.wrow.un .wl { color: #86efac; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  width: 100%; margin: 0.2em 0; padding: 0.7em 1.2em; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); color: #e2e8f0;
  border: 1px solid var(--line); border-radius: 0.7em;
  font-family: var(--font-ar); font-size: 1em; font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.btn:hover { transform: translateY(-2px); background: rgba(37, 99, 235, 0.24); }
.btn.primary {
  background: linear-gradient(180deg, #ef4444, #b91c1c); color: #fff; border-color: rgba(252, 165, 165, 0.4);
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.35);
}
.btn.primary:hover { box-shadow: 0 14px 34px rgba(220, 38, 38, 0.5); }
.lifeleft { font-size: 1.1em; font-weight: 700; color: #fcd34d; margin: 0.2em 0 0.6em; }

/* ---------- الشاشات الكاملة ---------- */
.screen {
  position: absolute; inset: 0; z-index: 10; display: none;
  place-items: center; padding: 1em;
  background: radial-gradient(90% 70% at 50% 40%, rgba(15, 23, 42, 0.86), rgba(5, 6, 12, 0.96));
  backdrop-filter: blur(6px); overflow-y: auto;
}
.screen.show { display: grid; }
.screen.dim { background: rgba(5, 6, 12, 0.72); }
.panel {
  width: min(38em, 96%); display: grid; gap: 0.7em; justify-items: center;
  padding: 1.3em 1.2em; text-align: center;
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--line); border-radius: 1em;
  box-shadow: var(--shadow); animation: fadeUp 0.35s ease both;
}
.panel.small { width: min(26em, 92%); }
.title {
  margin: 0; font-size: 2.5em; font-weight: 900; line-height: 1.1;
  background: linear-gradient(180deg, #fff 20%, #ef4444 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 10px 40px rgba(239, 68, 68, 0.25);
}
.title em { font-style: normal; color: #f59e0b; -webkit-text-fill-color: #f59e0b; }
.panel h2 { margin: 0; font-size: 1.4em; }
.panel h2.ok { color: #4ade80; }
.panel h2.bad { color: #f87171; }
.sub { margin: 0; font-size: 0.84em; color: var(--muted); }
.hint { margin: 0; font-size: 0.72em; color: #7c8798; line-height: 1.9; }
.lifeleft { margin: 0; font-size: 1.2em; font-weight: 700; color: #fca5a5; }
.stats { display: flex; flex-wrap: wrap; gap: 0.4em; justify-content: center; }
.stats .stat {
  display: grid; gap: 0.1em; min-width: 6.6em; padding: 0.35em 0.6em;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 0.5em;
}
.stats .stat span { font-size: 0.66em; color: var(--muted); }
.stats .stat b { font-family: var(--font-num); font-size: 0.92em; color: #fff; }
.wlist {
  display: grid; gap: 0.3em; width: 100%; max-height: 12em; overflow-y: auto;
  padding: 0.4em; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: 0.6em;
}
.wrow {
  display: grid; grid-template-columns: 1.8em 1fr auto auto; align-items: center; gap: 0.5em;
  padding: 0.26em 0.45em; border-radius: 0.4em;
  background: rgba(255, 255, 255, 0.03); font-size: 0.76em; color: #94a3b8;
}
.wrow.un { background: rgba(34, 197, 94, 0.12); color: #e2e8f0; }
.wrow .wi { width: 1.6em; height: 1.6em; }
.wrow .wi svg { width: 100%; height: 100%; }
.wrow .wn { text-align: right; font-weight: 700; }
.wrow .wd { font-family: var(--font-num); font-size: 0.9em; color: var(--muted); }
.wrow .wl { font-size: 0.86em; color: #f59e0b; white-space: nowrap; }
.wrow.un .wl { color: #4ade80; }

/* ---------- الأزرار ---------- */
.btn {
  padding: 0.55em 1.6em; border-radius: 0.6em; cursor: pointer;
  background: rgba(255, 255, 255, 0.07); color: #e2e8f0;
  border: 1px solid var(--line); font-family: var(--font-ar);
  font-size: 0.9em; font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.13); }
.btn.primary {
  background: linear-gradient(135deg, #dc2626, #f59e0b); color: #fff;
  border: none; box-shadow: 0 10px 26px rgba(220, 38, 38, 0.35);
}
.btn.primary:hover { box-shadow: 0 14px 32px rgba(220, 38, 38, 0.5); }

/* ---------- تنبيه الدوران ---------- */
#rotate {
  position: fixed; inset: 0; z-index: 40; display: none;
  place-items: center; text-align: center; padding: 2em;
  background: rgba(5, 6, 12, 0.95); color: #e2e8f0; font-size: 1.05em;
}
#rotate b { display: block; font-size: 1.3em; margin-bottom: 0.3em; }
#rotate span { color: var(--muted); font-size: 0.85em; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  #stagewrap { border-radius: 0; border: none; width: 100vw; height: 100vh; aspect-ratio: auto; }
}
/* في الوضع الرأسي على الجوال: تلميح صغير لا يمنع اللعب */
@media (orientation: portrait) and (max-width: 820px) {
  #rotate {
    inset: auto 0 0 0; display: grid; padding: 0.5em 1em;
    background: linear-gradient(0deg, rgba(5, 6, 12, 0.92), rgba(5, 6, 12, 0));
    pointer-events: none; opacity: 0.9;
  }
  #rotate b { font-size: 0.9em; margin: 0; }
  #rotate span { font-size: 0.72em; }
}

/* ---------- إشعارات وعدّاد المرحلة ---------- */
.banner {
  position: absolute; top: 7em; left: 50%; z-index: 18;
  display: flex; align-items: center; gap: 0.7em;
  padding: 0.55em 0.9em; border-radius: 0.7em;
  background: linear-gradient(100deg, rgba(127, 29, 29, 0.92), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(252, 165, 165, 0.45);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -1.4em) scale(0.94); opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.banner .bico svg { width: 2em; height: 2em; }
.banner .btxt { display: flex; flex-direction: column; }
.banner .btxt b { font-size: 0.95em; }
.banner .btxt span { font-size: 0.72em; color: #cbd5e1; }
.toast {
  position: absolute; top: 3.6em; left: 50%; z-index: 18;
  padding: 0.3em 0.8em; border-radius: 2em; font-size: 0.8em; font-weight: 700;
  background: rgba(15, 23, 42, 0.85); border: 1px solid var(--line); color: #fcd34d;
  transform: translate(-50%, -0.8em); opacity: 0; transition: all 0.22s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.lock { color: #fca5a5; border-color: rgba(239, 68, 68, 0.45); }
.intro {
  position: absolute; inset: 0; z-index: 19; display: none; place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(127, 29, 29, 0.45), rgba(3, 4, 9, 0.82));
  pointer-events: none; text-align: center;
}
.intro.show { display: grid; animation: fadeIn 0.3s ease both; }
.ibox { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.icount {
  font-family: var(--font-num); font-size: 4.2em; font-weight: 900; color: #fff;
  text-shadow: 0 0 34px rgba(239, 68, 68, 0.8); line-height: 1;
}
.intro h2 { margin: 0.15em 0 0; font-size: 1.9em; font-weight: 900; color: #fecaca; }
.intro p { margin: 0.1em 0; color: #cbd5e1; font-size: 0.95em; }
.intro .iz {
  display: inline-block; margin-top: 0.6em; padding: 0.25em 0.8em; border-radius: 2em;
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); color: #fcd34d; font-size: 0.8em;
}
#rotate { display: none; }
@media (orientation: portrait) {
  #rotate {
    display: grid; place-items: center; position: fixed; left: 0; right: 0; bottom: 0.4rem;
    z-index: 40; pointer-events: none;
  }
  #rotate > div {
    display: flex; align-items: center; gap: 0.5em; padding: 0.3rem 0.8rem;
    background: rgba(15, 23, 42, 0.9); border: 1px solid var(--line); border-radius: 2rem;
    font-size: 12px; color: #cbd5e1;
  }
  #rotate b { color: #fcd34d; }
  #rotate span { color: #64748b; }
}

/* ---------- حركات ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (max-width: 700px) {
  .slot { width: 68px; min-height: 48px; }
  .slot .nm { font-size: 11px; }
  .tbtn { min-width: 58px; height: 58px; }
  .tbtn.fire { min-width: 88px; height: 88px; }
  .wrow { grid-template-columns: 1.4em 1fr 3.4em 5em; font-size: 11px; }
}

/* ---------- سطر الإصدار وزر التحديث الإجباري ---------- */
.verline { margin: 0.85em 0 0; font-size: 0.72em; color: #64748b; letter-spacing: 0.2px; }
.verline a { color: #7dd3fc; text-decoration: none; border-bottom: 1px dashed rgba(125, 211, 252, 0.5); padding-bottom: 1px; }
.verline a:hover { color: #bae6fd; border-bottom-color: #bae6fd; }

/* ---------- أجواء الهالوين (الإصدار 4) ---------- */
.pumpkin {
  width: clamp(70px, 14vw, 108px); margin: 0 auto 0.35em;
  filter: drop-shadow(0 0 22px rgba(249, 115, 22, 0.55));
  animation: pumpFloat 3.8s ease-in-out infinite;
}
.pumpkin svg { width: 100%; height: auto; display: block; }
@keyframes pumpFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
.sub.halloween {
  color: #fdba74; font-weight: 700;
  text-shadow: 0 0 18px rgba(249, 115, 22, 0.35);
}
#scr-menu {
  background-image:
    radial-gradient(62% 48% at 50% 0%, rgba(249, 115, 22, 0.18), transparent 70%),
    radial-gradient(72% 62% at 50% 100%, rgba(88, 28, 135, 0.38), transparent 72%);
}
#btnMusic { min-width: 4.3em; }
#btnMusic.off { opacity: 0.6; }
#btnMusic:not(.off) {
  background: rgba(249, 115, 22, 0.24);
  border-color: rgba(249, 115, 22, 0.5);
  color: #ffedd5;
}
.ihint {
  margin: 0.45em 0 0; font-size: 0.82em; color: #fdba74;
  min-height: 1.15em; animation: ihintPulse 1.6s ease-in-out infinite;
}
@keyframes ihintPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@media (max-width: 560px) {
  .pumpkin { width: 62px; }
  .sub.halloween { font-size: 0.76em; }
  #btnMusic { min-width: 3.6em; }
}

/* ============================================================
   أجواء الهالوين — الإصدار 4 (قرع مضيء + بنفسجي + خطوط مرعبة)
   ============================================================ */
:root {
  --pumpkin: #f97316;
  --pumpkin-2: #fdba74;
  --pumpkin-3: #7c2d12;
  --purple: #7c3aed;
  --purple-2: #a855f7;
  --toxic: #a3e635;
  --bone: #f5e9d7;
  --red: #e11d48;
  --red-2: #fb7185;
  --blue: #7c3aed;
  --green: #a3e635;
  --amber: #f97316;
  --bg: #150a24;
  --bg-2: #0d0618;
  --glass: rgba(21, 10, 36, 0.78);
  --font-display: 'Rakkas', 'Cairo', serif;
  --font-num: 'Creepster', 'Cairo', system-ui, sans-serif;
}
html, body {
  background: radial-gradient(120% 90% at 50% 0%, #2a1240 0%, var(--bg-2) 45%, #05030a 100%);
}
#stagewrap { border-color: rgba(249, 115, 22, 0.22); box-shadow: 0 18px 60px rgba(249, 115, 22, 0.12), var(--shadow); }

/* ---- أرواح اللاعب: قرع مضيء ---- */
.heart { color: var(--pumpkin); filter: drop-shadow(0 0 7px rgba(249, 115, 22, 0.75)); }
.heart.off { color: #46384f; filter: none; opacity: 0.55; }

/* ---- العنوان والقرعة ---- */
.pumpkin { width: 7em; margin: 0 auto 0.2em; filter: drop-shadow(0 0 18px rgba(249, 115, 22, 0.55)); animation: pumpkinFloat 3.4s ease-in-out infinite; }
.pumpkin svg { width: 100%; height: auto; display: block; }
@keyframes pumpkinFloat { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-0.5em) rotate(2deg); } }
.title { font-family: var(--font-display); letter-spacing: 0.5px; text-shadow: 0 0 22px rgba(249, 115, 22, 0.45), 0 3px 0 rgba(0, 0, 0, 0.6); }
.title em { color: var(--pumpkin-2); font-style: normal; }
.sub.halloween { color: var(--pumpkin-2); }
.ihint { margin: 0.35em 0 0; font-size: 0.95em; color: var(--toxic); }

/* ---- أزرار الصوت/الموسيقى ---- */
.hbtns button.music { color: var(--pumpkin-2); border-color: rgba(249, 115, 22, 0.4); }
.hbtns button.music.off { color: #8b7f97; border-color: rgba(255, 255, 255, 0.12); opacity: 0.85; }
.banner { border-color: rgba(249, 115, 22, 0.45); box-shadow: 0 0 30px rgba(249, 115, 22, 0.25); }
.banner .bico { color: var(--pumpkin-2) !important; }
.btn.primary { background: linear-gradient(180deg, #f97316, #c2410c); border-color: rgba(253, 186, 116, 0.5); }
.btn.primary:hover { filter: brightness(1.08); }
.hpbar { background: linear-gradient(90deg, #f97316, #a3e635); }
.goalbar { background: linear-gradient(90deg, #a855f7, #f97316); }
.currw b.am.empty { color: var(--red-2); }

/* ---- تجربة الجوال (أندرويد): مساحات آمنة + أزرار أكبر + منع السحب ---- */
@supports (height: 100dvh) {
  #app { height: 100dvh; }
}
#stagewrap { border-radius: 0; }
#app { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
@media (pointer: coarse) {
  .hbtns button { min-width: 8.5em; min-height: 2.6em; font-size: 1em; }
  .slot { min-width: 4.6em; }
  .tbtn { min-width: 4.4em; min-height: 3.1em; }
  .tbtn.fire { min-width: 6.4em; min-height: 4.2em; font-size: 1.05em; }
  .tbtn.prone { min-width: 5.4em; }
  .touch { padding-bottom: calc(0.5em + env(safe-area-inset-bottom)); }
}
body.hastouch .currw { bottom: calc(1.2em + env(safe-area-inset-bottom)); }

/* ---- زخارف هالوين في شاشة البداية ---- */
#scr-menu .panel { position: relative; overflow: hidden; }
#scr-menu .panel::before,
#scr-menu .panel::after {
  content: ''; position: absolute; width: 6em; height: 6em; pointer-events: none;
  background-repeat: no-repeat; opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 60'><path d='M5 30c10-22 25-14 30 0 8-16 22-14 26 2 6-14 20-18 29 3-9-2-15-6-19-12-6 12-18 14-26 4-8 12-24 12-30-2-5 12-16 14-24 6z' fill='%23f97316'/></svg>");
}
#scr-menu .panel::before { top: 0.4em; left: 0.6em; animation: batDrift 9s linear infinite; }
#scr-menu .panel::after { bottom: 0.4em; right: 0.6em; transform: scaleX(-1); animation: batDrift 11s linear infinite reverse; }
@keyframes batDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(1.6em, -0.8em) rotate(6deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ---- احترام تقليل الحركة ---- */
@media (prefers-reduced-motion: reduce) {
  .pumpkin, #scr-menu .panel::before, #scr-menu .panel::after { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
