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

:root {
  --purple:      #6c3fc5;
  --purple-dark: #4e2c9a;
  --purple-light:#ede7ff;
  --green:       #2ecc71;
  --red:         #e74c3c;
  --text:        #1a1a2e;
  --muted:       #6b7280;
  --bg:          #f0ecff;
  --card:        #ffffff;
  --radius:      16px;
  --shadow:      0 4px 24px rgba(108,63,197,.12);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===== Layout ===== */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 20px 16px 100px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Quiz page sub-header ===== */
.quiz-page-header {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 100%;
}

.quiz-page-header > div {
  max-width: 600px;
}

.quiz-logo { font-size: 2.2rem; line-height: 1; }

/* ===== Breadcrumb bar ===== */
.sp-breadcrumb {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 0;
}

.sp-breadcrumb-link {
  font-size: .82rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  transition: color .15s;
}

.sp-breadcrumb-link:hover { color: #1a1a2e; }

.quiz-page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.5px;
}

.subtitle {
  font-size: .82rem;
  opacity: .8;
  margin-top: 2px;
  text-transform: capitalize;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card.center { text-align: center; }

/* ===== Quiz card ===== */
.question-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 12px;
}

.question-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 24px;
}

/* ===== Answer buttons ===== */
.answers { display: flex; flex-direction: column; gap: 10px; }

.answer-btn {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e2d9f3;
  border-radius: 12px;
  background: #faf8ff;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  position: relative;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--purple);
  background: var(--purple-light);
  transform: translateY(-1px);
}

.answer-btn:active:not(:disabled) { transform: translateY(0); }

.answer-btn.selected   { border-color: var(--purple); background: var(--purple-light); }
.answer-btn.correct    { border-color: var(--green); background: #edfaf3; color: #1a6e42; }
.answer-btn.wrong      { border-color: var(--red);   background: #fdf0ef; color: #7a1c1c; }
.answer-btn.reveal-correct { border-color: var(--green); background: #edfaf3; }

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

/* ===== Result card ===== */
.result-card { text-align: center; }

#result-badge {
  font-size: 3rem;
  margin-bottom: 10px;
}

.result-question {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ===== Stats bars ===== */
.stats-section { text-align: left; margin-top: 8px; }

.stats-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 12px;
}

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

.stat-label {
  flex-shrink: 0;
  width: 180px;
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-bar-wrap {
  flex: 1;
  height: 22px;
  background: #f0ecff;
  border-radius: 6px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  background: var(--purple);
  border-radius: 6px;
  transition: width .6s ease;
  min-width: 4px;
}

.stat-bar.correct { background: var(--green); }
.stat-bar.wrong   { background: var(--red);   }

.stat-pct {
  flex-shrink: 0;
  width: 38px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.stats-total {
  font-size: .82rem;
  color: var(--muted);
  text-align: right;
  margin-top: 8px;
}

/* ===== Countdown ===== */
.countdown-card { text-align: center; }

.countdown-label {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}

.countdown {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--purple);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.countdown-sub {
  font-size: .9rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ===== Push bar ===== */
.push-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--purple-dark);
  color: #fff;
  padding: 14px 16px;
  z-index: 100;
  display: none;
}

.push-bar.visible { display: block; }

.push-bar-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: .95rem;
  font-weight: 500;
}

/* ===== Buttons ===== */
.btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.btn:active { transform: scale(.97); }

.btn-push {
  background: #fff;
  color: var(--purple-dark);
  white-space: nowrap;
}

.btn-push:hover { background: #ede7ff; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--purple);
  color: var(--purple);
  margin-top: 10px;
}

.btn-next {
  width: 100%;
  margin-top: 20px;
  background: var(--purple);
  color: #fff;
  font-size: 1rem;
  padding: 14px;
  border-radius: 12px;
}
.btn-next:hover { background: var(--purple-dark); }

/* ===== Spinner ===== */
.spinner {
  width: 36px; height: 36px;
  border: 4px solid #e2d9f3;
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Helpers ===== */
.hidden { display: none !important; }
.emoji-big { font-size: 3rem; margin-bottom: 10px; }

/* ===== Responsive ===== */
@media (max-width: 400px) {
  .stat-label { width: 120px; }
  .countdown { font-size: 2rem; }
}
