/* ==========================================================
   عدّاء الأخلاق - واجهة داكنة أنيقة (جواهر داكنة × ذهبي راقٍ)
   ========================================================== */

:root {
  /* خلفية داكنة أنيقة */
  --bg-0: #120e1e;         /* الأعمق */
  --bg-1: #1c1730;         /* لوح */
  --bg-2: #29223f;         /* لوح أفتح قليلًا */
  --line: rgba(255, 255, 255, .1);
  /* بطاقات داكنة */
  --card-top: #2a2340;
  --card-bot: #1b1630;
  --ink: #efeaf7;          /* نص أساسي فاتح */
  --ink-soft: #b0a6c8;     /* نص ثانوي */
  /* ذهبي راقٍ (غير فاقع) */
  --gold: #d8b662;
  --gold-light: #f0d68f;
  --gold-dark: #a9863f;
  /* جواهر داكنة متنوّعة للّمسات */
  --ruby: #b23a54;
  --sapphire: #3f74c0;
  --emerald: #2f9e77;
  --amethyst: #9366d0;
  --amber: #cf9a44;
  --rose: #c25689;
  --teal: #2f9aa0;
  --cream: #f3ecdd;
  --red-bad: #c65068;
  --shadow: 0 20px 50px rgba(0, 0, 0, .55);
  --font-ui: 'Tajawal', Tahoma, sans-serif;
  --font-quote: 'Amiri', 'Tajawal', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  background: var(--bg-0);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* منع تمرير/تكبير الصفحة أثناء اللعب على لمسة الكانفس فقط،
   مع السماح بالتمرير الرأسي داخل الشاشات (كيفية اللعب...) على الجوال */
#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ==================== الشاشات ==================== */

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background:
    radial-gradient(1100px 760px at 50% 18%, #2a2145 0%, transparent 58%),
    radial-gradient(820px 620px at 86% 104%, #24183c 0%, transparent 55%),
    radial-gradient(760px 600px at 6% 96%, #1f1836 0%, transparent 55%),
    var(--bg-0);
}

/* نمط هندسي إسلامي راقٍ بلون ذهبي خفيف */
.screen::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23d8b662' stroke-width='1.2'%3E%3Cpath d='M48 4 L92 48 L48 92 L4 48 Z'/%3E%3Cpath d='M48 20 L76 48 L48 76 L20 48 Z'/%3E%3Ccircle cx='48' cy='48' r='10'/%3E%3Cpath d='M48 38 L52 48 L48 58 L44 48 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 96px;
}

.screen.overlay {
  background: rgba(9, 6, 16, .82);
}
.screen.overlay::before { opacity: .06; }

.screen > * { position: relative; z-index: 1; }

/* ==================== القائمة الرئيسية ==================== */

.menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 520px;
  width: 100%;
}

.bismillah {
  font-family: var(--font-quote);
  font-size: 20px;
  color: var(--gold-light);
  letter-spacing: 1px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}

.game-title {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  margin: 6px 0 2px;
}

.title-line1 {
  font-size: clamp(40px, 9vw, 68px);
  font-weight: 900;
  color: var(--cream);
  text-shadow: 0 4px 22px rgba(0, 0, 0, .6);
}

.title-line2 {
  font-size: clamp(52px, 12vw, 92px);
  font-weight: 900;
  background: linear-gradient(180deg, var(--gold-light) 8%, var(--gold) 55%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 5px 16px rgba(0, 0, 0, .5));
}

.game-credit {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-light);
  margin: -4px 0 2px;
  letter-spacing: .3px;
}

.game-sub {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 400px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(320px, 86vw);
  margin-top: 14px;
}

.menu-foot {
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

.ornament-top, .ornament-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 46px;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='46' viewBox='0 0 72 46'%3E%3Cpath d='M0 46 L0 30 Q0 8 18 8 Q36 8 36 26 Q36 8 54 8 Q72 8 72 30 L72 46 Z' fill='%23d8b662' fill-opacity='.2'/%3E%3Cpath d='M36 26 L36 46' stroke='%23d8b662' stroke-opacity='.3'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center bottom;
}
.ornament-top { top: 0; transform: scaleY(-1); }
.ornament-bottom { bottom: 0; }

/* ==================== الأزرار ==================== */

.btn {
  font-family: var(--font-ui);
  font-size: 19px;
  font-weight: 700;
  padding: 13px 26px;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .2s;
  width: 100%;
}
.btn:active { transform: scale(.965); }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 58%, var(--gold-dark));
  color: #2e2306;
  border-color: rgba(255, 244, 214, .55);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .5);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .3);
}
.btn-gold:hover { filter: brightness(1.06); }

.btn-outline {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  color: var(--gold-light);
  border-color: rgba(216, 182, 98, .5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.btn-outline:hover { background: linear-gradient(180deg, #322a4c, #221c38); }

.btn-back { width: min(320px, 86vw); margin-top: 20px; }

.btn-icon {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid rgba(216, 182, 98, .55);
  background: rgba(20, 15, 33, .82);
  color: var(--gold-light);
  font-size: 15px;
  cursor: pointer;
}

/* ==================== أزرار كتم الصوت في شاشة اللعب ==================== */
.hud-audio {
  position: absolute;
  top: max(60px, calc(env(safe-area-inset-top) + 52px));
  left: 12px;
  display: flex;
  gap: 8px;
  z-index: 15;
}
.hud-audio-btn {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 2px solid rgba(216, 182, 98, .55);
  background: rgba(18, 13, 30, .8);
  color: var(--gold-light);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hud-audio-btn:active { transform: scale(.94); }
.hud-audio-btn.off { opacity: .5; color: #b0a6c8; border-color: rgba(255, 255, 255, .22); }
.hud-audio-btn.off::after {
  content: '';
  position: absolute;
  left: 7px;
  right: 7px;
  top: 50%;
  height: 3px;
  background: #ff5a6e;
  border-radius: 2px;
  transform: rotate(-22deg);
}

/* ==================== عناوين الشاشات ==================== */

.screen-title {
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 900;
  color: var(--gold-light);
  margin-bottom: 22px;
  text-shadow: 0 3px 16px rgba(0, 0, 0, .55);
}

/* ==================== شبكة المستويات ==================== */

.levels-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: min(620px, 94vw);
}

@media (max-width: 560px) {
  .levels-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.level-card {
  aspect-ratio: 1;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #2c2440, #1c1730);
  color: var(--cream);
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  padding: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .4);
  position: relative;
  overflow: hidden;
}
/* لمعة علوية خفيفة تعطي إحساسًا زجاجيًا راقيًا */
.level-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), transparent);
  pointer-events: none;
}
.level-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(0, 0, 0, .55); }
.level-card .lv-num { font-size: 27px; font-weight: 900; line-height: 1; text-shadow: 0 2px 6px rgba(0, 0, 0, .4); position: relative; }
.level-card .lv-name { font-size: 12px; font-weight: 700; color: var(--cream); position: relative; }
.level-card .lv-stars { font-size: 13px; color: var(--gold-light); letter-spacing: 1px; position: relative; }
.level-card .lv-stars .off { color: rgba(255, 255, 255, .22); }

/* كل بطاقة بدرجة جوهرة داكنة مختلفة: تنوّع أنيق دون فقع */
.level-card:nth-child(6n+1) { background: linear-gradient(160deg, #4a1f30, #2b1220); border-color: rgba(178, 58, 84, .5); }
.level-card:nth-child(6n+1) .lv-num { color: #ef9bad; }
.level-card:nth-child(6n+2) { background: linear-gradient(160deg, #1a3054, #101d38); border-color: rgba(63, 116, 192, .5); }
.level-card:nth-child(6n+2) .lv-num { color: #96bdf0; }
.level-card:nth-child(6n+3) { background: linear-gradient(160deg, #123f3a, #0b2724); border-color: rgba(47, 158, 119, .5); }
.level-card:nth-child(6n+3) .lv-num { color: #86dcbc; }
.level-card:nth-child(6n+4) { background: linear-gradient(160deg, #4a3416, #2b1e0d); border-color: rgba(207, 154, 68, .55); }
.level-card:nth-child(6n+4) .lv-num { color: #f0cf8e; }
.level-card:nth-child(6n+5) { background: linear-gradient(160deg, #341f4e, #201338); border-color: rgba(147, 102, 208, .5); }
.level-card:nth-child(6n+5) .lv-num { color: #c7a6ef; }
.level-card:nth-child(6n)   { background: linear-gradient(160deg, #451f36, #2a1322); border-color: rgba(194, 86, 137, .5); }
.level-card:nth-child(6n)   .lv-num { color: #eda2c6; }

.level-card.locked {
  filter: grayscale(.7) brightness(.72) opacity(.6);
  cursor: not-allowed;
}
.level-card.locked .lv-num::before { content: '\1F512'; font-size: 15px; display: block; }

/* ==================== كيفية اللعب ==================== */

.howto-card {
  width: min(560px, 94vw);
  background: linear-gradient(170deg, var(--card-top), var(--card-bot));
  border: 1px solid rgba(216, 182, 98, .35);
  border-radius: 22px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: var(--shadow);
}

.howto-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15.5px;
  color: var(--ink);
}

.howto-key {
  min-width: 58px;
  text-align: center;
  background: rgba(20, 15, 33, .7);
  border: 1px solid rgba(216, 182, 98, .5);
  border-radius: 9px;
  padding: 5px 8px;
  font-size: 16px;
  color: var(--gold-light);
  flex-shrink: 0;
}

.howto-sep { height: 1px; background: var(--line); margin: 2px 0; }

.howto-ico {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.ico-coin { background: radial-gradient(circle at 35% 30%, #ffe9a8, #d4a944 60%, #9c7a26); box-shadow: 0 0 10px rgba(212, 169, 68, .6); }
.ico-good {
  background: radial-gradient(circle at 34% 30%, #ffe08a, #23b39c 60%, #4a63c0);
  box-shadow: 0 0 10px rgba(255, 255, 255, .28);
  position: relative;
}
.ico-good::after {
  content: '\2605';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.ico-bad { background: radial-gradient(circle at 35% 30%, #b0567e, #7a2244 58%, #351020); box-shadow: 0 0 10px rgba(120, 34, 68, .55); }
.ico-noor { background: radial-gradient(circle at 50% 50%, #fffbe8, #f0cf7e 55%, #d4a944); box-shadow: 0 0 14px rgba(240, 207, 126, .8); }
.ico-heart { background: radial-gradient(circle at 35% 30%, #ff9d94, #d94f43 60%, #8e1f16); border-radius: 50% 50% 46% 46%; }

/* ==================== بطاقة بداية المستوى ==================== */

.intro-card, .result-card, .pause-card {
  width: min(480px, 94vw);
  background: linear-gradient(170deg, var(--card-top) 0%, var(--card-bot) 100%);
  border: 1px solid rgba(216, 182, 98, .4);
  border-radius: 24px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  text-align: center;
  box-shadow: var(--shadow);
}

.pause-card .screen-title { margin-bottom: 10px; }

.intro-level {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-light);
  background: rgba(20, 15, 33, .5);
  border: 1px solid rgba(216, 182, 98, .5);
  border-radius: 20px;
  padding: 4px 18px;
}

.intro-title {
  font-size: clamp(34px, 8vw, 46px);
  font-weight: 900;
  color: var(--gold-light);
  line-height: 1.15;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .4);
}

.intro-vs {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.vs-good, .vs-bad {
  flex: 1;
  max-width: 170px;
  border-radius: 14px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 19px;
  font-weight: 800;
}
.vs-good { background: rgba(47, 158, 119, .18); border: 1px solid rgba(47, 158, 119, .6); color: #8fd9bd; }
.vs-bad { background: rgba(198, 80, 104, .18); border: 1px solid rgba(198, 80, 104, .6); color: #e6a4b2; }
.vs-label { font-size: 12px; font-weight: 700; opacity: .8; }
.vs-sep { align-self: center; font-size: 22px; color: var(--gold); font-weight: 900; }

.intro-text {
  font-size: 15.5px;
  color: var(--ink-soft);
  line-height: 1.8;
}

.intro-goal {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--gold-light);
  background: rgba(216, 182, 98, .1);
  border: 1px dashed rgba(216, 182, 98, .5);
  border-radius: 12px;
  padding: 8px 14px;
}

/* ==================== النتيجة ==================== */

.result-status {
  font-size: clamp(30px, 7vw, 42px);
  font-weight: 900;
  color: var(--gold-light);
}
.result-status.fail { color: #e6a4b2; }

.result-stars { font-size: 40px; letter-spacing: 8px; line-height: 1; }
.result-stars span { color: rgba(255, 255, 255, .2); transition: color .3s, text-shadow .3s; }
.result-stars span.on { color: var(--gold-light); text-shadow: 0 0 18px rgba(216, 182, 98, .8); }

.result-rows { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.result-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  background: rgba(0, 0, 0, .22);
  border-radius: 10px;
  padding: 8px 16px;
  color: var(--ink);
}
.result-row b { color: var(--gold-light); }

.result-lesson {
  width: 100%;
  background: rgba(216, 182, 98, .08);
  border: 1px solid rgba(216, 182, 98, .35);
  border-radius: 14px;
  padding: 14px 16px;
}
.lesson-head {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 6px;
}
.lesson-text {
  font-family: var(--font-quote);
  font-size: 18.5px;
  line-height: 2;
  color: var(--cream);
}
.lesson-source { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

.result-buttons { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

/* ==================== نهاية المستوى الاحتفالية ==================== */

.result-card { position: relative; }

/* بطاقة فائزة أنيقة داكنة (أرجواني ملكي) بإطار ذهبي متوهّج ونبض نور */
.result-card.win {
  background: linear-gradient(170deg, #3a2350 0%, #241634 100%);
  border-color: rgba(216, 182, 98, .8);
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, .6),
    0 0 0 1px rgba(216, 182, 98, .5),
    0 0 70px rgba(216, 182, 98, .28);
  animation: winPop .55s cubic-bezier(.2, 1.2, .4, 1), winAura 2.6s ease-in-out infinite alternate;
}
@keyframes winPop {
  0% { transform: scale(.82); opacity: 0; }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes winAura {
  from { box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(216,182,98,.4), 0 0 50px rgba(216,182,98,.2); }
  to   { box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(240,214,143,.7), 0 0 90px rgba(216,182,98,.42); }
}

/* بريق ينساب قطريًا عبر البطاقة */
.result-card.win::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(240, 214, 143, .18) 50%, transparent 58%);
  background-size: 220% 100%;
  background-repeat: no-repeat;
  animation: cardShine 3.6s ease-in-out infinite;
}
@keyframes cardShine {
  0% { background-position: 170% 0; }
  55%, 100% { background-position: -70% 0; }
}

/* تاج النصر: أشعّة نور دوّارة خلف الميدالية */
.result-crest { display: none; }
.result-card.win .result-crest {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 128px;
  height: 100px;
  margin-bottom: 2px;
}
.crest-rays {
  position: absolute;
  width: 168px;
  height: 168px;
  background: repeating-conic-gradient(from 0deg, rgba(255, 226, 140, .6) 0deg 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 20%, rgba(0, 0, 0, .55) 40%, transparent 70%);
  mask: radial-gradient(circle, #000 20%, rgba(0, 0, 0, .55) 40%, transparent 70%);
  animation: raysSpin 16s linear infinite;
}
@keyframes raysSpin { to { transform: rotate(360deg); } }

/* شارة النصر: ميدالية ذهبية بنجمة متلألئة وهالة نابضة */
.result-badge { display: none; }
.result-card.win .result-badge {
  display: block;
  position: relative;
  z-index: 1;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff6d8, #f0cf7e 45%, #d4a944 72%, #a97f22 100%);
  box-shadow: 0 6px 22px rgba(212, 169, 68, .6), inset 0 2px 6px rgba(255, 255, 255, .75), 0 0 34px rgba(255, 210, 100, .6);
  animation: badgeSpin 3.5s ease-in-out infinite alternate;
}
.result-card.win .result-badge::before {
  content: '\2605';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: #7a5410;
  text-shadow: 0 1px 1px rgba(255, 255, 255, .5);
}
@keyframes badgeSpin {
  from { transform: rotate(-8deg) scale(1); }
  to { transform: rotate(8deg) scale(1.06); }
}

.result-status.win {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 55%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .5));
  animation: statusGlow 2.2s ease-in-out infinite alternate;
}
@keyframes statusGlow {
  from { filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5)); }
  to { filter: drop-shadow(0 2px 16px rgba(216, 182, 98, .7)); }
}

/* لوحة التهنئة العامة عند الفوز */
.result-card.win .result-lesson {
  background: rgba(216, 182, 98, .12);
  border-color: rgba(216, 182, 98, .5);
}
.result-card.win .lesson-head { color: var(--gold-light); }
.result-card.win .lesson-text { color: var(--cream); }

/* الأزرار المضيئة عند الفوز */
.result-stars span.on { animation: starPop .5s ease both; }
@keyframes starPop {
  0% { transform: scale(0) rotate(-40deg); }
  70% { transform: scale(1.35) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

/* قصاصات ورق ملونة تتساقط عند الفوز */
.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.confetti i {
  position: absolute;
  top: -6vh;
  width: 11px;
  height: 15px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(-6vh) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translateY(112vh) rotate(720deg); opacity: 1; }
}

/* ==================== HUD ==================== */

#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#hud button { pointer-events: auto; }

.hud-top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-box {
  background: rgba(18, 13, 30, .8);
  border: 1px solid rgba(216, 182, 98, .55);
  border-radius: 14px;
  padding: 7px 14px;
  font-size: 19px;
  font-weight: 800;
  color: var(--cream);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 52px;
}
.hud-timer { font-variant-numeric: tabular-nums; color: var(--gold-light); }
.hud-level { font-size: 12.5px; font-weight: 700; color: var(--cream); text-shadow: 0 1px 5px rgba(0,0,0,.8); }

.hud-hearts { gap: 4px; font-size: 20px; }
.hud-hearts .h { color: #e0473a; text-shadow: 0 0 8px rgba(224, 71, 58, .6); }
.hud-hearts .h.off { color: rgba(247, 239, 217, .2); text-shadow: none; }

.hud-score { color: var(--gold-light); font-variant-numeric: tabular-nums; }
.coin-ico {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #d4a944 60%, #9c7a26);
  box-shadow: 0 0 8px rgba(212, 169, 68, .7);
  display: inline-block;
}

.hud-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.noor-wrap { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.noor-label { font-size: 12px; font-weight: 700; color: var(--gold-light); text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.noor-bar {
  width: 14px;
  height: 130px;
  border-radius: 8px;
  border: 1px solid rgba(216, 182, 98, .55);
  background: rgba(18, 13, 30, .8);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.noor-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, #fffbe8, var(--gold-light) 40%, var(--gold));
  box-shadow: 0 0 12px rgba(240, 207, 126, .9);
  transition: height .25s ease;
  border-radius: 0 0 6px 6px;
}
.noor-bar.full .noor-fill { animation: noorPulse .5s infinite alternate; }
@keyframes noorPulse { from { filter: brightness(1); } to { filter: brightness(1.5); } }


/* ==================== التنبيهات داخل اللعب ==================== */

.toast {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(20px, 5vw, 30px);
  font-weight: 900;
  padding: 10px 28px;
  border-radius: 16px;
  white-space: nowrap;
  animation: toastIn 1.6s ease forwards;
  pointer-events: none;
}
.toast.good { color: #8ce7bb; background: rgba(11, 61, 46, .85); border: 2px solid rgba(29, 158, 106, .8); text-shadow: 0 0 14px rgba(29, 158, 106, .8); }
.toast.bad { color: #f0a29a; background: rgba(64, 12, 12, .85); border: 2px solid rgba(176, 48, 48, .8); text-shadow: 0 0 14px rgba(176, 48, 48, .8); }
.toast.noor { color: #fffbe8; background: rgba(90, 68, 12, .85); border: 2px solid rgba(240, 207, 126, .9); text-shadow: 0 0 18px rgba(240, 207, 126, 1); }
.toast.heart { color: #ffd9e2; background: rgba(96, 12, 34, .85); border: 2px solid rgba(255, 92, 122, .9); text-shadow: 0 0 18px rgba(255, 92, 122, 1); }

@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.85); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.04); }
  20% { transform: translateX(-50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-18px); }
}

/* شاشات صغيرة بالعرض */
@media (max-height: 480px) {
  .hud-center { margin-top: 0; }
  .noor-bar { height: 90px; }
  .intro-card, .result-card { padding: 16px; gap: 8px; }
  .lesson-text { font-size: 15px; }
}
