:root {
  --bg: #050508;
  --surface: #0b0d14;
  --surface-2: #111522;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.28);
  --fg: #f8fafc;
  --muted: #94a3b8;
  --indigo: #818cf8;
  --violet: #a78bfa;
  --cyan: #38bdf8;
  --green: #22c55e;
  --red: #f43f5e;
  --amber: #f59e0b;
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Subtle atmospheric backdrop (hidden on pure empty start screen except ultra-faint center radial) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(680px 380px at 15% 10%, rgba(129, 140, 248, 0.08), transparent 65%),
    radial-gradient(620px 360px at 85% 90%, rgba(56, 189, 248, 0.07), transparent 65%);
  z-index: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

/* ======================== LOADING BAR OVERLAY ======================== */
#loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #040406;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.5s;
}

#loader-overlay.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #e2e8f0;
  opacity: 0.9;
}

.loader-track {
  width: min(340px, 76vw);
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.7);
}

.loader-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffffff, #818cf8, #38bdf8, #ffffff);
  background-size: 200% 100%;
  box-shadow: 0 0 18px rgba(129, 140, 248, 0.8), 0 0 6px #ffffff;
  transition: width 0.12s ease-out;
  animation: shimmer 1.2s linear infinite;
}

.loader-pct {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ======================== LANDING SCREEN (ONLY START BUTTON) ======================== */
.start-only-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.start-btn {
  position: relative;
  background: #ffffff;
  color: #050508;
  border: 0;
  padding: 20px 68px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, background 0.25s ease;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35), 0 16px 40px rgba(0, 0, 0, 0.7);
  animation: startPulse 2.6s infinite;
}

.start-btn::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(129, 140, 248, 0.55), rgba(56, 189, 248, 0.55), rgba(255, 255, 255, 0.45));
  z-index: -1;
  filter: blur(14px);
  opacity: 0.45;
  transition: opacity 0.25s ease;
}

.start-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 22px 50px rgba(129, 140, 248, 0.32);
}

.start-btn:hover::after {
  opacity: 0.85;
}

.start-btn:active {
  transform: scale(0.97);
}

@keyframes startPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.28), 0 14px 36px rgba(0, 0, 0, 0.65);
  }
  50% {
    box-shadow: 0 0 0 22px rgba(255, 255, 255, 0), 0 14px 36px rgba(0, 0, 0, 0.65);
  }
}

/* ======================== APP SHELL & TOP NAV ======================== */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 18px 64px;
  animation: viewIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 22px;
  background: rgba(11, 13, 20, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, var(--indigo));
  box-shadow: 0 0 12px var(--indigo);
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-btn:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}

.nav-btn.active {
  background: #ffffff;
  color: #050508;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.16);
}

.lv-pill {
  background: rgba(129, 140, 248, 0.16);
  color: #c7d2fe;
  border: 1px solid rgba(129, 140, 248, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.nav-btn.active .lv-pill {
  background: #050508;
  color: #ffffff;
  border-color: #050508;
}

/* ======================== AUTH CARD ======================== */
.auth-wrap {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  animation: viewIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.tabs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab-btn {
  background: transparent;
  border: 0;
  padding: 10px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: #ffffff;
  color: #050508;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 12px 0 6px;
}

.text-input {
  width: 100%;
  background: #07080d;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 15px;
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.btn-primary {
  background: #ffffff;
  color: #050508;
  border: 0;
  border-radius: 999px;
  padding: 13px 26px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(255, 255, 255, 0.2);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 11px 22px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffffff;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.45);
  border-radius: 999px;
  padding: 11px 22px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: var(--red);
  color: #ffffff;
  border-color: var(--red);
}

.error-banner {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fecdd3;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 12px;
  animation: shake 0.38s ease;
}

/* ======================== QUIZ INTERFACE ======================== */
.quiz-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.mini-bar {
  width: 110px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.mode-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-toggle.on {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  animation: cardIn 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.badge-important {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fcd34d;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.15);
}

.badge-repeated {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.5);
  color: #ddd6fe;
}

.badge-type {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}

.badge-paper {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.passage-box {
  background: rgba(129, 140, 248, 0.06);
  border: 1px solid rgba(129, 140, 248, 0.24);
  border-left: 4px solid var(--indigo);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  font-size: 15.5px;
  line-height: 1.8;
  color: #e2e8f0;
}

.passage-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--indigo);
  margin-bottom: 6px;
}

.question-body {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.8;
  color: #ffffff;
  margin-bottom: 20px;
  letter-spacing: -0.005em;
}

.question-body p,
.passage-box p,
.solution-body p {
  margin: 0 0 10px;
}

.question-body p:last-child,
.passage-box p:last-child,
.solution-body p:last-child {
  margin-bottom: 0;
}

/* KaTeX spacious styling so fractions, limits & matrices never look cramped */
.katex {
  font-size: 1.07em;
}

.katex-display {
  margin: 14px 0 !important;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ======================== FIGURES & TABLES ======================== */
.figure-box {
  margin: 18px 0 22px;
  padding: 16px;
  background: #070910;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.fig-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 580px) {
  .fig-grid {
    grid-template-columns: 1fr;
  }
}

.fig-card {
  margin: 0;
  background: #0b0d14;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.fig-card figcaption {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.fig-single {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fig-svg {
  width: 100%;
  max-width: 500px;
  height: auto;
  display: block;
}

.fig-note {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.fig-table-wrap {
  overflow-x: auto;
}

.fig-table-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--indigo);
  margin-bottom: 10px;
}

.fig-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.fig-table th,
.fig-table td {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.fig-table th {
  background: rgba(129, 140, 248, 0.12);
  color: #e0e7ff;
  font-weight: 700;
}

/* ======================== OPTIONS & NUMERICAL INPUT ======================== */
.msq-hint {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cyan);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 15.5px;
  line-height: 1.65;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.option-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.55);
  transform: translateX(4px);
  background: #161b2c;
}

.option-btn:disabled {
  cursor: default;
}

.opt-key {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  margin-top: 2px;
  transition: all 0.2s ease;
}

.option-btn.selected {
  border-color: var(--indigo);
  background: rgba(129, 140, 248, 0.14);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4);
}

.option-btn.selected .opt-key {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #050508;
}

.option-btn.correct {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.15);
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.15);
  animation: popIn 0.3s ease;
}

.option-btn.correct .opt-key {
  background: var(--green);
  border-color: var(--green);
  color: #050508;
}

.option-btn.wrong {
  border-color: var(--red);
  background: rgba(244, 63, 94, 0.13);
  animation: shake 0.38s ease;
}

.option-btn.wrong .opt-key {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}

.option-btn.missed {
  border-color: rgba(34, 197, 94, 0.6);
  border-style: dashed;
  background: rgba(34, 197, 94, 0.07);
}

.option-btn.missed .opt-key {
  border-color: var(--green);
  color: var(--green);
}

@keyframes popIn {
  0% { transform: scale(0.98); }
  50% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

@keyframes shake {
  20% { transform: translateX(-6px); }
  45% { transform: translateX(6px); }
  70% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

.num-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.num-input {
  flex: 1;
  min-width: 210px;
  background: #07080d;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  outline: none;
  transition: all 0.2s ease;
}

.num-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ======================== FEEDBACK & SOLUTION ======================== */
.feedback-box {
  margin-top: 22px;
  border-radius: 16px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  animation: viewIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.feedback-box.ok {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.45);
  border-left: 5px solid var(--green);
}

.feedback-box.bad {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.45);
  border-left: 5px solid var(--red);
}

.feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.verdict-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-box.ok .verdict-title {
  color: #86efac;
}

.feedback-box.bad .verdict-title {
  color: #fda4af;
}

.xp-chip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
}

.answer-summary {
  font-size: 15px;
  margin-bottom: 14px;
  color: #e2e8f0;
}

.solution-box {
  background: rgba(5, 5, 8, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
}

.solution-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cyan);
  margin-bottom: 8px;
}

.solution-body {
  font-size: 15.5px;
  line-height: 1.8;
  color: #e2e8f0;
}

/* ======================== HISTORY VIEW ======================== */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pill-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pill-btn:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.pill-btn.active {
  background: #ffffff;
  color: #050508;
  border-color: #ffffff;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-1px);
  background: var(--surface-2);
}

.history-main {
  flex: 1;
  min-width: 0;
}

.history-q {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.status-badge {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}

.status-ok {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.status-bad {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.status-viewed {
  background: rgba(56, 189, 248, 0.14);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

/* ======================== PROFILE VIEW ======================== */
.profile-banner {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.16), rgba(56, 189, 248, 0.1));
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 22px;
  padding: 26px;
  margin-bottom: 18px;
}

.profile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-circle {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: #ffffff;
  color: #050508;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 10px 25px rgba(129, 140, 248, 0.3);
}

.rank-title {
  font-size: 13px;
  font-weight: 700;
  color: #c7d2fe;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.xp-track {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffffff, var(--indigo), var(--cyan));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.xp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: #cbd5e1;
  margin-top: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.stat-val {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.stat-lbl {
  font-size: 13px;
  color: var(--muted);
}

.profile-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ======================== MODAL ======================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeOnly 0.2s ease;
}

@keyframes fadeOnly {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  animation: viewIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
}

.modal-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14.5px;
}

/* ======================== EMPTY / COMPLETED STATE ======================== */
.complete-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 40px 28px;
  text-align: center;
  animation: viewIn 0.4s ease;
}

.complete-card h2 {
  font-size: 28px;
  margin: 0 0 10px;
}

.complete-card p {
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 24px;
}

@media (max-width: 600px) {
  .q-card {
    padding: 20px 16px;
  }
  .question-body {
    font-size: 16.5px;
  }
  .start-btn {
    padding: 18px 54px;
    font-size: 20px;
  }
}
