/* ═══════════════════════════════════════
   NCC Exam Prep — style.css
   ═══════════════════════════════════════ */

/* 1. Reset + Custom Properties */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Global mobile tap improvements */
button, a, [role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:root {
  --green:    #1a6b3a;
  --green-lt: #e8f5ee;
  --red:      #ce2b37;
  --red-lt:   #fdecea;
  --accent:   #e9c46a;

  --correct:  #2d6a4f;
  --correct-bg: #d8f3dc;
  --wrong:    #c1121f;
  --wrong-bg: #ffe5e5;
  --pending:  #495057;

  --bg:       #f5f0e8;
  --card:     #ffffff;
  --border:   #e0d8cc;
  --text:     #1a1a1a;
  --text-muted: #6c757d;

  --nav-h:    60px;
  --radius:   16px;
  --radius-sm: 10px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.05), 0 1px 0 rgba(255,255,255,0.8) inset;
  --shadow-md:  0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08), 0 1px 0 rgba(255,255,255,0.9) inset;
  --shadow-lg:  0 4px 16px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.12);
  --shadow:     var(--shadow-md);

  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
  --transition: var(--transition-base);

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.22, 1, 0.36, 1);

  /* Welcome screen palette — additive, used only by #welcome-overlay */
  --gold:        #d4a64a;
  --coral:       #e63946;
  --cream-deep:  #ede4d3;
}

/* 2. Base */
html, body {
  height: 100%;
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

/* Subtle paper texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: multiply;
}

h1, h2, h3 {
  font-family: 'Lora', Georgia, serif;
}

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

.view {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  padding-top: calc(var(--nav-h) + 16px);
  padding-bottom: 80px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

/* View transition */
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view.active {
  display: flex;
  animation: viewEnter 0.35s var(--smooth) forwards;
}

/* 4. Nav */
#app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(26, 107, 58, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08), 0 4px 16px rgba(0,0,0,0.2);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: white;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.nav-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: white;
  font-family: 'Lora', Georgia, serif;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 0.63rem;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  transition: all 0.22s var(--spring);
  min-width: 46px;
  letter-spacing: 0.02em;
}

.nav-btn svg {
  width: 20px; height: 20px;
  fill: currentColor;
}

.nav-btn:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

.nav-btn.active {
  color: var(--green);
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

/* 5. Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.7);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.1);
}

/* 6. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

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

.btn-primary   { background: var(--green); color: white; box-shadow: 0 2px 8px rgba(26,107,58,0.3); }
.btn-primary:hover { background: #155f32; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,107,58,0.35); }
.btn-primary:active { transform: scale(0.97); box-shadow: 0 1px 4px rgba(26,107,58,0.2); }

.btn-secondary { background: var(--green-lt); color: var(--green); border: 1.5px solid rgba(26,107,58,0.25); }
.btn-secondary:hover { background: #d8eed9; transform: translateY(-1px); }

.btn-accent    { background: var(--accent); color: #5a3e0a; box-shadow: 0 2px 8px rgba(233,196,106,0.35); }
.btn-accent:hover { background: #ddb83a; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(233,196,106,0.4); }

.btn-ghost     { background: rgba(255,255,255,0.6); color: var(--text-muted); border: 1.5px solid var(--border); backdrop-filter: blur(4px); }
.btn-ghost:hover { background: rgba(255,255,255,0.9); color: var(--text); transform: translateY(-1px); }

.btn-danger    { background: var(--wrong); color: white; box-shadow: 0 2px 8px rgba(193,18,31,0.25); }
.btn-danger:hover { background: #9b0d18; transform: translateY(-1px); }

.btn-large     { padding: 15px 24px; font-size: 1.02rem; width: 100%; letter-spacing: 0.02em; }
.btn-sm        { padding: 6px 12px; font-size: 0.82rem; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* 7. Home */
.home-header { text-align: center; padding: 8px 0; }

.home-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(26,107,58,0.2));
}

.home-header h1 {
  font-size: 1.9rem;
  color: var(--green);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.home-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  margin-top: 4px;
}

.home-actions { display: flex; flex-direction: column; gap: 12px; }

/* 8. Stats summary */
.stat-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-box {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(232,245,238,0.6));
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: var(--shadow-sm);
}

.stat-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 700;
  font-family: 'Lora', Georgia, serif;
  color: var(--green);
  line-height: 1.1;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-bar-wrap { margin-top: 8px; }

.progress-bar {
  height: 10px;
  background: rgba(0,0,0,0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #2d9b54);
  border-radius: 9999px;
  transition: width 0.7s var(--smooth);
  box-shadow: 0 1px 4px rgba(26,107,58,0.3);
}

.progress-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
  text-align: right;
  font-weight: 600;
}

/* Category bars */
.category-bars h3 { margin-bottom: 12px; font-size: 0.95rem; }

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

.cat-bar-label {
  width: 120px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.cat-bar-track {
  flex: 1;
  height: 7px;
  background: rgba(0,0,0,0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #2d9b54);
  border-radius: 9999px;
  transition: width 0.7s var(--smooth);
}

.cat-bar-pct {
  width: 36px;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* 9. Category filter pills */
#category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.7);
  position: sticky;
  top: var(--nav-h);
  z-index: 10;
}

.pill {
  padding: 5px 13px;
  border-radius: 9999px;
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.6);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  letter-spacing: 0.01em;
}

.pill:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-lt);
  transform: translateY(-1px);
}

.pill.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
  box-shadow: 0 2px 8px rgba(26,107,58,0.25);
  transform: translateY(-1px);
}

/* 10. Study controls */
.study-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.study-pos {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Toggle switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-muted);
  user-select: none;
  font-weight: 600;
}

.toggle-label input[type="checkbox"] { display: none; }

.toggle-slider {
  width: 40px;
  height: 22px;
  background: rgba(0,0,0,0.12);
  border-radius: 9999px;
  position: relative;
  transition: background var(--transition-base);
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: left 0.22s var(--spring);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

input:checked + .toggle-slider { background: var(--green); }
input:checked + .toggle-slider::after { left: 21px; }

/* 11. Question card */
.question-card { gap: 0; }

.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.q-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0,0,0,0.05);
  padding: 3px 9px;
  border-radius: 9999px;
  letter-spacing: 0.04em;
}

.q-category-badge {
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 9999px;
  background: var(--green-lt);
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.bookmark-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--border);
  transition: all var(--transition-base);
  border-radius: 8px;
}

.bookmark-btn svg { width: 22px; height: 22px; fill: currentColor; display: block; }
.bookmark-btn:hover { color: var(--accent); transform: scale(1.1); }
.bookmark-btn.active { color: var(--accent); }

.q-text {
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Lora', Georgia, serif;
  line-height: 1.6;
  margin-bottom: 14px;
  color: var(--text);
  letter-spacing: 0.005em;
}

.q-translation {
  border-left: 3px solid var(--green);
  padding: 6px 0 6px 14px;
  margin-bottom: 14px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, rgba(26,107,58,0.04), transparent);
}

#bn-question {
  font-size: 0.95rem;
  line-height: 1.7;
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  color: var(--text-muted);
}

.q-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.7);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: 'Nunito', sans-serif;
  backdrop-filter: blur(4px);
}

.action-btn svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }

.action-btn:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-lt);
  transform: translateY(-1px);
}
.action-btn.loading { opacity: 0.6; pointer-events: none; }

/* 12. Options */
.q-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

/* Staggered option entrance */
@keyframes optionSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.8);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  animation: optionSlideIn 0.28s var(--smooth) forwards;
}

.q-options .option-btn:nth-child(1) { animation-delay: 0.04s; }
.q-options .option-btn:nth-child(2) { animation-delay: 0.11s; }
.q-options .option-btn:nth-child(3) { animation-delay: 0.18s; }

.option-btn:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--green-lt);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}

.option-letter {
  font-weight: 700;
  color: var(--text-muted);
  min-width: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

.option-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.option-it { line-height: 1.4; }

.option-bn {
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  font-size: 0.88em;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 3px;
  margin-top: 1px;
}

/* Answer feedback animations */
@keyframes correctBounce {
  0%   { transform: scale(1) translateX(0); }
  30%  { transform: scale(1.03) translateX(0); }
  60%  { transform: scale(0.99) translateX(0); }
  100% { transform: scale(1) translateX(0); }
}

@keyframes wrongShake {
  0%,100% { transform: translateX(0); }
  15%,45%,75% { transform: translateX(-6px); }
  30%,60%,90% { transform: translateX(5px); }
}

.option-btn.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
  color: var(--correct);
  opacity: 1;
  animation: correctBounce 0.45s var(--smooth) forwards;
}

.option-btn.correct .option-letter { color: var(--correct); }

.option-btn.wrong {
  border-color: var(--wrong);
  background: var(--wrong-bg);
  color: var(--wrong);
  opacity: 1;
  animation: wrongShake 0.45s ease forwards;
}

.option-btn.wrong .option-letter { color: var(--wrong); }

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

/* 13. Feedback */
.q-feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 10px;
  font-family: 'Nunito', sans-serif;
}

.q-feedback.correct-fb {
  background: var(--correct-bg);
  color: var(--correct);
  box-shadow: 0 2px 8px rgba(45,106,79,0.15);
}
.q-feedback.wrong-fb {
  background: var(--wrong-bg);
  color: var(--wrong);
  box-shadow: 0 2px 8px rgba(193,18,31,0.15);
}

#q-feedback-icon { font-size: 1.2rem; }

/* 14. Study navigation */
.q-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

/* 15. Practice Test — Setup Screen */
.test-setup-hero {
  text-align: center;
  padding: 28px 20px 22px;
  background: linear-gradient(135deg, #1a6b3a 0%, #145530 100%);
  color: white;
  border: none;
}

.test-setup-hero h2 {
  color: white;
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.test-setup-hero .bn-text {
  color: rgba(255,255,255,0.75);
  font-size: 0.95rem;
}

.test-setup-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}

.test-setup-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.test-setup-body .form-group {
  margin-bottom: 0;
}

/* Timer toggle row */
.test-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
}

.test-option-row:hover {
  border-color: var(--green);
  background: var(--green-lt);
}

.test-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.test-option-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.test-option-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Active test screen */
.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 8px;
}

.test-pos {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.test-timer {
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Lora', Georgia, serif;
  color: var(--red);
  background: var(--red-lt);
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(206,43,55,0.15);
  letter-spacing: 0.04em;
  transition: all var(--transition-base);
}

@keyframes timerUrgent {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.65; transform: scale(1.04); }
}

.test-timer.urgent {
  animation: timerUrgent 0.65s ease-in-out infinite;
}

.score-big {
  font-size: 3.2rem;
  font-weight: 700;
  font-family: 'Lora', Georgia, serif;
  text-align: center;
  color: var(--green);
  margin: 20px 0 10px;
  letter-spacing: -0.02em;
  line-height: 1;
}

.score-detail {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 0.95rem;
  font-weight: 600;
}

.score-wrong-list { margin-bottom: 20px; }

.score-wrong-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.score-wrong-item:last-child { border-bottom: none; }

.score-wrong-q { color: var(--text); margin-bottom: 6px; font-weight: 600; }
.score-wrong-user {
  color: var(--wrong);
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 2px;
}
.score-wrong-user.score-wrong-skipped { color: var(--text-muted); }
.score-wrong-correct { color: var(--correct); font-weight: 700; font-size: 0.82rem; }

.score-actions { display: flex; gap: 10px; }

/* 16. Stats */
.stats-hardest-item, .stats-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  gap: 10px;
}

.stats-hardest-item:last-child, .stats-recent-item:last-child { border-bottom: none; }

.stats-item-q { flex: 1; color: var(--text); }
.stats-item-pct { font-weight: 700; color: var(--wrong); }

.danger-zone h3 { color: var(--wrong); margin-bottom: 6px; }
.danger-zone p { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 12px; }

/* 17. Bookmarks */
.bookmark-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.bookmark-header h2 { font-size: 1.1rem; }

.bookmark-list-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: padding-left var(--transition-base);
}

.bookmark-list-item:last-child { border-bottom: none; }

.bookmark-list-item:hover { padding-left: 6px; }
.bookmark-list-item:hover .bookmark-q-text { color: var(--green); }

.bookmark-q-num { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 2px; font-weight: 600; }
.bookmark-q-text { font-size: 0.9rem; color: var(--text); transition: color var(--transition-base); }

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 0;
  font-size: 0.92rem;
  line-height: 1.8;
}

/* 18. Settings */
.form-group { margin-bottom: 22px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 0.9rem; letter-spacing: 0.01em; }

.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.8);
  font-size: 0.92rem;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  transition: border-color var(--transition-base);
}

.form-group select:focus { outline: none; border-color: var(--green); }

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--green);
  height: 4px;
}

.slider-edge { font-size: 1rem; line-height: 1; }
.slider-val { font-size: 0.88rem; color: var(--green); font-weight: 700; }

.cache-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.04);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.count-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.help-text p { margin-bottom: 6px; font-size: 0.92rem; }

/* Settings hero */
.settings-hero {
  text-align: center;
  padding: 24px 20px 18px;
  background: linear-gradient(135deg, #1a6b3a 0%, #145530 100%);
  color: white;
  border: none;
}

.settings-hero h2 { color: white; font-size: 1.5rem; margin-bottom: 2px; }
.settings-hero .bn-text { color: rgba(255,255,255,0.7); font-size: 0.92rem; }
.settings-hero-icon { font-size: 2.4rem; margin-bottom: 8px; line-height: 1; }

/* Settings sections */
.settings-section {
  padding: 0;
  overflow: hidden;
}

.settings-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 12px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.settings-section-icon { font-size: 1rem; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.settings-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-row-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.settings-row-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.settings-select {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.8);
  font-size: 0.85rem;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  max-width: 160px;
  transition: border-color var(--transition-base);
}

.settings-select:focus { outline: none; border-color: var(--green); }

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 0 18px;
}

/* Help steps */
.help-steps {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.help-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 11px 18px;
  transition: background var(--transition-base);
}

.help-step:hover { background: rgba(26,107,58,0.03); }

.help-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-lt);
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
}

.help-step-text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}

/* Danger section */
.settings-danger-section {
  border-color: rgba(193, 18, 31, 0.25);
}

.settings-danger-section .settings-section-title {
  color: var(--wrong);
  border-bottom-color: rgba(193, 18, 31, 0.15);
}

/* App info footer */
.settings-app-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 0 8px;
  opacity: 0.55;
}

.settings-app-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
  background: white;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 4px;
}

.settings-app-name {
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.settings-app-version {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
}

/* 19. Bengali text */
.bn-text {
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  font-size: 1.05em;
  line-height: 1.75;
}

/* 20. Toast */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e1e;
  color: white;
  padding: 10px 22px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  z-index: 999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
  animation: toastIn 0.28s var(--smooth) forwards;
}

.toast.hidden { display: none; }
.toast.success { background: var(--correct); }
.toast.error   { background: var(--wrong); }

/* 21. Modal */
@keyframes modalOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: modalOverlayIn 0.2s ease forwards;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.8);
  animation: modalIn 0.28s var(--spring) forwards;
}

.modal p { font-size: 1rem; margin-bottom: 22px; line-height: 1.6; }

.modal-actions { display: flex; gap: 10px; }

/* 22. Notebook */
@keyframes fabPulse {
  0%,100% { box-shadow: 0 4px 16px rgba(233,196,106,0.35), 0 2px 8px rgba(0,0,0,0.12); }
  50%      { box-shadow: 0 6px 28px rgba(233,196,106,0.6), 0 2px 8px rgba(0,0,0,0.12); }
}

.btn-float-note {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #5a3e0a;
  border: none;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: all 0.22s var(--spring);
  animation: fabPulse 2.8s ease-in-out infinite;
  touch-action: none;
}

.btn-float-note:active { cursor: grabbing; }

.btn-float-note:hover {
  background: #ddb83a;
  transform: scale(1.1) rotate(8deg);
}

.btn-float-note svg { width: 22px; height: 22px; fill: currentColor; }

.note-textarea {
  width: 100%;
  min-height: 110px;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  background: rgba(255,255,255,0.8);
  resize: vertical;
  margin-bottom: 16px;
  line-height: 1.6;
  display: block;
  transition: border-color var(--transition-base);
}

.note-textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(26,107,58,0.1); }

.note-modal-context {
  font-size: 0.78rem;
  color: var(--green);
  background: var(--green-lt);
  padding: 6px 11px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-weight: 600;
}

.note-item { margin-bottom: 0; }

.note-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.note-date { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.note-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all var(--transition-base);
  line-height: 1;
  font-family: 'Nunito', sans-serif;
}

.note-delete-btn:hover { color: var(--wrong); background: var(--wrong-bg); }

.note-context {
  font-size: 0.78rem;
  color: var(--green);
  background: var(--green-lt);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-weight: 600;
}

.note-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 23. Chapter cards */
.chapter-card {
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  margin-bottom: 0;
}

.chapter-card:hover {
  border-color: var(--green);
  background: linear-gradient(135deg, #ffffff, #f0faf4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,107,58,0.12);
}

.chapter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 10px;
}

.chapter-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.chapter-bn {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  margin-top: 2px;
}

.chapter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.05);
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 700;
}

.chapter-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 23b. Chapters — multi-select mode */
.chapters-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}
.chapters-multi-btn,
.chapters-cancel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chapters-cancel-btn { display: none; }
.chapters-subtitle-select { display: none; }

#view-chapters.selecting .chapters-multi-btn { display: none; }
#view-chapters.selecting .chapters-cancel-btn { display: inline-flex; }
#view-chapters.selecting .chapters-subtitle-default { display: none; }
#view-chapters.selecting .chapters-subtitle-select { display: block; }

.chapter-check-mark { display: none; }
#view-chapters.selecting .chapter-check-mark {
  display: inline-block;
  width: 1.2em;
  color: var(--green);
  font-weight: 900;
  opacity: 0;
  transition: opacity 0.15s;
}
#view-chapters.selecting .chapter-card.selected .chapter-check-mark {
  opacity: 1;
}
#view-chapters.selecting .chapter-card.selected {
  border-color: var(--green);
  background: linear-gradient(135deg, #ffffff, #d8f0e0);
  box-shadow: 0 6px 18px rgba(26,107,58,0.22);
  transform: translateY(-1px);
}

.chapters-quiz-bar {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  position: sticky;
  bottom: 16px;
  z-index: 10;
}
#view-chapters.selecting .chapters-quiz-bar { display: flex; }

.chapters-quiz-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chapters-quiz-summary {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}
.chapters-quiz-actions {
  display: flex;
  gap: 6px;
}
.chapters-count-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chapters-count-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.pill-group {
  display: flex;
  gap: 6px;
}
.chapters-start-btn { width: 100%; }
.chapters-start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 23c. App footer (powered by X3RO) */
.app-footer {
  margin-top: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 22px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.app-footer-text {
  opacity: 0.85;
}
.app-footer-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: transform var(--transition-base), opacity var(--transition-base);
  opacity: 0.92;
}
.app-footer-link:hover {
  transform: translateY(-1px);
  opacity: 1;
}
.app-footer-logo {
  height: 38px;
  width: auto;
  display: block;
}

/* 24. Utility */
.hidden { display: none !important; }

/* 25. Responsive — Bottom Nav on Mobile */
@media (max-width: 640px) {
  :root {
    --nav-h: 56px;
    --bottom-nav-h: 62px;
  }

  /* Top bar: brand only, centered */
  #app-nav {
    justify-content: center;
  }

  .nav-title { font-size: 1rem; }

  /* Bottom nav bar */
  .nav-links {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: rgba(20, 85, 48, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -1px 0 rgba(255,255,255,0.1), 0 -4px 20px rgba(0,0,0,0.25);
    z-index: 101;
    overflow-x: visible;
    gap: 0;
    border-radius: 0;
  }

  .nav-btn {
    flex: 1;
    min-width: 0;
    padding: 5px 2px;
    border-radius: 10px;
    font-size: 0.6rem;
    gap: 3px;
  }

  /* Show labels in bottom nav */
  .nav-btn span { display: flex; }

  .nav-btn svg { width: 20px; height: 20px; }

  .nav-btn.active {
    background: rgba(255,255,255,0.15);
    color: white;
    box-shadow: none;
    transform: translateY(-2px);
  }

  /* Push content above bottom nav */
  .view {
    padding-bottom: calc(var(--bottom-nav-h) + 24px);
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Raise floating note button above bottom nav */
  .btn-float-note {
    bottom: calc(var(--bottom-nav-h) + 12px);
  }

  /* Raise sticky chapters quiz bar above bottom nav */
  .chapters-quiz-bar {
    bottom: calc(var(--bottom-nav-h) + 12px);
  }

  /* Keep footer visible above fixed bottom nav */
  .app-footer {
    padding-bottom: calc(var(--bottom-nav-h) + 14px);
  }
  .app-footer-logo { height: 34px; }

  /* Category filter: horizontal scroll instead of wrapping */
  #category-filter {
    top: var(--nav-h);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding: 10px 12px;
  }
  #category-filter::-webkit-scrollbar { display: none; }
  #category-filter .pill { flex-shrink: 0; }

  /* Text sizing */
  .q-text { font-size: 1rem; }
  .stat-num { font-size: 1.35rem; }
  .stat-label { font-size: 0.65rem; }
  .score-big { font-size: 2.4rem; }

  /* Category bars: stacked layout so labels never truncate */
  .cat-bar-row {
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 12px;
  }
  .cat-bar-label {
    width: auto;
    flex: 1 1 auto;
    font-size: 0.75rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    min-width: 0;
  }
  .cat-bar-pct { width: auto; flex-shrink: 0; }
  .cat-bar-track { flex-basis: 100%; margin-top: 2px; }

  /* Home logo */
  .home-logo { width: 80px; height: 80px; }
  .home-header h1 { font-size: 1.6rem; }

  /* Tighter card padding */
  .card { padding: 14px; }

  /* Question card option font size */
  .option-btn { font-size: 0.9rem; padding: 11px 12px; }

  /* Action buttons — shrink on very small screens */
  .action-btn { font-size: 0.8rem; padding: 6px 11px; }

  /* Q-nav: equal-width buttons */
  .q-nav { gap: 8px; }
  .q-nav .btn { flex: 1; }

  /* Score actions: stack vertically */
  .score-actions { flex-direction: column; }
  .score-actions .btn { width: 100%; }

  /* Toast: raise above bottom nav */
  .toast { bottom: calc(var(--bottom-nav-h) + 16px); white-space: normal; }

  /* Full-width modals on mobile */
  .modal { border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* Settings rows: allow wrap on very small screens */
  .settings-row { gap: 10px; }
  .settings-select { max-width: 130px; }

  /* Study controls: smaller toggle text */
  .toggle-label { font-size: 0.8rem; }

  /* Chapter cards: tighter */
  .chapter-card { padding: 14px; }

  /* Stat row: let numbers breathe */
  .stat-row { gap: 8px; }
  .stat-box { padding: 10px 4px; }

  /* Home action buttons: full width, bigger tap targets */
  .home-actions { gap: 10px; }
  .home-actions .btn { width: 100%; justify-content: flex-start; padding: 14px 18px; font-size: 0.95rem; }

  /* Nav logo: slightly smaller on mobile */
  .nav-logo-img { width: 30px; height: 30px; }

  /* Stats section headings */
  .stats-section h3 { font-size: 0.9rem; }
}

/* Handle safe area for notched phones (top nav) */
@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 640px) {
    #app-nav {
      padding-top: env(safe-area-inset-top);
      height: calc(var(--nav-h) + env(safe-area-inset-top));
    }
    .view {
      padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 16px);
    }
    /* Sticky category filter must account for taller top bar */
    #category-filter {
      top: calc(var(--nav-h) + env(safe-area-inset-top));
    }
  }
}

/* Very small phones (iPhone SE, 320px width) */
@media (max-width: 375px) {
  .nav-btn { font-size: 0.55rem; min-width: 0; }
  .nav-btn svg { width: 18px; height: 18px; }
  .q-text { font-size: 0.95rem; }
  .option-btn { font-size: 0.85rem; padding: 10px 10px; }
  .action-btn { font-size: 0.75rem; padding: 5px 9px; }
  .action-btn svg { width: 14px; height: 14px; }
  .card { padding: 12px; }
  .stat-num { font-size: 1.2rem; }
  .home-header h1 { font-size: 1.4rem; }
}

/* ══════════════════════════════════════
   Exit button
══════════════════════════════════════ */
.exit-session-btn {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-color: transparent;
  background: transparent;
  flex-shrink: 0;
}
.exit-session-btn:hover {
  color: var(--wrong);
  border-color: rgba(193,18,31,0.2);
  background: var(--wrong-bg);
  transform: none;
}

/* ══════════════════════════════════════
   Study result screen
══════════════════════════════════════ */
#study-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Staggered entrance for result cards */
#study-result .result-hero      { animation: viewEnter 0.4s ease both; }
#study-result .result-stats-row { animation: viewEnter 0.4s 0.1s ease both; }
#study-result .result-actions   { animation: viewEnter 0.4s 0.25s ease both; }
#study-result #study-result-wrong-section { animation: viewEnter 0.4s 0.18s ease both; }

.result-hero {
  text-align: center;
  padding: 28px 20px 24px;
}

.result-hero h2 {
  font-size: 1.3rem;
  margin: 0 0 6px;
}

/* Big animated emoji */
.result-emoji {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 18px;
  display: block;
  animation: emojiBounce 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes emojiBounce {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  50%  { transform: scale(1.3) rotate(8deg);  opacity: 1; }
  70%  { transform: scale(0.9) rotate(-4deg); }
  85%  { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(1)   rotate(0deg);  opacity: 1; }
}

.result-divider {
  width: 48px;
  height: 3px;
  background: var(--green);
  border-radius: 2px;
  margin: 14px auto 12px;
  opacity: 0.4;
}

.result-motivational {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
  line-height: 1.5;
}

.result-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
}

.result-ring {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.ring-center-fill {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 108px;
  height: 108px;
  transform: translate(-50%, -50%);
  background: var(--card);
  border-radius: 50%;
  z-index: 0;
}

.result-ring {
  position: relative;
  z-index: 1;
}

.result-ring .ring-bg {
  fill: none;
  stroke: rgba(0,0,0,0.07);
  stroke-width: 8;
}

.result-ring .ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
}

.result-ring-wrap .score-big {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: 1.6rem;
  z-index: 2;
}

.result-stats-grid {
  display: flex;
  gap: 10px;
}

.result-stat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.03);
  animation: viewEnter 0.4s ease both;
}

.result-stat-card:nth-child(1) { animation-delay: 0.15s; }
.result-stat-card:nth-child(2) { animation-delay: 0.25s; }
.result-stat-card:nth-child(3) { animation-delay: 0.35s; }

.result-stat-card .result-stat-icon {
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 2px;
}

.result-stat-card .stat-num {
  font-size: 1.6rem;
}

.result-stat-card .stat-label {
  font-size: 0.65rem;
  text-align: center;
}

.result-stat-card.correct-card { background: rgba(34,197,94,0.08); }
.result-stat-card.wrong-card   { background: rgba(193,18,31,0.06); }

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ══════════════════════════════════════
   Confetti
══════════════════════════════════════ */
.confetti-piece {
  position: fixed;
  top: -14px;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { opacity: 1; }
  75%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ══════════════════════════════════════
   Trophy popup
══════════════════════════════════════ */
.trophy-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 9998;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 40px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  pointer-events: none;
}

.trophy-popup .trophy-icon {
  font-size: 3.5rem;
  display: block;
  line-height: 1.2;
}

.trophy-popup .trophy-msg {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
  margin-top: 10px;
}

.trophy-popup.show {
  animation: trophyBounce 2s ease forwards;
}

@keyframes trophyBounce {
  0%   { transform: translate(-50%,-50%) scale(0);    opacity: 0; }
  10%  { transform: translate(-50%,-50%) scale(1.25); opacity: 1; }
  20%  { transform: translate(-50%,-50%) scale(0.92); opacity: 1; }
  28%  { transform: translate(-50%,-50%) scale(1.06); opacity: 1; }
  36%  { transform: translate(-50%,-50%) scale(1);    opacity: 1; }
  75%  { transform: translate(-50%,-50%) scale(1);    opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(0.8);  opacity: 0; }
}

/* ══════════════════════════════════════
   Splash overlay
══════════════════════════════════════ */
#splash-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#splash-overlay[hidden] {
  display: none;
}

.splash-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.7);
  width: 100%;
  max-width: 480px;
}

.splash-brand {
  text-align: center;
  margin-bottom: 24px;
}

.splash-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 12px rgba(26,107,58,0.2));
}

.splash-brand h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.7rem;
  color: var(--green);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* Tabs */
.splash-tabs {
  display: flex;
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.splash-tab {
  flex: 1;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.splash-tab.active {
  background: var(--card);
  color: var(--green);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.splash-tab:hover:not(.active) {
  color: var(--text);
}

/* Form fields */
.splash-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.splash-field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.splash-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition-fast);
  outline: none;
}

.splash-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,107,58,0.12);
}

/* Turnstile widget — allow it to breathe */
.splash-card .cf-turnstile {
  margin: 16px 0;
}

/* Submit buttons */
.splash-submit-btn {
  width: 100%;
  margin-top: 8px;
}

#splash-btn-login[disabled],
#splash-btn-register[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error display — inline message; submit button is auto-re-enabled by setError(). */
#splash-error {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--red-lt);
  border: 1px solid rgba(206,43,55,0.25);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
}

/* GDPR consent */
.splash-consent {
  margin-bottom: 16px;
}

.splash-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.4;
}

.splash-consent-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--green);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.splash-privacy-link {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.splash-privacy-link:hover {
  color: #155f32;
}

/* Honeypot — must be invisible and out of flow */
input[name="company_url"] {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ══════════════════════════════════════
   Privacy page
══════════════════════════════════════ */
.privacy-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

.privacy-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,0.7);
  margin-bottom: 24px;
}

.privacy-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.privacy-back-link:hover {
  color: #155f32;
  text-decoration: underline;
}

.privacy-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.privacy-section {
  margin-bottom: 24px;
}

.privacy-section h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.15rem;
  color: var(--green);
  margin-bottom: 10px;
}

.privacy-section p,
.privacy-section li {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.65;
}

.privacy-section ul {
  padding-left: 20px;
  margin-top: 8px;
}

.privacy-section li {
  margin-bottom: 4px;
}

/* Footer privacy link */
.app-footer-privacy {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-decoration: none;
  margin-left: 12px;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.app-footer-privacy:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ══════════════════════════════════════
   Mobile — splash
══════════════════════════════════════ */
@media (max-width: 640px) {
  .splash-card {
    padding: 20px;
  }

  .splash-tabs {
    width: 100%;
  }

  .splash-tab {
    width: 100%;
  }

  .splash-field input {
    width: 100%;
  }
}

/* ═══════════════════════════════════════
   Welcome overlay — first-run only
   Editorial / Italian magazine meets warm Bengali calligraphy.
   Mirrors email-templates/welcome.html design language.
   ═══════════════════════════════════════ */

#welcome-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream-deep);
  z-index: 1100;                /* above splash (1000) */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 20px 60px;
}

#welcome-overlay[hidden] {
  display: none;                /* override the explicit display:flex above (lesson learned) */
}

/* Top + bottom split-color accent bars (carryover signature from email) */
.welcome-bar {
  width: 100%;
  max-width: 720px;
  height: 8px;
  background: linear-gradient(90deg,
    var(--coral) 0%, var(--coral) 50%,
    var(--green) 50%, var(--green) 100%);
  flex-shrink: 0;
  transform-origin: left center;
}
.welcome-bar-top    { margin-bottom: 28px; }
.welcome-bar-bottom { margin-top: 36px; }

/* Card */
.welcome-card {
  background: var(--card);
  border-radius: 4px;           /* sharper than --radius — editorial, not bubbly */
  padding: 40px 36px;
  max-width: 640px;
  width: 100%;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.04),
    0 12px 32px rgba(26,107,58,0.08),
    0 24px 60px rgba(0,0,0,0.06);
  border: 1px solid rgba(212,166,74,0.18);
  position: relative;
}

/* Eyebrow / "Iscrizione confermata · ১" */
.welcome-eyebrow {
  font-family: 'Lora', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 22px;
  text-align: center;
}

/* Headline row: Italian + gold underline + Bengali */
.welcome-headline-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.welcome-headline-it {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(2.6rem, 7vw, 3.8rem);
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}

.welcome-underline {
  display: block;
  width: 88px;
  height: 3px;
  background: var(--gold);
  transform-origin: left center;
}

.welcome-headline-bn {
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  font-size: clamp(1.9rem, 5.4vw, 2.6rem);
  font-weight: 700;
  color: var(--coral);
  line-height: 1;
  margin: 0;
}

/* Subtitle — small bilingual line under the headline */
.welcome-subtitle {
  text-align: center;
  font-size: 1.02rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.welcome-subtitle span[lang="bn"] {
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  margin-left: 4px;
}

/* Device-local notice — red-bordered alert box (carryover from email) */
.welcome-notice {
  background: #fdf6f0;
  border-left: 4px solid var(--coral);
  border-radius: 2px;
  padding: 16px 20px;
  margin-bottom: 28px;
}

.welcome-notice-label {
  display: inline-block;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 8px;
}
.welcome-notice-label span[lang="bn"] {
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.welcome-notice p {
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}
.welcome-notice p + p {
  margin-top: 8px;
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  color: #5d3a3a;
}
.welcome-notice strong {
  color: var(--coral);
}

/* Tip cards — numbered serif label, alternating accent color border */
.welcome-tips {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.welcome-tip {
  position: relative;
  background: #fefcf6;
  border: 1px solid rgba(0,0,0,0.05);
  border-left: 4px solid var(--gold);
  border-radius: 2px;
  padding: 18px 20px 18px 76px;
  min-height: 72px;
}
.welcome-tip-2 { border-left-color: var(--coral); }
.welcome-tip-3 { border-left-color: var(--green); }

.welcome-tip-num {
  position: absolute;
  top: 14px;
  left: 18px;
  font-family: 'Lora', Georgia, serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold);
  opacity: 0.75;
  letter-spacing: -0.02em;
}
.welcome-tip-2 .welcome-tip-num { color: var(--coral); }
.welcome-tip-3 .welcome-tip-num { color: var(--green); }

.welcome-tip h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.welcome-tip p {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}
.welcome-tip p + p {
  margin-top: 4px;
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  color: var(--coral);
  font-weight: 500;
}

/* CTA — hard-shadow button, the signature flourish */
.welcome-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--green);
  color: #fff;
  font-family: 'Lora', Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  padding: 16px 28px;
  border: 2px solid var(--green);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 6px 6px 0 var(--gold);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    background var(--transition-base);
}
.welcome-cta:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--gold);
  background: #155f32;
}
.welcome-cta:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--gold);
}
.welcome-cta:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.welcome-cta-sep {
  opacity: 0.5;
  font-weight: 400;
}
.welcome-cta span[lang="bn"] {
  font-family: 'Noto Sans Bengali', 'Vrinda', sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}

/* ═══════════ Orchestrated entrance ═══════════ */

@media (prefers-reduced-motion: no-preference) {

  @keyframes welcomeBarSlide {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
  @keyframes welcomeFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes welcomeFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  @keyframes welcomeHeadlineIt {
    from { opacity: 0; clip-path: inset(0 100% 0 0); }
    to   { opacity: 1; clip-path: inset(0 0 0 0); }
  }
  @keyframes welcomeUnderlineDraw {
    from { transform: scaleX(0); opacity: 0.5; }
    to   { transform: scaleX(1); opacity: 1; }
  }
  @keyframes welcomeHeadlineBn {
    from { opacity: 0; transform: translateY(14px) rotate(-2deg); }
    to   { opacity: 1; transform: translateY(0)    rotate(0); }
  }
  @keyframes welcomeStagger {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes welcomeCtaPop {
    0%   { opacity: 0; transform: scale(0.9); }
    60%  { opacity: 1; transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); }
  }

  /* Bars */
  .welcome-bar-top {
    animation: welcomeBarSlide 320ms ease-out 0ms both;
  }
  .welcome-bar-bottom {
    animation: welcomeBarSlide 320ms ease-out 200ms both;
  }

  /* Card body */
  .welcome-card {
    animation: welcomeFadeUp 460ms var(--smooth) 220ms both;
  }

  .welcome-eyebrow {
    animation: welcomeFadeIn 380ms ease-out 500ms both;
  }
  .welcome-headline-it {
    animation: welcomeHeadlineIt 620ms ease-out 620ms both;
  }
  .welcome-underline {
    animation: welcomeUnderlineDraw 360ms ease-out 1100ms both;
  }
  .welcome-headline-bn {
    animation: welcomeHeadlineBn 520ms var(--spring) 1280ms both;
  }
  .welcome-subtitle {
    animation: welcomeStagger 420ms var(--smooth) 1500ms both;
  }
  .welcome-notice {
    animation: welcomeStagger 460ms var(--smooth) 1700ms both;
  }
  .welcome-tip-1 { animation: welcomeStagger 440ms var(--smooth) 1880ms both; }
  .welcome-tip-2 { animation: welcomeStagger 440ms var(--smooth) 2030ms both; }
  .welcome-tip-3 { animation: welcomeStagger 440ms var(--smooth) 2180ms both; }
  .welcome-cta {
    animation: welcomeCtaPop 460ms var(--spring) 2380ms both;
  }
}

/* ═══════════ Mobile (≤640px) ═══════════ */
@media (max-width: 640px) {
  #welcome-overlay {
    padding: 18px 14px 40px;
  }
  .welcome-bar {
    height: 4px;
  }
  .welcome-bar-top    { margin-bottom: 18px; }
  .welcome-bar-bottom { margin-top: 22px; }
  .welcome-card {
    padding: 28px 22px;
  }
  .welcome-eyebrow {
    font-size: 0.66rem;
    letter-spacing: 0.22em;
    margin-bottom: 16px;
  }
  .welcome-tip {
    padding: 16px 18px 16px 64px;
  }
  .welcome-tip-num {
    font-size: 2rem;
    top: 14px;
    left: 16px;
  }
  .welcome-cta {
    padding: 14px 20px;
    font-size: 1rem;
  }
}
