/* ============================================================
   منصة المسابقات التعليمية — نظام التصميم v17
   هوية: برتقالي · أحمر · ذهبي · تدرجات دافئة
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

:root {
  --brand: #f97316;
  --brand-2: #ea580c;
  --red: #ef4444;
  --red-2: #dc2626;
  --gold: #fbbf24;
  --gold-2: #d97706;
  --amber: #f59e0b;

  --ink: #1c1917;
  --ink-2: #44403c;
  --muted: #78716c;
  --faint: #a8a29e;

  --bg: #fdf6ef;
  --bg-2: #f9ece0;
  --surface: #ffffff;
  --surface-2: #fffaf5;

  --line: #f0e2d4;
  --line-2: #e6d3c0;

  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --bad: #dc2626;
  --bad-bg: #fee2e2;
  --info: #2563eb;

  --grad-brand: linear-gradient(135deg, #fb923c 0%, #f97316 35%, #ef4444 100%);
  --grad-gold: linear-gradient(135deg, #fde68a 0%, #fbbf24 45%, #d97706 100%);
  --grad-deep: linear-gradient(160deg, #7f1d1d 0%, #b91c1c 45%, #ea580c 100%);
  --grad-surface: linear-gradient(180deg, #ffffff 0%, #fff8f1 100%);

  --sh-1: 0 1px 2px rgba(120, 53, 15, .06), 0 2px 6px rgba(120, 53, 15, .05);
  --sh-2: 0 4px 10px rgba(120, 53, 15, .07), 0 10px 26px rgba(120, 53, 15, .07);
  --sh-3: 0 8px 20px rgba(120, 53, 15, .10), 0 22px 52px rgba(120, 53, 15, .12);
  --sh-glow: 0 8px 24px rgba(249, 115, 22, .30);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Cairo', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* خلفية متدرّجة ناعمة */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 420px at 100% -5%, rgba(251, 191, 36, .16), transparent 65%),
    radial-gradient(760px 380px at 0% 8%, rgba(249, 115, 22, .14), transparent 62%),
    radial-gradient(700px 500px at 50% 110%, rgba(239, 68, 68, .10), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.2px; line-height: 1.35; }
p { margin: 0; }
a { color: var(--brand-2); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
::selection { background: rgba(249, 115, 22, .25); }

/* ============================ Layout ============================ */
.app-shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex: 0 0 264px;
  background: linear-gradient(180deg, #431407 0%, #7c2d12 42%, #991b1b 100%);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 6px 0 30px rgba(67, 20, 7, .18);
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 8px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--grad-gold);
  display: grid; place-items: center;
  font-size: 24px;
  box-shadow: 0 6px 18px rgba(251, 191, 36, .35), inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.brand b { display: block; font-size: 16px; font-weight: 800; }
.brand span { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .66); font-weight: 500; }

.nav-group-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .8px;
  color: rgba(255, 255, 255, .45); padding: 14px 12px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 13px;
  color: rgba(255, 255, 255, .84);
  font-weight: 600; font-size: 14px;
  transition: background .18s var(--ease), color .18s, transform .18s;
  text-align: right; width: 100%;
}
.nav-item .ico { font-size: 18px; width: 22px; text-align: center; filter: saturate(1.15); }
.nav-item:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(251, 191, 36, .28), rgba(249, 115, 22, .12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .35);
}
.nav-item.active .ico { filter: drop-shadow(0 0 6px rgba(251, 191, 36, .8)); }

.sidebar-foot { margin-top: auto; padding-top: 16px; }
.teacher-chip {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px; padding: 9px 11px;
}
.teacher-chip img, .teacher-chip .av {
  width: 36px; height: 36px; border-radius: 11px; object-fit: cover;
  background: var(--grad-brand); display: grid; place-items: center; font-weight: 800; color: #fff;
}
.teacher-chip b { font-size: 13px; display: block; }
.teacher-chip small { font-size: 10.5px; color: rgba(255, 255, 255, .6); }

.main { flex: 1; min-width: 0; padding: 26px 30px 64px; }

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar .page-title { font-size: 25px; font-weight: 900; }
.topbar .page-sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.topbar .spacer { flex: 1; }

/* ============================ Buttons ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; border-radius: 12px;
  font-weight: 700; font-size: 13.5px;
  background: #fff; color: var(--ink-2);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-1);
  transition: transform .16s var(--ease), box-shadow .2s, background .18s, border-color .18s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2); border-color: #dcc4ad; }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: 3px solid rgba(249, 115, 22, .45); outline-offset: 2px; }

.btn-primary {
  background: var(--grad-brand);
  color: #fff; border: none;
  box-shadow: var(--sh-glow);
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, .38) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform .6s var(--ease);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:hover { box-shadow: 0 10px 30px rgba(249, 115, 22, .42); }

.btn-gold { background: var(--grad-gold); color: #6b3b06; border: none; box-shadow: 0 6px 18px rgba(251, 191, 36, .35); }
.btn-dark { background: linear-gradient(135deg, #292524, #44403c); color: #fff; border: none; }
.btn-ghost { background: rgba(255, 255, 255, .7); border-color: var(--line); color: var(--ink-2); }
.btn-danger { background: #fef2f2; color: var(--red-2); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-ok { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; border: none; box-shadow: 0 6px 18px rgba(22, 163, 74, .28); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; border-radius: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; width: 38px; height: 38px; border-radius: 11px; }

/* ============================ Cards ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: 20px;
  position: relative;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s;
}
.card:hover { box-shadow: var(--sh-3); }
.card-hero {
  background: var(--grad-surface);
  border: 1px solid #f6e3d2;
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2), inset 0 1px 0 #fff;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 17px; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* KPI */
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi .kico {
  width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center;
  font-size: 23px; flex: 0 0 50px;
  background: linear-gradient(145deg, #fff7ed, #ffedd5);
  border: 1px solid #fed7aa; color: var(--brand-2);
  box-shadow: inset 0 -2px 0 rgba(249, 115, 22, .12);
}
.kpi .kval { font-size: 25px; font-weight: 900; line-height: 1.1; }
.kpi .klabel { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ============================ Forms ============================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 11px; color: var(--faint); font-weight: 500; }

.input, .select, .textarea {
  width: 100%; padding: 10px 13px;
  border-radius: 12px;
  border: 1.5px solid var(--line-2);
  background: #fff;
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, .13);
  background: #fffdfb;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.8; font-family: 'Cairo', monospace; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2378716c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 32px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { min-width: 0; }
.input-sm { padding: 7px 10px; font-size: 12.5px; border-radius: 10px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.switch input { display: none; }
.switch .track {
  width: 44px; height: 25px; border-radius: 999px; background: #e7d8c8;
  position: relative; transition: background .22s; flex: 0 0 44px;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; right: 3px;
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .22s var(--ease);
}
.switch input:checked + .track { background: var(--grad-brand); }
.switch input:checked + .track::after { transform: translateX(-19px); }

/* Segmented */
.seg { display: inline-flex; background: #f5e9dc; border-radius: 12px; padding: 4px; gap: 3px; }
.seg button {
  padding: 7px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  color: var(--muted); transition: all .18s var(--ease);
}
.seg button.active { background: #fff; color: var(--brand-2); box-shadow: var(--sh-1); }

/* ============================ Pills / Badges ============================ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800;
  background: #fff3e6; color: var(--brand-2); border: 1px solid #fed7aa;
}
.pill-gold { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.pill-red { background: #fef2f2; color: var(--red-2); border-color: #fecaca; }
.pill-ok { background: var(--ok-bg); color: #15803d; border-color: #bbf7d0; }
.pill-gray { background: #f5f5f4; color: var(--muted); border-color: #e7e5e4; }
.pill-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.tier { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; }
.tier-gold { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.tier-silver { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); color: #475569; }
.tier-bronze { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #9a3412; }
.tier-normal { background: #eff6ff; color: #1d4ed8; }

/* ============================ Badge Cards (CSS art) ============================ */
.badge-card {
  position: relative; border-radius: 18px; overflow: hidden;
  aspect-ratio: 2 / 3;
  display: flex; flex-direction: column; align-items: center;
  padding: 7% 8%;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28), inset 0 0 0 3px rgba(255, 255, 255, .12);
  border: 3px solid transparent;
  background-clip: padding-box;
  isolation: isolate;
}
.badge-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  border-radius: 15px;
}
.badge-card::after {
  content: ''; position: absolute; inset: -40% -40% auto auto; width: 120%; height: 120%;
  background: conic-gradient(from 0deg, rgba(255,255,255,.16), transparent 22%, transparent 78%, rgba(255,255,255,.14));
  animation: badgeSpin 14s linear infinite;
  z-index: -1;
}
@keyframes badgeSpin { to { transform: rotate(360deg); } }

.badge-card.gold { border-color: #fbbf24; background: radial-gradient(circle at 50% 30%, #b91c1c, #7f1d1d 70%); }
.badge-card.silver { border-color: #fbbf24; background: radial-gradient(circle at 50% 30%, #1d4ed8, #172554 70%); }
.badge-card.bronze { border-color: #fbbf24; background: radial-gradient(circle at 50% 30%, #15803d, #14532d 70%); }
.badge-card .bc-crown { font-size: 22px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.badge-card .bc-circle {
  width: 58%; aspect-ratio: 1; border-radius: 50%;
  border: 4px solid #fbbf24;
  background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.22), transparent 65%);
  display: grid; place-items: center; gap: 2px;
  box-shadow: inset 0 0 18px rgba(0,0,0,.45), 0 0 0 3px rgba(251,191,36,.28);
  margin-top: 2%;
}
.badge-card .bc-circle .stars { font-size: 16px; color: #fbbf24; letter-spacing: 2px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.badge-card .bc-ribbon {
  margin-top: auto; width: 108%;
  background: linear-gradient(180deg, #fde68a, #fbbf24 45%, #d97706);
  color: #4a2107; font-weight: 900; font-size: 12px;
  padding: 6px 4px; text-align: center; border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6);
  clip-path: polygon(4% 0, 96% 0, 100% 50%, 96% 100%, 4% 100%, 0 50%);
}
.badge-card .bc-body {
  width: 100%; background: rgba(0,0,0,.35);
  border: 2px solid #fbbf24; border-radius: 10px; padding: 6px 4px;
  margin-top: 5%; display: grid; gap: 3px;
  font-size: 10.5px; font-weight: 800; color: #fff;
}
.badge-card .bc-body .up { color: #fbbf24; }
.badge-card .bc-body .dn { color: #fca5a5; }

/* ============================ Lists / tables ============================ */
.list { display: flex; flex-direction: column; gap: 9px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: background .16s, border-color .16s, transform .16s;
}
.list-item:hover { background: #fff; border-color: #f3d9c2; transform: translateX(-2px); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; font-size: 13.5px; }
.list-item .li-sub { font-size: 11.5px; color: var(--muted); }
.list-item .li-acts { display: flex; gap: 6px; align-items: center; }

.table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.table th {
  text-align: right; font-size: 11.5px; font-weight: 800; color: var(--muted);
  padding: 0 12px 4px;
}
.table td { background: var(--surface-2); padding: 11px 12px; font-size: 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.table tr td:first-child { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }
.table tr td:last-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; }
.table tbody tr { transition: transform .15s; }
.table tbody tr:hover td { background: #fff; }

.rank-num {
  width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center;
  font-size: 12px; font-weight: 900; background: #f5f5f4; color: var(--muted);
}
.rank-1 { background: var(--grad-gold); color: #6b3b06; box-shadow: 0 3px 8px rgba(251,191,36,.4); }
.rank-2 { background: linear-gradient(135deg, #e2e8f0, #cbd5e1); color: #334155; }
.rank-3 { background: linear-gradient(135deg, #fed7aa, #fdba74); color: #7c2d12; }

.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  background: repeating-linear-gradient(45deg, #fffdfa, #fffdfa 12px, #fdf6ef 12px, #fdf6ef 24px);
  border: 1.5px dashed var(--line-2); border-radius: var(--r-lg);
}
.empty .em-ico { font-size: 40px; display: block; margin-bottom: 10px; opacity: .8; }
.empty b { display: block; font-size: 15px; color: var(--ink-2); margin-bottom: 4px; }

/* ============================ Modal / toast ============================ */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(28, 15, 8, .55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .18s var(--ease);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: var(--r-xl);
  width: min(660px, 100%); max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(28, 15, 8, .35);
  animation: popIn .24s var(--ease);
  border: 1px solid #f6e3d2;
}
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97) } to { opacity: 1; transform: none } }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; background: #fff; z-index: 2;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; }

.toasts { position: fixed; bottom: 22px; left: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  padding: 12px 16px; border-radius: 14px; font-size: 13px; font-weight: 700;
  background: #292524; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  display: flex; align-items: center; gap: 9px;
  animation: slideUp .26s var(--ease);
  max-width: 340px;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
.toast.ok { background: linear-gradient(135deg, #16a34a, #15803d); }
.toast.bad { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.toast.gold { background: linear-gradient(135deg, #f59e0b, #b45309); }

/* ============================ Question presentation ============================ */
.q-stage {
  background: linear-gradient(160deg, #450a0a 0%, #7f1d1d 45%, #9a3412 100%);
  border-radius: var(--r-xl); padding: 26px 28px; color: #fff;
  box-shadow: 0 20px 50px rgba(69, 10, 10, .30), inset 0 1px 0 rgba(255, 255, 255, .12);
  position: relative; overflow: hidden;
}
.q-stage::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(600px 220px at 85% 0%, rgba(251, 191, 36, .22), transparent 60%),
    repeating-conic-gradient(from 0deg at 50% 0%, rgba(255, 255, 255, .045) 0deg 6deg, transparent 6deg 12deg);
  pointer-events: none;
}
.q-stage > * { position: relative; }
.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.q-timer {
  font-variant-numeric: tabular-nums; font-weight: 900; font-size: 15px;
  background: rgba(0, 0, 0, .3); border: 1px solid rgba(251, 191, 36, .4);
  padding: 5px 13px; border-radius: 999px; color: #fde68a;
}
.q-timer.warn { background: rgba(239, 68, 68, .35); color: #fff; animation: pulseWarn .9s infinite; }
@keyframes pulseWarn { 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, .18) } }
.q-text { font-size: clamp(19px, 2.3vw, 30px); font-weight: 800; line-height: 1.55; margin-bottom: 18px; }

/* ============================================================
   الخيارات — نسختان: فاتحة (على البطاقات البيضاء للطالب)
   وداكنة (داخل مسرح السؤال الداكن وشاشة العرض)
   ============================================================ */
.options { display: grid; gap: 11px; }
.options.two { grid-template-columns: 1fr 1fr; }

/* الافتراضي: فاتح — نص داكن على خلفية فاتحة (يُقرأ دائمًا) */
.option {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 14px;
  background: #fffaf5;
  border: 1.5px solid var(--line-2);
  color: var(--ink); font-weight: 800; font-size: 15px;
  text-align: right; width: 100%;
  box-shadow: 0 1px 2px rgba(120, 53, 15, .04);
  transition: all .18s var(--ease);
}
.option:hover:not(.locked) {
  background: #fff7ed; border-color: var(--brand);
  transform: translateX(-3px); box-shadow: var(--sh-1);
}
.option:active:not(.locked) { transform: translateX(-1px) scale(.995); }
.option .letter {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  display: grid; place-items: center; font-weight: 900; font-size: 13px;
  background: var(--grad-gold); color: #6b3b06;
}
.option.correct { background: #dcfce7; border-color: #16a34a; color: #14532d; box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.option.wrong { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.option.chosen { background: #fffbeb; border-color: #f59e0b; color: #78350f; box-shadow: 0 0 0 3px rgba(251, 191, 36, .3); }
.option.locked { cursor: default; }

/* النسخة الداكنة: فقط داخل مسرح السؤال / شاشة العرض */
.q-stage .option,
.display-shell .option {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(251, 191, 36, .32);
  color: #fff; box-shadow: none;
}
.q-stage .option:hover:not(.locked),
.display-shell .option:hover:not(.locked) { background: rgba(251, 191, 36, .18); border-color: rgba(251, 191, 36, .65); }
.q-stage .option.correct,
.display-shell .option.correct {
  background: rgba(22, 163, 74, .38); border-color: #4ade80; color: #fff;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .22);
}
.q-stage .option.wrong,
.display-shell .option.wrong { background: rgba(220, 38, 38, .34); border-color: #f87171; color: #fff; }
.q-stage .option.chosen,
.display-shell .option.chosen { background: rgba(251, 191, 36, .20); border-color: rgba(251, 191, 36, .6); color: #fff; box-shadow: 0 0 0 3px rgba(251, 191, 36, .3); }
.q-stage .option .letter,
.display-shell .option .letter { background: var(--grad-gold); color: #6b3b06; }

/* ============================ Live room ============================ */
.live-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: all .25s var(--ease);
}
.lb-row.me { border-color: var(--brand); background: #fff7ed; box-shadow: 0 0 0 3px rgba(249, 115, 22, .12); }
.lb-row .lb-name { flex: 1; font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-score { font-weight: 900; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.lb-row.buzz-in { animation: buzzIn .45s var(--ease); }
@keyframes buzzIn { from { transform: scale(.94); background: #fef3c7 } to { transform: none } }

.buzz-big {
  background: linear-gradient(135deg, #7f1d1d, #dc2626);
  color: #fff; border-radius: 16px; padding: 16px; text-align: center;
  box-shadow: 0 10px 26px rgba(185, 28, 28, .35);
  animation: buzzIn .4s var(--ease);
}
.buzz-big b { display: block; font-size: 22px; }
.buzz-big span { font-size: 12px; opacity: .85; }

/* code display */
.code-box {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 2px dashed #fbbf24; border-radius: 18px;
  padding: 14px 18px;
}
.code-val {
  font-family: 'Tajawal', monospace; font-size: 32px; font-weight: 900;
  letter-spacing: 6px; color: #92400e; direction: ltr; text-align: center;
  flex: 1; text-shadow: 0 2px 0 #fff;
}

/* ============================ Wheel ============================ */
.wheel-wrap { position: relative; width: min(440px, 88vw); aspect-ratio: 1; margin: 0 auto; }
.wheel-pointer {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 3;
  border-left: 16px solid transparent; border-right: 16px solid transparent;
  border-top: 30px solid var(--red-2);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3));
}
#wheelCanvas {
  width: 100%; height: 100%; border-radius: 50%;
  box-shadow: 0 0 0 9px #fff, 0 0 0 13px var(--gold), 0 18px 44px rgba(120, 53, 15, .3);
  transition: transform 4.6s cubic-bezier(.15, .72, .12, 1);
}

/* ============================ Student / mobile ============================ */
.mobile-shell {
  min-height: 100vh; display: flex; flex-direction: column;
  padding: 16px 14px 84px; max-width: 520px; margin: 0 auto;
  position: relative; z-index: 1;
}
.mobile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mobile-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--grad-gold); display: grid; place-items: center; font-size: 20px; }

.join-hero {
  background: var(--grad-deep); color: #fff; border-radius: 26px;
  padding: 28px 22px; text-align: center; position: relative; overflow: hidden;
  box-shadow: 0 18px 40px rgba(127, 29, 29, .3);
  margin-bottom: 18px;
}
.join-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(400px 180px at 50% 0%, rgba(251, 191, 36, .3), transparent 70%);
}
.join-hero > * { position: relative; }
.join-hero h1 { font-size: 23px; margin-bottom: 6px; }
.join-hero p { font-size: 13px; opacity: .85; }

.big-bell {
  width: min(240px, 68vw); aspect-ratio: 1; border-radius: 50%; margin: 22px auto;
  background: radial-gradient(circle at 35% 30%, #fca5a5, #dc2626 55%, #7f1d1d);
  color: #fff; font-size: 18px; font-weight: 900;
  display: grid; place-items: center; gap: 4px;
  box-shadow: 0 0 0 10px rgba(239, 68, 68, .14), 0 18px 40px rgba(185, 28, 28, .4);
  transition: transform .1s;
  border: 5px solid rgba(255, 255, 255, .25);
  animation: bellPulse 2.2s infinite;
}
.big-bell:active { transform: scale(.94); }
.big-bell.off { background: radial-gradient(circle at 35% 30%, #d6d3d1, #a8a29e 55%, #57534e); animation: none; opacity: .7; }
@keyframes bellPulse { 0%, 100% { box-shadow: 0 0 0 10px rgba(239, 68, 68, .14), 0 18px 40px rgba(185, 28, 28, .4) } 50% { box-shadow: 0 0 0 20px rgba(239, 68, 68, .07), 0 18px 40px rgba(185, 28, 28, .4) } }

.score-hero {
  background: var(--grad-brand); color: #fff; border-radius: 22px;
  padding: 16px 20px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--sh-glow); margin-bottom: 14px;
}
.score-hero .big { font-size: 34px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.score-hero .lbl { font-size: 11.5px; opacity: .9; font-weight: 700; }

/* order drag */
.order-list { display: flex; flex-direction: column; gap: 9px; }
.order-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid var(--line-2); border-radius: 13px;
  padding: 12px 13px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--sh-1);
  touch-action: none; user-select: none;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.order-item.dragging { box-shadow: var(--sh-3); transform: scale(1.02); border-color: var(--brand); z-index: 5; }
.order-item .handle { color: var(--faint); font-size: 17px; cursor: grab; }
.order-item .num { width: 24px; height: 24px; border-radius: 8px; background: #fff3e6; color: var(--brand-2); display: grid; place-items: center; font-size: 12px; font-weight: 900; flex: 0 0 24px; }

/* ============================ Display (big screen) ============================ */
.display-shell {
  min-height: 100vh; padding: 22px 30px; display: flex; flex-direction: column; gap: 16px;
  position: relative; z-index: 1;
  background: radial-gradient(1200px 500px at 50% -10%, #7f1d1d 0%, #450a0a 45%, #1c0a0a 100%);
  color: #fff;
}
.display-head { display: flex; align-items: center; gap: 14px; }
.display-head .dtitle { font-size: 22px; font-weight: 900; }
.display-code {
  font-family: 'Tajawal', monospace; font-size: 26px; font-weight: 900; letter-spacing: 5px;
  background: rgba(251, 191, 36, .16); border: 1.5px solid rgba(251, 191, 36, .5);
  color: #fde68a; padding: 6px 18px; border-radius: 14px; direction: ltr;
}
.display-main { flex: 1; display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.display-shell .q-stage { background: rgba(255, 255, 255, .05); border: 1px solid rgba(251, 191, 36, .2); box-shadow: none; }
.display-shell .lb-row { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .1); color: #fff; }
.display-shell .lb-row .lb-score { color: #fbbf24; }
.display-shell .card { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
.display-shell .card-head h3 { color: #fff; }
.display-shell .card-head .sub { color: rgba(255, 255, 255, .6); }

/* ============================ Auth ============================ */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.auth-card {
  width: min(460px, 100%); background: #fff; border-radius: 28px; padding: 32px 30px;
  box-shadow: 0 30px 80px rgba(120, 53, 15, .18);
  border: 1px solid #f6e3d2;
  animation: popIn .3s var(--ease);
}
.auth-logo {
  width: 68px; height: 68px; border-radius: 20px; background: var(--grad-brand);
  display: grid; place-items: center; font-size: 32px; margin: 0 auto 14px;
  box-shadow: var(--sh-glow);
}
.auth-card h1 { text-align: center; font-size: 23px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; font-size: 12.5px; color: var(--muted); margin-bottom: 22px; font-weight: 500; }
.auth-tabs { display: flex; gap: 6px; background: #f7ede2; padding: 5px; border-radius: 13px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; padding: 9px; border-radius: 9px; font-weight: 800; font-size: 13px; color: var(--muted); }
.auth-tabs button.active { background: #fff; color: var(--brand-2); box-shadow: var(--sh-1); }

/* ============================ Animations / utils ============================ */
.fade-up { animation: fadeUp .34s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
.stagger > * { animation: fadeUp .38s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s }
.stagger > *:nth-child(2) { animation-delay: .06s }
.stagger > *:nth-child(3) { animation-delay: .1s }
.stagger > *:nth-child(4) { animation-delay: .14s }
.stagger > *:nth-child(5) { animation-delay: .18s }
.stagger > *:nth-child(6) { animation-delay: .22s }

.mt-0 { margin-top: 0 } .mt-1 { margin-top: 6px } .mt-2 { margin-top: 12px } .mt-3 { margin-top: 18px } .mt-4 { margin-top: 26px }
.mb-2 { margin-bottom: 12px } .mb-3 { margin-bottom: 18px }
.muted { color: var(--muted) } .small { font-size: 12px } .tiny { font-size: 11px }
.bold { font-weight: 800 } .center { text-align: center }
.flex { display: flex; align-items: center; gap: 10px } .flex-wrap { flex-wrap: wrap } .between { justify-content: space-between }
.grow { flex: 1 } .nowrap { white-space: nowrap }
.hidden { display: none !important }
.ltr { direction: ltr; unicode-bidi: embed }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' }
.divider { height: 1px; background: var(--line); margin: 16px 0 }
.scroll-y { max-height: 380px; overflow-y: auto; padding-inline-end: 4px; }
.scroll-y::-webkit-scrollbar { width: 7px }
.scroll-y::-webkit-scrollbar-thumb { background: #e7d5c2; border-radius: 8px }

/* ============================ Responsive ============================ */
.mobile-nav { display: none; }
@media (max-width: 980px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0;
    width: 100%; height: auto; flex-direction: row;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto; overflow-y: hidden;
    gap: 2px; z-index: 60;
    box-shadow: 0 -6px 24px rgba(67, 20, 7, .25);
  }
  .sidebar .brand, .sidebar-foot, .nav-group-label { display: none; }
  .nav-item {
    flex-direction: column; gap: 2px; padding: 7px 10px; min-width: 64px;
    font-size: 9.5px; border-radius: 11px; text-align: center;
  }
  .nav-item .ico { font-size: 19px; }
  .main { padding: 16px 14px 90px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .live-grid, .display-main { grid-template-columns: 1fr; }
  .topbar .page-title { font-size: 20px; }
  .options.two { grid-template-columns: 1fr; }
  .modal { border-radius: 20px; }
}
@media (min-width: 981px) and (max-width: 1280px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-grid { grid-template-columns: 1fr 270px; }
}
@media print {
  .sidebar, .topbar .btn, .toasts { display: none !important; }
  body::before { display: none; }
  .main { padding: 0; }
}

/* ============================================================
   ⛶ تكبير الشاشة — زر عائم موحّد لكل الصفحات
   ============================================================ */
.aq-zoom-fab {
  position: fixed; inset-inline-end: 18px; bottom: 18px; z-index: 900;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 16px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.4);
  background: linear-gradient(135deg, #1875d2, #0b3c88); color: #fff;
  font-family: inherit; font-weight: 900; font-size: 13px; cursor: pointer;
  box-shadow: 0 16px 34px -14px rgba(11,60,136,.9);
  transition: transform .16s var(--ease, ease), box-shadow .16s;
}
.aq-zoom-fab:hover { transform: translateY(-2px); box-shadow: 0 22px 42px -14px rgba(11,60,136,1); }
.aq-zoom-fab:active { transform: translateY(0) scale(.98); }
@media print { .aq-zoom-fab { display: none !important; } }

/* حالة التكبير: خطوط أكبر في شاشات المسابقة */
body.aq-big .q-text, body.aq-big .qstage .qtext { font-size: clamp(24px, 3vw, 46px) !important; }
body.aq-big .qstage .option, body.aq-big .qopt { font-size: clamp(17px, 1.9vw, 27px) !important; }
body.aq-big .option { font-size: clamp(16px, 1.7vw, 24px) !important; padding: 16px 18px !important; }
body.aq-big .lb-name { font-size: 16px; }
body.aq-big .lb-score { font-size: 18px; }
body.aq-big .sidebar { width: 232px; }
