/* ==============================================================================
   AT-TANAL ARABIC GRAMMAR EXAMINATION PLATFORM (KARIEV.UZ)
   Interstellar Cosmic Architecture & Classical Arabic Calligraphy
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Scheherazade+New:wght@500;600;700;800&display=swap');

:root {
  --space-void: #02050e;
  --space-deep: #060d24;
  --space-card: rgba(10, 18, 42, 0.78);
  --space-card-hover: rgba(16, 28, 64, 0.88);
  --space-border: rgba(56, 189, 248, 0.22);
  --space-border-hover: rgba(56, 189, 248, 0.65);

  --cyan: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.4);
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.4);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.4);
  --purple: #a855f7;
  --rose: #f43f5e;

  --text-pure: #ffffff;
  --text-starlight: #f1f5f9;
  --text-nebula: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-arabic: 'Scheherazade New', 'Amiri', 'Traditional Arabic', serif;
}

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

body {
  background-color: var(--space-void);
  background-image: 
    radial-gradient(ellipse at 50% 10%, rgba(14, 30, 74, 0.7) 0%, rgba(6, 13, 36, 0.85) 45%, #02050e 100%),
    radial-gradient(circle at 10% 25%, rgba(16, 185, 129, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 70%, rgba(56, 189, 248, 0.12) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-pure);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Cosmic Dust / Starfield Atmosphere */
.cosmic-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
}

/* ================= TOP COSMIC HUD ================= */
.cosmic-hud {
  width: 100%;
  max-width: 1240px;
  margin: 14px auto 0;
  padding: 10px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 16, 38, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--space-border);
  border-radius: 99px;
  position: sticky;
  top: 14px;
  z-index: 100;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.14);
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hud-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease;
}

.hud-brand-link:hover {
  transform: translateY(-1px) scale(1.02);
}

.hud-logo-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(16, 185, 129, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.hud-logo-box img {
  width: 26px;
  height: 26px;
}

.hud-brand-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.4px;
  line-height: 1.1;
  color: #fff;
}

.hud-brand-title span {
  color: var(--cyan);
}

.hud-brand-badge {
  font-size: 10px;
  font-weight: 800;
  color: #34d399;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* Student Badge Pill (Same as Kariev Speaking HUD) */
.hud-student-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.18), inset 0 0 12px rgba(56, 189, 248, 0.08);
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.hud-student-pill:hover {
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.hud-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981, 0 0 14px #10b981;
  animation: pulseBeacon 2s infinite ease-in-out;
}

@keyframes pulseBeacon {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.hud-pill-tag {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.hud-pill-id {
  font-family: var(--font-display), monospace;
  font-size: 13.5px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.hud-pill-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #f1f5f9;
  padding-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-hud-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.25s ease;
}

.btn-hud-back:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.4);
}

/* ================= MAIN CONTAINER ================= */
.main-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 24px auto 60px;
  padding: 0 20px;
  flex: 1;
}

.screen {
  display: none;
  animation: cosmicFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
  display: block;
}

@keyframes cosmicFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= 1. LOBBY SCREEN ================= */
.lobby-hero {
  text-align: center;
  padding: 24px 16px 28px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

.lobby-hero h1 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 10px;
}

.arabic-hero-title {
  display: block;
  font-family: var(--font-arabic);
  font-size: 34px;
  font-weight: 700;
  color: #f59e0b;
  margin-top: 6px;
  text-shadow: 0 0 24px rgba(245, 158, 11, 0.3);
  direction: rtl;
}

.lobby-hero p {
  color: var(--text-nebula);
  font-size: 15px;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* --- LOBBY HIGHLIGHTS BAR --- */
.lobby-highlights-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px auto 6px;
  max-width: 860px;
}

.hl-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
  transition: all 0.25s ease;
}

.hl-capsule:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.15);
}

.hl-icon {
  font-size: 16px;
}

/* ================= DIRECT EXAM CODE ENTRY CARD (Speaking Style) ================= */
.tanal-code-entry-card {
  background: linear-gradient(145deg, rgba(14, 26, 58, 0.88) 0%, rgba(8, 16, 38, 0.94) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 22px;
  padding: 24px 28px;
  margin: 18px 0 32px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.55), 0 0 35px rgba(56, 189, 248, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.tanal-code-entry-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.14) 0%, transparent 70%);
  pointer-events: none;
}

.tce-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.tce-icon-bubble {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(234, 88, 12, 0.3));
  border: 1px solid rgba(245, 158, 11, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
  flex-shrink: 0;
}

.tce-text-box {
  min-width: 0;
  flex: 1;
}

.tce-heading {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.tce-subheading {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.4;
}

.tce-subheading b {
  color: #38bdf8;
  font-weight: 700;
}

.tce-form {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.tce-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.tce-key-icon {
  position: absolute;
  left: 15px;
  font-size: 15px;
  color: #38bdf8;
  pointer-events: none;
}

.tce-input-wrapper input {
  width: 100%;
  padding: 13px 18px 13px 42px;
  background: rgba(4, 9, 22, 0.92);
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  outline: none;
  transition: all 0.25s ease;
}

.tce-input-wrapper input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
  background: rgba(6, 13, 30, 0.98);
}

.tce-input-wrapper input::placeholder {
  color: #64748b;
  font-weight: 500;
  font-size: 13.5px;
}

.tce-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.tce-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(37, 99, 235, 0.6);
}

.tce-error-box {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 10px;
  color: #f87171;
  font-size: 12.5px;
  font-weight: 600;
}

/* ================= PUBLIC VARIANTS SECTION BAR ================= */
.public-variants-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pvs-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pvs-icon {
  font-size: 22px;
}

.pvs-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.pvs-subtitle {
  font-size: 12px;
  color: #94a3b8;
}

.tanal-search-box {
  position: relative;
  flex: 1;
  max-width: 380px;
  min-width: 260px;
  display: flex;
  align-items: center;
}

.tanal-search-box .search-icon {
  position: absolute;
  left: 14px;
  font-size: 14px;
  color: #64748b;
  pointer-events: none;
}

.tanal-search-box input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  background: rgba(12, 22, 46, 0.85);
  border: 1.5px solid var(--space-border);
  border-radius: 12px;
  color: #ffffff;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: all 0.25s ease;
}

.tanal-search-box input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
  background: rgba(15, 28, 58, 0.95);
}

.tanal-search-box input::placeholder {
  color: #64748b;
  font-size: 13px;
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94a3b8;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s;
}

.search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.empty-variants-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 44px 20px;
  background: rgba(12, 22, 46, 0.65);
  border: 1.5px dashed var(--space-border);
  border-radius: 20px;
  backdrop-filter: blur(14px);
}

/* Variants Grid (Public tests) */
.variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}

.variant-card {
  background: linear-gradient(145deg, rgba(12, 22, 46, 0.9) 0%, rgba(6, 12, 28, 0.95) 100%);
  border: 1.5px solid var(--space-border);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.variant-card:hover {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(16, 185, 129, 0.2);
  transform: translateY(-3px);
}

.variant-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.variant-code-pill {
  font-family: var(--font-display), monospace;
  font-size: 12px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.variant-badge-public {
  font-size: 10.5px;
  font-weight: 800;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px 9px;
  border-radius: 99px;
  text-transform: uppercase;
}

.variant-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.3;
}

.variant-desc {
  font-size: 12.5px;
  color: var(--text-nebula);
  line-height: 1.5;
  margin-bottom: 16px;
}

.variant-meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #cbd5e1;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

.btn-start-variant {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  transition: all 0.25s ease;
}

.btn-start-variant:hover {
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.5);
  transform: scale(1.02);
}

/* Code-protected Variant Card Accents */
.variant-card.code-variant {
  border-color: rgba(245, 158, 11, 0.3);
}

.variant-card.code-variant:hover {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(245, 158, 11, 0.2);
}

.variant-badge-code {
  font-size: 10.5px;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 9px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-start-code {
  width: 100%;
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #fff;
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.35);
  transition: all 0.25s ease;
}

.btn-start-code:hover {
  box-shadow: 0 6px 22px rgba(217, 119, 6, 0.55);
  transform: scale(1.02);
}

/* PIN Modal Specifics */
.pin-input-glow:focus {
  border-color: #f59e0b !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.35), inset 0 0 10px rgba(245, 158, 11, 0.1) !important;
}

.btn-unlock-pin {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.btn-unlock-pin:hover {
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.6);
  transform: translateY(-1px);
}


/* Category Topic Cards */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 40px;
}

.topic-card {
  background: rgba(12, 22, 46, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}

.topic-card:hover {
  background: rgba(18, 32, 68, 0.85);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

.topic-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.topic-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  color: #fff;
}

.topic-arabic {
  font-family: var(--font-arabic);
  font-size: 17px;
  color: #f59e0b;
  margin-top: 2px;
  direction: rtl;
}

.topic-count {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ================= 2. EXAM ROOM SCREEN ================= */
.exam-topbar {
  background: linear-gradient(135deg, rgba(12, 22, 48, 0.95), rgba(6, 12, 28, 0.98));
  border: 1px solid var(--space-border);
  border-radius: 20px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.exam-info-col h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.exam-info-col span {
  font-size: 12px;
  color: var(--text-nebula);
}

.exam-timer-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: rgba(2, 6, 23, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  border-radius: 99px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.timer-digits {
  font-family: var(--font-display), monospace;
  font-size: 20px;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 1px;
}

.timer-warning {
  border-color: rgba(245, 158, 11, 0.6) !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3) !important;
}

.timer-warning .timer-digits {
  color: #fbbf24 !important;
}

.timer-critical {
  border-color: rgba(239, 68, 68, 0.8) !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.4) !important;
  animation: pulseTimer 1s infinite alternate;
}

.timer-critical .timer-digits {
  color: #f87171 !important;
}

@keyframes pulseTimer {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.btn-finish-exam {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-finish-exam:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.7);
}

/* Horizontal Question Strip (1..30) */
.question-nav-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px 14px;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.question-nav-strip::-webkit-scrollbar {
  height: 6px;
}

.question-nav-strip::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 99px;
}

.nav-pill-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(12, 22, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.nav-pill-btn:hover {
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
}

.nav-pill-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  border-color: var(--cyan) !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
  transform: scale(1.08);
}

.nav-pill-btn.answered {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

/* Question Card Main */
.question-card-main {
  background: linear-gradient(145deg, rgba(12, 22, 48, 0.92) 0%, rgba(6, 12, 28, 0.98) 100%);
  border: 1.5px solid var(--space-border);
  border-radius: 24px;
  padding: 32px 30px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  margin-bottom: 22px;
}

.question-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 10px;
}

.cat-badge {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.q-counter-badge {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Arabic Question Typography */
.arabic-question-text {
  font-family: var(--font-arabic);
  font-size: 28px;
  font-weight: 700;
  line-height: 2.1;
  color: #ffffff;
  text-align: right;
  direction: rtl;
  margin-bottom: 30px;
  padding: 10px 4px;
  letter-spacing: 0.3px;
}

@media (max-width: 640px) {
  .arabic-question-text {
    font-size: 24px;
    line-height: 2;
  }
}

/* 4 Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.option-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: right;
  direction: rtl;
  width: 100%;
}

.option-btn:hover {
  background: rgba(22, 34, 68, 0.85);
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateX(-3px);
}

.option-btn.selected {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.25) 0%, rgba(3, 105, 161, 0.35) 100%) !important;
  border-color: var(--cyan) !important;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.35);
}

.option-letter-badge {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-family: var(--font-arabic);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-btn.selected .option-letter-badge {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #02050e;
  font-weight: 900;
}

.option-text-ar {
  font-family: var(--font-arabic);
  font-size: 22px;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.8;
  flex: 1;
}

/* Exam Bottom Action Nav */
.exam-bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.btn-nav-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-nav-action:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-nav-submit {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.btn-nav-submit:hover {
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.5);
  transform: scale(1.02);
}

/* ================= 3. PREMIUM RESULT SHEET SCREEN (IMAGE 4 ADAPTATION) ================= */
/* ================= 3. PREMIUM RESULT SHEET SCREEN ================= */
.result-premium-sheet {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, rgba(30, 58, 138, 0.32) 0%, rgba(10, 18, 42, 0.96) 45%, rgba(4, 9, 24, 0.99) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 36px;
  padding: 42px 34px;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.9), 0 0 80px rgba(56, 189, 248, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  text-align: center;
  margin-bottom: 30px;
}

.sheet-watermark {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 260px;
  height: 260px;
  pointer-events: none;
  opacity: 0.12;
  color: #38bdf8;
  z-index: 0;
}

.sheet-header {
  position: relative;
  z-index: 1;
  text-align: left;
  margin-bottom: 26px;
}

.sheet-tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.sheet-badge-gold {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 4px 12px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
}

.sheet-badge-verified {
  font-size: 11px;
  font-weight: 800;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 4px 12px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sheet-student-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 60%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
  margin: 6px 0 3px;
  line-height: 1.2;
}

.sheet-date-time {
  font-size: 13px;
  color: var(--text-nebula);
  font-weight: 500;
}

/* Circular Radial Score Gauge */
.radial-gauge-wrapper {
  margin: 12px auto 20px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.radial-gauge-relative {
  position: relative;
  width: 176px;
  height: 176px;
}

.radial-svg {
  width: 176px;
  height: 176px;
  transform: rotate(-90deg);
}

.radial-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 11;
}

.radial-circle-bar {
  fill: none;
  stroke: #38bdf8;
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.5s ease;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.75));
}

.radial-inner-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.radial-big-score {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -1px;
  text-shadow: 0 0 25px rgba(56, 189, 248, 0.6);
}

.radial-ball-lbl {
  font-size: 11.5px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

/* CEFR Badge Pill */
.cefr-badge-container {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.cefr-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 26px;
  border-radius: 99px;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: all 0.3s ease;
}

.cefr-badge-pill.c2 {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.35), rgba(245, 158, 11, 0.45));
  border: 1.5px solid #fbbf24;
  color: #fef08a;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.45);
}

.cefr-badge-pill.c1 {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.35));
  border: 1.5px solid #f59e0b;
  color: #fde68a;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.35);
}

.cefr-badge-pill.b2 {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(2, 132, 199, 0.35));
  border: 1.5px solid #38bdf8;
  color: #e0f2fe;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}

.cefr-badge-pill.b1 {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(79, 70, 229, 0.35));
  border: 1.5px solid #818cf8;
  color: #e0e7ff;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
}

.cefr-badge-pill.a2,
.cefr-badge-pill.a1 {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.3), rgba(71, 85, 105, 0.35));
  border: 1.5px solid #94a3b8;
  color: #f1f5f9;
}

/* Motivational evaluation card */
.result-eval-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 16px;
  padding: 14px 20px;
  margin: 0 auto 26px;
  max-width: 620px;
  text-align: left;
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 1;
}

.result-eval-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.result-eval-text {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.6;
  margin: 0;
  font-weight: 500;
}

/* 5 Key Metrics Grid (Luxury Dashboard Tiles) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.metric-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.85) 0%, rgba(8, 14, 30, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.metric-card.card-correct { border-top: 2.5px solid #10b981; }
.metric-card.card-wrong { border-top: 2.5px solid #f43f5e; }
.metric-card.card-unanswered { border-top: 2.5px solid #f59e0b; }
.metric-card.card-percent { border-top: 2.5px solid #a855f7; }
.metric-card.card-time { border-top: 2.5px solid #38bdf8; }

.metric-icon {
  font-size: 16px;
  margin-bottom: 4px;
}

.metric-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
}

.metric-lbl {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-nebula);
  margin-top: 6px;
  text-transform: uppercase;
}

.text-correct { color: #34d399 !important; }
.text-wrong { color: #fb7185 !important; }
.text-unanswered { color: #fbbf24 !important; }
.text-percent { color: #c084fc !important; }
.text-time { color: #e2e8f0 !important; }

/* CEFR DARAJA SHKALASI */
.cefr-scale-section {
  text-align: left;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.scale-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}

.scale-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #94a3b8;
  text-transform: uppercase;
}

.scale-status-badge {
  font-size: 11.5px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 12px;
  border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.scale-card {
  background: rgba(3, 8, 22, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  transition: all 0.3s ease;
}

.scale-card-level {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  color: #94a3b8;
  margin-bottom: 2px;
}

.scale-card-sub {
  font-size: 10px;
  color: var(--text-nebula);
  margin-bottom: 3px;
  font-weight: 600;
}

.scale-card-range {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

.scale-card.active-level {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.45), rgba(56, 189, 248, 0.35)) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 26px rgba(56, 189, 248, 0.5), inset 0 0 14px rgba(56, 189, 248, 0.2);
  transform: translateY(-3px) scale(1.03);
}

.scale-card.active-level .scale-card-level {
  color: #ffffff !important;
}

.scale-card.active-level .scale-card-sub {
  color: #e0f2fe !important;
}

.scale-card.active-level .scale-card-range {
  color: #bae6fd !important;
  font-weight: 800;
}

/* Action Buttons */
.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.sheet-actions-secondary {
  display: flex;
  gap: 12px;
}

.btn-sheet-retry {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-sheet-retry:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-sheet-home {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-sheet-home:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Mobile & Tablet Responsiveness for Result Sheet */
@media (max-width: 768px) {
  .result-premium-sheet {
    padding: 30px 20px;
    border-radius: 28px;
  }
  .sheet-student-name {
    font-size: 26px;
  }
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .metric-card:nth-child(4) {
    grid-column: span 1;
  }
  .metric-card:nth-child(5) {
    grid-column: span 2;
  }
  .scale-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .result-premium-sheet {
    padding: 20px 12px;
    border-radius: 20px;
  }
  .sheet-student-name {
    font-size: 20px;
  }
  .sheet-tag-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .sheet-badge-gold,
  .sheet-badge-verified {
    font-size: 10px;
    padding: 3px 8px;
  }
  .radial-gauge-relative,
  .radial-svg {
    width: 140px;
    height: 140px;
  }
  .radial-big-score {
    font-size: 36px;
  }
  .cefr-badge-pill {
    font-size: 13px;
    padding: 7px 16px;
  }
  .result-eval-card {
    padding: 10px 12px;
    gap: 6px;
  }
  .result-eval-text {
    font-size: 11.5px;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .metric-card:last-child {
    grid-column: span 2;
  }
  .metric-val {
    font-size: 19px;
  }
  .scale-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }
  .scale-card {
    padding: 8px 3px;
  }
  .scale-card-level {
    font-size: 13px;
  }
  .scale-card-sub {
    display: none;
  }
  .scale-card-range {
    font-size: 9px;
  }
  .sheet-actions-secondary {
    flex-direction: column;
    gap: 8px;
  }

  /* Compact Review Cards for Phones (Image 1 Fix) */
  .review-item {
    padding: 11px 12px;
    margin-bottom: 9px;
    border-radius: 12px;
    border-left-width: 3.5px;
  }
  .review-q-header {
    margin-bottom: 6px;
  }
  .review-badge-status {
    font-size: 11.5px;
  }
  .review-badge-topic {
    font-size: 9.5px;
    padding: 1px 6px;
  }
  .review-q-arabic {
    font-size: 15px;
    line-height: 1.55;
    margin-bottom: 8px;
  }
  .review-answers-grid {
    gap: 6px;
    margin-bottom: 6px;
  }
  .review-ans-card {
    padding: 6px 8px;
    border-radius: 8px;
  }
  .review-ans-label {
    font-size: 9.5px;
    margin-bottom: 1px;
  }
  .review-ans-val {
    font-size: 14px;
    line-height: 1.35;
  }
  .review-explanation {
    padding: 7px 10px;
    font-size: 11px;
    line-height: 1.45;
    border-radius: 8px;
  }
}

/* Question Review Accordion / Cards (Desktop & Standard) */
.review-item {
  background: rgba(12, 22, 46, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 12px;
  text-align: left;
  border-left: 4px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.review-item.correct {
  border-left-color: #10b981;
}

.review-item.wrong {
  border-left-color: #f43f5e;
}

.review-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.review-badge-status {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.2px;
}
.review-badge-status.status-correct {
  color: #34d399;
}
.review-badge-status.status-wrong {
  color: #f87171;
}

.review-badge-topic {
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2.5px 8px;
  border-radius: 99px;
  color: var(--text-nebula);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

.review-q-arabic {
  font-family: var(--font-arabic);
  font-size: 18.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  margin-bottom: 12px;
}

.review-answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.review-ans-card {
  background: rgba(2, 6, 23, 0.7);
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.review-ans-card.ans-card-err {
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.06);
}

.review-ans-card.ans-card-ok,
.review-ans-card.ans-card-correct {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
}

.review-ans-label {
  font-size: 10.5px;
  display: block;
  margin-bottom: 2px;
}
.review-ans-label.label-err {
  color: #f87171;
}
.review-ans-label.label-ok,
.review-ans-label.label-correct {
  color: #34d399;
}

.review-ans-val {
  direction: rtl;
  text-align: right;
  display: block;
  font-family: var(--font-arabic);
  font-size: 16px;
  line-height: 1.4;
}
.review-ans-val.val-err {
  color: #f87171;
}
.review-ans-val.val-ok,
.review-ans-val.val-correct {
  color: #34d399;
}

.review-explanation {
  background: rgba(2, 6, 23, 0.75);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.55;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 14, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: linear-gradient(145deg, rgba(12, 22, 48, 0.98) 0%, rgba(6, 12, 28, 0.99) 100%);
  border: 1px solid var(--space-border);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9), 0 0 50px rgba(56, 189, 248, 0.2);
  text-align: center;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==============================================================================
   COMPREHENSIVE MOBILE RESPONSIVENESS & TOUCH OPTIMIZATION (KARIEV.UZ)
   ============================================================================== */
@media (max-width: 768px) {
  .cosmic-hud {
    position: sticky;
    top: 0;
    margin: 0;
    border-radius: 0 0 18px 18px;
    padding: 10px 14px;
    border-left: none;
    border-right: none;
    border-top: none;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    background: rgba(6, 12, 28, 0.88);
  }

  .hud-left {
    gap: 8px;
  }

  .hud-logo-box {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .hud-logo-box img {
    width: 20px;
    height: 20px;
  }

  .hud-brand-title {
    font-size: 16px;
  }

  .hud-brand-badge {
    font-size: 8.5px;
  }

  .hud-right {
    gap: 6px;
  }

  .hud-student-pill {
    padding: 5px 10px;
    gap: 5px;
  }

  .hud-pill-tag {
    font-size: 10px;
  }

  .hud-pill-id {
    font-size: 12px;
  }

  .hud-pill-name {
    font-size: 11px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-hud-back {
    padding: 5px 10px;
    font-size: 11.5px;
    gap: 4px;
  }

  .main-wrapper {
    margin: 12px auto 40px;
    padding: 0 12px;
  }

  .lobby-hero {
    padding: 14px 4px 18px;
  }

  .hero-pill {
    font-size: 9.5px;
    padding: 4px 10px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
  }

  .arabic-hero-title {
    font-size: 21px;
    line-height: 1.45;
    margin-top: 4px;
    margin-bottom: 4px;
  }

  .lobby-hero h1 {
    font-size: 23px;
    letter-spacing: -0.4px;
    line-height: 1.25;
    margin-bottom: 8px;
  }

  .lobby-hero p {
    font-size: 12.5px;
    line-height: 1.5;
    padding: 0 4px;
  }

  .lobby-highlights-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin: 14px 0 6px;
    width: 100%;
  }

  .hl-capsule {
    width: 100%;
    justify-content: center;
    padding: 6.5px 8px;
    font-size: 11px;
    gap: 5px;
    border-radius: 12px;
  }

  .hl-icon {
    font-size: 13px;
  }

  .tanal-code-entry-card {
    padding: 18px 14px;
    border-radius: 18px;
    margin: 16px 0 24px;
  }

  .tce-header {
    gap: 12px;
    margin-bottom: 14px;
  }

  .tce-icon-bubble {
    width: 42px;
    height: 42px;
    font-size: 20px;
    border-radius: 12px;
  }

  .tce-heading {
    font-size: 17px;
    margin-bottom: 3px;
  }

  .tce-subheading {
    font-size: 12px;
    line-height: 1.4;
  }

  .tce-form {
    flex-direction: column;
    gap: 10px;
  }

  .tce-input-wrapper {
    width: 100%;
  }

  .tce-input-wrapper input {
    padding: 12px 14px 12px 38px;
    font-size: 14px;
    border-radius: 11px;
  }

  .tce-key-icon {
    left: 12px;
    font-size: 14px;
  }

  .tce-submit-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
    border-radius: 11px;
  }

  .public-variants-section-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .pvs-title {
    font-size: 17px;
  }

  .pvs-subtitle {
    font-size: 11.5px;
  }

  .tanal-search-box {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .variants-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .variant-card {
    padding: 18px 15px;
    border-radius: 16px;
  }

  .variant-title {
    font-size: 17px;
  }

  .variant-desc {
    font-size: 12px;
  }

  .variant-meta-row {
    gap: 6px;
    font-size: 11px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }

  .btn-start-variant {
    padding: 12px;
    font-size: 13.5px;
    border-radius: 11px;
  }
}

@media (max-width: 480px) {
  .hud-pill-name {
    display: none;
  }

  .btn-hud-text {
    display: none;
  }

  .hud-brand-badge {
    display: none;
  }

  .hud-brand-title {
    font-size: 15px;
  }

  .btn-hud-back {
    padding: 5px 9px;
  }

  .lobby-hero h1 {
    font-size: 20px;
  }

  .arabic-hero-title {
    font-size: 18px;
  }

  .lobby-highlights-bar {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .hl-capsule {
    padding: 6px;
    font-size: 10.5px;
  }
}
