/* =============================================================================
 *  دوري الفصول — مدرسة الدوغة
 *  style.css — الهوية البصرية الكاملة
 * -----------------------------------------------------------------------------
 *  الفهرس:
 *   1) المتغيرات والثيمات        2) الأساسيات والأدوات      3) الخلفيات والزخرفة
 *   4) المكونات المشتركة          5) شاشة البداية             6) الرئيسية والدخول
 *   7) شاشة العرض                 8) لوحة الإدارة             9) لوحة الأجراس
 *  10) الحركات (Keyframes)        11) التجاوب مع الشاشات
 *  ملاحظة: الألوان الأساسية (--primary / --secondary / --accent) تُضبط تلقائياً
 *  من شعار المدرسة عبر JavaScript.
 * ============================================================================= */

/* ============================================================================
 * 1) المتغيرات والثيمات
 * ========================================================================== */
:root {
  --primary: #0F766E; --primary-rgb: 15, 118, 110; --primary-light: #2dd4bf; --primary-dark: #0b4d47; --on-primary: #fff;
  --secondary: #1E3A8A; --secondary-rgb: 30, 58, 138;
  --accent: #D4A72C; --accent-rgb: 212, 167, 44; --accent-light: #f3d67b; --on-accent: #1b1405;
  --bg-0: #071420; --bg-1: #0c1d33; --bg-2: #0b2a2a; --glow: #14b8a6;

  --text: #EEF4F8; --muted: #93A7B9; --border: rgba(255, 255, 255, .11); --border-strong: rgba(255, 255, 255, .22);
  --surface: rgba(255, 255, 255, .055); --surface-2: rgba(255, 255, 255, .09); --surface-3: rgba(255, 255, 255, .14);
  --input-bg: rgba(0, 0, 0, .22); --shadow: 0 18px 50px rgba(0, 0, 0, .38); --shadow-sm: 0 6px 18px rgba(0, 0, 0, .25);
  --success: #22C55E; --danger: #EF4444; --warning: #F59E0B; --info: #3B82F6;
  --gold-grad: linear-gradient(135deg, #FFF3C4 0%, #F8DE85 25%, #D4A72C 55%, #F8DE85 80%, #B8860B 100%);

  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-title: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-quran: 'Amiri', 'Traditional Arabic', 'Times New Roman', serif;
  --radius: 18px; --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);

  --pattern: 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='%23ffffff' stroke-opacity='0.065' stroke-width='1.1'%3E%3Crect x='26' y='26' width='44' height='44'/%3E%3Crect x='26' y='26' width='44' height='44' transform='rotate(45 48 48)'/%3E%3Ccircle cx='48' cy='48' r='9'/%3E%3Cpath d='M0 0L18 18M96 0L78 18M0 96L18 78M96 96L78 78M48 0V8M48 96V88M0 48H8M96 48H88'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="light"] {
  --text: #0E1B2A; --muted: #5B6B7C; --border: rgba(14, 27, 42, .12); --border-strong: rgba(14, 27, 42, .24);
  --surface: rgba(255, 255, 255, .72); --surface-2: rgba(14, 27, 42, .06); --surface-3: rgba(14, 27, 42, .1);
  --input-bg: rgba(255, 255, 255, .9); --shadow: 0 18px 50px rgba(15, 40, 60, .14); --shadow-sm: 0 6px 18px rgba(15, 40, 60, .1);
  --gold-grad: linear-gradient(135deg, #C8961E 0%, #9A6F0E 30%, #7A5508 55%, #B8860B 80%, #8a6410 100%);
  --pattern: 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='%23123048' stroke-opacity='0.07' stroke-width='1.1'%3E%3Crect x='26' y='26' width='44' height='44'/%3E%3Crect x='26' y='26' width='44' height='44' transform='rotate(45 48 48)'/%3E%3Ccircle cx='48' cy='48' r='9'/%3E%3Cpath d='M0 0L18 18M96 0L78 18M0 96L18 78M96 96L78 78M48 0V8M48 96V88M0 48H8M96 48H88'/%3E%3C/g%3E%3C/svg%3E");
}

/* ============================================================================
 * 2) الأساسيات والأدوات
 * ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg-0);
  line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-light); }
[data-theme="light"] a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; }
p { margin: 0 0 .6em; }
::selection { background: rgba(var(--accent-rgb), .45); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; justify-content: center; }
.grow { flex: 1 1 auto; }
.danger-text { color: var(--danger) !important; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .4em; border-radius: 6px; font-family: var(--font); font-size: .78em; font-weight: 800;
  text-align: center; background: var(--surface-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; line-height: 1.6;
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tc, var(--primary)); margin-inline-end: 6px; vertical-align: middle; box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc, var(--primary)) 30%, transparent); }
.ayah { font-family: var(--font-quran); font-weight: 700; color: var(--accent-light); line-height: 1.9; }
[data-theme="light"] .ayah { color: #8a6410; }
.hadith { color: var(--primary-light); font-weight: 700; }
[data-theme="light"] .hadith { color: var(--primary); }
.glass { background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); box-shadow: var(--shadow); }

/* ============================================================================
 * 3) الخلفيات والزخرفة الإسلامية
 * ========================================================================== */
.bg-pattern { position: absolute; inset: -96px; background-image: var(--pattern); background-size: 96px 96px; animation: patternDrift 60s linear infinite; pointer-events: none; }
.home-bg, .d-bg, .splash-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.home-bg {
  position: fixed;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(var(--primary-rgb), .35), transparent 60%),
    radial-gradient(900px 600px at 0% 110%, rgba(var(--secondary-rgb), .45), transparent 60%),
    radial-gradient(600px 400px at 50% 50%, rgba(var(--accent-rgb), .08), transparent 70%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0) 60%, var(--bg-2));
}

/* ============================================================================
 * 4) المكونات المشتركة
 * ========================================================================== */
/* ----- الأزرار ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em; padding: .55em 1.1em; min-height: 40px;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: .95rem; cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, opacity .2s, filter .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn:focus-visible, .seg-btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .6); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--secondary))); color: var(--on-primary); box-shadow: 0 6px 20px rgba(var(--primary-rgb), .35); }
.btn-accent { background: var(--gold-grad); background-size: 200% 200%; color: #2b1d02; box-shadow: 0 6px 20px rgba(var(--accent-rgb), .35); }
.btn-success { background: linear-gradient(135deg, #22C55E, #15803D); color: #fff; box-shadow: 0 6px 18px rgba(34, 197, 94, .3); }
.btn-danger { background: linear-gradient(135deg, #EF4444, #B91C1C); color: #fff; box-shadow: 0 6px 18px rgba(239, 68, 68, .3); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--primary-light); text-decoration: underline; font-weight: 700; }
[data-theme="light"] .btn-link { color: var(--primary); }
.btn-lg { padding: .75em 1.6em; font-size: 1.08rem; min-height: 50px; border-radius: 14px; }
.btn-sm { padding: .35em .8em; min-height: 32px; font-size: .86rem; border-radius: 10px; }
.btn-xs { padding: .2em .55em; min-height: 26px; font-size: .78rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.btn-row.center { justify-content: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: 1rem; transition: background .2s, transform .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.sm { width: 28px; height: 28px; font-size: .82rem; border-radius: 8px; }
.icon-btn.danger:hover { background: rgba(239, 68, 68, .2); }

/* ----- الحقول ----- */
.input {
  width: 100%; padding: .6em .85em; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--input-bg);
  color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s; min-height: 42px;
}
.input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .25); }
.input-lg { font-size: 1.15rem; padding: .8em 1em; text-align: center; letter-spacing: .2em; }
select.input { cursor: pointer; }
select.input option { background: var(--bg-1); color: var(--text); }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.7; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 700; font-size: .9rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
input[type="color"] { width: 44px; height: 44px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 12px; }

/* مفتاح التبديل */
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .25s; flex: none; border: 1px solid var(--border); }
.switch::before { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset-inline-start .25s var(--spring); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.switch:checked { background: var(--primary); }
.switch:checked::before { inset-inline-start: 22px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--border); cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; }
.switch-row small { color: var(--muted); font-size: .8rem; }

/* ----- الأزرار المجزأة ----- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.seg-btn { border: 0; background: transparent; padding: .45em 1em; border-radius: 10px; cursor: pointer; font-weight: 700; color: var(--muted); transition: all .2s; white-space: nowrap; }
.seg-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.seg-btn.active { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 14px rgba(var(--primary-rgb), .4); }
.seg-btn.seg-gold.active { background: var(--gold-grad); color: #2b1d02; }
.seg-btn.seg-danger.active { background: linear-gradient(135deg, #EF4444, #B91C1C); color: #fff; }
.seg-btn:disabled:not(.active) { opacity: .4; cursor: not-allowed; }

/* ----- الشرائح ----- */
.chip {
  --cc: var(--primary); display: inline-flex; align-items: center; gap: .35em; padding: .2em .75em; border-radius: 99px; font-weight: 700; font-size: .85rem;
  background: color-mix(in srgb, var(--cc) 18%, transparent); color: color-mix(in srgb, var(--cc) 70%, var(--text)); border: 1px solid color-mix(in srgb, var(--cc) 45%, transparent);
}
.chip.mini { font-size: .74rem; padding: .1em .55em; }
.chip-pts { --cc: var(--accent); }
.chip.used { --cc: #64748b; }
.chip-type.t-speed { --cc: #EAB308; }
.chip-type.t-decisive { --cc: #EF4444; }
.badge { display: inline-flex; padding: .1em .6em; border-radius: 99px; font-size: .75rem; font-weight: 800; background: var(--surface-3); color: var(--muted); }
.badge.b-run { background: rgba(34, 197, 94, .18); color: #4ade80; }
.badge.b-done { background: rgba(59, 130, 246, .18); color: #93c5fd; }
.badge.b-gold { background: var(--gold-grad); color: #2b1d02; }

/* ----- الصورة الرمزية للفريق ----- */
.avatar {
  --s: 40px; --tc: var(--primary); width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: calc(var(--s) * .52); line-height: 1; overflow: hidden; position: relative;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--tc) 45%, #fff), var(--tc) 62%, color-mix(in srgb, var(--tc) 70%, #000));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 35%, transparent), 0 6px 18px color-mix(in srgb, var(--tc) 40%, transparent);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { --s: 26px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 35%, transparent); }
.avatar.md { --s: 36px; }
.avatar.lg { --s: 52px; }
.avatar.xl { --s: 84px; }
.avatar.xxl { --s: 120px; }
.team-chip {
  --tc: var(--primary); display: inline-flex; align-items: center; gap: .45em; padding: .2em .8em .2em .25em; border-radius: 99px; font-weight: 800;
  background: color-mix(in srgb, var(--tc) 22%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 60%, transparent);
}
.team-chip b { white-space: nowrap; }

/* ----- البطاقات ----- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%); box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 small { font-weight: 600; color: var(--muted); font-size: .78rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.card.empty, .empty { text-align: center; color: var(--muted); padding: 30px; }
.note { padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); margin-bottom: 12px; font-size: .9rem; }
.note.warn { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .45); }
.lock-note { font-size: .72rem; font-weight: 700; padding: .1em .6em; border-radius: 99px; background: rgba(var(--accent-rgb), .16); color: var(--accent-light); }
[data-theme="light"] .lock-note { color: #8a6410; }

/* ----- الجداول ----- */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--muted); font-weight: 700; font-size: .8rem; }
.tbl.compact th, .tbl.compact td { padding: 6px 6px; font-size: .84rem; }
.tbl tr.is-out td { opacity: .5; text-decoration: line-through; }
.tbl td.actions { white-space: nowrap; text-align: end; }
.tbl td.actions .icon-btn { margin-inline-start: 4px; }

/* ----- التنبيهات ----- */
.toasts { position: fixed; bottom: 18px; left: 18px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--bg-1); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); transform: translateX(-30px); opacity: 0; transition: all .3s var(--spring); pointer-events: auto;
}
.toast.show { transform: none; opacity: 1; }
.toast p { margin: 0; font-weight: 600; font-size: .92rem; }
.toast > span { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; background: var(--info); }
.toast.t-success > span { background: var(--success); }
.toast.t-error > span { background: var(--danger); }
.toast.t-warn > span { background: var(--warning); }
.toast.t-error { border-color: rgba(239, 68, 68, .5); }

/* ----- النوافذ المنبثقة ----- */
.modal-wrap { position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 8, 16, .62); backdrop-filter: blur(6px); opacity: 0; transition: opacity .22s; }
.modal {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: 20px;
  background: var(--bg-1); border: 1px solid var(--border-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  transform: translateY(20px) scale(.97); opacity: 0; transition: all .25s var(--spring);
}
[data-theme="light"] .modal { background: #fff; }
.modal.wide { width: min(880px, 100%); }
.modal-wrap.show .modal-backdrop { opacity: 1; }
.modal-wrap.show .modal { transform: none; opacity: 1; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.confirm-msg { font-size: 1.05rem; font-weight: 600; }

/* ============================================================================
 * 5) شاشة البداية (Splash)
 * ========================================================================== */
.splash { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; overflow: hidden; background: var(--bg-0); color: #fff; }
.splash-bg {
  background:
    radial-gradient(900px 600px at 50% 40%, rgba(var(--primary-rgb), .45), transparent 65%),
    radial-gradient(700px 500px at 20% 100%, rgba(var(--secondary-rgb), .55), transparent 60%),
    radial-gradient(500px 400px at 85% 10%, rgba(var(--accent-rgb), .2), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
}
.splash-pattern { position: absolute; inset: -96px; background-image: var(--pattern); background-size: 96px; animation: patternDrift 40s linear infinite; opacity: .9; }
.splash-rays {
  position: absolute; left: 50%; top: 42%; width: 220vmax; height: 220vmax; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(var(--accent-rgb), .09) 0deg 6deg, transparent 6deg 18deg);
  animation: spin 80s linear infinite; mask-image: radial-gradient(circle, #000 0%, transparent 55%); -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
}
.splash-glow { position: absolute; left: 50%; top: 40%; width: 60vmin; height: 60vmin; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), .35), transparent 65%); filter: blur(20px); animation: breathe 4s ease-in-out infinite; }
.splash-content { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; padding: 20px; }
.splash-logo { position: relative; width: min(34vmin, 260px); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 2.5vmin; animation: logoIn 1.2s var(--spring) both; }
.splash-logo img { width: 78%; height: 78%; object-fit: contain; position: relative; z-index: 2; filter: drop-shadow(0 12px 40px rgba(0, 0, 0, .5)); animation: floaty 5s ease-in-out infinite; }
.splash-logo .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(var(--accent-rgb), .55); animation: ringPulse 3s ease-out infinite; }
.splash-logo .ring.r2 { animation-delay: 1s; }
.splash-logo .ring.r3 { animation-delay: 2s; }
.splash-school { font-family: var(--font-title); font-size: clamp(18px, 3.4vmin, 34px); color: var(--accent-light); letter-spacing: .04em; animation: fadeUp .9s .5s var(--ease) both; }
.splash-title { display: flex; align-items: center; gap: 2.4vmin; margin: .5vmin 0 1vmin; }
.splash-title h1 {
  font-family: var(--font-title); font-size: clamp(54px, 13vmin, 150px); margin: 0; line-height: 1.15;
  background: var(--gold-grad); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(var(--accent-rgb), .35)); animation: fadeUp 1s .7s var(--ease) both, shine 4s 1.5s linear infinite;
}
.sj-letter {
  display: grid; place-items: center; width: clamp(48px, 10vmin, 110px); aspect-ratio: 1; border-radius: 50%; font-family: var(--font-title); font-size: clamp(26px, 5.6vmin, 64px);
  color: #fff; background: radial-gradient(circle at 30% 30%, var(--primary-light), var(--primary) 60%, var(--primary-dark)); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .6), 0 10px 40px rgba(var(--primary-rgb), .6);
}
.sj-letter.l1 { animation: flyRight 1s .9s var(--spring) both, floaty 4s 2s ease-in-out infinite; }
.sj-letter.l2 { animation: flyLeft 1s .9s var(--spring) both, floaty 4s 2.5s ease-in-out infinite; background: radial-gradient(circle at 30% 30%, #93c5fd, var(--secondary) 60%, #0b1b44); }
.splash-sub { font-size: clamp(14px, 2.4vmin, 22px); color: rgba(255, 255, 255, .8); animation: fadeUp 1s 1.1s var(--ease) both; }
.splash-btn {
  margin-top: 4vmin; border: 0; cursor: pointer; padding: .75em 2.4em; border-radius: 99px; font-size: clamp(16px, 2.6vmin, 24px); font-weight: 900;
  background: var(--gold-grad); background-size: 200% 200%; color: #2b1d02; box-shadow: 0 10px 40px rgba(var(--accent-rgb), .5), 0 0 0 6px rgba(var(--accent-rgb), .18);
  animation: fadeUp .8s 1.5s var(--ease) both, btnPulse 2.2s 2.4s ease-in-out infinite; transition: transform .2s;
}
.splash-btn:hover { transform: scale(1.05); }
.splash-hint { margin-top: 1.6vmin; font-size: clamp(12px, 1.7vmin, 15px); color: rgba(255, 255, 255, .55); animation: fadeUp .8s 1.8s var(--ease) both; }
/* تشغيل المقدمة */
.splash.playing .splash-btn, .splash.playing .splash-hint { animation: fadeOut .4s forwards; pointer-events: none; }
.splash.playing .splash-logo { animation: logoBurst 2.2s var(--ease) forwards; }
.splash.playing .splash-logo .ring { animation: ringBurst 1.4s var(--ease) infinite; border-width: 3px; }
.splash.playing .splash-glow { animation: glowBurst 2.4s var(--ease) forwards; }
.splash.playing .splash-rays { animation: spin 10s linear infinite; }
.splash.playing .splash-title h1 { animation: shine 1.2s linear infinite; }
.splash.out { animation: splashOut .9s var(--ease) forwards; }

/* ============================================================================
 * 6) الرئيسية والدخول
 * ========================================================================== */
.view.home, .view.login, .view.buzzerpad { min-height: 100vh; position: relative; }
.home-wrap { position: relative; max-width: 1100px; margin: 0 auto; padding: 6vh 20px 40px; }
.home-head { display: flex; align-items: center; gap: 24px; margin-bottom: 40px; animation: fadeUp .8s var(--ease) both; }
.home-logo { width: 110px; height: 110px; object-fit: contain; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .4)); }
.home-school { color: var(--accent-light); font-family: var(--font-title); font-size: 1.3rem; }
[data-theme="light"] .home-school { color: #8a6410; }
.home-title { font-family: var(--font-title); font-size: clamp(42px, 7vw, 76px); margin: 0; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.2; }
.home-sub { color: var(--muted); font-size: 1.1rem; margin: 0; }
.home-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.home-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 28px 24px; border-radius: 24px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(16px); box-shadow: var(--shadow); overflow: hidden;
  transition: transform .3s var(--spring), border-color .3s; animation: fadeUp .8s var(--ease) both;
}
.home-card:nth-child(2) { animation-delay: .1s; } .home-card:nth-child(3) { animation-delay: .2s; }
.home-card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(400px 200px at 100% 0%, rgba(var(--primary-rgb), .25), transparent 70%); opacity: .8; }
.home-card.hc-admin::before { background: radial-gradient(400px 200px at 100% 0%, rgba(var(--accent-rgb), .25), transparent 70%); }
.home-card.hc-buzzer::before { background: radial-gradient(400px 200px at 100% 0%, rgba(239, 68, 68, .2), transparent 70%); }
.home-card:hover { transform: translateY(-6px); border-color: rgba(var(--accent-rgb), .5); }
.home-card > * { position: relative; }
.hc-ic { font-size: 46px; }
.home-card b { font-size: 1.35rem; font-family: var(--font-title); }
.home-card p { color: var(--muted); margin: 0; }
.hc-link { margin-top: 10px; font-size: .85rem; font-weight: 700; color: var(--primary-light); }
[data-theme="light"] .hc-link { color: var(--primary); }
.hc-link:hover { text-decoration: underline; }
.home-tips { margin-top: 26px; padding: 16px 20px; border-radius: 16px; background: var(--surface); border: 1px dashed var(--border-strong); color: var(--muted); animation: fadeUp .8s .3s var(--ease) both; }
.home-tips b { color: var(--text); }

.view.login { display: grid; place-items: center; padding: 20px; }
.login-card { position: relative; width: min(420px, 100%); padding: 34px 30px; border-radius: 26px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; animation: fadeUp .7s var(--ease) both; }
.login-logo { width: 96px; height: 96px; object-fit: contain; }
.login-school { color: var(--accent-light); font-family: var(--font-title); }
[data-theme="light"] .login-school { color: #8a6410; }
.login-card h2 { margin: 0; }
.login-error { color: var(--danger); font-weight: 700; min-height: 1.4em; }
.shake { animation: shake .45s; }

/* ============================================================================
 * 7) شاشة العرض للجمهور
 * ========================================================================== */
.display {
  --u: min(1vw, 1.78vh);
  position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; color: var(--text); background: var(--bg-0);
  font-size: max(14px, calc(var(--u) * 1.15)); user-select: none; cursor: default;
}
.d-bg-grad {
  position: absolute; inset: 0;
  background:
    radial-gradient(70% 60% at 85% 0%, rgba(var(--primary-rgb), .38), transparent 60%),
    radial-gradient(70% 70% at 0% 100%, rgba(var(--secondary-rgb), .5), transparent 60%),
    radial-gradient(40% 40% at 50% 45%, rgba(var(--accent-rgb), .08), transparent 70%),
    linear-gradient(170deg, var(--bg-1), var(--bg-0) 55%, var(--bg-2));
  transition: background 1s;
}
.d-orbs i {
  position: absolute; width: 30vmax; height: 30vmax; border-radius: 50%; filter: blur(60px); opacity: .22; background: var(--primary);
  animation: orb 26s ease-in-out infinite alternate;
}
.d-orbs i:nth-child(1) { top: -10%; right: -5%; }
.d-orbs i:nth-child(2) { bottom: -15%; left: -5%; background: var(--secondary); animation-duration: 32s; }
.d-orbs i:nth-child(3) { top: 30%; left: 35%; width: 18vmax; height: 18vmax; background: var(--accent); opacity: .1; animation-duration: 22s; }
.d-orbs i:nth-child(4) { top: 60%; right: 20%; width: 12vmax; height: 12vmax; animation-duration: 18s; }
.d-orbs i:nth-child(5) { top: 5%; left: 15%; width: 10vmax; height: 10vmax; background: var(--accent); opacity: .12; animation-duration: 28s; }
.d-orbs i:nth-child(6) { bottom: 10%; right: 45%; width: 14vmax; height: 14vmax; background: var(--secondary); animation-duration: 24s; }
[data-theme="light"] .d-orbs i { opacity: .12; }

/* ----- الرأس ----- */
.d-header { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 2vw; padding: calc(var(--u) * 1.2) calc(var(--u) * 2.4); }
.d-brand { display: flex; align-items: center; gap: calc(var(--u) * 1.1); min-width: 0; }
.d-logo { width: calc(var(--u) * 4.6); height: calc(var(--u) * 4.6); min-width: 40px; min-height: 40px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .35)); }
.d-brand-text { line-height: 1.2; }
.d-school { font-size: max(12px, calc(var(--u) * 1.1)); color: var(--muted); font-weight: 700; }
.d-event { font-family: var(--font-title); font-size: max(20px, calc(var(--u) * 2.2)); background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.d-context { display: flex; gap: calc(var(--u) * .8); align-items: center; }
.d-chip {
  padding: calc(var(--u) * .35) calc(var(--u) * 1.3); border-radius: 99px; font-weight: 800; font-size: max(13px, calc(var(--u) * 1.15));
  background: rgba(var(--primary-rgb), .25); border: 1px solid rgba(var(--primary-rgb), .6); box-shadow: 0 0 24px rgba(var(--primary-rgb), .25);
}
.d-chip-round { background: rgba(var(--accent-rgb), .18); border-color: rgba(var(--accent-rgb), .6); color: var(--accent-light); }
[data-theme="light"] .d-chip-round { color: #7a5708; }
.d-live { display: flex; align-items: center; gap: calc(var(--u) * .6); font-weight: 800; font-size: max(12px, calc(var(--u) * 1.05)); padding: calc(var(--u) * .3) calc(var(--u) * 1); border-radius: 99px; background: rgba(239, 68, 68, .14); border: 1px solid rgba(239, 68, 68, .45); }
.d-clock { font-variant-numeric: tabular-nums; opacity: .8; border-inline-start: 1px solid rgba(239, 68, 68, .45); padding-inline-start: calc(var(--u) * .6); }
.live-dot { width: .65em; height: .65em; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 0 rgba(239, 68, 68, .7); animation: livePulse 1.6s infinite; display: inline-block; }

/* ----- الشاشات والانتقالات ----- */
.d-main { position: relative; z-index: 2; min-height: 0; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--u) * 1) calc(var(--u) * 3); opacity: 0; visibility: hidden; transform: translateY(30px) scale(.97); filter: blur(6px);
  transition: opacity .6s var(--ease), transform .7s var(--ease), filter .6s, visibility 0s .7s; pointer-events: none;
}
.screen.active { opacity: 1; visibility: visible; transform: none; filter: none; transition: opacity .6s var(--ease) .1s, transform .7s var(--spring) .1s, filter .6s .1s, visibility 0s; pointer-events: auto; }
.screen.leaving { opacity: 0; transform: translateY(-30px) scale(1.04); filter: blur(8px); visibility: visible; }
.scr-head { text-align: center; margin-bottom: calc(var(--u) * 2); }
.scr-title {
  font-family: var(--font-title); font-size: max(26px, calc(var(--u) * 3.4)); margin: 0;
  background: var(--gold-grad); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite;
}
.scr-sub { color: var(--muted); font-size: max(14px, calc(var(--u) * 1.4)); font-weight: 700; }
.empty-note { color: var(--muted); font-size: calc(var(--u) * 2); }

/* ----- الترحيب ----- */
.welcome { text-align: center; display: flex; flex-direction: column; align-items: center; }
.welcome-logo { position: relative; width: calc(var(--u) * 20); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: calc(var(--u) * 1.2); }
.welcome-logo img { width: 80%; height: 80%; object-fit: contain; position: relative; z-index: 2; animation: floaty 6s ease-in-out infinite; filter: drop-shadow(0 16px 40px rgba(0, 0, 0, .45)); }
.halo { position: absolute; inset: 0; border-radius: 50%; }
.halo.h1 { background: conic-gradient(from 0deg, transparent, rgba(var(--accent-rgb), .8), transparent 30%, transparent 50%, rgba(var(--primary-rgb), .8), transparent 80%); animation: spin 8s linear infinite; mask: radial-gradient(circle, transparent 62%, #000 63%, #000 66%, transparent 67%); -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%, #000 66%, transparent 67%); }
.halo.h2 { inset: 8%; background: radial-gradient(circle, rgba(var(--accent-rgb), .22), transparent 65%); animation: breathe 4s ease-in-out infinite; }
.welcome-school { font-family: var(--font-title); font-size: max(18px, calc(var(--u) * 2)); color: var(--accent-light); }
[data-theme="light"] .welcome-school { color: #8a6410; }
.welcome-title { display: flex; align-items: center; gap: calc(var(--u) * 2); }
.welcome-title h1 {
  font-family: var(--font-title); font-size: max(48px, calc(var(--u) * 9)); margin: 0; line-height: 1.2;
  background: var(--gold-grad); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 5s linear infinite; filter: drop-shadow(0 6px 30px rgba(var(--accent-rgb), .3));
}
.sj-bubble {
  display: grid; place-items: center; width: calc(var(--u) * 7); height: calc(var(--u) * 7); min-width: 46px; min-height: 46px; border-radius: 50%;
  font-family: var(--font-title); font-size: max(22px, calc(var(--u) * 3.6)); color: #fff;
  background: radial-gradient(circle at 30% 30%, var(--primary-light), var(--primary) 60%, var(--primary-dark));
  box-shadow: 0 0 0 calc(var(--u) * .35) rgba(var(--accent-rgb), .6), 0 10px 40px rgba(var(--primary-rgb), .5); animation: floaty 4s ease-in-out infinite;
}
.sj-bubble.b2 { background: radial-gradient(circle at 30% 30%, #93c5fd, var(--secondary) 60%, #0b1b44); animation-delay: -2s; }
.welcome-sub { font-size: max(16px, calc(var(--u) * 1.8)); color: var(--muted); font-weight: 700; margin-top: calc(var(--u) * .4); }
.welcome-stage:not(:empty) { margin-top: calc(var(--u) * 1.6); padding: calc(var(--u) * .5) calc(var(--u) * 2); border-radius: 99px; font-weight: 800; font-size: max(15px, calc(var(--u) * 1.6)); background: rgba(var(--primary-rgb), .22); border: 1px solid rgba(var(--primary-rgb), .55); }
.screen.active .welcome > * { animation: fadeUp .9s var(--ease) both; }
.screen.active .welcome > *:nth-child(2) { animation-delay: .15s; }
.screen.active .welcome > *:nth-child(3) { animation-delay: .3s; }
.screen.active .welcome > *:nth-child(4) { animation-delay: .45s; }
.screen.active .welcome > *:nth-child(5) { animation-delay: .6s; }

/* ----- الفرق ----- */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(var(--u) * 22), 1fr)); gap: calc(var(--u) * 2); width: 100%; max-width: calc(var(--u) * 92); }
.team-card {
  --tc: var(--primary); position: relative; overflow: hidden; text-align: center; padding: calc(var(--u) * 2.2) calc(var(--u) * 1.5) calc(var(--u) * 1.6);
  border-radius: calc(var(--u) * 2); background: var(--surface); border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent); backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3), inset 0 4px 0 var(--tc);
}
.screen.active .team-card { animation: cardIn .8s var(--spring) both; animation-delay: calc(var(--i) * .15s + .2s); }
.team-card-glow { position: absolute; inset: -40% -20% auto; height: 80%; background: radial-gradient(circle, color-mix(in srgb, var(--tc) 40%, transparent), transparent 65%); pointer-events: none; }
.team-card .avatar.xl { --s: calc(var(--u) * 8); min-width: 60px; min-height: 60px; animation: floaty 5s ease-in-out infinite; }
.team-card-name { position: relative; font-family: var(--font-title); font-size: max(20px, calc(var(--u) * 2.3)); margin: calc(var(--u) * 1) 0 calc(var(--u) * .4); color: color-mix(in srgb, var(--tc) 45%, var(--text)); }
.team-card-badge { display: inline-block; margin-bottom: calc(var(--u) * .6); padding: .1em .9em; border-radius: 99px; background: var(--gold-grad); color: #2b1d02; font-weight: 800; font-size: max(12px, calc(var(--u) * 1)); }
.team-card-students { position: relative; list-style: none; margin: 0; padding: 0; display: grid; gap: calc(var(--u) * .4); }
.team-card-students li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(var(--u) * .4) calc(var(--u) * .9); border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: max(13px, calc(var(--u) * 1.15)); }
.team-card-students em { font-style: normal; color: var(--muted); font-size: .85em; }

/* ----- العجلة ----- */
.wheel-wrap { display: grid; grid-template-columns: auto minmax(0, calc(var(--u) * 34)); align-items: center; gap: calc(var(--u) * 4); width: 100%; justify-content: center; }
.wheel-box { width: min(64vh, 46vw); height: min(64vh, 46vw); display: grid; place-items: center; filter: drop-shadow(0 20px 50px rgba(0, 0, 0, .5)); }
.wheel-side { display: flex; flex-direction: column; gap: calc(var(--u) * 1.6); }
.wheel-side .scr-title { text-align: start; }
.wheel-result { --cc: var(--accent); min-height: calc(var(--u) * 9); display: grid; place-items: center; text-align: center; padding: calc(var(--u) * 1.2); border-radius: calc(var(--u) * 1.6); background: var(--surface); border: 2px dashed var(--border-strong); font-size: max(16px, calc(var(--u) * 1.6)); }
.wheel-result.spinning { border-style: solid; border-color: rgba(var(--accent-rgb), .5); }
.wheel-result.done { border: 2px solid var(--cc); background: color-mix(in srgb, var(--cc) 22%, transparent); box-shadow: 0 0 50px color-mix(in srgb, var(--cc) 45%, transparent); animation: popIn .7s var(--spring); }
.wheel-result small { display: block; color: var(--muted); font-weight: 700; }
.wheel-result b { font-family: var(--font-title); font-size: max(26px, calc(var(--u) * 3.2)); }
.spin-dots::after { content: '...'; animation: dots 1.2s steps(4) infinite; display: inline-block; width: 1.5em; text-align: start; }
.muted-txt { color: var(--muted); }
.wheel-cats { display: flex; flex-wrap: wrap; gap: calc(var(--u) * .5); }
.wc-chip { --cc: var(--primary); padding: .2em .8em; border-radius: 99px; font-weight: 700; font-size: max(12px, calc(var(--u) * 1)); background: color-mix(in srgb, var(--cc) 22%, transparent); border: 1px solid color-mix(in srgb, var(--cc) 60%, transparent); }
.wc-chip.used { opacity: .3; text-decoration: line-through; }

/* ----- الاستعداد ----- */
.ready { text-align: center; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1); }
.ready-cat > span { --cc: var(--primary); display: inline-block; padding: .3em 1.2em; border-radius: 99px; font-weight: 800; font-size: max(16px, calc(var(--u) * 1.8)); background: color-mix(in srgb, var(--cc) 25%, transparent); border: 2px solid var(--cc); }
.ready-title { font-family: var(--font-title); font-size: max(26px, calc(var(--u) * 3.8)); }
.ready-type { color: var(--accent-light); font-weight: 800; font-size: max(15px, calc(var(--u) * 1.6)); }
[data-theme="light"] .ready-type { color: #7a5708; }
.ready-ring { position: relative; width: calc(var(--u) * 20); height: calc(var(--u) * 20); min-width: 150px; min-height: 150px; display: grid; place-items: center; margin: calc(var(--u) * 1) 0; }
.rr { position: absolute; inset: 0; border-radius: 50%; border: calc(var(--u) * .35) solid rgba(var(--accent-rgb), .7); animation: ringPulse 1s ease-out infinite; }
.rr.r2 { animation-delay: .5s; border-color: rgba(var(--primary-rgb), .7); }
.ready-num {
  font-family: var(--font-title); font-size: max(80px, calc(var(--u) * 13)); font-weight: 700; line-height: 1; position: relative;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(var(--accent-rgb), .5));
}
.ready-num.pop { animation: numPop .9s var(--spring); }
.ready-team { display: flex; align-items: center; gap: calc(var(--u) * 1); font-size: max(16px, calc(var(--u) * 1.8)); font-weight: 800; }
.ready-turn { color: var(--muted); }
.ready-open { color: var(--accent-light); animation: blink 1.2s ease-in-out infinite; }
.team-chip.lg { font-size: max(16px, calc(var(--u) * 1.9)); padding: .25em 1em .25em .3em; }
.team-chip.lg .avatar.sm { --s: calc(var(--u) * 3.2); min-width: 30px; min-height: 30px; }

/* ----- السؤال ----- */
.screen[data-screen="question"] { padding: calc(var(--u) * .6) calc(var(--u) * 2.4) calc(var(--u) * .8); justify-content: stretch; align-items: stretch; }
.q-layout { width: 100%; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); gap: calc(var(--u) * .8) calc(var(--u) * 2); }
.q-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.q-chips { display: flex; gap: calc(var(--u) * .6); flex-wrap: wrap; }
.q-chip { --cc: var(--primary); padding: .25em 1em; border-radius: 99px; font-weight: 800; font-size: max(13px, calc(var(--u) * 1.2)); background: color-mix(in srgb, var(--cc) 25%, transparent); border: 1.5px solid color-mix(in srgb, var(--cc) 70%, transparent); }
.q-chip.type { --cc: var(--secondary); }
.q-chip.type.t-speed { --cc: #EAB308; animation: glowPulse 1.2s ease-in-out infinite; }
.q-chip.type.t-decisive { --cc: #EF4444; animation: glowPulse 1s ease-in-out infinite; }
.q-index { font-weight: 700; color: var(--muted); font-size: max(13px, calc(var(--u) * 1.25)); }
.q-index b { color: var(--text); font-size: 1.3em; }
.q-center { display: flex; flex-direction: column; gap: calc(var(--u) * 1); min-height: 0; justify-content: center; }
.q-turn { align-self: center; display: flex; align-items: center; gap: calc(var(--u) * .8); min-height: calc(var(--u) * 3.6); font-weight: 800; font-size: max(14px, calc(var(--u) * 1.5)); }
.q-turn:empty { display: none; }
.q-turn .qt-label { color: var(--muted); }
.q-turn.is-turn .team-chip { box-shadow: 0 0 30px color-mix(in srgb, var(--tc) 50%, transparent); }
.q-turn.is-buzz { padding: calc(var(--u) * .3) calc(var(--u) * 1.4) calc(var(--u) * .3) calc(var(--u) * .3); border-radius: 99px; background: color-mix(in srgb, var(--tc) 30%, transparent); border: 2px solid var(--tc); animation: buzzGlow 1s ease-in-out infinite; }
.q-turn.is-buzz .qt-label { color: var(--text); }
.qt-open { padding: .3em 1.2em; border-radius: 99px; background: linear-gradient(90deg, rgba(var(--accent-rgb), .15), rgba(var(--accent-rgb), .4), rgba(var(--accent-rgb), .15)); background-size: 200% 100%; border: 2px solid rgba(var(--accent-rgb), .7); animation: shine 2s linear infinite, glowPulse 1.2s ease-in-out infinite; }
.q-card {
  position: relative; padding: calc(var(--u) * 2.2) calc(var(--u) * 3); border-radius: calc(var(--u) * 2); text-align: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface) 100%, transparent), rgba(var(--primary-rgb), .14));
  border: 1px solid rgba(var(--accent-rgb), .35); backdrop-filter: blur(18px); box-shadow: 0 24px 60px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.q-card-deco::before, .q-card-deco::after { content: '۞'; position: absolute; top: calc(var(--u) * .6); font-size: max(16px, calc(var(--u) * 1.8)); color: rgba(var(--accent-rgb), .6); }
.q-card-deco::before { right: calc(var(--u) * 1.2); }
.q-card-deco::after { left: calc(var(--u) * 1.2); }
.q-text { font-size: max(20px, calc(var(--u) * 3.1)); font-weight: 800; line-height: 1.6; }
.long-text .q-text { font-size: max(18px, calc(var(--u) * 2.5)); }
.q-text .ayah { font-size: 1.12em; }
.anim-in .q-card { animation: qCardIn .8s var(--spring) both; }
.anim-in .q-turn { animation: fadeUp .6s .1s var(--ease) both; }
.q-type-speed .q-card { border: 2px solid #EAB308; box-shadow: 0 0 60px rgba(234, 179, 8, .35), 0 24px 60px rgba(0, 0, 0, .35); }
.q-type-decisive .q-card { border: 2px solid #EF4444; box-shadow: 0 0 70px rgba(239, 68, 68, .4), 0 24px 60px rgba(0, 0, 0, .35); background: linear-gradient(160deg, rgba(239, 68, 68, .14), rgba(var(--accent-rgb), .12)); animation: decisiveGlow 2s ease-in-out infinite; }

/* الخيارات */
.q-body { min-height: 0; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(var(--u) * 1.1); }
.opts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opts-5, .opts-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt {
  --c: #1368CE; position: relative; display: flex; align-items: center; gap: calc(var(--u) * 1); min-height: calc(var(--u) * 6.4);
  padding: calc(var(--u) * .9) calc(var(--u) * 1.4); border-radius: calc(var(--u) * 1.3); color: #fff; font-weight: 800; font-size: max(16px, calc(var(--u) * 1.9));
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 92%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 75%, #000));
  box-shadow: 0 calc(var(--u) * .5) 0 color-mix(in srgb, var(--c) 60%, #000), 0 14px 30px rgba(0, 0, 0, .3);
  transition: opacity .5s, transform .5s var(--spring), filter .5s, box-shadow .5s;
}
.anim-in .opt { animation: optIn .55s var(--spring) both; animation-delay: calc(var(--i) * .09s + .25s); }
.opt-shape { width: calc(var(--u) * 3.2); height: calc(var(--u) * 3.2); min-width: 28px; min-height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .2); font-size: .85em; }
.opt-letter { font-family: var(--font-title); opacity: .85; }
.opt-text { flex: 1; line-height: 1.45; }
.opt-text .ayah { color: #fff; }
.opt-check { position: absolute; inset-inline-end: calc(var(--u) * 1); top: 50%; transform: translateY(-50%) scale(0); width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.4); min-width: 28px; min-height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #16A34A; font-size: .9em; transition: transform .5s var(--spring); }
.opts-tf .opt { min-height: calc(var(--u) * 9); justify-content: center; font-size: max(22px, calc(var(--u) * 3.2)); }
.opts-tf .opt-text { flex: none; }
.opts-tf .opt-shape { font-size: 1em; }
.is-revealed .opt:not(.is-correct) { opacity: .25; filter: grayscale(.7); transform: scale(.96); }
.is-revealed .opt.is-correct { transform: scale(1.03); box-shadow: 0 0 0 calc(var(--u) * .35) #fff, 0 0 60px var(--c), 0 0 120px rgba(34, 197, 94, .5); animation: correctPulse 1.4s ease-in-out infinite; z-index: 2; }
.is-revealed .opt.is-correct .opt-check { transform: translateY(-50%) scale(1); }
/* التوصيل */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--u) * 2); }
.match-col { display: flex; flex-direction: column; gap: calc(var(--u) * .7); }
.match-item { display: flex; align-items: center; gap: calc(var(--u) * .8); padding: calc(var(--u) * .5) calc(var(--u) * 1.1); border-radius: calc(var(--u) * 1); background: var(--surface-2); border: 1px solid var(--border-strong); font-weight: 800; font-size: max(14px, calc(var(--u) * 1.5)); transition: all .5s var(--ease); }
.anim-in .match-item { animation: optIn .5s var(--spring) both; animation-delay: calc(var(--i) * .08s + .25s); }
.match-item.opt-like { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, #fff), var(--c)); color: #fff; border: 0; }
.mi-num { width: calc(var(--u) * 2.6); height: calc(var(--u) * 2.6); min-width: 24px; min-height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--accent-rgb), .3); font-size: .85em; }
.opt-like .mi-num { background: rgba(255, 255, 255, .25); }
.mi-text { flex: 1; }
.mi-ans { max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; padding: 0; border-radius: 99px; background: #16A34A; color: #fff; transition: all .7s var(--spring); }
.is-revealed .mi-ans { max-width: 60%; opacity: 1; padding: .1em .8em; }
.is-revealed .match-col.right { opacity: .25; filter: grayscale(.6); }
.is-revealed .match-col.left .match-item { border-color: #22C55E; box-shadow: 0 0 24px rgba(34, 197, 94, .35); }
/* الترتيب */
.order { display: grid; }
.order-list { grid-area: 1 / 1; display: flex; flex-direction: column; gap: calc(var(--u) * .5); transition: opacity .5s, transform .5s; }
.order-item { display: flex; align-items: center; gap: calc(var(--u) * 1); padding: calc(var(--u) * .5) calc(var(--u) * 1.2); border-radius: calc(var(--u) * 1); color: #fff; font-weight: 800; font-size: max(14px, calc(var(--u) * 1.5)); background: linear-gradient(135deg, color-mix(in srgb, var(--c, #1368CE) 85%, #fff), var(--c, #1368CE)); }
.anim-in .order-list.shuffled .order-item { animation: optIn .5s var(--spring) both; animation-delay: calc(var(--i) * .08s + .25s); }
.order-item.ok { background: linear-gradient(135deg, #22C55E, #15803D); }
.oi-num { width: calc(var(--u) * 2.8); height: calc(var(--u) * 2.8); min-width: 26px; min-height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.order-list.correct { opacity: 0; pointer-events: none; }
.is-revealed .order-list.shuffled { opacity: 0; transform: scale(.96); }
.is-revealed .order-list.correct { opacity: 1; }
.is-revealed .order-list.correct .order-item { animation: optIn .5s var(--spring) both; animation-delay: calc(var(--i) * .15s); }
/* سؤال مفتوح */
.open-hint { text-align: center; padding: calc(var(--u) * 1.4); border-radius: calc(var(--u) * 1.4); border: 2px dashed var(--border-strong); color: var(--muted); font-weight: 800; font-size: max(16px, calc(var(--u) * 1.8)); }
.q-type-speed .open-hint { border-color: #EAB308; color: #FDE047; animation: glowPulse 1.2s ease-in-out infinite; }
.q-type-decisive .open-hint { border-color: #EF4444; color: #FCA5A5; }
[data-theme="light"] .q-type-speed .open-hint { color: #a16207; }
[data-theme="light"] .q-type-decisive .open-hint { color: #b91c1c; }
/* الإجابة */
.q-answer { display: none; text-align: center; padding: calc(var(--u) * 1.2) calc(var(--u) * 2); border-radius: calc(var(--u) * 1.6); background: linear-gradient(135deg, rgba(34, 197, 94, .28), rgba(21, 128, 61, .2)); border: 2px solid #22C55E; box-shadow: 0 0 50px rgba(34, 197, 94, .35); }
.is-revealed .q-answer:not(.hide-for-type) { display: block; animation: answerIn .8s var(--spring) both; }
.q-answer-label { font-weight: 800; color: #86efac; font-size: max(13px, calc(var(--u) * 1.2)); }
[data-theme="light"] .q-answer-label { color: #15803d; }
.q-answer-text { font-size: max(20px, calc(var(--u) * 2.8)); font-weight: 900; }
.q-center > * { flex-shrink: 0; }
/* أسئلة الخيارات: تظهر الإجابة كشريط مدمج مكان مؤشر الدور حتى لا تتزاحم مع الخيارات */
.has-opts.is-revealed .q-turn { display: none; }
.has-opts .q-answer { order: -1; align-self: center; padding: calc(var(--u) * .45) calc(var(--u) * 2.2); border-radius: 99px; }
.has-opts .q-answer-label, .has-opts .q-answer-text { display: inline; }
.has-opts .q-answer-label { margin-inline-end: .8em; }
.has-opts .q-answer-text { font-size: max(17px, calc(var(--u) * 2)); }
/* المؤقت */
.q-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * 1.4); }
.timer { --tcol: #22C55E; position: relative; width: calc(var(--u) * 14); height: calc(var(--u) * 14); min-width: 96px; min-height: 96px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg) scaleY(-1); filter: drop-shadow(0 0 14px color-mix(in srgb, var(--tcol) 60%, transparent)); }
.t-track { fill: color-mix(in srgb, var(--bg-0) 60%, transparent); stroke: var(--surface-3); stroke-width: 9; }
.t-bar { fill: none; stroke: var(--tcol); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .4s; }
.t-num { font-family: var(--font-title); font-size: max(32px, calc(var(--u) * 5)); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; position: relative; margin-top: -.15em; }
.t-label { position: absolute; bottom: 22%; font-size: max(11px, calc(var(--u) * .95)); color: var(--muted); font-weight: 700; }
.timer.t-warn { --tcol: #F59E0B; }
.timer.t-danger, .timer.t-over { --tcol: #EF4444; }
.timer.t-over .t-num { color: #EF4444; }
.timer.stopped .t-label { color: var(--accent-light); }
.timer.urgent { animation: heartbeat 1s ease-in-out infinite; }
.timer.urgent .t-num { color: #fca5a5; }
.timer.boom { animation: shake .6s; }
.buzz-state { text-align: center; }
.locked-list { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.locked-list small { color: var(--muted); font-weight: 700; }
.locked-chip { padding: .1em .7em; border-radius: 99px; background: color-mix(in srgb, var(--tc) 18%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 50%, transparent); font-weight: 700; font-size: max(12px, calc(var(--u) * 1)); opacity: .75; }

/* ----- احتساب النتائج ----- */
.calc { text-align: center; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1.4); }
.calc-star { position: relative; width: calc(var(--u) * 14); height: calc(var(--u) * 14); min-width: 100px; min-height: 100px; animation: spin 3s linear infinite; }
.calc-star span { position: absolute; inset: 15%; border: calc(var(--u) * .5) solid var(--accent); border-radius: 12%; box-shadow: 0 0 30px rgba(var(--accent-rgb), .6), inset 0 0 30px rgba(var(--accent-rgb), .3); }
.calc-star span:nth-child(2) { transform: rotate(45deg); border-color: var(--primary-light); box-shadow: 0 0 30px rgba(var(--primary-rgb), .6); }
.calc-title { font-family: var(--font-title); font-size: max(26px, calc(var(--u) * 4)); margin: 0; }
.calc-run::after { content: '...'; display: inline-block; width: 1.4em; text-align: start; animation: dots 1.2s steps(4) infinite; }
.calc-done-txt { display: none; }
.calc-done .calc-run { display: none; }
.calc-done .calc-done-txt { display: inline; }
.calc-done .calc-star { animation: popIn .8s var(--spring); }
.calc-digits { display: flex; gap: calc(var(--u) * 1); direction: ltr; }
.calc-digit { width: calc(var(--u) * 7); height: calc(var(--u) * 9); min-width: 50px; min-height: 64px; display: grid; place-items: center; border-radius: calc(var(--u) * 1.2); font-family: var(--font-title); font-size: max(34px, calc(var(--u) * 5.5)); background: var(--surface); border: 2px solid rgba(var(--accent-rgb), .5); box-shadow: inset 0 -10px 20px rgba(0, 0, 0, .25), 0 0 30px rgba(var(--accent-rgb), .25); color: var(--accent-light); }
.calc-done .calc-digit { color: #22C55E; border-color: #22C55E; }
.calc-bar { width: min(60vw, calc(var(--u) * 50)); height: calc(var(--u) * 1.2); min-height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.calc-bar i { display: block; height: 100%; width: 0; background: var(--gold-grad); background-size: 200% 100%; animation: shine 1.5s linear infinite; border-radius: 99px; }
.calc-sub { color: var(--muted); font-weight: 700; font-size: max(15px, calc(var(--u) * 1.6)); }

/* ----- كسر التعادل ----- */
.tb { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1); width: 100%; height: 100%; justify-content: center; overflow: hidden; border-radius: calc(var(--u) * 2); }
.tb-stripes { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(239, 68, 68, .14) 0 calc(var(--u) * 2), transparent calc(var(--u) * 2) calc(var(--u) * 4)); background-size: calc(var(--u) * 5.66) calc(var(--u) * 5.66); animation: stripes 1s linear infinite; mask-image: radial-gradient(ellipse at center, transparent 30%, #000 75%); -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, #000 75%); }
.tb-beacon { position: absolute; top: -20%; width: 60vmin; height: 60vmin; background: conic-gradient(from 0deg, rgba(239, 68, 68, .55), transparent 25%, transparent 50%, rgba(245, 158, 11, .45), transparent 75%); border-radius: 50%; animation: spin 2s linear infinite; filter: blur(10px); opacity: .7; }
.tb-beacon.b1 { right: -20vmin; }
.tb-beacon.b2 { left: -20vmin; animation-direction: reverse; }
.tb-icon { position: relative; font-size: max(56px, calc(var(--u) * 9)); animation: shakeHard .5s ease-in-out infinite; }
.tb-title { position: relative; font-family: var(--font-title); font-size: max(48px, calc(var(--u) * 8)); margin: 0; color: #fff; text-shadow: 0 0 20px #ef4444, 0 0 60px #ef4444; animation: blink .8s ease-in-out infinite; }
.tb-sub { position: relative; font-weight: 800; font-size: max(16px, calc(var(--u) * 2)); color: #fecaca; }
[data-theme="light"] .tb-sub { color: #991b1b; }
[data-theme="light"] .tb-title { color: #7f1d1d; }
.tb-teams { position: relative; display: flex; align-items: center; gap: calc(var(--u) * 2.5); margin-top: calc(var(--u) * 1.4); flex-wrap: wrap; justify-content: center; }
.tb-team { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * .6); font-weight: 900; font-size: max(18px, calc(var(--u) * 2.2)); }
.tb-team .avatar.xl { --s: calc(var(--u) * 9); min-width: 64px; min-height: 64px; animation: floaty 2s ease-in-out infinite; }
.vs { font-family: var(--font-title); font-size: max(26px, calc(var(--u) * 4)); color: var(--accent); text-shadow: 0 0 30px rgba(var(--accent-rgb), .7); animation: heartbeat 1s ease-in-out infinite; }

/* وضع كسر التعادل: كامل الشاشة بألوان طوارئ */
.display.mode-tiebreak .d-bg-grad { background: radial-gradient(70% 60% at 85% 0%, rgba(239, 68, 68, .4), transparent 60%), radial-gradient(70% 70% at 0% 100%, rgba(245, 158, 11, .3), transparent 60%), linear-gradient(170deg, #2a0909, #12060a 55%, #1f0b05); }
[data-theme="light"] .display.mode-tiebreak .d-bg-grad { background: radial-gradient(70% 60% at 85% 0%, rgba(239, 68, 68, .25), transparent 60%), linear-gradient(170deg, #fff1f1, #ffe4e4); }
.display.mode-tiebreak .d-orbs i { background: #ef4444; }
.display.mode-tiebreak .d-chip-round { background: rgba(239, 68, 68, .3); border-color: #ef4444; color: #fecaca; animation: blink 1s infinite; }
.display.mode-tiebreak .q-card { border-color: #ef4444; box-shadow: 0 0 60px rgba(239, 68, 68, .35); }
.display.mode-grand .d-chip-stage { background: var(--gold-grad); color: #2b1d02; border-color: transparent; }

/* ----- لوحة الشرف ----- */
.honor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(var(--u) * 17), 1fr)); gap: calc(var(--u) * 1.6); width: 100%; max-width: calc(var(--u) * 110); }
.honor-card {
  --tc: var(--accent); position: relative; text-align: center; padding: calc(var(--u) * 1.6); border-radius: calc(var(--u) * 1.8); overflow: hidden;
  background: linear-gradient(170deg, color-mix(in srgb, var(--tc) 22%, transparent), var(--surface)); border: 2px solid transparent;
  background-clip: padding-box; box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .55), 0 20px 50px rgba(0, 0, 0, .3);
}
.honor-card.wide { grid-column: 1 / -1; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .9), 0 0 80px rgba(var(--accent-rgb), .35); }
.screen.active .honor-card { animation: cardIn .8s var(--spring) both; }
.screen.active .honor-card:nth-child(2) { animation-delay: .12s; } .screen.active .honor-card:nth-child(3) { animation-delay: .24s; }
.screen.active .honor-card:nth-child(4) { animation-delay: .36s; } .screen.active .honor-card:nth-child(5) { animation-delay: .48s; } .screen.active .honor-card:nth-child(6) { animation-delay: .6s; }
.honor-icon { font-size: max(36px, calc(var(--u) * 4.4)); animation: floaty 3s ease-in-out infinite; }
.honor-title { font-weight: 800; color: var(--accent-light); font-size: max(14px, calc(var(--u) * 1.4)); margin-bottom: calc(var(--u) * .6); }
[data-theme="light"] .honor-title { color: #7a5708; }
.honor-body { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * .5); font-size: max(16px, calc(var(--u) * 1.9)); font-weight: 900; }
.honor-body small { color: var(--muted); font-size: .7em; font-weight: 700; }
.honor-body .avatar.lg { --s: calc(var(--u) * 6); min-width: 46px; min-height: 46px; }
.honor-card.wide .honor-body { flex-direction: row; justify-content: center; font-size: max(22px, calc(var(--u) * 3)); }
.tbd { color: var(--muted); font-size: .8em; font-weight: 700; }

/* ----- المنصة ----- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: calc(var(--u) * 2); width: 100%; height: 75%; }
.pod { --tc: var(--primary); display: flex; flex-direction: column; align-items: center; width: calc(var(--u) * 22); min-width: 100px; }
.pod-top { position: relative; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * .4); margin-bottom: calc(var(--u) * 1); text-align: center; }
.pod-top .avatar.xl { --s: calc(var(--u) * 8); min-width: 56px; min-height: 56px; }
.pod-top .avatar.xxl { --s: calc(var(--u) * 11); min-width: 72px; min-height: 72px; box-shadow: 0 0 0 calc(var(--u) * .4) rgba(var(--accent-rgb), .9), 0 0 60px rgba(var(--accent-rgb), .6); }
.pod-name { font-family: var(--font-title); font-size: max(17px, calc(var(--u) * 2.1)); }
.pod-1 .pod-name { font-size: max(22px, calc(var(--u) * 2.8)); background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pod-top small { color: var(--muted); font-weight: 700; }
.pod-crown { position: absolute; top: calc(var(--u) * -5); font-size: max(36px, calc(var(--u) * 5)); animation: crown 2s ease-in-out infinite; z-index: 2; }
.pod-block { position: relative; width: 100%; border-radius: calc(var(--u) * 1.2) calc(var(--u) * 1.2) 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: calc(var(--u) * 1); gap: calc(var(--u) * .3); color: #2b1d02; font-weight: 900; overflow: hidden; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .5); }
.pod-block::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); background-size: 250% 100%; animation: shine 3s linear infinite; }
.pod-1 .pod-block { height: calc(var(--u) * 24); background: linear-gradient(180deg, #FFE58A, #D4A72C 60%, #9a7414); }
.pod-2 .pod-block { height: calc(var(--u) * 17); background: linear-gradient(180deg, #F1F5F9, #A7B4C2 60%, #6b7785); }
.pod-3 .pod-block { height: calc(var(--u) * 12); background: linear-gradient(180deg, #F3C49B, #C27C3E 60%, #8a5222); }
.pod-medal { font-size: max(28px, calc(var(--u) * 3.6)); }
.pod-label { font-size: max(13px, calc(var(--u) * 1.3)); }
.pod-num { font-family: var(--font-title); font-size: max(40px, calc(var(--u) * 6)); opacity: .35; line-height: 1; }
.screen.active .pod { animation: podRise 1s var(--spring) both; }
.screen.active .pod-3 { animation-delay: .3s; } .screen.active .pod-2 { animation-delay: .7s; } .screen.active .pod-1 { animation-delay: 1.2s; }

/* ----- مسار البطولة ----- */
.bracket { width: 100%; max-width: calc(var(--u) * 110); display: flex; flex-direction: column; gap: calc(var(--u) * 1.4); }
.br-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--u) * 1.6); }
.br-col { padding: calc(var(--u) * 1.2); border-radius: calc(var(--u) * 1.6); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: calc(var(--u) * .6); }
.screen.active .br-col { animation: cardIn .7s var(--spring) both; }
.screen.active .br-col:nth-child(2) { animation-delay: .15s; } .screen.active .br-col:nth-child(3) { animation-delay: .3s; }
.br-col h4 { text-align: center; font-family: var(--font-title); font-size: max(16px, calc(var(--u) * 1.7)); margin: 0 0 calc(var(--u) * .4); color: var(--accent-light); }
[data-theme="light"] .br-col h4 { color: #7a5708; }
.br-team { --tc: var(--primary); display: flex; align-items: center; gap: calc(var(--u) * .6); padding: calc(var(--u) * .45) calc(var(--u) * .8); border-radius: 99px; background: color-mix(in srgb, var(--tc) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 50%, transparent); font-weight: 800; font-size: max(13px, calc(var(--u) * 1.3)); }
.br-team > span:not(.avatar) { flex: 1; }
.br-team i { font-style: normal; }
.br-team.is-out { opacity: .4; text-decoration: line-through; }
.br-team.is-in i { color: #22C55E; }
.br-team.is-champ { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .9), 0 0 20px rgba(var(--accent-rgb), .4); }
.br-arrow { text-align: center; color: var(--muted); }
.br-champ { text-align: center; padding: calc(var(--u) * .6); border-radius: calc(var(--u) * 1); border: 2px dashed var(--border-strong); font-weight: 900; color: var(--muted); font-size: max(13px, calc(var(--u) * 1.35)); }
.br-champ.has { border: 2px solid var(--tc); color: var(--text); background: color-mix(in srgb, var(--tc) 22%, transparent); }
.br-grand { display: flex; flex-direction: column; align-items: center; }
.br-grand-line { width: 70%; height: calc(var(--u) * 1.6); border: 2px solid var(--border-strong); border-top: 0; border-radius: 0 0 20px 20px; }
.br-grand-box { margin-top: -2px; padding: calc(var(--u) * 1) calc(var(--u) * 3); border-radius: calc(var(--u) * 1.6); text-align: center; background: var(--surface); border: 2px dashed rgba(var(--accent-rgb), .6); }
.br-grand-box.has { border: 3px solid var(--accent); background: color-mix(in srgb, var(--tc) 25%, transparent); box-shadow: 0 0 60px rgba(var(--accent-rgb), .4); animation: glowPulse 2s ease-in-out infinite; }
.br-grand-box small { display: block; color: var(--muted); font-weight: 700; }
.br-grand-box b { font-family: var(--font-title); font-size: max(20px, calc(var(--u) * 2.6)); }

/* ----- استراحة / رسالة / توقف ----- */
.brk, .msg, .paused { text-align: center; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1.2); max-width: calc(var(--u) * 90); }
.brk-logo { width: calc(var(--u) * 12); min-width: 80px; animation: floaty 5s ease-in-out infinite; }
.brk-title { font-family: var(--font-title); font-size: max(36px, calc(var(--u) * 6)); margin: 0; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brk-timer { font-family: var(--font-title); font-size: max(44px, calc(var(--u) * 7)); font-variant-numeric: tabular-nums; direction: ltr; padding: 0 .6em; border-radius: calc(var(--u) * 1.4); background: var(--surface); border: 1px solid var(--border); }
.brk-wisdom { min-height: 3em; font-size: max(18px, calc(var(--u) * 2.4)); font-weight: 700; line-height: 1.8; opacity: 0; }
.brk-wisdom.in { animation: wisdom 8s ease-in-out both; }
.msg-icon { font-size: max(48px, calc(var(--u) * 7)); animation: floaty 3s ease-in-out infinite; }
.msg-text { font-size: max(26px, calc(var(--u) * 4.4)); font-weight: 900; line-height: 1.6; padding: calc(var(--u) * 2) calc(var(--u) * 3); border-radius: calc(var(--u) * 2); background: var(--surface); border: 1px solid rgba(var(--accent-rgb), .45); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.screen.active .msg-text { animation: qCardIn .8s var(--spring) both; }
.paused-ic { font-size: max(64px, calc(var(--u) * 10)); animation: breathe 2s ease-in-out infinite; }
.paused h2 { font-family: var(--font-title); font-size: max(36px, calc(var(--u) * 5.5)); margin: 0; }
.paused p { color: var(--muted); font-size: max(16px, calc(var(--u) * 2)); }

/* ----- الشريط السفلي ----- */
.d-footer { position: relative; z-index: 5; }
.d-strip { display: flex; justify-content: center; align-items: center; gap: calc(var(--u) * 1.2); padding: calc(var(--u) * .7) calc(var(--u) * 2) calc(var(--u) * .9); flex-wrap: wrap; transition: all .5s var(--ease); }
.no-strip .d-strip { display: none; }
.strip-team {
  --tc: var(--primary); position: relative; display: flex; align-items: center; gap: calc(var(--u) * .7); padding: calc(var(--u) * .4) calc(var(--u) * 1.4) calc(var(--u) * .4) calc(var(--u) * .45);
  border-radius: 99px; background: color-mix(in srgb, var(--tc) 16%, var(--surface)); border: 2px solid color-mix(in srgb, var(--tc) 55%, transparent);
  font-weight: 800; font-size: max(13px, calc(var(--u) * 1.4)); transition: all .4s var(--spring); backdrop-filter: blur(10px);
}
.strip-team .avatar.md { --s: calc(var(--u) * 3.4); min-width: 30px; min-height: 30px; }
.strip-team.is-turn { transform: translateY(-4px) scale(1.06); border-color: var(--tc); box-shadow: 0 0 30px color-mix(in srgb, var(--tc) 60%, transparent); }
.strip-team.is-buzz { transform: translateY(-8px) scale(1.14); background: color-mix(in srgb, var(--tc) 55%, transparent); border-color: #fff; box-shadow: 0 0 0 4px var(--tc), 0 0 50px var(--tc); animation: buzzGlow 1s ease-in-out infinite; }
.strip-team.is-locked { opacity: .4; filter: grayscale(.8); }
.st-mark { width: 1.6em; height: 1.6em; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .85em; animation: popIn .5s var(--spring); }
.j-correct .st-mark { background: #22C55E; }
.j-wrong .st-mark { background: #EF4444; }
.st-key { position: absolute; top: -.7em; inset-inline-start: -.3em; font-size: .7em; background: var(--bg-1); color: var(--accent-light); }
.d-ticker { display: flex; align-items: stretch; height: max(30px, calc(var(--u) * 3)); background: rgba(0, 0, 0, .35); border-top: 1px solid rgba(var(--accent-rgb), .35); overflow: hidden; }
[data-theme="light"] .d-ticker { background: rgba(255, 255, 255, .6); }
.no-ticker .d-ticker { display: none; }
.d-ticker-label { flex: none; display: flex; align-items: center; gap: .5em; padding: 0 calc(var(--u) * 1.4); background: var(--gold-grad); color: #2b1d02; font-weight: 900; font-size: max(12px, calc(var(--u) * 1.1)); position: relative; z-index: 2; }
.d-ticker-track { flex: 1; overflow: hidden; position: relative; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.d-ticker-text { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; direction: ltr; white-space: nowrap; animation: ticker 40s linear infinite; font-weight: 700; font-size: max(13px, calc(var(--u) * 1.2)); }
.d-ticker-text > span { direction: rtl; padding: 0 4em; unicode-bidi: isolate; }
.d-ticker-text > span span { padding: 0; }
.d-ticker-text .ayah { line-height: 1; }

/* ----- ومضة التحكيم ----- */
.d-flash { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: none; opacity: 0; visibility: hidden; }
.d-flash.correct { background: radial-gradient(circle, rgba(34, 197, 94, .45), rgba(21, 128, 61, .15) 50%, transparent 75%); }
.d-flash.wrong { background: radial-gradient(circle, rgba(239, 68, 68, .45), rgba(127, 29, 29, .15) 50%, transparent 75%); }
.d-flash.show { visibility: visible; animation: flash 1.9s var(--ease) forwards; }
.d-flash-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1); }
.d-flash-icon { width: calc(var(--u) * 16); height: calc(var(--u) * 16); min-width: 110px; min-height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: max(60px, calc(var(--u) * 9)); color: #fff; font-weight: 900; }
.d-flash.correct .d-flash-icon { background: radial-gradient(circle at 30% 30%, #4ade80, #16A34A); box-shadow: 0 0 0 calc(var(--u) * .8) rgba(255, 255, 255, .25), 0 0 100px rgba(34, 197, 94, .8); }
.d-flash.wrong .d-flash-icon { background: radial-gradient(circle at 30% 30%, #f87171, #DC2626); box-shadow: 0 0 0 calc(var(--u) * .8) rgba(255, 255, 255, .25), 0 0 100px rgba(239, 68, 68, .8); }
.d-flash.show .d-flash-icon { animation: stamp .7s var(--spring); }
.d-flash-title { font-family: var(--font-title); font-size: max(34px, calc(var(--u) * 5.5)); color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.display.shake .d-main { animation: shake .5s; }

/* ----- لافتة الجرس ----- */
.d-buzzbanner { position: fixed; top: 14%; left: 50%; z-index: 45; transform: translate(-50%, -150%); pointer-events: none; opacity: 0; }
.d-buzzbanner.show { animation: bannerIn 2.2s var(--spring) forwards; }
.bb-in { position: relative; display: flex; align-items: center; gap: calc(var(--u) * 1.4); padding: calc(var(--u) * 1) calc(var(--u) * 3) calc(var(--u) * 1) calc(var(--u) * 1); border-radius: 99px; background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 85%, #fff), var(--tc)); color: #fff; box-shadow: 0 0 0 calc(var(--u) * .4) #fff, 0 0 80px var(--tc), 0 30px 60px rgba(0, 0, 0, .4); font-family: var(--font-title); font-size: max(26px, calc(var(--u) * 4.2)); white-space: nowrap; }
.bb-in .avatar.xl { --s: calc(var(--u) * 8); min-width: 56px; min-height: 56px; box-shadow: 0 0 0 4px #fff; }
.bb-bell { font-size: 1.1em; animation: ring .5s ease-in-out 3; display: inline-block; }
.bb-ring { position: absolute; inset: 0; border-radius: 99px; border: 4px solid var(--tc); animation: ringOut 1s ease-out 2; }

/* ----- الإعلانات ----- */
.d-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; opacity: 0; visibility: hidden; transition: opacity .5s, visibility 0s .5s; }
.d-overlay.show { opacity: 1; visibility: visible; transition: opacity .5s; }
.ov-bg { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(var(--primary-rgb), .55), rgba(4, 10, 20, .94) 70%); backdrop-filter: blur(10px); }
[data-theme="light"] .ov-bg { background: radial-gradient(circle at 50% 45%, rgba(var(--accent-rgb), .35), rgba(250, 248, 240, .96) 70%); }
.ov-rays { position: absolute; left: 50%; top: 45%; width: 250vmax; height: 250vmax; transform: translate(-50%, -50%); background: repeating-conic-gradient(rgba(var(--accent-rgb), .16) 0deg 7deg, transparent 7deg 20deg); animation: spin 30s linear infinite; mask-image: radial-gradient(circle, #000, transparent 45%); -webkit-mask-image: radial-gradient(circle, #000, transparent 45%); }
.ov-content { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1.2); padding: 20px; max-width: 94vw; }
.ov-icon { font-size: max(64px, calc(var(--u) * 10)); line-height: 1; filter: drop-shadow(0 10px 40px rgba(var(--accent-rgb), .7)); }
.ov-title { font-family: var(--font-title); font-size: max(40px, calc(var(--u) * 7.4)); line-height: 1.2; background: var(--gold-grad); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 3s linear infinite; filter: drop-shadow(0 6px 30px rgba(var(--accent-rgb), .45)); }
.ov-teams { display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 3); flex-wrap: wrap; }
.ov-team { --tc: var(--primary); display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * .6); }
.ov-team .avatar.xxl { --s: calc(var(--u) * 13); min-width: 90px; min-height: 90px; box-shadow: 0 0 0 calc(var(--u) * .5) rgba(255, 255, 255, .9), 0 0 80px var(--tc); }
.ov-team b { font-family: var(--font-title); font-size: max(30px, calc(var(--u) * 5)); color: #fff; text-shadow: 0 0 30px var(--tc), 0 4px 20px rgba(0, 0, 0, .5); }
[data-theme="light"] .ov-team b { color: color-mix(in srgb, var(--tc) 70%, #000); text-shadow: none; }
.ov-team small { color: rgba(255, 255, 255, .8); font-weight: 700; font-size: max(13px, calc(var(--u) * 1.4)); max-width: calc(var(--u) * 40); }
[data-theme="light"] .ov-team small { color: var(--muted); }
.ov-sub { font-size: max(17px, calc(var(--u) * 2.2)); font-weight: 800; color: rgba(255, 255, 255, .9); max-width: calc(var(--u) * 80); }
[data-theme="light"] .ov-sub { color: var(--text); }
.ov-brand { display: flex; align-items: center; gap: 10px; margin-top: calc(var(--u) * 1); opacity: .75; font-weight: 700; color: rgba(255, 255, 255, .8); font-size: max(13px, calc(var(--u) * 1.2)); }
[data-theme="light"] .ov-brand { color: var(--muted); }
.ov-brand img { width: calc(var(--u) * 3.4); min-width: 30px; }
.d-overlay.show .ov-icon { animation: iconDrop 1s var(--spring) both, floaty 3s 1s ease-in-out infinite; }
.d-overlay.show .ov-title { animation: titleZoom 1s .2s var(--spring) both, shine 3s 1.2s linear infinite; }
.d-overlay.show .ov-team { animation: teamIn 1s var(--spring) both; animation-delay: calc(.5s + var(--i) * .2s); }
.d-overlay.show .ov-sub { animation: fadeUp .8s 1s var(--ease) both; }
.d-overlay.show .ov-brand { animation: fadeUp .8s 1.3s var(--ease) both; }
.d-overlay.show .vs { animation: popIn .6s .8s var(--spring) both, heartbeat 1s 1.4s infinite; }
.d-overlay.hide { opacity: 0; }
/* أنواع الإعلانات */
.ov-eliminated .ov-rays { background: repeating-conic-gradient(rgba(255, 255, 255, .06) 0deg 7deg, transparent 7deg 20deg); }
.ov-eliminated .ov-bg { background: radial-gradient(circle at 50% 45%, rgba(71, 85, 105, .6), rgba(4, 10, 20, .95) 70%); }
.ov-eliminated .ov-title { background: linear-gradient(135deg, #e2e8f0, #94a3b8); -webkit-background-clip: text; background-clip: text; }
.ov-eliminated .ov-team .avatar { filter: saturate(.7); }
.ov-tournamentChampion .ov-title { font-size: max(48px, calc(var(--u) * 9)); }
.ov-tournamentChampion .ov-rays { background: repeating-conic-gradient(rgba(var(--accent-rgb), .3) 0deg 6deg, transparent 6deg 14deg); animation-duration: 14s; }
.ov-tournamentChampion .ov-team .avatar.xxl, .ov-stageChampion .ov-team .avatar.xxl { box-shadow: 0 0 0 calc(var(--u) * .6) #F8DE85, 0 0 120px rgba(var(--accent-rgb), .9); }
.ov-final .ov-bg { background: radial-gradient(circle at 50% 45%, rgba(239, 68, 68, .35), rgba(4, 10, 20, .94) 70%); }

/* ----- طبقة المؤثرات ----- */
.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }

/* ----- وضع المعاينة داخل لوحة الإدارة ----- */
.route-preview .display { cursor: default; }
.route-preview .d-orbs i { animation: none; }

/* ============================================================================
 * 8) لوحة الإدارة
 * ========================================================================== */
.view.admin {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(var(--primary-rgb), .18), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(var(--secondary-rgb), .22), transparent 60%),
    var(--bg-0);
}
.adm-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; background: color-mix(in srgb, var(--bg-1) 85%, transparent); border-inline-end: 1px solid var(--border); backdrop-filter: blur(16px); z-index: 20; }
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; border-bottom: 1px solid var(--border); }
.adm-brand img { width: 50px; height: 50px; object-fit: contain; }
.adm-brand b { display: block; font-size: 1rem; }
.adm-brand small { display: block; font-family: var(--font-title); color: var(--accent-light); font-size: 1.05rem; }
[data-theme="light"] .adm-brand small { color: #8a6410; }
.adm-nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; font-weight: 700; color: var(--muted); text-align: start; transition: all .2s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(var(--primary-rgb), .9), rgba(var(--primary-rgb), .6)); color: var(--on-primary); box-shadow: 0 6px 20px rgba(var(--primary-rgb), .35); }
.nav-ic { font-size: 1.15rem; width: 26px; text-align: center; }
.adm-side-foot { display: flex; flex-direction: column; gap: 8px; }
.adm-side-foot .btn-row { margin: 0; flex-wrap: nowrap; gap: 6px; }
.adm-side-foot .btn-row .btn { padding: .4em; min-width: 0; }
.adm-main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.adm-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg-0) 75%, transparent); backdrop-filter: blur(14px); }
.adm-top h1 { font-size: 1.3rem; margin: 0; white-space: nowrap; }
.adm-burger { display: none; }
.adm-context { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; padding: 6px 14px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.ctx-stage { color: var(--accent-light); }
[data-theme="light"] .ctx-stage { color: #8a6410; }
.ctx-sep { color: var(--muted); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status-dot.st-running { background: #22C55E; box-shadow: 0 0 10px #22C55E; animation: blink 1.4s infinite; }
.status-dot.st-paused { background: var(--warning); }
.status-dot.st-ended { background: var(--info); }
.adm-content { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.page { display: none; animation: fadeUp .4s var(--ease); }
.page.active { display: block; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar.wrap > .input { width: auto; flex: 1 1 150px; }
.toolbar .search { flex: 3 1 260px !important; }
.toolbar-card { margin-bottom: 14px; }
.toolbar-card .toolbar:last-child { margin-bottom: 0; }

/* ----- التحكم المباشر ----- */
.ctx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-bottom: 10px; }
.ctx-group { display: flex; flex-direction: column; gap: 4px; }
.ctx-group label { font-size: .75rem; font-weight: 800; color: var(--muted); }
.ctx-status { margin-inline-start: auto; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px; font-weight: 800; font-size: .88rem; background: var(--surface-2); }
.status-pill i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status-pill.st-running { color: #4ade80; background: rgba(34, 197, 94, .14); }
.status-pill.st-running i { animation: blink 1.4s infinite; }
.status-pill.st-paused { color: #fbbf24; background: rgba(245, 158, 11, .14); }
.status-pill.st-ended { color: #93c5fd; background: rgba(59, 130, 246, .14); }
[data-theme="light"] .status-pill.st-running { color: #15803d; } [data-theme="light"] .status-pill.st-paused { color: #b45309; } [data-theme="light"] .status-pill.st-ended { color: #1d4ed8; }
.ctx-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.next-step { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 14px; border-radius: 14px; background: rgba(var(--accent-rgb), .1); border: 1px solid rgba(var(--accent-rgb), .35); font-size: .92rem; }
.next-step span { color: var(--accent-light); font-weight: 800; }
[data-theme="light"] .next-step span { color: #8a6410; }
.next-step.big { font-size: 1.05rem; padding: 14px 18px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.live-main, .live-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* لوحة المقدّم */
.q-panel.empty { text-align: center; padding: 30px; }
.empty-ic { font-size: 48px; }
.phase-row { margin-top: 14px; }
.aq-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.aq-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.aq-index { font-weight: 700; color: var(--muted); }
.aq-index b { color: var(--text); font-size: 1.2rem; }
.aq-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.aq-team { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; }
.aq-team.open { color: var(--accent-light); }
[data-theme="light"] .aq-team.open { color: #8a6410; }
.aq-team.buzz .team-chip { animation: buzzGlow 1s infinite; }
.phase-pill { margin-inline-start: auto; padding: 3px 12px; border-radius: 99px; font-size: .8rem; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.phase-pill.ph-ready { background: rgba(245, 158, 11, .18); color: #fbbf24; }
.phase-pill.ph-question { background: rgba(34, 197, 94, .15); color: #4ade80; }
.phase-pill.ph-wheel { background: rgba(var(--accent-rgb), .2); color: var(--accent-light); }
[data-theme="light"] .phase-pill.ph-ready { color: #b45309; } [data-theme="light"] .phase-pill.ph-question { color: #15803d; }
.aq-text { font-size: 1.35rem; font-weight: 800; line-height: 1.7; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); margin-bottom: 10px; }
.aq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.aq-opt { --c: #1368CE; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); font-weight: 700; }
.aq-opt > b { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-size: .85rem; }
.aq-opt > span { flex: 1; }
.aq-opt.ok { background: rgba(34, 197, 94, .2); border: 2px solid #22C55E; }
.aq-opt em { font-style: normal; font-size: .78rem; font-weight: 800; color: #4ade80; white-space: nowrap; }
[data-theme="light"] .aq-opt em { color: #15803d; }
.aq-pairs { display: grid; gap: 6px; margin-bottom: 10px; }
.aq-pair { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 700; }
.aq-pair i { color: var(--muted); font-style: normal; }
.aq-pair b { color: #4ade80; }
[data-theme="light"] .aq-pair b { color: #15803d; }
.aq-order { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.aq-order small { display: block; color: var(--muted); font-weight: 800; margin-bottom: 4px; }
.aq-oi { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); margin-bottom: 5px; font-weight: 700; }
.aq-oi b { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: .8rem; }
.aq-oi.ok b { background: #22C55E; color: #fff; }
.aq-answer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; background: rgba(34, 197, 94, .12); border: 1px dashed rgba(34, 197, 94, .6); margin-bottom: 12px; }
.aq-answer > span { font-weight: 800; color: #4ade80; font-size: .88rem; }
[data-theme="light"] .aq-answer > span { color: #15803d; }
.aq-answer b { font-size: 1.15rem; }
.aq-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.aq-nav .btn { flex: 1 1 auto; }
.aq-nav .btn-primary { flex: 2 1 140px; }
.aq-next { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.aq-next label { display: block; font-size: .75rem; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.aq-next-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; }
.nx-cat { font-weight: 800; }
.nx-q { flex: 1 1 100%; font-weight: 600; }
.nx-a { color: #4ade80; font-weight: 700; font-size: .85rem; }
[data-theme="light"] .nx-a { color: #15803d; }
.nx-open { color: var(--accent-light); font-weight: 700; }

/* المؤقت والجرس */
.atimer { text-align: center; padding: 6px 0 10px; --tcol: #22C55E; }
.atimer.t-warn { --tcol: #F59E0B; } .atimer.t-danger, .atimer.t-over { --tcol: #EF4444; }
.atimer-num { font-family: var(--font-title); font-size: 3.4rem; line-height: 1.1; color: var(--tcol); font-variant-numeric: tabular-nums; text-shadow: 0 0 24px color-mix(in srgb, var(--tcol) 50%, transparent); }
.atimer-sub { font-size: .82rem; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.atimer-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.atimer-bar i { display: block; height: 100%; width: 100%; background: var(--tcol); border-radius: 99px; transition: width .2s linear, background .3s; margin-inline-start: auto; }
.dur-chips { display: flex; gap: 6px; justify-content: center; margin: 10px 0 4px; }
.dur { flex: 1; padding: 6px 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 800; cursor: pointer; transition: all .2s; }
.dur.active { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.bz-status { text-align: center; padding: 10px; border-radius: 12px; font-weight: 800; margin: 6px 0; background: var(--surface-2); }
.bz-status.open { background: rgba(34, 197, 94, .14); color: #4ade80; animation: glowPulse 1.4s infinite; }
[data-theme="light"] .bz-status.open { color: #15803d; }
.bz-status.win { background: color-mix(in srgb, var(--tc) 30%, transparent); border: 2px solid var(--tc); font-size: 1.1rem; }
.bz-status small { opacity: .8; font-size: .8rem; }
.bz-sim { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 6px; }
.bz-btn { --tc: var(--primary); flex: 1 1 90px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--tc) 60%, transparent); background: color-mix(in srgb, var(--tc) 16%, transparent); font-weight: 800; cursor: pointer; font-size: .85rem; transition: all .2s; }
.bz-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--tc) 35%, transparent); }
.bz-btn:disabled { opacity: .45; cursor: not-allowed; }
.bz-btn.win { background: var(--tc); color: #fff; opacity: 1; }
.bz-btn.locked { text-decoration: line-through; }

/* بطاقات التحكيم */
.judge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.judge-card { --tc: var(--primary); position: relative; padding: 12px; border-radius: 16px; background: color-mix(in srgb, var(--tc) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tc) 40%, transparent); display: flex; flex-direction: column; gap: 8px; transition: all .3s; }
.judge-card.is-turn { box-shadow: 0 0 0 2px var(--tc), 0 10px 30px color-mix(in srgb, var(--tc) 35%, transparent); }
.judge-card.is-buzz { box-shadow: 0 0 0 3px var(--tc), 0 0 40px color-mix(in srgb, var(--tc) 55%, transparent); animation: buzzGlow 1s infinite; }
.judge-card.j-correct { border-color: #22C55E; }
.judge-card.j-wrong { border-color: #EF4444; }
.jc-head { display: flex; align-items: center; gap: 10px; }
.jc-name { flex: 1; min-width: 0; }
.jc-name b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jc-name small { color: var(--accent-light); font-weight: 700; font-size: .75rem; }
[data-theme="light"] .jc-name small { color: #8a6410; }
.jc-rank { font-family: var(--font-title); font-size: 1.2rem; color: var(--muted); }
.jc-score { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.jc-score > div { text-align: center; padding: 6px; border-radius: 10px; background: var(--surface-2); }
.jc-score b { display: block; font-size: 1.5rem; font-family: var(--font-title); line-height: 1.2; }
.jc-score small { font-size: .7rem; color: var(--muted); font-weight: 700; }
.jc-judged { text-align: center; font-weight: 800; padding: 4px; border-radius: 8px; }
.jc-judged.correct { background: rgba(34, 197, 94, .18); color: #4ade80; }
.jc-judged.wrong { background: rgba(239, 68, 68, .18); color: #f87171; }
[data-theme="light"] .jc-judged.correct { color: #15803d; } [data-theme="light"] .jc-judged.wrong { color: #b91c1c; }
.jc-students { display: flex; flex-wrap: wrap; gap: 4px; }
.stu { padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); font-size: .74rem; font-weight: 700; cursor: pointer; color: var(--muted); transition: all .15s; }
.stu:hover { color: var(--text); }
.stu.active { background: var(--tc); color: #fff; border-color: transparent; }
.jc-actions { display: flex; gap: 6px; }
.jc-pts { display: flex; gap: 4px; justify-content: space-between; }
.jc-pts .btn { flex: 1; padding-inline: 0; }
.steal-note { margin-top: 10px; }

/* النتائج */
.results-card h3 { margin-bottom: 10px; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.res-block { padding: 12px; border-radius: 14px; background: var(--surface-2); }
.res-block h4 { font-size: .95rem; }
.res-block h4 small { color: var(--muted); font-weight: 600; }
.res-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.res-list li { --tc: var(--primary); display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.res-list li.is-mark { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.res-pos { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-weight: 800; font-size: .8rem; }
.res-list b { flex: 1; }
.res-score { font-weight: 800; color: var(--accent-light); font-size: .88rem; }
[data-theme="light"] .res-score { color: #8a6410; }
.res-score small { color: var(--muted); font-weight: 600; }
.res-ok { padding: 8px 12px; border-radius: 10px; background: rgba(34, 197, 94, .14); color: #86efac; font-weight: 700; margin-bottom: 6px; }
[data-theme="light"] .res-ok { color: #15803d; }
.res-warn { padding: 8px 12px; border-radius: 10px; background: rgba(239, 68, 68, .14); border: 1px solid rgba(239, 68, 68, .4); font-weight: 700; margin-bottom: 6px; }
.res-warn .btn-row { margin-top: 6px; }

/* التحكم بالشاشة والإعلانات */
.screen-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.scr-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-weight: 700; font-size: .78rem; transition: all .2s; }
.scr-btn span { font-size: 1.2rem; }
.scr-btn:hover { background: var(--surface-3); }
.scr-btn.active { background: rgba(var(--primary-rgb), .3); border-color: var(--primary-light); box-shadow: 0 0 0 1px var(--primary-light); }
.wheel-ctl { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.wheel-ctl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.cat-chip { --cc: var(--primary); padding: 3px 10px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--cc) 55%, transparent); background: color-mix(in srgb, var(--cc) 16%, transparent); font-weight: 700; font-size: .78rem; cursor: pointer; }
.cat-chip:hover:not(:disabled) { background: color-mix(in srgb, var(--cc) 35%, transparent); }
.cat-chip.used { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.cat-chip.current { box-shadow: 0 0 0 2px var(--cc); opacity: 1; text-decoration: none; }
.ann-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ann-btn { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-weight: 700; font-size: .84rem; text-align: start; transition: all .2s; }
.ann-btn span { font-size: 1.2rem; }
.ann-btn:hover { background: var(--surface-3); transform: translateY(-1px); }
.ann-btn.ann-stageChampion, .ann-btn.ann-tournamentChampion { background: rgba(var(--accent-rgb), .15); border-color: rgba(var(--accent-rgb), .5); }
.ann-btn.ann-eliminated { border-color: rgba(148, 163, 184, .4); }
.ov-live { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border-radius: 12px; background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .45); font-size: .88rem; }

/* المعاينة */
.preview-card { padding-bottom: 14px; }
.preview-box { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; border: 1px solid var(--border-strong); background: #000; }
.preview-box iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 720px; border: 0; transform-origin: 0 0; pointer-events: none; }
.preview-card.collapsed .preview-box { display: none; }

/* السجل */
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.log-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); font-size: .84rem; }
.lg-k { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-weight: 900; font-size: .75rem; }
.k-correct .lg-k { background: #22C55E; color: #fff; }
.k-wrong .lg-k { background: #EF4444; color: #fff; }
.k-manual .lg-k { background: var(--info); color: #fff; }
.lg-team { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.lg-ctx { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.lg-note { flex: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.lg-d { font-family: var(--font-title); min-width: 38px; text-align: center; }
.lg-d.pos { color: #4ade80; } .lg-d.neg { color: #f87171; }
[data-theme="light"] .lg-d.pos { color: #15803d; } [data-theme="light"] .lg-d.neg { color: #b91c1c; }
.lg-time { color: var(--muted); font-size: .72rem; white-space: nowrap; direction: ltr; }
.log-list.full .log-row { padding: 8px 12px; }

/* ----- صفحة الفرق ----- */
.teams-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.team-admin { --tc: var(--primary); border-top: 4px solid var(--tc); }
.ta-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ta-title { flex: 1; min-width: 0; }
.ta-title h3 { margin: 0; }
.ta-title small { color: var(--muted); direction: ltr; }
.ta-actions { display: flex; gap: 6px; }
.team-admin .tbl { margin-bottom: 10px; }
.te-layout { display: grid; grid-template-columns: 180px 1fr; gap: 20px; }
.te-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 18px; border-radius: 16px; background: var(--surface-2); text-align: center; font-size: 1.2rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; background: var(--c); cursor: pointer; transition: transform .15s; }
.sw:hover { transform: scale(1.12); }
.sw.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--c); }
.avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.av-opt { height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 1.3rem; cursor: pointer; }
.av-opt.active { background: rgba(var(--primary-rgb), .35); border-color: var(--primary-light); }
.team-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tp-item { --tc: var(--primary); display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--tc) 40%, transparent); background: color-mix(in srgb, var(--tc) 10%, transparent); cursor: pointer; font-weight: 700; }
.tp-item.other { opacity: .65; }
.tp-item input { width: 18px; height: 18px; accent-color: var(--tc); }
.tp-item > span:not(.avatar) { flex: 1; }
.tp-item small { color: var(--muted); font-size: .7rem; }
.tb-intro { padding: 12px 14px; border-radius: 12px; background: rgba(239, 68, 68, .14); border: 1px solid rgba(239, 68, 68, .45); margin-bottom: 14px; font-weight: 700; }

/* ----- صفحة الأسئلة ----- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; }
.kpi b { font-size: 1.6rem; font-family: var(--font-title); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { color: var(--muted); font-weight: 700; font-size: .85rem; }
.kpi small { color: var(--accent-light); font-weight: 700; font-size: .76rem; }
[data-theme="light"] .kpi small { color: #8a6410; }
.kpi-ic { position: absolute; inset-inline-end: 12px; top: 10px; font-size: 1.6rem; opacity: .5; }
.small-kpis .kpi { padding: 10px 14px; }
.small-kpis .kpi b { font-size: 1.3rem; }
.q-count { color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.q-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px; margin-bottom: 14px; }
.q-item { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.q-item.is-used { opacity: .62; }
.qi-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.qi-id { margin-inline-start: auto; font-size: .7rem; color: var(--muted); direction: ltr; }
.qi-q { font-weight: 700; line-height: 1.6; }
.qi-a { color: #86efac; font-weight: 700; font-size: .9rem; }
[data-theme="light"] .qi-a { color: #15803d; }
.qi-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.qe-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qe-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.qe-row { display: flex; align-items: center; gap: 8px; }
.qe-row i { font-style: normal; color: var(--muted); }
.qe-letter { --c: var(--secondary); width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-size: .85rem; }
.qe-radio { display: grid; place-items: center; cursor: pointer; }
.qe-radio input { display: none; }
.qe-radio span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--border-strong); color: transparent; font-weight: 900; transition: all .2s; }
.qe-radio input:checked + span { background: #22C55E; border-color: #22C55E; color: #fff; }
.qe-points { padding: 10px 14px; border-radius: 12px; background: rgba(var(--accent-rgb), .1); border: 1px dashed rgba(var(--accent-rgb), .45); }

/* ----- مسار البطولة ----- */
.flow-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; font-size: .84rem; font-weight: 700; }
.flow-strip span { padding: 5px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); }
.flow-strip span.gold { background: rgba(var(--accent-rgb), .15); border-color: rgba(var(--accent-rgb), .45); }
.flow-strip i { color: var(--muted); font-style: normal; }
.tour-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tour-card.grand { border: 1px solid rgba(var(--accent-rgb), .45); margin-bottom: 14px; }
.tour-rounds { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tour-rounds > div { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: .85rem; }
.tour-teams { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tour-team { --tc: var(--primary); display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 12px; background: color-mix(in srgb, var(--tc) 10%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 35%, transparent); }
.tour-team b { flex: 1; }
.tour-team > span:not(.avatar) { color: var(--muted); font-weight: 700; font-size: .85rem; }
.tour-team em { font-style: normal; font-weight: 800; font-size: .82rem; min-width: 70px; text-align: end; }
.tour-team.is-out { opacity: .5; }
.tour-team.is-champ { box-shadow: 0 0 0 2px var(--accent); }
.tour-card .results-card { margin: 10px 0; background: transparent; border: 0; padding: 0; box-shadow: none; backdrop-filter: none; }
.tour-card .results-card h3 { display: none; }
.tour-card .res-grid { grid-template-columns: 1fr 1fr; }
.danger-zone { margin-top: 14px; border-color: rgba(239, 68, 68, .35); }
.danger-zone h3 { color: #f87171; }

/* ----- الإحصائيات ----- */
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card canvas { width: 100%; display: block; }

/* ----- لوحة الشرف (إدارة) ----- */
.honor-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.honor-admin { --tc: var(--accent); text-align: center; border-top: 4px solid var(--tc); }
.ha-ic { font-size: 2.2rem; }
.ha-team { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ha-team b { font-size: 1.15rem; }
.ha-team small { color: var(--muted); font-weight: 700; }
.podium-admin { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 10px 0; }
.pa { --tc: var(--primary); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 18px; border-radius: 16px 16px 6px 6px; background: color-mix(in srgb, var(--tc) 14%, var(--surface)); min-width: 140px; }
.pa-1 { padding-bottom: 44px; box-shadow: 0 0 0 2px var(--accent); }
.pa-2 { padding-bottom: 26px; }
.pa.empty { opacity: .5; }

/* ----- الإعدادات ----- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; }
.settings-grid h3 { margin-top: 6px; }
.logo-row { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.logo-preview { width: 120px; height: 120px; flex: none; border-radius: 20px; display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 10px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.palette { display: flex; gap: 14px; }
.pal { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.sound-tests { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.manual-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.manual-form .field { margin: 0; flex: 1 1 150px; }
.manual-form .field.grow { flex: 3 1 220px; }
.manual-form > .btn { min-height: 42px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 12px; }
.help-row { display: flex; align-items: center; gap: 10px; }
.help-row kbd { min-width: 56px; }

/* ============================================================================
 * 9) لوحة الأجراس
 * ========================================================================== */
.view.buzzerpad { display: flex; flex-direction: column; padding: 18px; gap: 18px; height: 100vh; overflow: hidden; }
.bzp-head { position: relative; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bzp-head img { width: 56px; height: 56px; object-fit: contain; }
.bzp-head b { display: block; font-family: var(--font-title); font-size: 1.5rem; }
.bzp-head small { color: var(--muted); font-weight: 700; }
.bzp-status { --tc: var(--primary); margin-inline-start: auto; padding: 10px 20px; border-radius: 99px; font-weight: 900; font-size: 1.2rem; background: var(--surface-2); border: 1px solid var(--border); }
.bzp-status.open { background: rgba(34, 197, 94, .18); border-color: #22C55E; animation: glowPulse 1.2s infinite; }
.bzp-status.win { background: var(--tc); color: #fff; }
.bzp-grid { position: relative; flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; min-height: 0; }
.bzp-btn {
  --tc: var(--primary); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; border-radius: 32px; cursor: pointer;
  border: 0; color: #fff; font-size: clamp(22px, 3vw, 38px); font-family: var(--font-title); touch-action: manipulation;
  background: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--tc) 55%, #fff), var(--tc) 55%, color-mix(in srgb, var(--tc) 60%, #000));
  box-shadow: 0 14px 0 color-mix(in srgb, var(--tc) 50%, #000), 0 30px 60px rgba(0, 0, 0, .4); transition: transform .08s, box-shadow .08s, opacity .3s, filter .3s;
}
.bzp-btn .avatar.xl { --s: clamp(70px, 9vw, 130px); box-shadow: 0 0 0 5px rgba(255, 255, 255, .7); }
.bzp-btn kbd { position: absolute; top: 14px; inset-inline-start: 14px; font-size: 1rem; background: rgba(0, 0, 0, .3); color: #fff; border-color: rgba(255, 255, 255, .3); }
.bzp-btn:disabled { opacity: .5; filter: grayscale(.4); cursor: not-allowed; }
.bzp-btn.pressed, .bzp-btn:active:not(:disabled) { transform: translateY(10px); box-shadow: 0 4px 0 color-mix(in srgb, var(--tc) 50%, #000), 0 10px 30px rgba(0, 0, 0, .4); }
.bzp-btn.win { opacity: 1; filter: none; box-shadow: 0 0 0 8px #fff, 0 0 80px var(--tc); animation: buzzGlow 1s infinite; }
.bzp-btn.locked { opacity: .3; }
.bzp-hint { position: relative; text-align: center; color: var(--muted); font-weight: 700; margin: 0; }

/* ============================================================================
 * 10) الحركات
 * ========================================================================== */
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.halo.h1, .calc-star, .tb-beacon { animation-name: spinPlain; }
@keyframes spinPlain { to { transform: rotate(360deg); } }
@keyframes patternDrift { to { transform: translate(96px, 96px); } }
@keyframes orb { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(5vw, -4vh) scale(1.15); } 100% { transform: translate(-4vw, 5vh) scale(.92); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes breathe { 0%, 100% { opacity: .7; transform: translate(-50%, -50%) scale(1); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } }
.halo.h2, .paused-ic { animation-name: breathePlain; }
@keyframes breathePlain { 0%, 100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; transform: scale(.9); } }
@keyframes shine { to { background-position: -220% 0; } }
@keyframes logoIn { from { opacity: 0; transform: scale(.3) rotate(-30deg); } to { opacity: 1; transform: none; } }
@keyframes ringPulse { from { transform: scale(.85); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
@keyframes ringBurst { from { transform: scale(.8); opacity: 1; } to { transform: scale(3.5); opacity: 0; } }
@keyframes logoBurst { 0% { transform: scale(1); } 30% { transform: scale(1.18); filter: drop-shadow(0 0 40px rgba(var(--accent-rgb), .9)); } 100% { transform: scale(1.08); } }
@keyframes glowBurst { 0% { transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(2.8); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(2.2); opacity: .7; } }
@keyframes splashOut { to { opacity: 0; transform: scale(1.15); filter: blur(8px); } }
@keyframes flyRight { from { opacity: 0; transform: translateX(120px) rotate(30deg) scale(.4); } to { opacity: 1; transform: none; } }
@keyframes flyLeft { from { opacity: 0; transform: translateX(-120px) rotate(-30deg) scale(.4); } to { opacity: 1; transform: none; } }
@keyframes btnPulse { 0%, 100% { box-shadow: 0 10px 40px rgba(var(--accent-rgb), .5), 0 0 0 6px rgba(var(--accent-rgb), .18); } 50% { box-shadow: 0 10px 50px rgba(var(--accent-rgb), .7), 0 0 0 14px rgba(var(--accent-rgb), .06); } }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .7); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(60px) scale(.85) rotateX(20deg); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@keyframes numPop { 0% { transform: scale(2.2); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 0 0 rgba(var(--accent-rgb), 0); } 50% { box-shadow: 0 0 30px rgba(var(--accent-rgb), .55); } }
@keyframes buzzGlow { 0%, 100% { box-shadow: 0 0 0 3px var(--tc), 0 0 20px var(--tc); } 50% { box-shadow: 0 0 0 6px var(--tc), 0 0 60px var(--tc); } }
@keyframes qCardIn { from { opacity: 0; transform: scale(.7) translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes optIn { from { opacity: 0; transform: translateY(40px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes correctPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.2); } }
@keyframes answerIn { from { opacity: 0; transform: scale(.6) translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.1); } 30% { transform: scale(1); } 45% { transform: scale(1.06); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes shakeHard { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.1); } 75% { transform: rotate(12deg) scale(1.1); } }
@keyframes stripes { to { background-position: calc(var(--u) * 5.66) 0; } }
@keyframes decisiveGlow { 0%, 100% { box-shadow: 0 0 40px rgba(239, 68, 68, .35), 0 24px 60px rgba(0, 0, 0, .35); } 50% { box-shadow: 0 0 90px rgba(239, 68, 68, .6), 0 24px 60px rgba(0, 0, 0, .35); } }
@keyframes crown { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-10px) rotate(6deg); } }
@keyframes podRise { from { opacity: 0; transform: translateY(70%); } to { opacity: 1; transform: none; } }
@keyframes wisdom { 0% { opacity: 0; transform: translateY(20px); } 12%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-20px); } }
@keyframes ticker { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@keyframes flash { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes stamp { 0% { transform: scale(3) rotate(-25deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes bannerIn { 0% { transform: translate(-50%, -150%); opacity: 0; } 15% { transform: translate(-50%, 0); opacity: 1; } 85% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, -150%); opacity: 0; } }
@keyframes ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-25deg); } 75% { transform: rotate(25deg); } }
@keyframes ringOut { from { transform: scale(1); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@keyframes iconDrop { from { opacity: 0; transform: translateY(-120px) scale(.3) rotate(-30deg); } to { opacity: 1; transform: none; } }
@keyframes titleZoom { from { opacity: 0; transform: scale(2.4); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes teamIn { from { opacity: 0; transform: translateY(60px) scale(.6); } to { opacity: 1; transform: none; } }

/* ============================================================================
 * 11) التجاوب مع الشاشات
 * ========================================================================== */
@media (max-width: 1280px) {
  .live-grid { grid-template-columns: 1fr; }
  .live-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
}
@media (max-width: 980px) {
  .view.admin { grid-template-columns: 1fr; }
  .adm-side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; transform: translateX(110%); transition: transform .3s var(--ease); box-shadow: var(--shadow); }
  .admin.nav-open .adm-side { transform: none; }
  .adm-burger { display: inline-grid; }
  .home-cards { grid-template-columns: 1fr; }
  .res-grid, .tour-card .res-grid { grid-template-columns: 1fr; }
  .tour-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .qe-grid { grid-template-columns: 1fr 1fr; }
  .q-cards { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .adm-content { padding: 12px 12px 30px; }
  .adm-top { padding: 10px 12px; }
  .adm-top h1 { font-size: 1.05rem; }
  .adm-context { display: none; }
  .aq-opts, .aq-order { grid-template-columns: 1fr; }
  .te-layout { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
  .home-head { flex-direction: column; text-align: center; }
  .ctx-status { margin-inline-start: 0; }
  .screen-btns { grid-template-columns: repeat(2, 1fr); }
  .ann-btns { grid-template-columns: 1fr; }
  .live-side { display: flex; }
}
/* شاشة العرض على الأجهزة الطولية (جوال) */
@media (max-aspect-ratio: 4/5) {
  .display { --u: 1.6vw; }
  .d-header { flex-wrap: wrap; justify-content: center; }
  .d-live { display: none; }
  .q-layout { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .q-side { flex-direction: row; order: -1; grid-row: 2; }
  .opts, .opts-3, .opts-5, .opts-6 { grid-template-columns: 1fr; }
  .match { grid-template-columns: 1fr; }
  .wheel-wrap { grid-template-columns: 1fr; justify-items: center; }
  .wheel-box { width: 80vw; height: 80vw; }
  .br-stages { grid-template-columns: 1fr; }
  .screen { overflow-y: auto; justify-content: flex-start; padding-top: 20px; }
  .podium { height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============================================================================
 * 12) ضبط ملاءمة الشاشات الكبيرة (لوحة الشرف / المنصة / المسار)
 * ========================================================================== */
.screen[data-screen="honor"], .screen[data-screen="podium"], .screen[data-screen="bracket"], .screen[data-screen="teams"] { justify-content: flex-start; padding-top: calc(var(--u) * 1.4); }
.screen[data-screen="honor"] .scr-head, .screen[data-screen="podium"] .scr-head, .screen[data-screen="bracket"] .scr-head { margin-bottom: calc(var(--u) * 1.2); }
.honor-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: calc(var(--u) * 1.2); }
.honor-card { padding: calc(var(--u) * 1.1) calc(var(--u) * .9); }
.honor-icon { font-size: max(28px, calc(var(--u) * 3.2)); }
.honor-body { font-size: max(15px, calc(var(--u) * 1.6)); }
.honor-body .avatar.lg { --s: calc(var(--u) * 4.6); }
.honor-card.wide { display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 2); padding: calc(var(--u) * .9) calc(var(--u) * 2); }
.honor-card.wide .honor-icon { font-size: max(32px, calc(var(--u) * 4)); }
.honor-card.wide .honor-title { margin: 0; font-size: max(16px, calc(var(--u) * 1.8)); }
.honor-card.wide .honor-body { font-size: max(20px, calc(var(--u) * 2.6)); gap: calc(var(--u) * 1); }
.podium { flex: 1; min-height: 0; height: auto; padding-top: calc(var(--u) * 5); }
.pod-1 .pod-block { height: calc(var(--u) * 16); }
.pod-2 .pod-block { height: calc(var(--u) * 11.5); }
.pod-3 .pod-block { height: calc(var(--u) * 8); }
.pod-top .avatar.xxl { --s: calc(var(--u) * 8.5); }
.pod-top .avatar.xl { --s: calc(var(--u) * 6.4); }
.pod-crown { top: calc(var(--u) * -4.2); font-size: max(30px, calc(var(--u) * 4)); }
.pod-num { font-size: max(30px, calc(var(--u) * 4)); }
@media (max-aspect-ratio: 4/5) { .honor-grid { grid-template-columns: 1fr 1fr; } }
[data-theme="light"] .btn-accent, [data-theme="light"] .d-ticker-label, [data-theme="light"] .badge.b-gold,
[data-theme="light"] .team-card-badge, [data-theme="light"] .seg-btn.seg-gold.active, [data-theme="light"] .display.mode-grand .d-chip-stage { color: #fff; }

/* ==========================================================================
 * 13) اختيار الإجابة من شاشة العرض + الانتقال التلقائي
 * ======================================================================== */
.can-pick .opt { cursor: pointer; }
.can-pick .opt:hover { transform: translateY(calc(var(--u) * -.4)) scale(1.02); filter: brightness(1.08); }
.can-pick .opt:active { transform: scale(.98); }
.opt.is-pending { box-shadow: 0 0 0 calc(var(--u) * .35) #fff, 0 0 40px var(--c); animation: pickPulse .8s ease-in-out infinite; }
.opt.is-wrong { background: linear-gradient(135deg, #b91c1c, #7f1d1d) !important; opacity: .9 !important; filter: none !important; animation: wrongShake .5s ease both; cursor: not-allowed; }
.opt.is-wrong .opt-check { transform: translateY(-50%) scale(1); color: #DC2626; }
.opt.is-wrong .opt-check::before { content: '✗'; }
.opt.is-wrong .opt-check { font-size: 0; }
.opt.is-wrong .opt-check::before { font-size: max(16px, calc(var(--u) * 1.8)); }
.is-revealed .opt.is-picked.is-correct { box-shadow: 0 0 0 calc(var(--u) * .5) #fde047, 0 0 70px #22c55e, 0 0 140px rgba(34, 197, 94, .6); }
@keyframes pickPulse { 50% { transform: scale(1.03); } }
@keyframes wrongShake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.auto-next-d { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: calc(var(--u) * .7) calc(var(--u) * 1.2); border-radius: calc(var(--u) * 1.2); background: rgba(var(--accent-rgb), .16); border: 1px solid rgba(var(--accent-rgb), .5); text-align: center; }
.auto-next-d[hidden] { display: none; }
.auto-next-d small { font-size: max(11px, calc(var(--u) * 1)); color: var(--muted); font-weight: 700; }
.auto-next-d b { font-size: max(22px, calc(var(--u) * 3)); color: var(--accent-light); line-height: 1.1; }
.auto-next { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(var(--accent-rgb), .14); border: 1px solid rgba(var(--accent-rgb), .45); font-weight: 700; font-size: .9rem; }
.auto-next[hidden] { display: none; }
.d-hint { position: fixed; left: 50%; bottom: 12%; transform: translate(-50%, 20px); padding: 12px 26px; border-radius: 99px; background: rgba(15, 23, 42, .92); color: #fff; font-weight: 700; font-size: max(15px, calc(var(--u) * 1.6)); opacity: 0; pointer-events: none; transition: all .35s var(--spring); z-index: 60; }
.d-hint.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
 * 14) منع تداخل النصوص: شاشة الاستعداد + لوحة الانتقال التلقائي
 * ======================================================================== */
.ready { gap: calc(var(--u) * .6); max-height: 100%; }
.ready-title { font-size: max(24px, calc(var(--u) * 3.2)); line-height: 1.3; }
.ready-ring { width: calc(var(--u) * 14); height: calc(var(--u) * 14); min-width: 110px; min-height: 110px; margin: calc(var(--u) * .4) 0; }
.ready-num { font-size: max(64px, calc(var(--u) * 9)); }
.ready-team { flex-wrap: wrap; justify-content: center; }
.d-main { overflow: hidden; }
.auto-next-d { width: 100%; max-width: calc(var(--u) * 14); min-width: 96px; box-sizing: border-box; }
.auto-next-d small { white-space: normal; line-height: 1.4; }
/* الإعلانات: تتسع دائماً داخل الشاشة (بما في ذلك 3 فرق) */
.ov-content { gap: calc(var(--u) * .8); max-height: 100vh; box-sizing: border-box; padding: calc(var(--u) * 2) 20px; }
.ov-icon { font-size: max(52px, calc(var(--u) * 7.5)); }
.ov-title { font-size: max(36px, calc(var(--u) * 6.2)); }
.ov-tournamentChampion .ov-title { font-size: max(42px, calc(var(--u) * 7.4)); }
.ov-team .avatar.xxl { --s: calc(var(--u) * 10.5); min-width: 80px; min-height: 80px; }
.ov-team b { font-size: max(26px, calc(var(--u) * 4.2)); }
.ov-brand { margin-top: 0; }
