/* =========================================
   RUNNER.CSS - COMPLETE FIXED VERSION
   ========================================= */

/* --- RESET & VARIABLES --- */
:root {
  --primary: #2563eb;       /* Blue */
  --primary-dark: #1e40af;
  --success: #16a34a;       /* Green */
  --warning: #f59e0b;       /* Yellow/Orange */
  --danger: #dc2626;        /* Red */
  --text: #1f2937;
  --bg: #f3f4f6;
  --white: #ffffff;
  --border: #e5e7eb;
}

/* --- FULL SCREEN OVERLAY (FOCUS MODE) --- */
#txyf_runner {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 99999; /* Always on top */
  display: flex;
  flex-direction: column;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  overflow: hidden; 
}

/* --- TOP BAR (Timer & Info) --- */
.txyf-topbar {
  background: var(--white);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  flex-shrink: 0;
  z-index: 20;
}
.test-title { font-weight: 700; font-size: 18px; color: var(--primary-dark); }
.timer-box {
  background: #eff6ff;
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 700;
  font-family: monospace;
  font-size: 18px;
  border: 1px solid #dbeafe;
}

/* --- MAIN LAYOUT --- */
.txyf-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- LEFT: QUESTION AREA --- */
.txyf-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--white);
  overflow-y: auto; /* Scrollable */
  position: relative;
}

.question-container {
  padding: 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 100px; /* Space for footer */
}

.q-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; border-bottom: 2px solid var(--bg); padding-bottom: 15px;
}
.q-badge {
  background: var(--primary); color: white;
  padding: 5px 12px; border-radius: 6px; font-weight: 600; font-size: 14px;
}
.q-marks { font-size: 13px; color: #6b7280; font-weight: 500; }

.q-text {
  font-size: 18px; line-height: 1.6; font-weight: 600; color: #111827; margin-bottom: 25px;
}
.q-image img {
  max-width: 100%; max-height: 300px; border-radius: 8px; margin-bottom: 20px;
  border: 1px solid var(--border);
}

/* --- PREVIOUS YEAR EXAM TAG --- */
.q-meta-row {
  display: flex;
  justify-content: flex-end; /* Right Side Alignment */
  margin-top: 5px;
  margin-bottom: 20px; /* Gap before options */
  padding-right: 5px;
}

.q-exam-tag {
  background: linear-gradient(135deg, #4f46e5, #7c3aed); /* Purple Gradient */
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 6px rgba(124, 58, 237, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.q-exam-tag::before { content: '🎯'; font-size: 10px; }

/* OPTIONS GRID (2 Columns) */
.options-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px;
}
.opt-label {
  display: flex; align-items: center; gap: 12px;
  padding: 15px; border: 2px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: all 0.2s ease; background: white;
}
.opt-label:hover { border-color: #93c5fd; background: #f0f9ff; }
.opt-label.selected { border-color: var(--primary); background: #eff6ff; box-shadow: 0 4px 12px rgba(37,99,235,0.15); }

.opt-radio {
  width: 20px; height: 20px; border: 2px solid #cbd5e1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.opt-label.selected .opt-radio { border-color: var(--primary); background: var(--primary); }
.opt-label.selected .opt-radio::after { content: ''; width: 8px; height: 8px; background: white; border-radius: 50%; }

.opt-text { font-size: 15px; font-weight: 500; color: #374151; }
.opt-img { max-height: 80px; border-radius: 4px; margin-left: 10px; }

/* --- RIGHT: PALETTE SIDEBAR --- */
.txyf-sidebar {
  width: 300px;
  background: #f8fafc;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.palette-header { padding: 20px; background: white; border-bottom: 1px solid var(--border); font-weight: 700; }
.palette-grid {
  padding: 20px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  overflow-y: auto; align-content: start;
}
.p-btn {
  height: 36px; border-radius: 8px; border: 1px solid #cbd5e1; background: white;
  font-weight: 600; font-size: 13px; cursor: pointer; color: #64748b;
  display: flex; align-items: center; justify-content: center;
}
.p-btn:hover { border-color: var(--primary); color: var(--primary); }
.p-btn.active { border: 2px solid var(--primary); transform: scale(1.1); box-shadow: 0 0 0 2px rgba(37,99,235,0.2); }
.p-btn.answered { background: var(--success); color: white; border-color: var(--success); }
.p-btn.review { background: var(--warning); color: white; border-color: var(--warning); }
.p-btn.visited { background: #e2e8f0; color: #475569; }

/* --- BOTTOM BAR (Buttons) --- */
.txyf-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid var(--border);
  padding: 15px 40px;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 10;
}
.footer-left, .footer-right { display: flex; gap: 12px; }

.btn {
  padding: 12px 24px; border-radius: 10px; font-weight: 600; font-size: 14px;
  cursor: pointer; border: none; transition: transform 0.1s;
  display: flex; align-items: center; gap: 8px;
}
.btn:active { transform: scale(0.98); }

.btn-prev { background: #f1f5f9; color: #475569; }
.btn-clear { background: #fee2e2; color: var(--danger); }
.btn-review { background: #fef3c7; color: #b45309; }
.btn-save { background: var(--success); color: white; box-shadow: 0 4px 12px rgba(22,163,74,0.3); }
.btn-submit { background: var(--danger); color: white; margin-left: auto; }

/* --- RESULT PAGE --- */
.result-box {
  max-width: 600px; margin: 40px auto; text-align: center;
  background: white; padding: 40px; border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  overflow-y: auto; max-height: 90vh;
}
.user-greeting { font-size: 24px; font-weight: 700; color: #1e3a8a; margin-bottom: 5px; }
.rank-badge {
  background: #fef3c7; color: #b45309; padding: 5px 15px; border-radius: 20px;
  font-size: 14px; font-weight: 600; display: inline-block; margin-bottom: 25px;
  border: 1px solid #fcd34d;
}

.score-circle {
  width: 150px; height: 150px; border-radius: 50%;
  background: conic-gradient(var(--success) 0%, #e2e8f0 0%);
  margin: 0 auto 30px; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.score-inner {
  width: 130px; height: 130px; background: white; border-radius: 50%;
  display: flex; flex-direction: column; justify-content: center;
}
.score-val { font-size: 32px; font-weight: 800; color: var(--text); }
.score-label { font-size: 12px; color: #6b7280; text-transform: uppercase; }

.result-stats { display: flex; justify-content: center; gap: 20px; margin-bottom: 30px; }
.stat-item { padding: 15px; background: #f8fafc; border-radius: 12px; width: 100px; }
.stat-val { display: block; font-size: 20px; font-weight: 700; }
.stat-lbl { font-size: 12px; color: #6b7280; }
.st-green { color: var(--success); } .st-red { color: var(--danger); }

/* Buttons Centering Fix */
.result-actions { display: flex; gap: 15px; justify-content: center; margin-top: 30px; }
.btn-home { background: #3b82f6; color: white; }
.btn-exit { background: #64748b; color: white; }
.result-actions .btn { justify-content: center; 
    text-align: center; }

/* Leaderboard */
.leaderboard-box {
  margin-top: 30px; text-align: left; background: #f8fafc;
  padding: 20px; border-radius: 15px; border: 1px solid #e2e8f0;
}
.lb-title { font-size: 16px; font-weight: 700; color: #64748b; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; }

.lb-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; background: white; margin-bottom: 10px; border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02); border: 1px solid transparent;
  transition: transform 0.2s;
}
.lb-item.is-me { border-color: var(--primary); background: #eff6ff; }
.lb-item:hover { transform: translateX(5px); }
.lb-left { display: flex; align-items: center; gap: 12px; }
.lb-number { font-weight: 700; color: #94a3b8; font-size: 14px; width: 20px; }
.lb-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #cbd5e1; color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; position: relative;
}
.lb-rank-1 .lb-avatar::after, .lb-rank-2 .lb-avatar::after, .lb-rank-3 .lb-avatar::after {
  content: '👑'; position: absolute; top: -18px; left: -8px;
  font-size: 24px; transform: rotate(-15deg); filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}
.lb-rank-2 .lb-avatar::after { filter: grayscale(1) brightness(1.2); }
.lb-rank-3 .lb-avatar::after { filter: sepia(1) hue-rotate(-50deg) saturate(3); }
.lb-rank-1 .lb-avatar { background: linear-gradient(135deg, #f59e0b, #d97706); }
.lb-rank-2 .lb-avatar { background: linear-gradient(135deg, #94a3b8, #64748b); }
.lb-rank-3 .lb-avatar { background: linear-gradient(135deg, #d97706, #b45309); }
.lb-name { font-weight: 600; color: #334155; font-size: 15px; }
.lb-score { font-weight: 800; color: var(--primary); }


/* --- START SCREEN (Welcome Overlay) --- */
.start-screen {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: #f0fdf4; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.start-box {
  max-width: 800px; width: 100%;
  background: white; border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 90vh; overflow: hidden;
}
.sb-header {
  padding: 20px 30px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.sb-title { font-size: 22px; font-weight: 800; color: #1e3a8a; }
.sb-body { flex: 1; padding: 30px; overflow-y: auto; background: #f9fafb; }
.lang-row { margin-bottom: 20px; text-align: right; }
.lang-select {
  padding: 8px 15px; border-radius: 8px; border: 1px solid #cbd5e1;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.instruction-content {
  background: white; padding: 25px; border-radius: 12px;
  border: 1px solid #e2e8f0; font-size: 15px; line-height: 1.7; color: #334155;
  text-align: left;
}
.instruction-content h3 { margin-top: 0; color: var(--primary); }
.instruction-content ul { padding-left: 20px; margin: 10px 0; }
.instruction-content li { margin-bottom: 8px; }
.sb-footer {
  padding: 20px 30px; background: white; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px;
}
.name-input-group { flex: 1; text-align: left; }
.name-input-group label { display: block; font-size: 13px; font-weight: 700; color: #64748b; margin-bottom: 5px; }
.sb-input {
  width: 100%; padding: 12px; border: 2px solid #e2e8f0; border-radius: 8px;
  font-size: 16px; font-weight: 600; outline: none;
}
.sb-input:focus { border-color: var(--primary); }
.btn-start-final {
  padding: 14px 40px; background: var(--primary); color: white;
  font-size: 16px; font-weight: 700; border-radius: 10px; border: none;
  cursor: pointer; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
  transition: transform 0.2s; white-space: nowrap;
}
.btn-start-final:hover { transform: translateY(-2px); background: var(--primary-dark); }

/* Hide Test Interface Initially */
.txyf-interface { display: none; height: 100%; flex-direction: column; flex: 1; }
.txyf-interface.active { display: flex; }

/* Language Select inside Test Topbar */
.txyf-lang-switch {
  margin-right: 15px; padding: 5px 10px; border-radius: 6px;
  border: 1px solid #dbeafe; font-size: 13px; font-weight: 600;
  color: #1e40af; background: #eff6ff; cursor: pointer; outline: none;
}

/* --- SOLUTION MODE STYLES --- */
.opt-label.correct-ans {
  border-color: var(--success); background: #f0fdf4; position: relative;
}
.opt-label.correct-ans::after { content: '✅'; position: absolute; right: 15px; font-size: 16px; }
.opt-label.wrong-ans {
  border-color: var(--danger); background: #fef2f2; position: relative; opacity: 0.8;
}
.opt-label.wrong-ans::after { content: '❌'; position: absolute; right: 15px; font-size: 16px; }
.explanation-box {
  margin-top: 25px; background: #fffbeb; border: 1px solid #fcd34d;
  border-radius: 12px; padding: 20px; animation: fadeIn 0.3s ease-in;
}
.exp-title {
  font-weight: 700; color: #b45309; font-size: 14px;
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 8px;
}
.exp-text { font-size: 15px; line-height: 1.6; color: #1f2937; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.btn-solution { background: #8b5cf6; color: white; }

/* --- EXAM CARD COMPACT (Grid) --- */
.txyf-compact-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; width: 100%; box-sizing: border-box; padding-bottom: 20px;
}
.txyf-card-compact {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 12px; display: flex; flex-direction: column; justify-content: space-between;
    text-decoration: none !important; transition: transform 0.2s, box-shadow 0.2s;
    min-height: 110px; box-shadow: 0 1px 2px rgba(0,0,0,0.03); position: relative;
}
.txyf-card-compact:hover { transform: translateY(-3px); box-shadow: 0 8px 16px rgba(0,0,0,0.08); border-color: #cbd5e1; }
.tc-row-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tc-exam-info { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; color: #64748b; text-transform: uppercase; }
.tc-exam-info img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }
.tc-badges { display: flex; gap: 4px; }
.tc-badge { font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 4px; line-height: 1; }
.tc-new { background: #dcfce7; color: #15803d; }
.tc-done { background: #e0f2fe; color: #0369a1; display: none; }
.txyf-card-compact.is-attempted .tc-done { display: inline-block; }
.txyf-card-compact.is-attempted .tc-new { display: none; }
.tc-row-mid { margin-bottom: 12px; flex-grow: 1; }
.tc-title { font-size: 14px; font-weight: 700; color: #0f172a; line-height: 1.3; margin: 0; text-align: left; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-row-bot { display: flex; justify-content: space-between; align-items: flex-end; border-top: 1px dashed #f1f5f9; padding-top: 8px; }
.tc-meta-left { display: flex; flex-direction: column; gap: 2px; font-size: 10px; font-weight: 600; color: #64748b; text-align: left; }
.tc-meta-right { text-align: right; }
.tc-users { font-size: 10px; font-weight: 700; color: #4f46e5; background: #eef2ff; padding: 3px 6px; border-radius: 4px; }

/* Tablet Grid */
@media (max-width: 1024px) {
    .txyf-compact-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}


/* =========================================
   MOBILE MASTER FIX (APP-LIKE LAYOUT)
   ========================================= */
@media (max-width: 768px) {

  /* 1. LAYOUT STRUCTURE (Full Height, No Body Scroll) */
  #txyf_runner {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    height: 100vh; /* Full Screen */
    display: flex; flex-direction: column; overflow: hidden;
  }

  /* 2. TOP BAR (Fixed Top) */
  .txyf-topbar {
    flex-shrink: 0; height: 50px; padding: 0 10px; z-index: 20;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  .test-title { 
    font-size: 14px; flex: 1; /* Title Takes space */
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; 
    max-width: unset;
  }
  .txyf-lang-switch { flex-shrink: 0; font-size: 11px; padding: 4px 8px; }
  .timer-box { font-size: 13px; padding: 4px 8px; margin-left: auto; display: none; } /* Timer header se hata diya agar dense ho */

  /* 3. MAIN CONTENT AREA (Scrollable Middle) */
  .txyf-layout { flex: 1; position: relative; overflow: hidden; }
  .txyf-main {
    height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; 
    background: #fff; padding-bottom: 80px; /* Footer Overlap Fix */
  }
  .question-container {
    padding: 15px; padding-bottom: 100px; /* Extra safe space */
    width: 100%; max-width: 100%;
  }

  /* 4. CONTENT STYLING */
  .q-text { font-size: 16px; line-height: 1.5; margin-bottom: 15px; color: #111827; }
  .q-image img { max-width: 100%; height: auto; border-radius: 6px; }

  /* 5. OPTIONS (Radio + Text Fix) */
  .options-grid { grid-template-columns: 1fr; gap: 10px; }
  .opt-label {
    display: grid; grid-template-columns: 24px 1fr; gap: 12px;
    align-items: flex-start; padding: 12px; background: #fff;
  }
  .opt-radio { margin-top: 2px; width: 20px; height: 20px; }
  .opt-text { font-size: 15px; line-height: 1.4; word-break: break-word; }

  /* 6. FOOTER (Fixed Bottom) */
  .txyf-footer {
    flex-shrink: 0; position: relative; padding: 10px; height: auto;
    background: white; border-top: 1px solid #e5e7eb;
    display: flex; justify-content: space-between; gap: 10px; z-index: 20;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  .btn { flex: 1; padding: 10px 5px; font-size: 13px; justify-content: center; border-radius: 8px; white-space: nowrap; }
  .btn-clear { display: none; } /* Hide Clear */
  .footer-left { display: none; } /* Hide Left buttons to save space */
  .footer-right { width: 100%; display: flex; gap: 8px; }
  .btn-submit { background: #dc2626; color: white; flex: 0.8; }
  .btn-save { flex: 1.5; }

  /* 7. DRAWER & START SCREEN */
  .txyf-sidebar {
    position: absolute; top: 0; right: 0; bottom: 0; width: 85%;
    background: #f8fafc; z-index: 50; transform: translateX(100%);
    transition: transform 0.3s ease; box-shadow: -5px 0 15px rgba(0,0,0,0.1);
  }
  .txyf-sidebar.open { transform: translateX(0); }
  
  .palette-toggle {
    display: flex !important; position: fixed; bottom: 80px; right: 15px;
    width: 45px; height: 45px; background: #1e293b; color: white;
    border-radius: 50%; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 30; font-size: 20px;
  }

  /* Grid Fix Mobile */
  .txyf-compact-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .txyf-card-compact { padding: 10px; min-height: 110px; }
  
  /* Start Screen Mobile */
  .sb-footer { flex-direction: column; padding: 20px; }
  .btn-start-final { width: 100%; }
}
/* =========================================
   MOBILE FINAL FIX (Footer Buttons & Scroll)
   ========================================= */
@media (max-width: 768px) {

  /* 1. App-Like Layout */
  #txyf_runner {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    height: 100%; /* 100% prevents address bar issues */
    display: flex; flex-direction: column; overflow: hidden;
  }

  /* 2. Top Bar */
  .txyf-topbar {
    padding: 0 10px;
    height: 50px;
    gap: 10px;
}

.test-title {
    font-size: 13px;
    /* Title ko limit karo taaki Timer ke liye jagah bache */
    width: 120px; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
  .txyf-lang-switch { flex-shrink: 0; font-size: 11px; padding: 4px 8px; }
  .timer-box {
    display: flex !important; /* Isko wapas laane ke liye */
    align-items: center;
    font-size: 13px;
    padding: 4px 8px;
    margin-left: auto; /* Right side me chipkane ke liye */
    background: #eff6ff;
    border-radius: 4px;
    height: 30px;
}

  /* 3. Main Scroll Area (Important Fix for Footer Overlap) */
  .txyf-layout { flex: 1; position: relative; overflow: hidden; }
  
  .txyf-main {
    height: 100%; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    background: #fff;
    /* Footer ki height (60px) + thoda extra gap */
    padding-bottom: 80px !important; 
  }

  .question-container {
    padding: 15px;
    width: 100%; max-width: 100%;
    /* Extra padding taaki last line footer ke piche na chupe */
    padding-bottom: 50px; 
  }

  /* 4. FOOTER (Fixed Bottom & Visible Buttons) */
  .txyf-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 8px 12px;
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 10px; 
    z-index: 999; /* Sabse upar */
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
  }

  /* Button Visibility Fix */
  .footer-left { 
    display: flex !important; /* Previous button wapas laye */
    flex: 1;
  }
  .footer-right { 
    display: flex !important; 
    flex: 1; justify-content: flex-end; gap: 8px;
  }

  /* Button Styling */
  .btn { 
    padding: 10px 15px; 
    font-size: 13px; 
    border-radius: 8px; 
    white-space: nowrap; 
  }
  
  /* Sirf 'Clear' button chupao, 'Previous' dikhao */
  .btn-clear { display: none !important; } 
  .btn-prev { background: #f1f5f9; color: #475569; margin-right: auto; } /* Prev Left me */

  /* 5. Options */
  .options-grid { grid-template-columns: 1fr; gap: 10px; }
  .opt-label {
    display: grid; grid-template-columns: 24px 1fr; gap: 10px;
    align-items: flex-start; padding: 12px; background: #fff;
  }
  .opt-radio { margin-top: 3px; width: 18px; height: 18px; }
  .opt-text { font-size: 15px; line-height: 1.4; }

  /* 6. Sidebar & Palette Toggle */
  .txyf-sidebar {
    position: fixed; top: 0; right: 0; bottom: 0; width: 85%;
    background: #f8fafc; z-index: 1000; transform: translateX(100%);
    transition: transform 0.3s; box-shadow: -5px 0 20px rgba(0,0,0,0.2);
  }
  .txyf-sidebar.open { transform: translateX(0); }
  
  /* Toggle button Footer ke upar */
  .palette-toggle {
    display: flex !important;
    position: fixed; bottom: 75px; right: 15px;
    width: 45px; height: 45px; background: #1e293b; color: white;
    border-radius: 50%; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 998;
  }
  
  /* Grid Fix */
  .txyf-compact-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .txyf-card-compact { padding: 10px; min-height: 110px; }
  .sb-footer { flex-direction: column; padding: 20px; }
  .btn-start-final { width: 100%; }
}
/* =========================================
   RESULT DASHBOARD ANIMATIONS & DESIGN
   ========================================= */

/* 1. Rank Badge Design (Top & Center) */
.rank-badge-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    margin-top: -10px; /* Thoda upar adjust */
}

.rank-badge {
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%); /* Gold Gradient */
    color: #92400e;
    padding: 8px 25px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(253, 185, 49, 0.4);
    border: 2px solid #fff;
    position: relative;
    overflow: hidden;
}

/* Shine Effect on Badge */
.rank-badge::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shine 2s infinite;
}

/* 2. Keyframe Animations */
@keyframes cardEntry {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

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

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* 3. Applying Animations */
.anim-card { animation: cardEntry 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.anim-bounce { animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s both; }
.anim-pop { animation: popIn 0.6s ease-out 0.4s both; }
.anim-fade-up { animation: fadeInUp 0.6s ease-out 0.5s both; }

/* Staggered Delay for Stats */
.anim-delay-1 { animation: fadeInUp 0.5s ease-out 0.6s both; }
.anim-delay-2 { animation: fadeInUp 0.5s ease-out 0.7s both; }
.anim-delay-3 { animation: fadeInUp 0.5s ease-out 0.8s both; }

/* 4. Score Circle Pulse Effect */
.score-circle {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(37, 99, 235, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
/* GLOBAL INSTRUCTION FIX */
.instruction-content ul, 
.instruction-content ol {
    margin-left: 20px !important; /* Left margin force karega */
    padding-left: 15px !important;
    list-style-position: outside !important; /* Number content ke bahar rahenge */
}

.instruction-content li {
    padding-left: 5px;
    margin-bottom: 5px;
}

/* single quiz styling */
/* --- SINGLE QUIZ CARD STYLING --- */

/* 1. Main Card Body */
.ca-card-wrap {
    background: transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ca-card-inner {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden; /* Image ko round rakhne ke liye */
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Hover Effect (Card Upar Uthega) */
.ca-card-wrap:hover .ca-card-inner {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.15); /* Blue Shadow Glow */
    border-color: #2563eb;
}

/* 2. Image Area */
.ca-img-box {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
}

.ca-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* Image Zoom on Hover */
.ca-card-wrap:hover .ca-img-box img {
    transform: scale(1.08);
}

/* 3. Content Area */
.ca-body-box {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Category Badge (Example: HISTORY) */
.sub-cat-btn {
    background: #eff6ff;
    color: #2563eb;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    align-self: flex-start;
}

/* Title Styling */
.ca-title-main {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.4;
    transition: color 0.2s;
}

.ca-card-wrap:hover .ca-title-main {
    color: #2563eb; /* Title Blue ho jayega hover par */
}

/* 4. Footer (Date & Arrow Button) */
.ca-footer-info {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ca-date-txt {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

/* The Arrow Button (➜) */
.info-btn {
    width: 35px;
    height: 35px;
    background: #f8fafc;
    color: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.ca-card-wrap:hover .info-btn {
    background: #2563eb;
    color: #ffffff;
    transform: rotate(-45deg); /* Arrow thoda ghumega style ke liye */
    border-color: #2563eb;
}
/* --- SEO CONTENT BOX DESIGN --- */
.txyf-seo-box { margin-top: 25px; padding-top: 20px; border-top: 1px dashed #e5e7eb; }
.seo-inner-content { font-family: 'Inter', sans-serif; color: #374151; line-height: 1.6; font-size: 15px; text-align: left; }

/* Headings */
.seo-inner-content h2 { font-size: 18px; font-weight: 800; color: #1e293b; margin: 25px 0 15px; border-left: 4px solid #2563eb; padding-left: 12px; }
.seo-inner-content h3 { font-size: 16px; font-weight: 700; color: #4b5563; margin: 20px 0 10px; }

/* Tables (Scrollable) */
.seo-inner-content table { width: 100%; border-collapse: collapse; margin: 15px 0; min-width: 300px; }
.seo-inner-content th { background: #f8fafc; color: #1f2937; padding: 10px; border: 1px solid #e5e7eb; font-weight: 700; font-size: 13px; text-transform: uppercase; }
.seo-inner-content td { padding: 10px; border: 1px solid #e5e7eb; font-size: 14px; }

/* Lists */
.seo-inner-content ul { padding-left: 20px; list-style: none; }
.seo-inner-content li { position: relative; margin-bottom: 8px; padding-left: 20px; }
.seo-inner-content li::before { content: '✔'; position: absolute; left: 0; color: #16a34a; font-weight: bold; }

/* Links */
.txyf-link-chip { display: inline-block; background: #eff6ff; color: #2563eb; padding: 4px 10px; border-radius: 20px; text-decoration: none; font-weight: 600; font-size: 13px; margin: 2px; }
.txyf-link-chip:hover { background: #2563eb; color: #fff; }

/* Ad Box */
.txyf-ad-box { margin: 20px 0; padding: 10px; background: #fff1f2; border: 1px dashed #be123c; border-radius: 8px; text-align: center; }