/* ========================================================
   غرفة التحدي الكبرى - بطولة المتميز (Challenge Arena)
   ======================================================== */

:root {
  --primary-navy: #0d1b2a;
  --primary-espresso: #241a11;
  --accent-gold: #ffb300;
  --accent-gold-dark: #b37418;
  --accent-gold-light: #ffe082;
  --emerald-green: #1b5e20;
  --emerald-light: #2e7d32;
  --card-border: #d8caa7;
  --card-stitch: #cfbe9a;
  --text-dark: #1f1610;
  --text-body: #3d2d1e;
  --text-muted: #6d5b4b;
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.28);
  --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.1);
  --radius-xl: 22px;
}

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

html, body {
  height: 100vh;
  width: 100vw;
  overflow: hidden; /* إلغاء السكرول الخارجي نهائياً في كامل الصفحة */
  margin: 0;
  padding: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background-color: #0f3824;
  background-image: url('assets/bg.jpg');
  background-repeat: repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--text-dark);
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==================== الشريط العلوي ==================== */
.top-nav {
  height: 60px;
  background: rgba(36, 26, 17, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 3.5px solid #c99632;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(20, 12, 6, 0.45);
  flex-shrink: 0;
  z-index: 50;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-back-home {
  font-size: 0.92rem;
  font-weight: 800;
  font-family: 'Cairo', sans-serif;
  text-decoration: none;
  background: linear-gradient(135deg, #1b5e20, #2e7d32);
  color: #ffffff !important;
  border: 1.5px solid #ffca28;
  border-radius: 999px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-back-home:hover, .btn-back-home:active {
  transform: scale(1.05);
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
}
.btn-back-home .back-ico {
  font-size: 1.1rem;
  color: #ffca28;
}

.nav-trophy-ico {
  font-size: 2rem;
  filter: drop-shadow(0 2px 8px rgba(255, 202, 40, 0.6));
  animation: pulse-glow 2.5s infinite alternate;
}
.brand-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.1;
}
.brand-title span {
  color: #ffca28;
}
.brand-sub {
  font-size: 0.72rem;
  color: #d7ccc8;
  font-weight: 600;
}

.user-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 202, 40, 0.45);
  border-radius: 999px;
  padding: 4px 14px 4px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #ffe082, #ffb300);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.user-details {
  display: flex;
  flex-direction: column;
}
.user-name {
  color: #fff;
  font-weight: 900;
  font-size: 0.88rem;
  line-height: 1.1;
}
.user-origin {
  color: #ffca28;
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-controls {
  display: flex;
  gap: 8px;
}
.nav-btn-icon {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.nav-btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}
.nav-btn-icon.active-music {
  background: #ffb300;
  color: #241a11;
  border-color: #ffd54f;
  box-shadow: 0 0 10px rgba(255, 179, 0, 0.6);
}

/* ==================== نظام الشاشات المحكم (Zero Outer Scroll) ==================== */
.screen {
  display: none;
  flex: 1;
  padding: 12px 20px;
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden; /* حظر السكرول الخارجي */
  position: relative;
}
.screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ==================== الشاشة 1: الترحيب والبطولة ==================== */
.welcome-box {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 3.5px solid var(--card-border);
  outline: 2px dashed var(--card-stitch);
  outline-offset: -8px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  overflow: hidden;
  max-height: calc(100vh - 84px); /* يتناسب بدقة دون سكرول */
}

.welcome-banner-media {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.banner-overlay-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(36, 26, 17, 0.92);
  color: #ffd54f;
  border: 1.5px solid #ffb300;
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.welcome-info-card {
  padding: 18px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fffdf9;
  justify-content: center;
}

.trophy-pill {
  display: inline-block;
  background: #fff8e1;
  color: #b78103;
  border: 1.5px solid #ffe082;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 3px 12px;
  border-radius: 999px;
  align-self: flex-start;
}

.welcome-title {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--primary-espresso);
  line-height: 1.2;
}

.welcome-desc {
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.5;
}

.prize-highlight-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.prize-item {
  background: #fdfaf3;
  border: 1.5px solid #e0d5c1;
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.p-ico {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.prize-item strong {
  display: block;
  font-size: 0.88rem;
  color: var(--primary-espresso);
  font-weight: 900;
  line-height: 1.2;
}
.prize-item p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.registration-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  margin-top: 2px;
}
.input-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.input-field label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary-espresso);
}
.input-field input, .input-field select {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #cbd5e1;
  outline: none;
  background: #fff;
}
.input-field input:focus, .input-field select:focus {
  border-color: #b37418;
  box-shadow: 0 0 0 3px rgba(179, 116, 24, 0.2);
}

.welcome-actions {
  margin-top: 4px;
}

/* ==================== الأزرار العامة ثلاثية الأبعاد ==================== */
.btn {
  font-family: inherit;
  font-weight: 900;
  font-size: 1rem;
  border: none;
  border-radius: 14px;
  padding: 10px 20px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, box-shadow 0.12s, filter 0.15s;
  text-decoration: none;
}
.btn-large {
  width: 100%;
  padding: 12px 24px;
  font-size: 1.15rem;
}
.btn-sub {
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.9;
}
.btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(2px);
}

.btn-primary {
  background: linear-gradient(180deg, #1b5e20, #0f3b14);
  color: #fff;
  box-shadow: 0 4px 0 #07220b, 0 6px 14px rgba(27, 94, 32, 0.35);
}
.btn-primary:active { box-shadow: 0 1px 0 #07220b; }

.btn-secondary {
  background: linear-gradient(180deg, #3e2723, #241a11);
  color: #fff;
  box-shadow: 0 4px 0 #120d08, 0 6px 14px rgba(36, 26, 17, 0.3);
}
.btn-secondary:active { box-shadow: 0 1px 0 #120d08; }

.btn-accent {
  background: linear-gradient(180deg, #ffb300, #ff8f00);
  color: #241a11;
  box-shadow: 0 4px 0 #b36200, 0 6px 14px rgba(255, 143, 0, 0.4);
}
.btn-accent:active { box-shadow: 0 1px 0 #b36200; }

.hidden { display: none !important; }

/* ==================== الشاشة 2: شجرة التصفيات ==================== */
.bracket-container {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 3.5px solid var(--card-border);
  outline: 2px dashed var(--card-stitch);
  outline-offset: -8px;
  box-shadow: var(--shadow-lg);
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 84px);
  overflow: hidden;
}

.bracket-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0d5c1;
  flex-shrink: 0;
}
.badge-stage {
  display: inline-block;
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 2px;
  border: 1px solid #a5d6a7;
}
.bracket-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--primary-espresso);
}
.bracket-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.tournament-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #fdfaf3;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1.5px solid #e0d5c1;
  flex-shrink: 0;
}
.t-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  text-align: center;
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #616161;
  font-weight: 900;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all 0.2s;
}
.step-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
}
.step-status {
  font-size: 0.7rem;
  font-weight: 700;
  color: #8d6e63;
}
.t-connector {
  height: 3px;
  background: #d7ccc8;
  flex: 1;
  max-width: 45px;
  border-radius: 999px;
}
.t-step.completed .step-num {
  background: #2e7d32;
  color: #fff;
  box-shadow: 0 0 8px rgba(46, 125, 50, 0.4);
}
.t-step.active .step-num {
  background: #ffb300;
  color: #241a11;
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(255, 179, 0, 0.7);
  animation: pulse-glow 2s infinite alternate;
}
.t-step.active .step-name {
  color: var(--primary-espresso);
  font-weight: 900;
}

/* سكرول داخلي فقط لقائمة المتأهلين */
.contestants-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}
.contestants-heading {
  font-size: 1rem;
  font-weight: 900;
  color: var(--primary-espresso);
  flex-shrink: 0;
}

.contestants-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}
/* تخصيص السكرول بار الداخلي الأنيق */
.contestants-scroll-area::-webkit-scrollbar {
  width: 6px;
}
.contestants-scroll-area::-webkit-scrollbar-track {
  background: #f5f0e6;
  border-radius: 999px;
}
.contestants-scroll-area::-webkit-scrollbar-thumb {
  background: #b37418;
  border-radius: 999px;
}

.contestants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.c-card {
  background: #ffffff;
  border: 1.5px solid #e0d5c1;
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  position: relative;
  transition: transform 0.15s, border-color 0.15s;
}
.c-card:hover {
  transform: translateY(-2px);
  border-color: #b37418;
}
.c-card.player-card {
  background: linear-gradient(135deg, #fff9c4, #fffde7);
  border: 2px solid #f57f17;
  box-shadow: 0 4px 10px rgba(245, 127, 23, 0.25);
}
.c-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eceff1;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #cfd8dc;
  flex-shrink: 0;
}
.player-card .c-avatar {
  background: #ffe082;
  border-color: #ffb300;
}
.c-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.c-name {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--primary-espresso);
}
.c-wilaya {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 700;
}
.c-status-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  position: absolute;
  top: 6px;
  left: 6px;
  background: #e3f2fd;
  color: #1565c0;
}

/* ==================== الشاشة 3: حلبة السباق والنزال المباشر ==================== */
.match-arena {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 84px);
  overflow: hidden;
}

/* حلبة السباق الأسفلتية الحقيقية (Grand Prix) */
.live-race-board {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 3.5px solid var(--card-border);
  outline: 2px dashed var(--card-stitch);
  outline-offset: -8px;
  box-shadow: var(--shadow-card);
  padding: 10px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.race-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.race-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-pulse {
  background: #ffebee;
  color: #c62828;
  font-weight: 900;
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #ffcdd2;
  animation: pulse-glow 1.5s infinite alternate;
}
.race-title {
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--primary-espresso);
}
.race-round-info {
  background: #fdfaf3;
  color: #8d6e63;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #e0d5c1;
}

/* مضمار السباق الأسفلتي */
.asphalt-track-wrapper {
  display: flex;
  align-items: stretch;
  background: #1e293b;
  border-radius: 16px;
  border: 3px solid #0f172a;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
  position: relative;
}

.track-start-line, .track-finish-line {
  width: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  padding: 4px;
}
.track-start-line {
  background: #334155;
  border-right: 2px dashed #94a3b8;
}
.traffic-lights { font-size: 1.2rem; }

.track-finish-line {
  background: repeating-linear-gradient(
    45deg,
    #000000,
    #000000 8px,
    #ffffff 8px,
    #ffffff 16px
  );
  border-left: 3px solid #ffca28;
  color: #000;
  font-weight: 900;
  background-color: #ffffff;
}
.track-finish-line span {
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.65rem;
}
.checkered-flag { font-size: 1.3rem; }

.race-lanes {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 6px;
  max-height: 140px;
  overflow-y: auto;
}
.race-lanes::-webkit-scrollbar { width: 4px; }
.race-lanes::-webkit-scrollbar-thumb { background: #475569; border-radius: 999px; }

.lane-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 25px;
  background: #334155;
  border-radius: 6px;
  padding: 0 8px;
  position: relative;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
}
.lane-row.is-player {
  background: #475569;
  border: 1.5px solid #ffb300;
  box-shadow: 0 0 8px rgba(255, 179, 0, 0.4);
}

.lane-competitor-name {
  width: 90px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.lane-row.is-player .lane-competitor-name {
  color: #fde047;
}

.lane-track {
  flex: 1;
  height: 10px;
  position: relative;
}
.lane-car {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 0%; /* يتقدم من اليمين إلى اليسار نحو خط النهاية */
  font-size: 1.15rem;
  transition: right 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.lane-score {
  font-size: 0.78rem;
  font-weight: 900;
  color: #fbbf24;
  width: 50px;
  text-align: left;
  flex-shrink: 0;
}

/* محطة السؤال والعداد (مضغوطة للشاشة الواحدة) */
.question-station {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 3.5px solid var(--card-border);
  outline: 2px dashed var(--card-stitch);
  outline-offset: -8px;
  box-shadow: var(--shadow-lg);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.station-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer-widget {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-bg {
  fill: none;
  stroke: #eceff1;
  stroke-width: 8;
}
.timer-progress {
  fill: none;
  stroke: #2e7d32;
  stroke-width: 8;
  stroke-dasharray: 276;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.2s linear, stroke 0.3s;
}
.timer-progress.warning { stroke: #f57c00; }
.timer-progress.danger { stroke: #d32f2f; }

.timer-seconds {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--primary-espresso);
}

.question-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.subject-chip {
  align-self: flex-start;
  background: #e0f2f1;
  color: #00695c;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #b2dfdb;
}
.q-statement {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-espresso);
  line-height: 1.35;
}

.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.ans-btn {
  background: #ffffff;
  border: 2.5px solid #e0d5c1;
  border-radius: 14px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-espresso);
  cursor: pointer;
  box-shadow: 0 3px 0 #cfbe9a, 0 4px 10px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  text-align: right;
  transition: transform 0.08s, box-shadow 0.08s, border-color 0.15s;
}
.ans-letter {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #f5ede1;
  border: 1.5px solid #d8caa7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
  color: #b37418;
  flex-shrink: 0;
}
.ans-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: #b37418;
  box-shadow: 0 5px 0 #b37418;
}
.ans-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #cfbe9a;
}
.ans-btn.correct {
  background: #e8f5e9 !important;
  border-color: #2e7d32 !important;
  color: #1b5e20 !important;
  box-shadow: 0 3px 0 #1b5e20 !important;
}
.ans-btn.wrong {
  background: #ffebee !important;
  border-color: #c62828 !important;
  color: #b71c1c !important;
  box-shadow: 0 3px 0 #b71c1c !important;
}

.instant-feedback {
  background: #f1f8e9;
  border: 2px solid #a5d6a7;
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #1b5e20;
}
.instant-feedback.wrong {
  background: #ffebee;
  border-color: #ef9a9a;
  color: #c62828;
}

/* ==================== الشاشة 4: نتائج الدور والتأهل ==================== */
.qualify-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 3.5px solid var(--card-border);
  outline: 2px dashed var(--card-stitch);
  outline-offset: -8px;
  box-shadow: var(--shadow-lg);
  padding: 22px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  max-height: calc(100vh - 84px);
}

.qualify-crest {
  font-size: 2.5rem;
  animation: pulse-glow 2s infinite alternate;
}
.qualify-title {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--primary-espresso);
}
.qualify-msg {
  font-size: 0.95rem;
  color: var(--text-body);
  max-width: 560px;
}

.qualify-stats-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
}
.qstat-box {
  background: #fdfaf3;
  border: 1.5px solid #e0d5c1;
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.qs-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.qs-val {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--emerald-green);
}

.qualifiers-list-box {
  width: 100%;
  background: #faf6ee;
  border: 1.5px solid #e0d5c1;
  border-radius: 14px;
  padding: 10px 14px;
  text-align: right;
}
.qualifiers-list-box h4 {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--primary-espresso);
  margin-bottom: 6px;
}
.mini-qualifiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.mini-q-pill {
  background: #fff;
  border: 1.5px solid #d8caa7;
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--primary-espresso);
}
.mini-q-pill.is-me {
  background: #fff9c4;
  border-color: #f57f17;
  color: #b78103;
}

.qualify-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}

/* ==================== الشاشة 5: التتويج وجائزة المتميز ==================== */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
}

.podium-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 3.5px solid var(--card-border);
  outline: 2px dashed var(--card-stitch);
  outline-offset: -8px;
  box-shadow: var(--shadow-lg);
  padding: 16px 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  max-height: calc(100vh - 84px);
  box-sizing: border-box;
}

.champions-cup-float {
  font-size: 2.3rem;
  line-height: 1;
  animation: pulse-glow 2s infinite alternate;
}
.coronation-badge {
  background: #b37418;
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  padding: 3px 14px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}
.champion-name {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  font-weight: 700;
  color: #b71c1c;
  line-height: 1.1;
  margin: 0;
}
.champion-sub {
  font-size: 0.85rem;
  color: var(--text-body);
  max-width: 580px;
  margin: 0;
}

.vip-voucher-card {
  width: 100%;
  background: linear-gradient(135deg, #fffdf5, #fff8e1);
  border: 1.5px double #d4af37;
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.voucher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 3px;
  border-bottom: 1px dashed #d4af37;
}
.v-tag {
  font-weight: 900;
  font-size: 0.85rem;
  color: #795548;
}
.v-duration {
  background: #2e7d32;
  color: #fff;
  font-weight: 900;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
}
.voucher-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.voucher-body p {
  font-size: 0.78rem;
  font-weight: 700;
  color: #4e342e;
  margin: 0;
}
.voucher-code-box {
  background: #fff;
  border: 1.5px dashed #b37418;
  border-radius: 8px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.v-code {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 900;
  color: #1b5e20;
  letter-spacing: 1.5px;
}
.btn-copy-code {
  background: #ffb300;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.78rem;
  color: #241a11;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-copy-code:hover {
  background: #ffa000;
  transform: scale(1.04);
}
.v-note {
  font-size: 0.7rem;
  color: #2e7d32;
  font-weight: 700;
}

.podium-steps {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
}
.step-runner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  max-width: 130px;
}
.step-avatar {
  font-size: 1.5rem;
}
.step-name {
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--primary-espresso);
}
.step-bar {
  width: 100%;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  font-size: 0.75rem;
}
.h-1 { height: 50px; background: linear-gradient(180deg, #ffb300, #f57f17); }
.h-2 { height: 38px; background: linear-gradient(180deg, #b0bec5, #78909c); }
.h-3 { height: 28px; background: linear-gradient(180deg, #bcaaa4, #8d6e63); }

.podium-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 700px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  padding-bottom: 6px;
}
.podium-actions .btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 800;
  border-radius: 12px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* ==================== الشهادة الملكية الشرفية المخصصة للطباعة ==================== */
.royal-printable-certificate {
  display: none; /* مخفية على الشاشة تماماً وتظهر في الطباعة فقط */
}

@media print {
  @page {
    size: A4 landscape;
    margin: 6mm;
  }
  body {
    background: #ffffff !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #app {
    display: none !important;
  }
  .royal-printable-certificate {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .cert-frame-outer {
    border: 6px double #b37418;
    border-radius: 12px;
    padding: 8px;
    background: #fffef8;
    box-sizing: border-box;
  }
  .cert-frame-inner {
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 16px 24px;
    text-align: center;
    background: radial-gradient(circle at center, #ffffff 60%, #fffbf0 100%);
    box-sizing: border-box;
  }

  .cert-header {
    margin-bottom: 6px;
  }
  .cert-emblem {
    font-size: 1.8rem;
    margin-bottom: 2px;
    line-height: 1;
  }
  .cert-header h3 {
    font-size: 1.05rem;
    color: #1b5e20;
    font-weight: 900;
    margin: 2px 0;
  }
  .cert-header p {
    font-size: 0.82rem;
    color: #795548;
    font-weight: 700;
    margin: 2px 0;
  }

  .cert-main-title {
    font-family: 'Amiri', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #b37418;
    margin: 4px 0 2px;
    line-height: 1.1;
  }
  .cert-title-badge {
    display: inline-block;
    background: #b37418;
    color: #ffffff;
    font-weight: 900;
    font-size: 0.95rem;
    padding: 2px 16px;
    border-radius: 999px;
    margin-bottom: 6px;
  }

  .cert-intro-text {
    font-size: 1rem;
    color: #37474f;
    font-weight: 700;
    margin: 4px 0 2px;
  }
  .cert-hero-name {
    font-family: 'Amiri', serif;
    font-size: 2.6rem;
    font-weight: 700;
    color: #1a237e;
    margin: 2px 0;
    border-bottom: 2.5px solid #ffb300;
    display: inline-block;
    padding: 0 32px;
    line-height: 1.15;
  }
  .cert-hero-wilaya {
    font-size: 0.95rem;
    font-weight: 900;
    color: #e65100;
    margin-bottom: 6px;
  }

  .cert-declaration {
    font-size: 0.92rem;
    line-height: 1.55;
    color: #263238;
    max-width: 780px;
    margin: 6px auto;
    font-weight: 600;
  }

  .cert-bottom-stamps {
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1.5px dashed #d7ccc8;
  }
  .c-stamp-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .cs-label {
    font-size: 0.8rem;
    color: #78909c;
    font-weight: 700;
  }
  .cs-val {
    font-size: 1.05rem;
    font-weight: 900;
    color: #2e7d32;
  }

  .c-gold-seal {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe082 0%, #ffb300 70%, #d4af37 100%);
    border: 2px double #ffffff;
    box-shadow: 0 3px 8px rgba(212, 175, 55, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4e342e;
    font-size: 0.65rem;
    font-weight: 900;
    transform: rotate(-6deg);
  }
  .seal-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
  }

  .cert-motto {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #8d6e63;
    font-weight: 800;
    font-style: italic;
  }
}

/* ==================== أنيميشن ==================== */
@keyframes pulse-glow {
  0% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(255, 179, 0, 0.4)); }
  100% { transform: scale(1.06); filter: drop-shadow(0 0 14px rgba(255, 179, 0, 0.8)); }
}

/* ==================== نافذة فحص واعتماد الأسئلة الأسبوعية (Admin Modal) ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.modal-overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-audit-card {
  background: #ffffff;
  border-radius: 24px;
  border: 4px solid var(--accent-gold);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  background: linear-gradient(135deg, #2b170c, #1f1008);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2.5px solid #c99632;
  color: #fff;
}
.modal-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 900;
  color: #ffca28;
  margin: 0;
}
.modal-badge-status {
  background: #2e7d32;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid #81c784;
}
.modal-badge-status.unapproved {
  background: #c62828;
  border-color: #ef9a9a;
}
.btn-close-modal {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-close-modal:hover {
  background: #c62828;
  transform: rotate(90deg);
}

.modal-toolbar {
  background: #fdfbf7;
  padding: 12px 24px;
  border-bottom: 1px solid #e0d5c1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.auditor-label {
  font-weight: 800;
  font-size: 0.85rem;
  color: #4e342e;
}
.audit-input {
  padding: 6px 12px;
  border: 1.5px solid #c99632;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  outline: none;
}
.audit-input:focus {
  border-color: #e65100;
  box-shadow: 0 0 0 2px rgba(230, 81, 0, 0.2);
}

.audit-tabs-row {
  display: flex;
  background: #efebe9;
  border-bottom: 2px solid #d7ccc8;
  padding: 4px 16px 0;
  gap: 8px;
}
.audit-tab {
  background: #d7ccc8;
  border: none;
  border-radius: 10px 10px 0 0;
  padding: 8px 18px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.88rem;
  color: #4e342e;
  cursor: pointer;
  transition: all 0.2s;
}
.audit-tab.active {
  background: #ffffff;
  color: #b71c1c;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
  border-top: 3px solid #b71c1c;
}

.audit-questions-list {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fbf9f5;
}

.audit-q-card {
  background: #ffffff;
  border: 1.5px solid #d7ccc8;
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.audit-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.audit-q-num {
  background: #ffecb3;
  color: #b78103;
  font-weight: 900;
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: 999px;
}
.audit-q-subject {
  font-weight: 800;
  font-size: 0.82rem;
  color: #2e7d32;
}
.audit-q-statement-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #b0bec5;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e1e1e;
  box-sizing: border-box;
}

.audit-options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.audit-opt-box {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid #cfd8dc;
  border-radius: 8px;
  padding: 4px 8px;
  background: #fdfdfd;
}
.audit-opt-box.is-correct {
  border-color: #2e7d32;
  background: #e8f5e9;
}
.audit-radio {
  cursor: pointer;
}
.audit-opt-text {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  outline: none;
}
.audit-q-tip {
  font-size: 0.76rem;
  color: #78909c;
  margin: 0;
}
