/* ═══════════════════════════════════════════════════
   CARDS — like a note pinned onto the page
   ═══════════════════════════════════════════════════ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px 14px 12px 16px;
  padding: var(--sp-md);
  box-shadow: var(--shadow-paper);
}

/* ═══════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  border-radius: 10px 12px 9px 13px;
  padding: var(--sp-sm) var(--sp-lg);
  font-size: var(--fs-base);
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: transform var(--t-fast), opacity var(--t-fast), filter var(--t-fast), box-shadow var(--t-fast);
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 rgba(0,0,0,0.15);
}

.btn:active:not(:disabled) { transform: translateY(2px) scale(0.99); filter: brightness(0.94); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-primary   { background: var(--c-green);    color: #fff; box-shadow: 0 3px 0 #2c7420; }
.btn-secondary { background: var(--c-surface2); color: var(--c-text); box-shadow: 0 3px 0 var(--c-border); }
.btn-blue      { background: var(--c-blue);     color: #fff; box-shadow: 0 3px 0 #1c608f; }
.btn-danger    { background: var(--c-red);      color: #fff; box-shadow: 0 3px 0 #8f2f28; }
.btn-full      { width: 100%; }
.btn-sm        { padding: var(--sp-xs) var(--sp-md); font-size: var(--fs-sm); border-radius: 8px 9px 7px 10px; box-shadow: 0 2px 0 rgba(0,0,0,0.15); }
.btn-sm:active:not(:disabled) { box-shadow: 0 1px 0 rgba(0,0,0,0.15); }

/* ═══════════════════════════════════════════════════
   CHIPS
   ═══════════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-full);
  border: 1.5px dashed currentColor;
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.chip-green  { background: rgba(63,155,46,0.13);  color: var(--c-green);  }
.chip-red    { background: rgba(196,67,58,0.13);  color: var(--c-red);   }
.chip-orange { background: rgba(224,138,30,0.13); color: var(--c-orange); }
.chip-blue   { background: rgba(44,134,201,0.13); color: var(--c-blue);  }
.chip-muted  { background: rgba(138,124,99,0.13); color: var(--c-muted); border-style: solid; border-color: var(--c-border); }

.ml-xs { margin-left: var(--sp-xs); }

/* ═══════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════ */
.textarea {
  width: 100%;
  min-height: 180px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text);
  padding: var(--sp-sm);
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--fs-sm);
  resize: vertical;
  line-height: 1.6;
}

.textarea:focus {
  outline: none;
  border-color: var(--c-blue);
}

.textarea::placeholder { color: var(--c-muted); }

.text-input {
  width: 100%;
  background: var(--c-surface);
  border: none;
  border-bottom: 2px solid var(--c-border);
  border-radius: 4px 4px 0 0;
  color: var(--c-text);
  padding: var(--sp-sm) var(--sp-md);
  font-size: var(--fs-base);
  transition: border-color var(--t-fast), background var(--t-fast);
}

.text-input:focus {
  outline: none;
  border-color: var(--c-blue);
  background: var(--c-surface2);
}

.text-input::placeholder { color: var(--c-muted); }

/* ═══════════════════════════════════════════════════
   NAME GATE (perfil por nombre al abrir la app)
   ═══════════════════════════════════════════════════ */
.name-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-lg);
  padding: var(--sp-lg);
  background-color: var(--c-bg);
  background-image:
    linear-gradient(90deg, transparent 31px, var(--c-margin) 31px, var(--c-margin) 32px, transparent 32px),
    repeating-linear-gradient(var(--c-bg), var(--c-bg) 31px, var(--c-rule-line) 31px, var(--c-rule-line) 32px);
  text-align: center;
}

.name-gate.hidden { display: none; }

.name-gate-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px 16px 12px 18px;
  padding: var(--sp-xl) var(--sp-lg);
  box-shadow: var(--shadow-paper-lg);
  transform: rotate(-0.6deg);
}

/* ═══════════════════════════════════════════════════
   INFO BANNER
   ═══════════════════════════════════════════════════ */
.info-banner {
  background: rgba(28,176,246,0.1);
  border: 1px solid rgba(28,176,246,0.4);
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-md);
  font-size: var(--fs-sm);
  color: var(--c-blue);
  line-height: 1.5;
}

.info-banner code {
  background: rgba(255,255,255,0.1);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
}

/* ═══════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════ */
.progress-bar {
  height: 8px;
  background: var(--c-surface2);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--c-green);
  border-radius: var(--r-full);
  transition: width 0.3s ease;
}

/* ═══════════════════════════════════════════════════
   OPTION BUTTONS (Quiz)
   ═══════════════════════════════════════════════════ */
.option-btn {
  width: 100%;
  text-align: left;
  padding: var(--sp-md);
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: 10px 13px 9px 12px;
  color: var(--c-text);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  min-height: 52px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  animation: optionIn 0.3s ease backwards;
  box-shadow: var(--shadow-paper);
}

.options-stack .option-btn:nth-child(1) { animation-delay: 0.02s; }
.options-stack .option-btn:nth-child(2) { animation-delay: 0.07s; }
.options-stack .option-btn:nth-child(3) { animation-delay: 0.12s; }
.options-stack .option-btn:nth-child(4) { animation-delay: 0.17s; }
.options-stack .option-btn:nth-child(5) { animation-delay: 0.22s; }

.option-btn:hover:not(:disabled) {
  border-color: var(--c-blue);
  background: rgba(44,134,201,0.07);
}

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

.option-btn.correct {
  border-color: var(--c-green);
  background: rgba(63,155,46,0.13);
  animation: correctPop 0.4s ease;
  box-shadow: var(--shadow-paper), inset 0 0 0 1px rgba(63,155,46,0.3);
}

.option-btn.wrong {
  border-color: var(--c-red);
  background: rgba(196,67,58,0.13);
  animation: shake 0.4s ease;
  box-shadow: var(--shadow-paper), inset 0 0 0 1px rgba(196,67,58,0.3);
}

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

.option-letter {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.15rem;
  min-width: 22px;
  opacity: 0.7;
  flex-shrink: 0;
}

.options-stack { display: flex; flex-direction: column; gap: var(--sp-sm); }

/* ═══════════════════════════════════════════════════
   COMBO BADGE
   ═══════════════════════════════════════════════════ */
.combo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--c-orange);
  color: #fff;
  padding: 4px 14px;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: var(--fs-sm);
  animation: pop 0.25s ease;
}

/* ═══════════════════════════════════════════════════
   TIMER & HEARTS
   ═══════════════════════════════════════════════════ */
.timer {
  font-size: var(--fs-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}

.timer.warning {
  color: var(--c-red);
  animation: pulse 1s ease-in-out infinite;
}

.hearts-row { display: flex; gap: 4px; }

.heart {
  font-size: 1.3rem;
  transition: opacity 0.3s, filter 0.3s;
}

.heart.lost { opacity: 0.3; filter: grayscale(1); }

/* ═══════════════════════════════════════════════════
   QUESTION SCREEN LAYOUT
   ═══════════════════════════════════════════════════ */
.question-header {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.question-back {
  background: none;
  border: none;
  color: var(--c-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--sp-xs);
  border-radius: var(--r-sm);
  line-height: 1;
  transition: background var(--t-fast);
  flex-shrink: 0;
}

.question-back:hover { background: var(--c-surface); }

.question-counter {
  flex: 1;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--c-muted);
  font-weight: 600;
}

.question-exam-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-sm);
}

.question-text {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: var(--sp-md);
  animation: slideIn 0.3s ease;
}

/* ═══════════════════════════════════════════════════
   ARTICLE REFERENCE PANEL
   ═══════════════════════════════════════════════════ */
.article-ref {
  background: rgba(63,155,46,0.06);
  border: 1px dashed rgba(63,155,46,0.35);
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.article-ref-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  color: var(--c-green);
  font-weight: 600;
}
.article-ref-caret {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.article-ref.open .article-ref-caret {
  transform: rotate(180deg);
}
.article-ref-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.article-ref.open .article-ref-body {
  max-height: 400px;
  overflow-y: auto;
}
.article-ref-path {
  padding: 0 12px 6px;
  font-size: 0.7rem;
  font-style: italic;
  color: var(--c-muted);
  opacity: 0.8;
}
.article-ref-text {
  padding: 0 12px 12px;
  font-size: 0.75rem;
  color: var(--c-muted);
  line-height: 1.55;
}

/* ═══════════════════════════════════════════════════
   EXPLANATION BOX
   ═══════════════════════════════════════════════════ */
.explanation-box {
  background: #FBF0C8;
  border: 1px dashed #C9AD5C;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 3px 10px 3px 10px;
  font-size: var(--fs-sm);
  color: #5C4A1E;
  animation: slideIn 0.2s ease;
  line-height: 1.5;
  box-shadow: var(--shadow-paper);
  position: relative;
}

.explanation-box::before {
  content: '📌';
  position: absolute;
  top: -10px;
  left: 14px;
  font-size: 1rem;
  transform: rotate(-8deg);
}

.explanation-box--positive {
  background: #E8F3DD;
  border-color: #A9C98E;
  color: #33511F;
}

/* ═══════════════════════════════════════════════════
   RESULTS SCREEN
   ═══════════════════════════════════════════════════ */
.score-big {
  font-family: var(--font-hand);
  font-size: 4.5rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
  transform: rotate(-2deg);
  display: inline-block;
}

.score-gold   { color: var(--c-gold); }
.score-green  { color: var(--c-green); }
.score-orange { color: var(--c-orange); }
.score-red    { color: var(--c-red); }

.stat-chips {
  display: flex;
  gap: var(--sp-sm);
  justify-content: center;
  flex-wrap: wrap;
}

.stat-chip {
  padding: var(--sp-xs) var(--sp-md);
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: var(--fs-sm);
}

/* ═══════════════════════════════════════════════════
   XP BAR
   ═══════════════════════════════════════════════════ */
.xp-bar-wrap {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  height: 12px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-orange), var(--c-gold));
  border-radius: var(--r-full);
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 4px;
}

.xp-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-xs);
  color: var(--c-muted);
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xs);
  pointer-events: none;
  width: 90vw;
  max-width: 360px;
}

.toast {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: 8px 12px 8px 12px;
  padding: var(--sp-sm) var(--sp-md);
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
  animation: slideUp 0.3s ease;
  text-align: center;
  box-shadow: var(--shadow-paper-lg);
}

.toast-hide { animation: slideDown 0.3s ease forwards; }

.toast-success { border-color: var(--c-green);  color: var(--c-green);  }
.toast-error   { border-color: var(--c-red);    color: var(--c-red);   }
.toast-xp      { border-color: var(--c-orange); color: var(--c-orange); }
.toast-info    { border-color: var(--c-blue);   color: var(--c-blue);  }
.toast-badge   { border-color: var(--c-gold);   color: var(--c-gold); display:flex; gap:var(--sp-sm); align-items:center; }

/* ═══════════════════════════════════════════════════
   MODAL & CONFETTI
   ═══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px 20px 14px 20px;
  padding: var(--sp-xl);
  text-align: center;
  max-width: 320px;
  width: 90%;
  animation: pop 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-paper-lg);
}

.modal-title { font-family: var(--font-hand); font-size: 2rem; font-weight: 700; margin-bottom: var(--sp-sm); }
.modal-icon  { font-size: 4rem; display: block; margin-bottom: var(--sp-sm); }

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  top: -10px;
}

/* ═══════════════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════════════ */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--c-surface);
  border-top: 1.5px dashed var(--c-border);
  box-shadow: 0 -4px 14px rgba(90,65,20,0.08);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  color: var(--c-muted);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: var(--sp-xs);
  position: relative;
  transition: color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.nav-icon { font-size: 1.3rem; line-height: 1; display: inline-block; }

.nav-item.active { color: var(--c-blue); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 6px;
  width: 22px;
  height: 3px;
  border-radius: var(--r-full);
  background: var(--c-blue);
}
.nav-item.active .nav-icon { animation: navBounce 0.35s ease; }
.nav-item:active { transform: scale(0.93); }

/* ═══════════════════════════════════════════════════
   HEATMAP
   ═══════════════════════════════════════════════════ */
.heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-sm);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.heatmap-nav-btn {
  background: none;
  border: none;
  color: var(--c-text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  line-height: 1;
}

.heatmap-nav-btn:hover { background: var(--c-surface2); }

.heatmap-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}

.heatmap-weekday {
  font-size: 0.62rem;
  text-align: center;
  color: var(--c-muted);
  font-weight: 600;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity var(--t-fast);
}

.heatmap-cell:hover:not(.empty) { opacity: 0.75; }
.heatmap-cell.today { box-shadow: 0 0 0 2px var(--c-text); }
.heatmap-cell.empty { background: transparent !important; pointer-events: none; }

/* ═══════════════════════════════════════════════════
   PHASE BARS
   ═══════════════════════════════════════════════════ */
.phase-bar-wrap { cursor: pointer; }

.phase-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--c-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.phase-bar {
  height: 10px;
  background: var(--c-surface2);
  border-radius: var(--r-full);
  overflow: hidden;
}

.phase-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════
   CTA HOME CARDS
   ═══════════════════════════════════════════════════ */
.cta-card {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: 12px 18px 12px 18px;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  transition: transform var(--t-fast), filter var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-paper-lg);
  position: relative;
}

.cta-card::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 22px;
  width: 44px;
  height: 16px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.7);
  transform: rotate(-4deg);
}

.cta-card:active { transform: scale(0.98); filter: brightness(0.92); }
.cta-card { animation: slideIn 0.35s ease backwards; }
.cta-card:nth-of-type(1) { animation-delay: 0.03s; }
.cta-card:nth-of-type(2) { animation-delay: 0.09s; }
.cta-card:nth-of-type(3) { animation-delay: 0.15s; }

.cta-card-icon   { font-size: 2rem; flex-shrink: 0; }
.cta-card-label  { font-family: var(--font-hand); font-size: 1.5rem; font-weight: 700; display:block; }
.cta-card-sub    { font-size: var(--fs-xs); color: rgba(255,255,255,0.8); margin-top: 2px; display:block; }

.cta-practice { background: linear-gradient(135deg, #2C7420, var(--c-green)); color: #fff; }
.cta-exam     { background: linear-gradient(135deg, #1C608F, var(--c-blue));  color: #fff; }
.cta-review   { background: linear-gradient(135deg, #A8650F, var(--c-orange));color: #fff; }

/* ═══════════════════════════════════════════════════
   STREAK DISPLAY
   ═══════════════════════════════════════════════════ */
.streak-num      { font-family: var(--font-hand); font-size: 1.8rem; font-weight: 700; }
.streak-num.big  { font-size: 2.4rem; }
.streak-num.huge { font-size: 3.2rem; text-shadow: 0 0 16px rgba(224,138,30,0.5); }

.freeze-icons { display: flex; gap: 2px; }
.freeze-icon  { font-size: 1.2rem; }

/* ═══════════════════════════════════════════════════
   PRACTICE SELECTOR
   ═══════════════════════════════════════════════════ */
.phase-accordion {
  border-radius: 10px 14px 12px 16px;
  overflow: hidden;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-paper);
  margin-bottom: var(--sp-sm);
}

.phase-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast);
}

.phase-accordion-header:hover { background: var(--c-surface2); }

.phase-caret {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.phase-accordion.open .phase-caret { transform: rotate(180deg); }

.phase-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.phase-accordion.open .phase-accordion-body { max-height: 2000px; }

.phase-accordion-inner { padding: 0 var(--sp-sm) var(--sp-sm); }

.theme-card {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm);
  border-radius: var(--r-sm);
  background: var(--c-bg);
  margin-bottom: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.theme-card.selected {
  border-color: var(--c-blue);
  background: rgba(44,134,201,0.07);
}

.theme-indicator {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.theme-info  { flex: 1; min-width: 0; }
.theme-id    {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--c-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.theme-sub   { font-size: var(--fs-xs); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.theme-mastery     { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.theme-mastery-pct { font-size: var(--fs-xs); font-weight: 700; }
.theme-mastery-bar { width: 40px; height: 4px; background: var(--c-surface2); border-radius: var(--r-full); overflow: hidden; }
.theme-mastery-fill { height: 100%; border-radius: var(--r-full); }

.theme-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--c-border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.theme-card.selected .theme-check {
  background: var(--c-blue);
  border-color: var(--c-blue);
}

.theme-status-row { margin-top: 2px; }
.theme-status-row:empty { display: none; }
.theme-status-tag { font-size: 0.65rem; padding: 1px 6px; }

.theme-exam-btn {
  flex-shrink: 0;
  padding: 6px 8px;
  line-height: 1;
}

.sticky-bottom {
  position: sticky;
  bottom: calc(var(--nav-height) + 8px + env(safe-area-inset-bottom, 0px));
  padding: var(--sp-sm) 0 0;
  background: linear-gradient(transparent, var(--c-bg) 40%);
}

/* ═══════════════════════════════════════════════════
   MASTERY GRID (Profile)
   ═══════════════════════════════════════════════════ */
.mastery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

@media (max-width: 360px) {
  .mastery-grid { grid-template-columns: repeat(4, 1fr); }
}

.mastery-card {
  aspect-ratio: 1;
  border-radius: 6px 9px 6px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--t-fast);
  animation: fadeIn 0.3s ease backwards;
  -webkit-tap-highlight-color: transparent;
}

.mastery-card:active { transform: scale(0.92); }
.m-id  { font-family: var(--font-hand); font-size: 0.85rem; font-weight: 700; opacity: 0.8; display: flex; align-items: center; gap: 2px; }
.m-pct { font-size: var(--fs-lg); font-weight: 900; line-height: 1; }
.m-status { font-size: 0.7rem; }

/* ═══════════════════════════════════════════════════
   BADGE GRID (Profile)
   ═══════════════════════════════════════════════════ */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-sm);
}

.badge-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px 14px 10px 14px;
  padding: var(--sp-sm);
  text-align: center;
  box-shadow: var(--shadow-paper);
}

.badge-card.locked { opacity: 0.4; filter: grayscale(1); box-shadow: none; }

.badge-icon { font-size: 2rem; display: block; margin-bottom: 4px; }
.badge-name { font-family: var(--font-hand); font-size: 0.9rem; font-weight: 700; }
.badge-date { font-size: 0.62rem; color: var(--c-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════════
   EXAM HISTORY (Profile)
   ═══════════════════════════════════════════════════ */
.exam-history-list { display: flex; flex-direction: column; gap: var(--sp-xs); }

.exam-history-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
}

.exam-score-badge { font-family: var(--font-hand); font-size: 1.7rem; font-weight: 700; min-width: 52px; text-align: center; }
.exam-meta        { flex: 1; }
.exam-date        { font-size: var(--fs-xs); color: var(--c-muted); }

/* ═══════════════════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════════════════ */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-sm) 0;
  cursor: pointer;
  font-size: var(--fs-sm);
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  transition: background var(--t-fast);
}

.toggle input:checked ~ .toggle-track { background: var(--c-green); border-color: transparent; }

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #FFFDF5;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(90,65,20,0.3);
  transition: transform var(--t-fast);
  pointer-events: none;
}

.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }

/* ═══════════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════════ */
@keyframes pop {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

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

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

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

@keyframes confettiFall {
  0%   { transform: translateY(-10px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(320px) rotate(720deg); opacity: 0; }
}

@keyframes optionIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@keyframes correctPop {
  0%, 100% { transform: scale(1); }
  40%      { transform: scale(1.025); }
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

@keyframes navBounce {
  0%, 100% { transform: scale(1) translateY(0); }
  35%      { transform: scale(1.25) translateY(-3px); }
  60%      { transform: scale(0.95) translateY(0); }
}
