/* ── يزن · Design tokens (Pixel-arcade: neon on deep ink) ── */
:root {
  --bg: #0b1020;
  --bg-2: #111a33;
  --card: rgba(255, 255, 255, .05);
  --bg-hover: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .18);
  --text: #f6f8ff;
  --muted: #94a0bd;
  --primary: #dc2626;
  --secondary: #2563eb;
  --accent: #22c55e;
  --gold: #fbbf24;
  --pink: #f472b6;
  --grad: linear-gradient(135deg, #dc2626, #f97316);
  --grad-sky: linear-gradient(180deg, #0b1020 0%, #17224a 55%, #2b1e4d 100%);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 6px 26px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, .6);
  --font-display: 'Baloo Bhaijaan 2', 'Cairo', system-ui, sans-serif;
  --font-body: 'Cairo', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
svg { display: block; }

/* ── Ambient glow ── */
.glow {
  position: fixed; inset: -30% -20% auto -20%; height: 65vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(220, 38, 38, .28), transparent 60%),
    radial-gradient(ellipse at 15% 10%, rgba(37, 99, 235, .25), transparent 55%);
}
/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0 1.25rem; height: 62px;
  background: rgba(11, 16, 32, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: #fff;
  background: var(--grad); box-shadow: 0 6px 20px rgba(220, 38, 38, .45);
}
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1; }
.brand-text small { display: block; font-size: .62rem; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; }
.nav-actions { display: flex; align-items: center; gap: .5rem; }
/* ── Badges & icon buttons ── */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  font-size: .78rem; font-weight: 700; padding: .3rem .7rem; border-radius: 999px;
}
.badge.amber { background: rgba(251, 191, 36, .14); color: var(--gold); border: 1px solid rgba(251, 191, 36, .3); }
.badge svg { width: 15px; height: 15px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--border); background: var(--card);
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.icon-btn:hover { transform: translateY(-2px); background: var(--bg-hover); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Stage layout ── */
.stage {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: .85rem;
  padding: 1rem 1rem 1.5rem; width: 100%;
}
.hud {
  display: flex; align-items: stretch; gap: .5rem; width: 100%; max-width: 460px;
}
.hud-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .5rem .3rem; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.hud-item svg { width: 15px; height: 15px; color: var(--gold); }
.hud-item > span:first-of-type { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.hud-item small { font-size: .62rem; color: var(--muted); letter-spacing: .04em; }
.hud-item .lives { display: flex; gap: .15rem; height: 1.05rem; align-items: center; }
.hud-item .lives i { width: 11px; height: 11px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px rgba(220, 38, 38, .8); }
.hud-item .lives i.off { background: rgba(255, 255, 255, .14); box-shadow: none; }

/* ── Canvas frame ── */
.canvas-wrap {
  position: relative; width: 100%;
  max-width: min(460px, calc((100dvh - 300px) * 0.6667));
  aspect-ratio: 2 / 3; margin-inline: auto;
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #05070f;
  box-shadow: var(--shadow-lg), 0 0 0 6px rgba(255, 255, 255, .02);
}
#game { width: 100%; height: 100%; display: block; touch-action: none; }
.scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: .25;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .5) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
/* ── Overlay screens ── */
.overlay {
  position: absolute; inset: 0; z-index: 5; display: none;
  align-items: center; justify-content: center; padding: 1rem;
  background: radial-gradient(ellipse at 50% 120%, rgba(37, 99, 235, .35), transparent 60%), rgba(5, 7, 15, .82);
  backdrop-filter: blur(6px);
}
.overlay.active { display: flex; animation: fadeUp .35s ease both; }
.panel {
  width: 100%; max-width: 330px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .65rem;
}
.eyebrow {
  font-size: .68rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--primary); background: rgba(220, 38, 38, .12);
  border: 1px solid rgba(220, 38, 38, .28); padding: .2rem .7rem; border-radius: 999px;
}
.game-title {
  font-family: var(--font-display); font-weight: 800; line-height: .95;
  font-size: clamp(3rem, 16vw, 4.4rem); letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff 30%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 22px rgba(251, 191, 36, .35));
}
.panel-title { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; }
.tagline { font-size: .88rem; line-height: 1.7; color: var(--muted); max-width: 30ch; }

/* ── Buttons ── */
.btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border: none; border-radius: 999px;
  font-size: .95rem; font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 30px rgba(220, 38, 38, .38); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(220, 38, 38, .5); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--bg-hover); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.985); }
/* ── Tabs (difficulty) ── */
.tabs {
  display: flex; gap: .25rem; width: 100%; padding: .25rem;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--border); border-radius: 999px;
}
.tab {
  flex: 1; padding: .4rem .5rem; border: none; border-radius: 999px; background: transparent;
  font-size: .82rem; font-weight: 700; color: var(--muted); transition: all .2s ease;
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.active { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(220, 38, 38, .35); }

/* ── Hints & score grid ── */
.hints { list-style: none; display: flex; flex-direction: column; gap: .3rem; font-size: .74rem; color: var(--muted); }
.hints b { color: var(--text); font-weight: 700; }
.hints span {
  padding: .05rem .4rem; border: 1px solid var(--border-strong);
  border-radius: 6px; font-size: .7rem; background: rgba(255, 255, 255, .05);
}
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; width: 100%; }
.score-cell {
  padding: .6rem .3rem; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
}
.score-cell small { display: block; font-size: .64rem; color: var(--muted); }
.score-cell strong { font-family: var(--font-display); font-size: 1.4rem; color: var(--gold); }

/* ── Footer & mobile pads ── */
.mobile-controls { display: none; gap: .75rem; width: 100%; max-width: 460px; }
.pad {
  flex: 1; display: grid; place-items: center; padding: .7rem 0;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); backdrop-filter: blur(12px);
  transition: transform .12s ease, background .12s ease;
}
.pad:active, .pad.on { background: rgba(220, 38, 38, .22); border-color: rgba(220, 38, 38, .5); transform: scale(.97); }
.pad svg { width: 24px; height: 24px; }
.foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem .9rem;
  font-size: .7rem; color: var(--muted);
}
.foot span { display: inline-flex; align-items: center; gap: .3rem; }
.foot svg { width: 13px; height: 13px; color: var(--accent); }

/* ── Toast ── */
.toast-wrap { position: fixed; bottom: 1.25rem; inset-inline-start: 1.25rem; z-index: 60; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  padding: .6rem 1rem; border-radius: var(--radius-sm); font-size: .84rem; font-weight: 700;
  background: rgba(34, 197, 94, .16); border: 1px solid rgba(34, 197, 94, .35); color: #86efac;
  box-shadow: var(--shadow); animation: fadeUp .3s ease both;
}
.toast.gold { background: rgba(251, 191, 36, .16); border-color: rgba(251, 191, 36, .38); color: var(--gold); }
.toast.red { background: rgba(220, 38, 38, .18); border-color: rgba(220, 38, 38, .4); color: #fca5a5; }

.fade-up { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { transform: scale(1.06); } }
.record { animation: pulse 1.1s ease-in-out infinite; }

@media (max-width: 720px) {
  .navbar { height: 56px; padding: 0 .8rem; }
  .stage { gap: .6rem; padding: .7rem .7rem 1rem; }
  .canvas-wrap { max-width: min(100%, 460px); }
  .mobile-controls { display: flex; }
  .foot { display: none; }
  .hud-item small { font-size: .58rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}/* --- أيقونات: حماية من فقدان الحجم قبل تحميل مكتبة الأيقونات --- */
i[data-lucide]{display:inline-block;width:18px;height:18px;flex:none}
.overlay .panel{cursor:default}
