/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0b0f19;
  --bg-card: #151a2a;
  --bg-card-solid: #151a2a;
  --accent: #7f5af0;
  --accent-glow: rgba(127, 90, 240, 0.35);
  --accent-light: #9f7aea;
  --primary: #7f5af0;
  --surface: rgba(255, 255, 255, 0.08);
  --bg-body: rgba(255, 255, 255, 0.02);
  --font-heading: 'Inter', system-ui, sans-serif;
  --green: #2cb67d;
  --green-glow: rgba(44, 182, 125, 0.25);
  --red: #e45858;
  --red-glow: rgba(228, 88, 88, 0.25);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
  
  /* Component styles */
  --bg-option: rgba(255, 255, 255, 0.04);
  --border-option: rgba(255, 255, 255, 0.1);
  --bg-option-hover: rgba(127, 90, 240, 0.08);
  --bg-key: rgba(255, 255, 255, 0.07);
  --bg-badge: rgba(255, 255, 255, 0.07);
  --bg-spinner: rgba(255, 255, 255, 0.1);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px 40px;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(127, 90, 240, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(44, 182, 125, 0.1), transparent);
  transition: background-color 0.22s ease, color 0.22s ease;
}

/* ── Header / Branding ────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 20px 0 24px;
  animation: fadeDown 0.5s ease-out;
}
.brand h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-light), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}
.logo-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(109, 40, 217, 0.35);
  flex-shrink: 0;
}
.logo-icon svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.logo-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.logo-main {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.1;
  font-family: var(--font-heading);
  letter-spacing: -0.5px;
}
.logo-accent {
  background: linear-gradient(135deg, #2c8bea, #ed6712);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
}
.logo-light {
  font-weight: 600;
  color: var(--text-primary);
}
@media (max-width: 480px) {
  .logo-main {
    font-size: 1.4rem;
  }
}
.logo-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.flex-row-gap {
  display: flex;
  gap: 8px;
}
.exam-badge.spaced-right {
  margin-right: auto;
  margin-left: 15px;
}
.result-action-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.result-action-row .action-flex-1 {
  flex: 1;
}
.result-action-row .action-flex-2 {
  flex: 2;
}
.result-action-row .action-flex-3 {
  flex: 3;
}
.action-compact {
  margin: 0;
  padding: 14px 10px;
  font-size: 0.9rem;
  text-align: center;
}
.auth-toggle-row {
  margin-top: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.auth-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}
.auth-link-btn:hover {
  text-decoration: underline;
}
.otp-btn + .otp-btn {
  margin-top: 12px;
}
.otp-btn.secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: none;
}
.otp-btn.secondary:hover:not(:disabled) {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}
.phone-input-group + .phone-input-group {
  margin-top: 12px;
}
.phone-prefix {
  padding: 12px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(127, 90, 240, 0.08);
  border-right: 1px solid var(--border);
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}
.phone-prefix.emoji {
  padding-left: 17px;
  padding-right: 17px;
}
.password-wrapper input {
  padding-right: 42px;
}

/* ── Card Shell ────────────────────────────────── */
.card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px 28px;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.45s ease-out;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(109, 40, 217, 0.15), transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.hidden { display: none !important; }

/* ── Top Bar (timer + progress) ───────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.timer-badge, .progress-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--bg-badge);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.timer-badge svg, .progress-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.timer-badge.danger {
  color: var(--red);
  border-color: rgba(228, 88, 88, 0.3);
  background: var(--red-glow);
  animation: pulse 1s ease-in-out infinite;
}

/* ── Section Tabs ─────────────────────────────── */
.section-tabs-container {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.section-tabs-container::-webkit-scrollbar { height: 4px; }
.section-tabs-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.section-tab-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.section-tab-btn:hover { background: rgba(255, 255, 255, 0.1); }
.section-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Progress Bar ─────────────────────────────── */
.progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  margin-bottom: 24px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 100px;
  transition: width 0.5s ease;
}

/* ── Question ──────────────────────────────────── */
.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 22px;
  letter-spacing: -0.01em;
}

/* ── Question Image ───────────────────────────── */
.question-image {
  display: none;
  width: 100%;
  max-height: 360px;
  min-height: 120px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
  border: 1px solid var(--border);
  background: var(--bg-badge);
  animation: fadeUp 0.35s ease-out;
  color: transparent;
}
.question-image.visible {
  display: block;
}

/* ── Option Images (non-verbal reasoning) ──────── */
.option-btn .option-image {
  max-height: 80px;
  min-height: 60px;
  max-width: 100%;
  width: auto;
  min-width: 80px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  background: var(--bg-badge);
  color: transparent;
}
.option-btn.has-image {
  justify-content: center;
  padding: 12px 14px;
}

/* ── Options ───────────────────────────────────── */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-option);
  border: 1.5px solid var(--border-option);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.option-btn:active {
  transform: scale(0.985);
}
.option-btn:hover {
  border-color: var(--accent);
  background: var(--bg-option-hover);
}
.option-btn .key {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--text-secondary);
  background: transparent;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.2s ease;
  position: relative;
}
.option-btn .key::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s ease;
}
.option-btn.selected {
  border-color: var(--accent);
  background: var(--bg-option);
}
.option-btn.selected .key {
  border-color: var(--accent);
  background: var(--accent);
}
.option-btn.selected .key::after {
  opacity: 1;
  transform: scale(1);
}
.option-btn.disabled {
  pointer-events: none;
  opacity: 0.55;
}

/* ── Next Button ───────────────────────────────── */
.next-btn {
  width: 100%;
  padding: 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6c3ce0);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 24px var(--accent-glow);
  -webkit-tap-highlight-color: transparent;
}
.next-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 32px var(--accent-glow);
}
.next-btn:active {
  transform: translateY(0) scale(0.985);
}

/* ── Previous Button ───────────────────────────── */
.prev-btn {
  padding: 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-badge);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.prev-btn:hover {
  background: var(--bg-key);
}
.prev-btn:active {
  transform: scale(0.985);
}

/* ── Result Screen ─────────────────────────────── */
#result-screen .result-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent), var(--green));
  box-shadow: 0 8px 32px var(--accent-glow);
  animation: bounceIn 0.6s ease;
}
#result-screen h2 {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 4px;
}
#result-screen .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 28px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.score-item {
  text-align: center;
  padding: 16px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.score-item .value {
  font-size: 1.5rem;
  font-weight: 800;
  display: block;
  margin-bottom: 4px;
}
.score-item .label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.score-item.green .value { color: var(--green); }
.score-item.red .value { color: var(--red); }
.score-item.accent .value {
  background: linear-gradient(135deg, var(--accent-light), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Section-Wise Breakdown ──────────────────── */
.section-breakdown {
  margin-top: 8px;
  margin-bottom: 24px;
}
.section-breakdown h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 14px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.section-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 520px) {
  .section-breakdown-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.section-break-item {
  text-align: center;
  padding: 16px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  transition: transform 0.2s ease;
}
.section-break-item:hover {
  transform: translateY(-2px);
}
.section-break-item .sb-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.section-break-item .sb-score {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2px;
}
.section-break-item .sb-correct {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
}

/* ── Time Spent Badge ─────────────────────────── */
.time-spent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(127, 90, 240, 0.1);
  border: 1px solid rgba(127, 90, 240, 0.25);
  color: var(--accent-light);
  margin-left: 8px;
  vertical-align: middle;
}
.time-spent-badge svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* ── Solutions Review ────────────────────────── */
.solutions-container {
  margin-top: 32px;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.solutions-container h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 12px;
  text-align: center;
}
.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}
.review-question {
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.review-status-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.review-status-label.not-attempted { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border); }
.review-status-label.correct { background: rgba(44, 182, 125, 0.1); color: var(--green); border: 1px solid rgba(44, 182, 125, 0.3); }
.review-status-label.wrong { background: rgba(228, 88, 88, 0.1); color: var(--red); border: 1px solid rgba(228, 88, 88, 0.3); }

.review-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border-option);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  background: var(--bg-option);
  transition: all 0.2s ease;
}
.review-opt.is-correct {
  background: rgba(44, 182, 125, 0.08);
  border-color: var(--green);
}
.review-opt.is-wrong {
  background: rgba(228, 88, 88, 0.08);
  border-color: var(--red);
}
.review-opt-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: bold;
  background: var(--bg-card);
  border: 1px solid var(--border-option);
}
.review-opt.is-correct .review-opt-icon { background: var(--green); color: #fff; border-color: var(--green); }
.review-opt.is-wrong .review-opt-icon { background: var(--red); color: #fff; border-color: var(--red); }

/* Explanation toggle button */
.explanation-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(44, 182, 125, 0.08);
  border: 1px solid rgba(44, 182, 125, 0.25);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.explanation-toggle-btn:hover {
  background: rgba(44, 182, 125, 0.15);
  border-color: rgba(44, 182, 125, 0.4);
}
.explanation-toggle-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}
.explanation-toggle-btn.open svg {
  transform: rotate(180deg);
}


/* Explanation content (hidden by default) */
.review-explanation {
  display: none;
  margin-top: 4px;
  margin-bottom: 8px;
  padding-top: 15px;
  padding-bottom: 15px;
  padding-left: 16px;
  padding-right: 16px;
  height: auto;
  background: rgba(44, 182, 125, 0.06);
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  animation: fadeUp 0.3s ease-out;
}
.review-explanation .expl-bullet {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  white-space: normal;
}
.review-explanation .expl-bullet::before {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--green);
}
.review-explanation.open {
  display: block;
}
.review-explanation strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  margin-bottom: 4px;
}

/* Solutions Tabs */
.review-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.review-tabs::-webkit-scrollbar { height: 4px; }
.review-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.review-tab-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.review-tab-btn:hover { background: rgba(255, 255, 255, 0.1); }
.review-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.review-tab-content { display: none; }
.review-tab-content.active { display: block; }

.final-score-banner {
  text-align: center;
  padding: 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(127, 90, 240, 0.15), rgba(44, 182, 125, 0.1));
  border: 1px solid rgba(127, 90, 240, 0.2);
  margin-bottom: 24px;
}
.final-score-banner .fs-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.final-score-banner .fs-value {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.final-score-banner .fs-total {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.retry-btn {
  width: 100%;
  padding: 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--green), #1a9963);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 24px var(--green-glow);
  -webkit-tap-highlight-color: transparent;
}
.retry-btn:hover {
  transform: translateY(-1px);
}
.retry-btn:active {
  transform: translateY(0) scale(0.985);
}

.back-select-btn {
  width: 100%;
  padding: 16px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-badge);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}
.back-select-btn:hover {
  background: var(--bg-key);
  border-color: var(--accent-light);
}
.back-select-btn:active {
  transform: translateY(0) scale(0.985);
}

/* ── Start Screen ─────────────────────────────── */
#start-screen { text-align: center; }
.test-portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(44, 182, 125, 0.12);
  border: 1px solid rgba(44, 182, 125, 0.3);
  color: #2cb67d;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  background: #2cb67d;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(44, 182, 125, 0.7);
  animation: livePulse 1.8s infinite;
}
@keyframes livePulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(44, 182, 125, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(44, 182, 125, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(44, 182, 125, 0);
  }
}
#start-screen .quiz-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
#start-screen .quiz-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 18px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.test-features-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 auto 22px;
  max-width: 580px;
}
.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.feature-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.feature-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.feature-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
@media (max-width: 480px) {
  .test-features-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .feature-item {
    padding: 8px 4px;
  }
  .feature-title {
    font-size: 0.7rem;
  }
}
.info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.chip.green { color: var(--green); border-color: rgba(44, 182, 125, 0.25); }
.chip.red { color: var(--red); border-color: rgba(228, 88, 88, 0.25); }
.chip.accent { color: var(--accent-light); border-color: rgba(127, 90, 240, 0.25); }

.start-btn {
  width: 100%;
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6c3ce0);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 24px var(--accent-glow);
  -webkit-tap-highlight-color: transparent;
}
.start-btn:hover { transform: translateY(-1px); }
.start-btn:active { transform: translateY(0) scale(0.985); }
.start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Animations ────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
.slide-in { animation: slideIn 0.35s ease-out; }

/* ── Footer ────────────────────────────────────── */
.footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0.6;
}
.footer a {
  color: var(--accent-light);
  text-decoration: none;
}

/* ── Category Grid ─────────────────────────────── */
.category-section {
  width: 100%;
  margin-bottom: 24px;
  text-align: left;
}
.category-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  background: var(--bg-option);
  border: 1.5px solid var(--border-option);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease-out;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  position: relative; /* Added for test count pill positioning */
}

.test-count-pill {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent-gradient, linear-gradient(135deg, #7f5af0, #6c3ce0));
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.category-card:hover {
  border-color: var(--accent);
  background: var(--bg-option-hover);
  transform: translateY(-2px);
}
.category-card:active {
  transform: translateY(0) scale(0.985);
}
.category-card.selected {
  border-color: var(--accent);
  background: var(--bg-option-hover);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 20px var(--accent-glow);
}
.category-card .icon {
  font-size: 1.4rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
}
.category-card .name {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (min-width: 381px) {
  .category-card.span-2 {
    grid-column: span 2;
  }
}

/* ── Category Group Layout ─────────────────────── */
.category-group {
  background: var(--bg-option);
  border: 1.5px solid var(--border-option);
  border-radius: var(--radius-sm);
  padding: 14px 12px 12px;
  margin-bottom: 12px;
}
.category-group:last-child {
  margin-bottom: 0;
}
.category-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-option);
}
.group-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.group-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.group-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  line-height: 1.3;
}

/* Highlighted group (Assam State Exams) - No Border, Just Moving Badge */
.category-group.highlighted {
  border-color: var(--border-option);
  background: var(--bg-option);
  box-shadow: none;
}
.category-group.highlighted .category-group-header {
  border-bottom-color: var(--border-option);
}
.category-group.highlighted .group-title {
  color: var(--text-secondary);
}

/* Moving Popular Badge */
.moving-popular-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 20px;
  background: linear-gradient(90deg, #ff416c, #ff4b2b);
  color: #fff;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 10px rgba(255, 75, 43, 0.3);
  animation: moveBadge 2s ease-in-out infinite alternate;
}
@keyframes moveBadge {
  0% { transform: translateX(0) scale(1); }
  100% { transform: translateX(-6px) scale(1.05); }
}

/* Within groups, the grid resets per group */
.category-group .category-grid {
  margin-bottom: 0;
}

@media (max-width: 380px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
  .category-group {
    padding: 12px 10px 10px;
  }
}

/* ── Desktop polish ────────────────────────────── */
@media (min-width: 520px) {
  body { padding-top: 48px; }
  .card { padding: 32px 28px 36px; }
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  body {
    padding-top: 64px;
    padding-bottom: 64px;
  }
  .brand {
    margin-bottom: 32px;
  }
  .brand h1 {
    font-size: 2.2rem;
  }
  .brand p {
    font-size: 1rem;
    margin-top: 6px;
  }
  .card {
    max-width: 768px;
    padding: 40px 48px 48px;
  }
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .category-group {
    padding: 18px 16px 14px;
    margin-bottom: 16px;
  }
  .options-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* ── Sub-Category Screen ──────────────────────── */
.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-badge);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-primary);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}
.back-btn:hover {
  background: var(--bg-key);
  border-color: var(--accent-light);
}
.back-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}
.exam-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-light);
  background: var(--accent-glow);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid rgba(127, 90, 240, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sub-category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 16px;
  margin-bottom: 12px;
}
.sub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 20px 16px;
  background: var(--bg-option);
  border: 1.5px solid var(--border-option);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.sub-card:hover {
  border-color: var(--accent);
  background: var(--bg-option-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.05);
}
.logo-icon.logo-icon--image {
  width: auto;
  height: auto;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.logo-icon.logo-icon--image .logo-image {
  display: block;
  width: 54px;
  height: 50px;
  max-width: 100%;
  object-fit: contain;
  flex-shrink: 0;
}
.logo-icon:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(109, 40, 217, 0.45);
}
.sub-card:active {
  transform: translateY(0) scale(0.98);
}
.sub-card .sub-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
}
.sub-card .sub-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.sub-card .sub-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

#sub-loading-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  animation: fadeUp 0.3s ease-out;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-spinner);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .sub-category-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (min-width: 1024px) {
  body {
    padding-top: 80px;
    padding-bottom: 80px;
  }
  .card {
    max-width: 1024px;
    padding: 48px 64px 64px;
  }
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }
  .category-group {
    padding: 22px 20px 18px;
    margin-bottom: 20px;
  }
  .sub-category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
  .options-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  .brand h1 {
    font-size: 2.6rem;
  }
  .brand p {
    font-size: 1.15rem;
    margin-top: 8px;
  }
}

.quiz-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}
.quiz-main-content {
  width: 100%;
}
.quiz-sidebar {
  position: absolute;
  top: 130px; /* start below top bars */
  left: 0;
  width: 100%;
  height: calc(100% - 130px);
  background: #2b2d31; /* matches image */
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  z-index: 50;
  transform: translateX(110%);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-y: auto;
}

/* ── Question Palette Styles (Mobile & Desktop) ── */
.sidebar-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.palette-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: #36393f;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}
.palette-btn:hover {
  background: #404249;
  color: #fff;
  transform: translateY(-1px);
}
.palette-btn:active {
  transform: translateY(0);
}
.palette-btn.active {
  border: 1px solid #7f5af0;
  background: rgba(127, 90, 240, 0.2);
  color: #fff;
  box-shadow: 0 0 12px rgba(127, 90, 240, 0.4), inset 0 0 0 1px #7f5af0;
}
.palette-btn.answered {
  background: #2cb67d;
  border-color: #2cb67d;
  color: #fff;
}
.palette-btn.skipped {
  background: #e45858;
  border-color: #e45858;
  color: #fff;
}
.palette-btn.review {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}
.palette-btn.review-answered {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
  position: relative;
}
.palette-btn.review-answered::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #2cb67d;
  border-radius: 50%;
  border: 2px solid #2b2d31;
}
.palette-legend {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.legend-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
  flex-shrink: 0;
}
.legend-dot.green { background: #2cb67d; }
.legend-dot.red { background: #e45858; }
.legend-dot.gray { background: #36393f; border: 1px solid rgba(255, 255, 255, 0.05); }
.legend-dot.yellow { background: #f59e0b; }
.legend-dot.yellow-green { 
  background: #f59e0b; 
  position: relative; 
}
.legend-dot.yellow-green::after {
  content: '';
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background: #2cb67d;
  border-radius: 50%;
  border: 2px solid #2b2d31;
}

.quiz-sidebar.show-mobile {
  transform: translateX(0);
}
.palette-close-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.palette-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-badge);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.palette-toggle-btn:hover {
  background: var(--bg-key);
  border-color: var(--accent-light);
}
.palette-toggle-btn svg {
  width: 16px;
  height: 16px;
}

@media (min-width: 1024px) {
  #quiz-screen {
    max-width: 1100px;
  }
  .quiz-layout {
    display: grid;
    grid-template-columns: 72% 28%;
    gap: 32px;
    align-items: start;
    position: static;
  }
  .quiz-sidebar {
    position: sticky;
    top: 24px;
    right: auto;
    left: auto;
    width: auto;
    height: auto;
    max-width: none;
    background: #2b2d31; /* match mobile image background on desktop too */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    transform: translateX(0);
    transition: none;
    z-index: auto;
    overflow-y: visible;
  }
  .palette-close-btn {
    display: none;
  }
  .palette-toggle-btn {
    display: none;
  }
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  outline: none;
}
.theme-toggle-btn:hover {
  background: rgba(255,255,255,0.08);
}
.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
}


#live-lang-toggle {
  background: var(--bg-card-solid);
  color: var(--text-primary);
  border: 1.5px solid var(--accent);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s ease;
}
#live-lang-toggle:hover {
  border-color: var(--accent-light);
  box-shadow: 0 0 8px var(--accent-glow);
}
#live-lang-toggle option {
  background: var(--bg-card-solid);
  color: var(--text-primary);
}

/* ── Auth UI ──────────────────────────────────── */
/* Fixed auth container — top-right corner */
.auth-fixed-bar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Header Home Portal Button */
.header-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header-home-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--bg-option-hover);
  transform: translateY(-1px);
}
.header-home-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
@media (max-width: 580px) {
  .header-home-text {
    display: none;
  }
  .header-home-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    justify-content: center;
  }
}

/* Header Login Button (shown when logged out) */
.header-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6c3ce0);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 2px 16px var(--accent-glow);
  -webkit-tap-highlight-color: transparent;
  animation: fadeDown 0.3s ease-out;
}
.header-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--accent-glow);
}
.header-login-btn:active {
  transform: translateY(0) scale(0.97);
}
.header-login-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Profile Wrapper (logged-in state) */
.profile-wrapper {
  position: relative;
}
.profile-trigger {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  cursor: pointer;
  object-fit: cover;
  transition: all 0.22s ease;
  box-shadow: 0 2px 12px var(--accent-glow);
  -webkit-tap-highlight-color: transparent;
}
.profile-trigger:hover {
  border-color: var(--accent-light);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: scale(1.05);
}

/* Profile Dropdown Menu */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1001;
}
.profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* User info header inside dropdown */
.dropdown-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.dropdown-user-info img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
}
.dropdown-user-info .dropdown-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown menu items */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.dropdown-item:hover {
  background: rgba(127, 90, 240, 0.08);
}
.dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dropdown-item.logout-item {
  color: var(--red);
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 12px;
}
.dropdown-item.logout-item svg {
  stroke: var(--red);
}

/* Login Required Modal */
.login-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 25, 0.75);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  padding: 20px;
  animation: fadeUp 0.25s ease-out;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background-color: #141b2d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 2.25rem 2rem;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.35s ease-out;
}

.card-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.card-subtitle {
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.45;
}

.google-btn {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: #ffffff;
  color: #1e293b;
  font-size: 0.925rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-family: inherit;
}

.google-btn:hover {
  background-color: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.google-btn:active {
  transform: translateY(0);
}

.google-btn img,
.google-btn svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.modal-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: #232c42;
}

.modal-divider span {
  padding: 0 1rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}
.form-group.hidden {
  display: none;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #cbd5e1;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background-color: #0c1220;
  border: 1px solid #28334e;
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.input-wrapper input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 0.9rem;
  font-family: inherit;
}

.input-wrapper input::placeholder {
  color: #64748b;
}

.input-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  background-color: #172033;
  border-right: 1px solid #28334e;
  user-select: none;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.password-toggle:hover {
  color: #f1f5f9;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.input-wrapper.has-toggle input {
  padding-right: 42px;
}

.btn-primary {
  width: 100%;
  height: 46px;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary:active {
  transform: translateY(0);
}

.card-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  text-align: center;
}

.signup-text {
  font-size: 0.85rem;
  color: #94a3b8;
}

.link-btn {
  background: none;
  border: none;
  color: #818cf8;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  padding: 2px 4px;
  transition: color 0.15s ease;
}

.link-btn:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

.btn-ghost-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 8px 18px;
  font-size: 0.825rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.25rem;
  font-family: inherit;
}

.btn-ghost-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* ── OTP Code Input ── */
.otp-code-input {
  width: 100%;
  padding: 14px;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  letter-spacing: 8px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}
.otp-code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.otp-code-input::placeholder {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0;
}

/* ── OTP Sent Info ── */
.otp-sent-info {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
}
.otp-sent-info strong {
  color: var(--accent);
  font-weight: 700;
}

/* ── Resend OTP ── */
.otp-resend-btn {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px;
  transition: color 0.2s ease;
}
.otp-resend-btn:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* ── OTP Status Messages ── */
.otp-status-msg {
  font-size: 0.76rem;
  font-weight: 600;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.otp-status-msg.hidden {
  display: none;
}
.otp-status-msg.otp-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}
.otp-status-msg.otp-success {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

/* ── Invisible reCAPTCHA container ── */
/* Firebase renders this invisibly; keep it out of the way */
/* Logout button on result screen */
.logout-result-btn {
  width: 100%;
  padding: 14px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--red);
  background: rgba(228, 88, 88, 0.08);
  border: 1.5px solid rgba(228, 88, 88, 0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.logout-result-btn:hover {
  background: rgba(228, 88, 88, 0.15);
  border-color: rgba(228, 88, 88, 0.4);
}

.save-status {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
  animation: fadeUp 0.3s ease-out;
}
.save-status.success {
  color: var(--green);
  background: var(--green-glow);
  border: 1px solid rgba(44, 182, 125, 0.3);
}
.save-status.error {
  color: var(--red);
  background: var(--red-glow);
  border: 1px solid rgba(228, 88, 88, 0.3);
}
.save-status.info {
  color: var(--accent-light);
  background: var(--accent-glow);
  border: 1px solid rgba(127, 90, 240, 0.3);
}

/* Responsive tweaks for small mobile screens */
@media (max-width: 480px) {
  .auth-fixed-bar {
    top: 12px;
    right: 12px;
    gap: 8px;
  }
  .profile-trigger,
  .header-login-btn,
  .theme-toggle-btn {
    width: 34px;
    height: 34px;
  }
  .theme-toggle-btn svg {
    width: 17px;
    height: 17px;
  }
  .profile-dropdown {
    min-width: 160px;
  }
}

/* ── Global Loader ────────────────────────────── */
.global-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}
.global-loader.hidden {
  display: none !important;
}
.global-loader .loader-content, .global-loader .loader-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  animation: fadeUp 0.3s ease-out;
}

/* ── Moved Inline Styles ──────────────────────── */
.loader-error-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}
.global-error-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.global-retry-btn {
  padding: 10px 20px;
  font-weight: bold;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent), #6c3ce0);
  color: #fff;
}
.brand-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 480px;
}
.start-screen-icon {
  font-size: 2.4rem;
  margin-bottom: 14px;
}
.sub-category-info-chips {
  margin-bottom: 24px;
}
.instructions-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
}
.mock-lang-container {
  display: none;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.lang-select-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.lang-select {
  width: 100%;
  padding: 10px;
  margin-bottom: 16px;
  background: var(--bg-card-solid);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}
.instructions-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}
.instructions-checkbox {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.quiz-sub-header {
  margin-bottom: 20px;
}
.quiz-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.quiz-action-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 24px;
}
.quiz-nav-btn {
  width: 15%;
  padding: 12px;
}
#prev-question-btn {
  display: none;
}
.quiz-nav-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}
.clear-btn {
  display: none;
  background: rgba(228, 88, 88, 0.15);
  color: #e45858;
  border: 1.5px solid #e45858;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 12px;
  transition: all 0.2s ease;
}
.review-btn {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1.5px solid #8b5cf6;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  flex-grow: 1;
  padding: 12px;
  transition: all 0.2s ease;
}
.save-next-btn {
  background: linear-gradient(135deg, var(--accent), #6c3ce0);
  flex-grow: 1;
  padding: 12px;
}
.palette-close-icon {
  width: 16px;
  height: 16px;
}
.result-retry-btn {
  margin-bottom: 8px;
}
.result-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}
.logout-result-icon {
  width: 16px;
  height: 16px;
}

/* --- Error Report Section --- */
.error-report-container.compact {
  background: var(--bg-card);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.error-report-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.error-report-row {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
}
.error-report-container input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
}
.error-report-container input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.error-report-btn, #submitReportBtn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1;
  flex-shrink: 0;
}
.error-report-btn:hover, #submitReportBtn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.error-report-btn:disabled, #submitReportBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
#error-report-status {
  font-size: 0.85rem;
  font-weight: 500;
  padding-left: 4px;
}
#error-report-status.success {
  color: var(--green);
}
#error-report-status.error {
  color: var(--red);
}

/* ── My Results Screen ────────────────────────── */
#my-results-screen {
  max-width: 640px;
}
.my-results-header {
  text-align: center;
  margin-bottom: 28px;
}
.my-results-header .result-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.my-results-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-light), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.my-results-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Loading spinner for results */
.my-results-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 0;
}
.my-results-loading .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bg-spinner);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.my-results-loading p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Empty state */
.my-results-empty {
  text-align: center;
  padding: 48px 16px;
}
.my-results-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.7;
}
.my-results-empty h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.my-results-empty p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Results list container */
.my-results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Individual result card */
.result-history-card {
  background: var(--bg-option);
  border: 1px solid var(--border-option);
  border-radius: var(--radius-sm);
  padding: 18px;
  transition: all 0.25s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.4s ease-out both;
}
.result-history-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.result-history-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-2px);
}
.result-history-card:hover::before {
  opacity: 1;
}

/* Staggered animation for cards */
.result-history-card:nth-child(1) { animation-delay: 0s; }
.result-history-card:nth-child(2) { animation-delay: 0.06s; }
.result-history-card:nth-child(3) { animation-delay: 0.12s; }
.result-history-card:nth-child(4) { animation-delay: 0.18s; }
.result-history-card:nth-child(5) { animation-delay: 0.24s; }
.result-history-card:nth-child(n+6) { animation-delay: 0.3s; }

/* Card header row */
.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.result-card-exam {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.result-card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-glow);
  color: var(--accent-light);
  white-space: nowrap;
}
.result-card-test-id {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Stats grid inside card */
.result-card-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.result-stat-item {
  text-align: center;
  padding: 10px 4px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.result-stat-item .stat-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.result-stat-item .stat-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 3px;
}
.result-stat-item.stat-correct .stat-value { color: var(--green); }
.result-stat-item.stat-wrong .stat-value { color: var(--red); }
.result-stat-item.stat-score .stat-value {
  background: linear-gradient(135deg, var(--accent-light), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Card footer */
.result-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.result-card-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}
.result-card-date svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.result-card-action {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-light);
  background: var(--accent-glow);
  border: 1px solid rgba(127, 90, 240, 0.2);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.result-card-action:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Score percentage ring (mini) */
.result-card-percentage {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.percentage-bar-track {
  flex: 1;
  height: 6px;
  border-radius: 100px;
  background: var(--bg-badge);
  overflow: hidden;
}
.percentage-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.6s ease;
}
.percentage-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-light);
  min-width: 42px;
  text-align: right;
}

/* Responsive */
@media (max-width: 480px) {
  .result-card-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Subject Filter Tabs ────────────────────────── */
.filter-tabs-container {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 4px 12px 4px;
  margin: 16px 0;
  -ms-overflow-style: none;
}
.filter-tabs-container::-webkit-scrollbar {
  display: none;
}
.filter-tab {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-option);
  border: 1px solid var(--border-option);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.filter-tab:hover {
  background: var(--bg-option-hover);
  color: var(--text-primary);
}
.filter-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
}


/* ── Mode Toggle ──────────────────────────────── */
.mode-toggle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 8px 0 20px;
}

.mode-toggle {
  position: relative;
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  gap: 0;
  overflow: hidden;
}

.mode-toggle-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--accent);
  border-radius: 11px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.mode-toggle-slider.study-active {
  transform: translateX(100%);
}

.mode-toggle-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: color 0.3s ease;
  white-space: nowrap;
}

.mode-toggle-btn.active {
  color: #fff;
}

.mode-toggle-btn:hover:not(.active) {
  color: var(--text-primary);
}

.mode-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.mode-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  transition: opacity 0.3s ease;
  min-height: 1.2em;
}

@media (max-width: 480px) {
  .mode-toggle-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
    gap: 5px;
  }
  .mode-icon {
    width: 15px;
    height: 15px;
  }
}


/* ── Study Mode Screen ────────────────────────── */
.study-header {
  text-align: center;
  margin-bottom: 16px;
}

.study-header-icon {
  font-size: 2.8rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}

.study-lang-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.study-progress-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.study-progress-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.study-reveal-all-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--accent-light);
  background: rgba(127, 90, 240, 0.1);
  border: 1px solid rgba(127, 90, 240, 0.25);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.study-reveal-all-btn:hover {
  background: rgba(127, 90, 240, 0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.study-reveal-all-btn.all-revealed {
  color: var(--red);
  background: var(--red-glow);
  border-color: rgba(228, 88, 88, 0.3);
}

/* Questions Container */
.study-questions-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual Question Card */
.study-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  animation: studyCardFadeIn 0.4s ease both;
}

.study-question-card:hover {
  border-color: rgba(127, 90, 240, 0.2);
}

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

.study-question-number {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-light);
  background: rgba(127, 90, 240, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.study-question-section-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 3px 8px;
  border-radius: 6px;
  margin-left: 6px;
}

.study-question-text {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  margin-bottom: 10px;
  word-wrap: break-word;
}

.study-question-image {
  display: none;
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.study-question-image.visible {
  display: block;
}

/* Study Options (read-only display) */
.study-options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.study-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-option);
  border: 1.5px solid var(--border-option);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-primary);
  transition: all 0.2s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.study-option:hover {
  border-color: var(--accent);
  background: var(--bg-option-hover);
}
.study-option:active {
  transform: scale(0.985);
}
.study-option.selected {
  border-color: var(--accent);
  background: var(--bg-option);
}
.study-option.selected .study-key {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.study-option .study-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-key);
  border-radius: 8px;
  flex-shrink: 0;
}

.study-option.study-option-image {
  padding: 10px;
}
.study-option.study-option-image img {
  max-width: 100%;
  border-radius: 8px;
}

/* Show Answer Button */
.study-show-answer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--accent-light);
  background: rgba(127, 90, 240, 0.06);
  border: 1.5px dashed rgba(127, 90, 240, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
}
.study-show-answer-btn:hover {
  background: rgba(127, 90, 240, 0.12);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.study-show-answer-btn .btn-icon {
  transition: transform 0.3s ease;
}
.study-show-answer-btn.revealed .btn-icon {
  transform: rotate(180deg);
}

/* Answer Section */
.study-answer-section {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.35s ease,
              margin 0.3s ease;
  margin-top: 0;
}

.study-answer-section.revealed {
  max-height: 2000px;
  opacity: 1;
  margin-top: 14px;
}

.study-answer-content {
  background: rgba(44, 182, 125, 0.06);
  border: 1px solid rgba(44, 182, 125, 0.2);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.study-correct-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.study-correct-answer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(44, 182, 125, 0.08);
  border: 1px solid rgba(44, 182, 125, 0.25);
  border-radius: 10px;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.study-correct-answer .study-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
  flex-shrink: 0;
}

.study-explanation {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
}
.study-explanation strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

/* Highlight correct option in options list when answer is revealed */
.study-question-card.answer-revealed .study-option.is-correct {
  background: rgba(44, 182, 125, 0.1);
  border-color: rgba(44, 182, 125, 0.35);
}
.study-question-card.answer-revealed .study-option.is-correct .study-key {
  background: var(--green);
  color: #fff;
}

/* Highlight wrong option in options list when selected and answer is revealed */
.study-question-card.answer-revealed .study-option.selected:not(.is-correct) {
  background: rgba(228, 88, 88, 0.1);
  border-color: rgba(228, 88, 88, 0.4);
}
.study-question-card.answer-revealed .study-option.selected:not(.is-correct) .study-key {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* Footer Actions */
.study-footer-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.study-footer-actions .back-select-btn {
  flex: 1;
  min-width: 120px;
}

/* Study Mode Info Chips (replaces scoring chips) */
.study-info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 12px 0;
}

.study-info-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-light);
  background: rgba(127, 90, 240, 0.08);
  border: 1px solid rgba(127, 90, 240, 0.2);
  border-radius: 20px;
}

.study-info-chip svg {
  width: 16px;
  height: 16px;
}

/* Responsive */
@media (max-width: 600px) {
  .study-question-card {
    padding: 14px;
  }
  .study-progress-bar {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    text-align: center;
  }
  .study-reveal-all-btn {
    justify-content: center;
  }
  .study-footer-actions {
    flex-direction: column;
  }
  .study-footer-actions .back-select-btn {
    min-width: unset;
  }
}

/* ══════════════════════════════════════════════════════ */
/*  TOAST NOTIFICATIONS                                  */
/* ══════════════════════════════════════════════════════ */
.custom-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.custom-toast {
  min-width: 260px;
  max-width: 380px;
  background: rgba(20, 27, 45, 0.97);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  color: #f8fafc;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  animation: toastSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: auto;
  border-left: 4px solid transparent;
  cursor: default;
}
.custom-toast .toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}
.custom-toast .toast-msg {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

/* Type variants */
.custom-toast.toast-error {
  border-left-color: #ef4444;
  background: rgba(40, 18, 18, 0.97);
}
.custom-toast.toast-warning {
  border-left-color: #f59e0b;
  background: rgba(40, 32, 12, 0.97);
}
.custom-toast.toast-success {
  border-left-color: #10b981;
  background: rgba(12, 36, 28, 0.97);
}
.custom-toast.toast-info {
  border-left-color: #7f5af0;
  background: rgba(20, 27, 45, 0.97);
}





/* Fade out */
.custom-toast.fade-out {
  animation: toastFadeOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
  from { transform: translateX(120%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes toastFadeOut {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to   { transform: translateX(120%) scale(0.9); opacity: 0; }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .custom-toast-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
  }
  .custom-toast {
    min-width: unset;
    max-width: unset;
    width: 100%;
    font-size: 0.85rem;
    padding: 12px 14px;
    border-radius: 12px;
  }
}

/* ══════════════════════════════════════════════════════ */
/*  CUSTOM CONFIRM MODAL (showCustomConfirm)             */
/* ══════════════════════════════════════════════════════ */
.login-modal {
  width: 100%;
  max-width: 400px;
  background-color: #141b2d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 2rem 1.75rem;
  box-shadow:
    0 20px 40px -15px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: fadeUp 0.3s ease-out;
  text-align: center;
}
.login-modal h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.login-modal p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}
.login-modal .confirm-yes-btn,
.login-modal .confirm-no-btn {
  flex: 1;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.login-modal .confirm-yes-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.login-modal .confirm-yes-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}
.login-modal .confirm-no-btn {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.login-modal .confirm-no-btn:hover {
  background: var(--bg-option-hover);
  border-color: var(--accent);
}

