/* =====================================================================
   zahma.css — أنماط «فكّ الزحمة» (صفحتا العربية والإنجليزية)
   ---------------------------------------------------------------------
   اللوحة رسمٌ لا نصّ، فاتجاهها ثابتٌ في اللغتين (`direction: ltr` على
   حاويتها). ولولا ذلك لانقلب المخرج إلى اليسار في العربية، فصار اللغز
   لغزاً آخر وبطلت أرقام «الحلّ الأمثل» المخزّنة معه.

   والسيّارة تتحرّك بـ`transform` في CSS لا بوسم `transform` في SVG —
   فالأولى وحدها تقبل الانتقال المتدرّج، والثانية تقفز قفزاً.
   ===================================================================== */

.z-stage {
  background: var(--bg-soft); border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg); padding: 16px 12px 18px; margin: 14px 0;
}

/* ------------------------------------------------------- المستويات */
.z-levels { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.z-lvl {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  padding: 9px 16px; min-height: 40px; border-radius: 999px;
  background: var(--tile-bg); border: 1px solid var(--tile-border); color: var(--text-muted);
  transition: background .15s, border-color .15s, color .15s;
}
.z-lvl.on { background: var(--accent-teal-dim); border-color: var(--accent-teal); color: var(--accent-teal); }
.z-lvl.locked { opacity: .62; }
/* الشرط مكتوبٌ على الزرّ لا في تلميحٍ يحتاج فأرة — الجوّال لا فأرة فيه */
.z-lock {
  font-style: normal; font-size: 11.5px; font-weight: 800;
  margin-inline-start: 6px; padding: 2px 6px; border-radius: 999px;
  background: rgba(245, 184, 78, .16); color: var(--accent-amber);
}

/* ------------------------------------------------------- الشريط العلوي */
.z-head {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  flex-wrap: wrap; margin: 2px 0 10px;
}
.z-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 12.5px; color: var(--text-muted);
  background: var(--tile-bg); border: 1px solid var(--tile-border);
  border-radius: 999px; padding: 6px 13px;
}
.z-chip b { font-family: var(--font-mono); font-size: 15px; color: var(--text-primary); }
.z-chip.par b { color: var(--accent-teal); }
.z-chip.over b { color: var(--accent-amber); }

.z-ask { text-align: center; font-size: 15px; font-weight: 800; color: var(--text-primary); margin: 0 0 10px; line-height: 1.7; }

/* ------------------------------------------------------- اللوحة */
.z-boardwrap { direction: ltr; display: flex; justify-content: center; padding: 2px 0; }
.z-board {
  width: 100%; max-width: 440px; height: auto;
  touch-action: none;            /* السحب لنا لا للمتصفّح */
  user-select: none; -webkit-user-select: none;
}

.z-asphalt { fill: #0a0e1a; }
.z-frame   { fill: none; stroke: #2b3860; stroke-width: 7; }
.z-lane    { stroke: #1b2440; stroke-width: 2; stroke-dasharray: 9 13; }

/* باب الخروج */
.z-exit-glow { fill: var(--accent-teal); opacity: .12; }
.z-door { animation: zDoorGlow 2.1s ease-in-out infinite; }
.z-door-way  { fill: #05080f; stroke: var(--accent-teal); stroke-width: 3; }
.z-door-leaf { fill: rgba(87, 232, 201, .22); stroke: var(--accent-teal); stroke-width: 2.5; stroke-linejoin: round; }
.z-door-knob { fill: var(--accent-teal); }
@keyframes zDoorGlow {
  0%, 100% { opacity: .78; filter: none; }
  50%      { opacity: 1;   filter: drop-shadow(0 0 9px rgba(87, 232, 201, .85)); }
}

/* السيّارات */
.zcar { cursor: grab; transition: transform .19s cubic-bezier(.2, .85, .3, 1); }
.zcar.drag { cursor: grabbing; transition: none; }
.zcar .shell { stroke: rgba(0, 0, 0, .45); stroke-width: 2; }
.zcar .glass { fill: rgba(255, 255, 255, .26); }
.zcar .strip { fill: rgba(0, 0, 0, .18); }

.zcar.red .shell { filter: drop-shadow(0 0 9px rgba(255, 77, 94, .55)); }
.zcar.sel  .shell { stroke: #fff; stroke-width: 3.5; }
.zcar.sel  { filter: drop-shadow(0 0 12px rgba(87, 232, 201, .75)); }
.zcar.lit  { animation: zPulse 1s ease-in-out infinite; }
@keyframes zPulse { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 14px rgba(245, 184, 78, 1)); } }

.zcar.out { transition: transform .55s cubic-bezier(.4, 0, .9, .45), opacity .35s ease .3s; opacity: 0; }

/* الخانات التي تقبل السيّارة المختارة */
.zspot { fill: rgba(87, 232, 201, .17); stroke: rgba(87, 232, 201, .5); stroke-width: 2; stroke-dasharray: 6 6; cursor: pointer; rx: 10; }
.zspot:hover { fill: rgba(87, 232, 201, .3); }

.z-say { text-align: center; font-size: 13px; color: var(--text-muted); min-height: 20px; margin-top: 8px; line-height: 1.7; }
.z-say.warn { color: var(--accent-amber); font-weight: 700; }

/* ------------------------------------------------------- الأزرار */
.z-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.z-tools button {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  min-height: 44px; padding: 10px 16px; border-radius: 12px;
  background: var(--tile-bg); border: 1px solid var(--tile-border); color: var(--text-primary);
}
.z-tools button:hover:not(:disabled) { border-color: var(--accent-teal); }
.z-tools button:disabled { opacity: .45; cursor: default; }
.z-tools .primary { background: var(--accent-teal-dim); border-color: var(--accent-teal); color: var(--accent-teal); }

/* ------------------------------------------------------- لوحة الفوز */
.z-win {
  margin-top: 14px; text-align: center; padding: 18px 14px;
  background: linear-gradient(180deg, rgba(87, 232, 201, .12), var(--tile-bg));
  border: 1px solid var(--accent-teal); border-radius: var(--radius-lg);
}
.z-win h3 { margin: 0 0 8px; font-size: 19px; color: var(--text-primary); }
/* النجوم تُملأ من اليسار دائماً في اللغتين — تقييمٌ لا نصّ */
.z-stars { direction: ltr; display: flex; gap: 8px; justify-content: center; margin: 4px 0 10px; }
.z-star { font-size: 30px; line-height: 1; filter: grayscale(1); opacity: .3; transform: scale(.75); }
.z-star.on { filter: none; opacity: 1; transform: scale(1); animation: zPop .42s cubic-bezier(.2, 1.5, .4, 1) backwards; }
.z-star.on:nth-child(1) { animation-delay: .05s; }
.z-star.on:nth-child(2) { animation-delay: .2s; }
.z-star.on:nth-child(3) { animation-delay: .35s; }
@keyframes zPop { from { transform: scale(0) rotate(-45deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }

.z-win .tally { font-size: 14px; color: var(--text-muted); }
.z-win .score { font-size: 15px; font-weight: 800; color: var(--accent-teal); margin-top: 4px; }
.z-win .extra { font-size: 13px; color: var(--accent-violet); margin-top: 6px; min-height: 18px; }
.z-win .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.z-win button {
  font: inherit; font-weight: 800; font-size: 15px; cursor: pointer;
  min-height: var(--touch-min); padding: 12px 24px; border-radius: 999px; border: 0;
  background: linear-gradient(90deg, var(--accent-teal), var(--accent-violet)); color: var(--bg);
}
.z-win button.ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--tile-border); font-weight: 700;
}

@media (max-width: 420px) {
  .z-ask { font-size: 14px; }
  .z-tools button { padding: 10px 12px; font-size: 12.5px; }
  .z-chip { padding: 5px 11px; }
}
