/* ═══════════════════════════════════════════════════════════
   BiologieCoach – Groen/goud thema, Nunito, mobile-first
═══════════════════════════════════════════════════════════ */

:root {
  --green-dark:   #2e7d32;
  --green-mid:    #43a047;
  --green-light:  #e8f5e9;
  --green-pale:   #f1f8e9;
  --gold:         #f9a825;
  --gold-light:   #fff9c4;
  --red:          #e53935;
  --red-light:    #ffebee;
  --correct:      #43a047;
  --correct-bg:   #e8f5e9;
  --wrong:        #e53935;
  --wrong-bg:     #ffebee;
  --white:        #ffffff;
  --text:         #1b1b1b;
  --text-muted:   #666;
  --shadow:       0 4px 16px rgba(0,0,0,0.10);
  --radius:       16px;
  --radius-sm:    10px;
}

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

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: var(--green-pale);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ── Screens ─────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.screen.active { display: flex; }

/* ── HOME ─────────────────────────────────────────────── */
.home-header {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
  color: white;
  padding: 20px 20px 24px;
  border-radius: 0 0 28px 28px;
  box-shadow: var(--shadow);
}
.home-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.app-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.home-badges {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
}
.badge-icon { font-size: 16px; }
.home-subtitle {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
}

/* Module list */
.module-list {
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.home-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.section-head h2 {
  font-size: 18px;
  font-weight: 900;
  color: var(--green-dark);
}
.section-head p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}
.module-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.module-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  border: 2px solid transparent;
  min-height: 80px;
}
.module-card:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.module-icon-wrap {
  position: relative;
  flex-shrink: 0;
}
.module-icon {
  font-size: 36px;
  line-height: 1;
}
.module-info { flex: 1; }
.module-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: 2px;
}
.module-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.module-meta {
  font-size: 12px;
  color: var(--green-mid);
  font-weight: 700;
  margin-top: 4px;
}

/* Progress ring */
.progress-ring-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg { fill: none; stroke: #e0e0e0; }
.progress-ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.progress-pct {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
}

/* ── SESSION ─────────────────────────────────────────── */
.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  position: sticky;
  top: 0;
  z-index: 10;
}
.progress-bar-wrap { flex: 1; }
#session-progress-bar {
  background: #e0e0e0;
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}
#session-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-mid), var(--gold));
  border-radius: 8px;
  transition: width 0.4s ease;
  width: 0%;
}
.lives { font-size: 20px; flex-shrink: 0; }

.session-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 32px;
}

/* Card */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 480px;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}
.card.shake { animation: shake 0.4s ease; }

.card-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--green-mid);
  margin-bottom: 14px;
}
.question-text {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 24px;
  min-height: 56px;
}

/* Multiple choice options */
.mc-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mc-option {
  background: var(--green-light);
  border: 2px solid #c8e6c9;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  min-height: 48px;
  line-height: 1.35;
}
.mc-option:active { transform: scale(0.97); }
.mc-option.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
  color: var(--correct);
}
.mc-option.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
  color: var(--wrong);
}

/* Type input */
.type-wrap { display: flex; flex-direction: column; gap: 10px; }
.accent-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.accent-btn {
  background: var(--gold-light);
  border: 1.5px solid var(--gold);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-width: 40px;
  min-height: 40px;
  color: #333;
}
.type-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border: 2.5px solid #c8e6c9;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
  background: var(--green-light);
}
.type-input:focus { border-color: var(--green-mid); }
.type-input.correct { border-color: var(--correct); background: var(--correct-bg); }
.type-input.wrong   { border-color: var(--wrong);   background: var(--wrong-bg); }

.btn-check {
  background: var(--green-dark);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-height: 48px;
}
.btn-check:active { transform: scale(0.97); }
.btn-check:disabled { background: #ccc; cursor: default; }

/* Feedback */
.feedback-area {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 700;
  min-height: 24px;
  line-height: 1.4;
}
.feedback-correct { color: var(--correct); }
.feedback-wrong   { color: var(--wrong); }

/* ── RESULT ─────────────────────────────────────────────── */
#screen-result {
  justify-content: center;
  align-items: center;
  background: var(--green-pale);
}
.result-wrap {
  text-align: center;
  padding: 32px 24px;
  max-width: 360px;
  width: 100%;
}
.result-emoji  { font-size: 72px; margin-bottom: 16px; }
.result-title  { font-size: 26px; font-weight: 900; margin-bottom: 20px; color: var(--green-dark); }
.result-stats  {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
}
.result-row .val { color: var(--green-dark); font-weight: 900; }

/* ── STATS ─────────────────────────────────────────────── */
.stats-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.stats-header h2 { font-size: 18px; font-weight: 800; }
.stats-content { padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 24px; }
.stats-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stats-section h3 { font-size: 15px; font-weight: 800; margin-bottom: 14px; color: var(--green-dark); }

#xp-chart { width: 100%; height: auto; display: block; }

.stat-module-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.stat-module-row:last-child { border-bottom: none; }
.stat-mod-icon { font-size: 24px; flex-shrink: 0; }
.stat-mod-info { flex: 1; }
.stat-mod-name { font-size: 14px; font-weight: 800; }
.stat-bar-wrap {
  background: #e0e0e0;
  border-radius: 6px;
  height: 8px;
  margin-top: 4px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-mid), var(--gold));
  border-radius: 6px;
  transition: width 0.6s ease;
}
.stat-mod-pct { font-size: 13px; font-weight: 800; color: var(--gold); flex-shrink: 0; }

/* ── Shared buttons ─────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  width: 100%;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 4px 12px rgba(46,125,50,0.3);
}
.btn-primary:active { transform: scale(0.97); }

.btn-icon {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-icon:active { background: rgba(0,0,0,0.07); }

/* ── Confetti canvas ────────────────────────────────────── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ── Flash overlays on card ─────────────────────────────── */
.card.flash-correct { background: var(--correct-bg); }
.card.flash-wrong   { background: var(--wrong-bg); }
