/* =========================================================
   MIND SPRINT — STYLE SHEET
   Palette: deep-space navy base, cyan/violet duo-tone accent,
   gold as the single "reward" color so wins actually pop.
   Type: Sora for UI/body, Space Grotesk for numerals & display,
   Noto Sans Gurmukhi for Punjabi question text.
   ========================================================= */

:root {
  --bg: #060b16;
  --bg-gradient:
    radial-gradient(circle at 85% 8%, rgba(124, 58, 237, 0.28), transparent 42%),
    radial-gradient(circle at 12% 92%, rgba(24, 215, 242, 0.16), transparent 42%),
    #060b16;

  --panel-glass: rgba(15, 34, 58, 0.72);
  --panel-glass-solid: rgba(15, 34, 58, 0.92);
  --panel-border: rgba(180, 210, 240, 0.14);
  --panel-glow: 0 18px 44px rgba(0, 0, 0, 0.45);

  --cyan: #22d3ee;
  --cyan-glow: rgba(34, 211, 238, 0.4);
  --blue: #3b82f6;
  --purple: #7c3aed;
  --gold: #ffc736;
  --gold-glow: rgba(255, 199, 54, 0.45);
  --orange: #ff7a30;
  --green: #12c48b;
  --red: #f0475a;

  --text-main: #f4f8fc;
  --text-muted: #8ea0b8;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  min-height: 100dvh;
  width: 100%;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Sora', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Visible, deliberate focus ring everywhere interactive */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 8px;
}

#sparkleCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px 50px;
  min-height: calc(100vh - 45px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 10;
  flex: 1;
}

.hidden { display: none !important; }
.mobile-only { display: none !important; }

/* ---------- Glass panels ---------- */
.glass-card {
  background: var(--panel-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-glow);
  width: 100%;
}

.screen-fade {
  animation: fadeInUp 0.45s var(--ease) both;
  width: 100%;
}

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

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Achievement toast ---------- */
.achievement-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #0b1220;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: 50px;
  box-shadow: 0 12px 30px var(--gold-glow);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-toast.show { transform: translateX(-50%) translateY(0); }
.toast-icon { font-size: 20px; }

/* ---------- Branding ---------- */
.brand-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  background: linear-gradient(100deg, var(--cyan), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.01em;
}

.eyebrow {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
}

/* ================= LOGIN SCREEN ================= */
.login-layout {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 32px;
  min-height: 80vh;
  width: 100%;
}

.login-box { width: 100%; max-width: 480px; padding: 44px 32px; text-align: center; }
.login-lb-box { width: 100%; max-width: 550px; padding: 24px; }

.logo-container {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.22), transparent 70%);
  display: grid;
  place-items: center;
  animation: pulseGlow 3.2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px var(--cyan-glow)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 20px var(--cyan-glow)); }
}

.login-title { font-size: 42px; margin-bottom: 2px; }

.school-tag {
  font-size: 19px;
  color: var(--cyan);
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}

.login-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #bae6fd;
  margin-bottom: 24px;
}

.input-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 14px; }

.login-input {
  width: 100%;
  height: 58px;
  border-radius: var(--radius-md);
  border: 2px solid var(--panel-border);
  background: rgba(7, 18, 32, 0.85);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.login-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.18);
}

.btn-primary, .btn-secondary, .btn-danger {
  width: 100%;
  height: 58px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.35);
}

.btn-secondary {
  border: 2px solid var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  color: var(--cyan);
  margin-top: 14px;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #99182b);
  color: #fff;
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.3);
}

.btn-primary:active, .btn-secondary:active, .btn-danger:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.status-msg {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  min-height: 20px;
}

/* ================= WELCOME SCREEN ================= */
.welcome-box { max-width: 650px; margin: 0 auto; padding: 32px 28px; text-align: center; }
.welcome-name { font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; color: var(--cyan); margin: 8px 0; }
.welcome-details { color: var(--text-muted); font-size: 16px; margin-bottom: 24px; }

.stats-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

.stat-card-preview {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card-preview .title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card-preview .value { font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; color: var(--gold); margin-top: 4px; }

.record-holder-meta { font-size: 12px; color: var(--cyan); margin-top: 4px; font-weight: 600; line-height: 1.3; white-space: pre-line; }

/* ================= QUIZ PLAY SCREEN ================= */
.quiz-container { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.quiz-top-branding { text-align: center; margin-bottom: 2px; }
.quiz-top-branding h2 { font-size: 24px; }
.quiz-top-branding p { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.06em; line-height: 1.3; }
.quiz-top-branding .school-name-top { font-size: 15px; color: var(--cyan); font-weight: 700; }

.quiz-header { padding: 12px 20px; display: flex; flex-direction: column; gap: 10px; width: 100%; }

.quiz-header-top {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  gap: 12px;
}

.student-badge { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.student-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  display: grid;
  place-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3);
  flex-shrink: 0;
}

.student-info h3 { font-size: 17px; font-weight: 700; color: var(--text-main); text-transform: uppercase; word-wrap: break-word; }
.student-info p { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.helplines-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1 1 auto; margin: 0 10px; }
.helpline-warning { text-align: center; font-size: 12px; color: var(--orange); font-weight: 700; margin-bottom: 6px; }
.helplines-container { display: flex; justify-content: center; gap: 10px; flex-wrap: nowrap; width: 100%; }

.helpline-btn {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  border: 1px solid var(--panel-border);
  color: white;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
  transition: transform 0.2s var(--ease), filter 0.2s ease;
  flex: 1;
  max-width: 120px;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .helpline-btn:hover:not(:disabled) { transform: scale(1.05); filter: brightness(1.1); }
}
.helpline-btn:active:not(:disabled) { transform: scale(0.95); }
.helpline-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.helpline-btn.glow { animation: emergencyGlow 0.8s infinite alternate; border-color: var(--gold); }
@keyframes emergencyGlow { from { box-shadow: 0 0 5px var(--gold-glow); } to { box-shadow: 0 0 20px var(--gold); } }

.scores-row { display: flex; gap: 10px; align-items: center; flex: 0 0 auto; }

.score-chip { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--panel-border); padding: 6px 14px; border-radius: 12px; text-align: center; min-width: 85px; }
.score-chip .chip-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.score-chip .chip-val { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; color: var(--gold); }
.score-chip.live-score .chip-val { color: var(--cyan); transition: transform 0.2s ease, color 0.3s ease; }

.record-details-banner {
  width: 100%;
  text-align: center;
  background: rgba(255, 199, 54, 0.1);
  border: 1px solid rgba(255, 199, 54, 0.3);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  word-wrap: break-word;
}
.record-details-banner b { color: #fff; }

.quiz-meta-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 20px; width: 100%; }
.q-counter { font-size: 15px; font-weight: 700; color: var(--text-muted); flex: 1; font-family: 'Space Grotesk', sans-serif; }
.q-counter span { font-size: 22px; color: #fff; }

.timer-wrap { position: relative; width: 60px; height: 60px; display: grid; place-items: center; flex: 0 0 60px; margin: 0 auto; }
.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-circle-bg { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 5; }
.timer-circle-progress {
  fill: none; stroke: var(--cyan); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 175.9; stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}
.timer-digit { position: absolute; font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; color: #fff; }

.points-tag { text-align: right; flex: 1; }
.points-tag .badge { display: inline-block; padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-low { background: rgba(18, 196, 139, 0.2); color: var(--green); border: 1px solid var(--green); }
.badge-mod { background: rgba(255, 199, 54, 0.2); color: var(--gold); border: 1px solid var(--gold); }
.badge-high { background: rgba(240, 71, 90, 0.2); color: var(--red); border: 1px solid var(--red); }
.points-tag .pts { font-size: 13px; font-weight: 700; color: var(--gold); margin-top: 2px; }

.progress-track { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--purple)); border-radius: 10px; transition: width 0.35s ease; }

.question-card { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; width: 100%; }

.question-en {
  font-size: clamp(19px, 2.8vw, 29px);
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
  text-align: center;
  overflow-wrap: break-word;
}

.question-pa {
  font-family: 'Noto Sans Gurmukhi', sans-serif;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 700;
  line-height: 1.4;
  color: #bae6fd;
  text-align: center;
  margin-top: -4px;
  overflow-wrap: break-word;
}

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; width: 100%; }

.option-btn {
  min-height: 58px;
  height: auto;
  padding: 10px 16px;
  background: rgba(12, 27, 47, 0.85);
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s var(--ease), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  width: 100%;
  font-family: inherit;
}

@media (hover: hover) and (pointer: fine) {
  .option-btn:hover { border-color: var(--orange); background: rgba(255, 122, 48, 0.12); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(255, 122, 48, 0.2); }
}
.option-btn:active { transform: scale(0.98); }

.opt-letter {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  background: rgba(255, 255, 255, 0.08); color: var(--gold);
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px;
  display: grid; place-items: center;
}

.opt-text { flex: 1 1 auto; line-height: 1.25; font-family: 'Noto Sans Gurmukhi', 'Sora', sans-serif; overflow-wrap: break-word; }

.option-btn.correct {
  border-color: var(--green) !important;
  background: rgba(18, 196, 139, 0.25) !important;
  color: #fff;
  box-shadow: 0 0 25px rgba(18, 196, 139, 0.4);
  animation: correctPulse 0.4s ease;
  pointer-events: none;
}
.option-btn.correct .opt-letter { background: var(--green); color: #060e1a; }

.option-btn.wrong { border-color: var(--red) !important; background: rgba(240, 71, 90, 0.25) !important; animation: wrongShake 0.4s ease; }
.option-btn.wrong .opt-letter { background: var(--red); color: #fff; }

@keyframes correctPulse { 0% { transform: scale(0.96); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes wrongShake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.feedback-banner { min-height: 24px; text-align: center; font-size: 18px; font-weight: 700; }

/* ================= LOGIN LEADERBOARD ================= */
.lb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.lb-header h2 { font-size: 19px; font-weight: 700; color: var(--cyan); display: flex; align-items: center; gap: 8px; }

.btn-refresh-lb {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  font-family: inherit;
}

.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { color: var(--gold); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 8px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.lb-table td { padding: 10px 8px; font-size: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.lb-table tr.my-row { background: rgba(255, 122, 48, 0.15); border-left: 4px solid var(--orange); }
.lb-empty { text-align: center; color: var(--text-muted); }

.rank-cell { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; width: 45px; text-align: center; }
.student-cell .s-name { font-weight: 700; display: block; }
.student-cell .s-meta { font-size: 11px; color: var(--text-muted); }

/* ================= RESULT SCREEN ================= */
.result-box { max-width: 650px; margin: 0 auto; padding: 40px 24px; text-align: center; width: 100%; }
.result-trophy { font-size: 60px; animation: pulseGlow 2.5s infinite ease-in-out; }
.result-title { font-family: 'Space Grotesk', sans-serif; font-size: 32px; font-weight: 700; margin: 10px 0 6px; color: var(--cyan); }
.result-student-meta { color: var(--text-muted); font-size: 16px; font-weight: 600; }

.result-score-highlight {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(58px, 8vw, 88px);
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin: 16px 0;
  text-shadow: 0 0 30px var(--gold-glow);
}

.result-msg { font-size: 18px; color: var(--text-muted); margin-bottom: 24px; }
.result-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.result-actions button { flex: 1; min-width: 200px; max-width: 260px; }

/* ================= FOOTER ================= */
.app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: rgba(4, 10, 20, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; justify-content: center; align-items: center;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  z-index: 100;
}
.app-footer .heart { display: inline-block; color: #ff3b69; margin: 0 4px; font-size: 15px; animation: heartbeat 1.5s infinite; }
.app-footer a { color: var(--cyan); text-decoration: none; font-weight: 700; margin-left: 4px; transition: color 0.2s ease; }
.app-footer a:hover { color: var(--gold); }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(1); }
  45% { transform: scale(1.25); }
  60% { transform: scale(1); }
}

/* ================= RESPONSIVE ================= */
@media screen and (max-width: 992px) {
  .app-container { padding: 4px 4px 45px; gap: 6px; }

  .mobile-only { display: block !important; }
  #loginBoxContainer.hidden-mobile { display: none !important; }
  #loginLbContainer { display: none; }
  #loginLbContainer.active-mobile { display: block !important; }

  .login-layout { flex-direction: column; gap: 12px; }
  .login-lb-box { max-width: 100%; padding: 16px 10px; }

  .lb-header h2 { font-size: 22px; }
  .btn-refresh-lb { font-size: 15px; padding: 10px 16px; }
  .lb-table th { font-size: 15px; padding: 14px 10px; }
  .lb-table td { font-size: 17px; padding: 14px 10px; }
  .rank-cell { font-size: 20px; }
  .student-cell .s-name { font-size: 17px; }
  .student-cell .s-meta { font-size: 13px; }

  /* ---------- Quiz screen: fit the whole play area in one viewport,
     no scrolling needed to reach the options. ---------- */

  /* Reclaim the footer's strip while a question is on screen. */
  body.quiz-active .app-footer { display: none; }
  body.quiz-active .app-container { padding-bottom: 4px; }

  #quizScreen { display: flex; }
  #quizScreen .quiz-container {
    height: calc(100dvh - 8px);
    max-height: calc(100dvh - 8px);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
  }

  .quiz-top-branding { flex: 0 0 auto; margin-bottom: 0; }
  .quiz-top-branding h2 { font-size: 19px; }
  .quiz-top-branding p { display: none; } /* decorative tagline — cut to buy vertical room while playing */

  .quiz-header { flex: 0 0 auto; padding: 6px 8px; gap: 4px; }

  .quiz-header-top { flex-wrap: nowrap; gap: 6px; align-items: center; }
  .student-badge { order: 1; flex: 1 1 auto; min-width: 0; gap: 6px; }
  .scores-row { order: 2; flex: 0 0 auto; gap: 5px; }

  .student-avatar { width: 34px; height: 34px; font-size: 15px; }
  .student-info { min-width: 0; }
  .student-info h3,
  .student-info p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 32vw;
  }
  .student-info h3 { font-size: 14px; }
  .student-info p { font-size: 10px; }

  /* Compact, fixed-width chips so "Your best" / "Current score" never wrap or overflow. */
  .score-chip { min-width: 0; width: 64px; padding: 4px 2px; border-radius: 10px; }
  .score-chip .chip-label { font-size: 8px; line-height: 1.1; white-space: normal; }
  .score-chip .chip-val { font-size: 16px; }

  .helplines-wrapper {
    order: 3; flex: 0 0 auto; margin: 2px 0 0 0; padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }
  .helpline-warning { font-size: 11px; margin-bottom: 4px; }
  .helplines-container { gap: 6px; width: 100%; flex-wrap: nowrap; }
  .helpline-btn { font-size: 12px; padding: 6px 4px; flex: 1 1 auto; max-width: none; }

  .record-details-banner { display: none; } /* revisited on the welcome screen already — cut here to save a row */

  .quiz-meta-bar { flex: 0 0 auto; padding: 4px 10px; gap: 6px; }
  .q-counter { font-size: 12px; }
  .q-counter span { font-size: 17px; }
  .timer-wrap { width: 40px; height: 40px; flex: 0 0 40px; }
  .timer-digit { font-size: 14px; }
  .points-tag .badge { font-size: 10px; padding: 3px 9px; }
  .points-tag .pts { font-size: 11px; }

  .progress-track { flex: 0 0 auto; height: 4px; }

  /* The question card takes all remaining height and lays itself out
     so the options are always visible — text scales down on short
     screens via the vh term in each clamp(). */
  .question-card {
    flex: 1 1 auto;
    min-height: 0;
    padding: 8px 8px;
    justify-content: center;
    gap: 6px;
    overflow-y: auto; /* safety net only — sizing below is tuned to avoid needing it */
  }

  .question-en {
    font-size: clamp(15px, 4.2vw + 1.6vh, 24px);
    line-height: 1.2;
    margin-bottom: 0;
  }
  .question-pa {
    font-size: clamp(14px, 3.6vw + 1.4vh, 21px);
    line-height: 1.25;
    margin-top: 0;
  }

  .options-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
    flex: 1 1 auto;
    min-height: 0;
    justify-content: center;
  }
  .option-btn {
    flex: 1 1 0;
    min-height: 38px;
    max-height: 68px;
    padding: 6px 12px;
    font-size: clamp(13px, 3vw + 0.8vh, 18px);
    border-radius: 12px;
    white-space: normal;
    gap: 8px;
  }
  .opt-letter { width: 26px; height: 26px; font-size: 13px; flex-shrink: 0; }

  .feedback-banner { min-height: 16px; font-size: 14px; flex: 0 0 auto; }
}

@media screen and (max-width: 400px) {
  .student-info h3 { font-size: 13px; }
  .score-chip { width: 56px; }
  .score-chip .chip-val { font-size: 14px; }
  .timer-wrap { width: 36px; height: 36px; flex: 0 0 36px; }
  .timer-digit { font-size: 13px; }
  .helpline-btn { font-size: 11px; padding: 5px 2px; }
  .option-btn { min-height: 34px; padding: 5px 10px; }
  .opt-letter { width: 22px; height: 22px; font-size: 12px; }
}

/* Extra-short viewports (small phones in landscape, split screen, etc.):
   shrink the branding row further and tighten gaps a bit more. */
@media screen and (max-width: 992px) and (max-height: 620px) {
  .quiz-top-branding { display: none; }
  .quiz-header { padding: 4px 8px; }
  .student-avatar { width: 28px; height: 28px; font-size: 13px; }
  .score-chip { padding: 3px 2px; }
  .quiz-meta-bar { padding: 3px 8px; }
  .timer-wrap { width: 34px; height: 34px; flex: 0 0 34px; }
  .option-btn { min-height: 32px; }
}
