/* Servisch leren — mobile-first, rustig en fris */

:root {
  --bg: #0f172a;
  --bg-2: #111c33;
  --surface: #1a2540;
  --surface-2: #243250;
  --border: #2d3a5c;
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --accent: #ef4444;      /* Servische rood */
  --accent-2: #3b82f6;    /* blauw, koel contrast */
  --accent-3: #facc15;    /* warm geel voor XP/streak */
  --good: #22c55e;
  --bad: #f43f5e;
  --revi: #60a5fa;
  --sjertsje: #f472b6;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --shadow-soft: 0 2px 8px rgba(0,0,0,.2);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(circle at 18% 0%, rgba(239,68,68,.10), transparent 45%),
    radial-gradient(circle at 88% 5%, rgba(59,130,246,.10), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(250,204,21,.06), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(72px + var(--safe-bot));
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
}

.hidden { display: none !important; }

/* === TOPBAR === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.profiles {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid var(--border);
  max-width: calc(100vw - 100px);
  overflow-x: auto;
  scrollbar-width: none;
}
.profiles::-webkit-scrollbar { display: none; }

.profile-add .avatar {
  background: var(--surface-2) !important;
  color: var(--text-dim) !important;
}
.profile-add .name { display: none; }
.profile-add { padding: 4px !important; }

.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  transition: background .15s, color .15s;
}

.profile-btn[aria-selected="true"] {
  background: var(--bg);
  color: var(--text);
}

.profile-btn .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--surface-2);
  font-size: 13px;
}

.profile-btn[data-profile="revi"][aria-selected="true"] .avatar {
  background: var(--revi);
  color: #0a1228;
}
.profile-btn[data-profile="sjertsje"][aria-selected="true"] .avatar {
  background: var(--sjertsje);
  color: #2a0a1a;
}

.script-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  padding: 3px;
}

.script-opt {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--text-dim);
  transition: background .15s, color .15s;
}

.script-opt.active {
  background: var(--accent-2);
  color: white;
}

/* === STATS === */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 16px 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  min-width: 0;
}

.stat-icon { font-size: 20px; line-height: 1; }

.stat-body { min-width: 0; flex: 1; }

.stat-value {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-mute);
  font-weight: 600;
}

.stat-label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}

.goal-ring {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  pointer-events: none;
}

.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-bg, .ring-fg {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.ring-bg { stroke: var(--border); }
.ring-fg {
  stroke: var(--accent-3);
  stroke-dasharray: 100.5;
  stroke-dashoffset: 100.5;
  transition: stroke-dashoffset .5s ease;
}

/* === LEVEL PICKER (vervangt tabs) === */
.level-picker-row {
  padding: 0 16px 12px;
}

.level-picker-btn {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s, border-color .15s;
  text-align: left;
}

.level-picker-btn:active { background: var(--surface-2); }
.level-picker-btn.lezen {
  background: linear-gradient(135deg, rgba(239,68,68,.12), rgba(239,68,68,.04));
  border-color: rgba(239,68,68,.35);
}

.lp-label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  flex-shrink: 0;
}

.lp-current {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.lp-arrow {
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Level picker modal */
.level-modal-card {
  text-align: left;
  max-width: 380px;
  width: 100%;
}

.level-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-align: left;
}

.level-option:active { background: var(--bg-2); }
.level-option.active { border-color: var(--accent-2); background: rgba(59,130,246,.12); }
.level-option.lezen.active { border-color: var(--accent); background: rgba(239,68,68,.12); }

.level-option-code {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.level-option.active .level-option-code { background: var(--accent-2); color: white; }
.level-option.lezen.active .level-option-code { background: var(--accent); }

.level-option-text { flex: 1; min-width: 0; }
.level-option-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.level-option-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.level-option-check {
  font-size: 18px;
  color: var(--accent-2);
  flex-shrink: 0;
  opacity: 0;
}
.level-option.active .level-option-check { opacity: 1; }

/* === VIEW: PATH === */
.path-intro {
  padding: 16px 20px 24px;
}

.path-intro h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 6px;
}

.path-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
}

.lesson-path {
  list-style: none;
  margin: 0;
  padding: 0 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

.lesson-node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  width: 100%;
  max-width: 460px;
}

.lesson-node.right { flex-direction: row-reverse; }

.lesson-node::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -14px;
  width: 3px;
  height: 28px;
  background: var(--border);
  transform: translateX(-50%);
  border-radius: 999px;
}

.lesson-node:first-child::before { display: none; }

.lesson-bubble {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 32px;
  flex-shrink: 0;
  position: relative;
  transition: transform .15s;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,.35), 0 10px 24px rgba(0,0,0,.25);
}

.lesson-bubble:hover:not(.locked) { transform: translateY(-2px); }
.lesson-bubble:active:not(.locked) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.2); }

.lesson-bubble:active { transform: scale(.94); }

.lesson-bubble.done {
  background: var(--good);
  border-color: #16a34a;
}

.lesson-bubble.skipped {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #b45309;
  opacity: .85;
}

.lesson-bubble.skipped .lesson-emoji {
  font-size: 28px;
  color: white;
}

.lesson-bubble .skip-ico {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--surface-2);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  border: 2px solid var(--bg);
  color: var(--accent-3);
}

.lesson-meta-skipped {
  font-size: 11px;
  color: #f59e0b;
  margin-top: 4px;
  font-style: italic;
}

.lesson-node.right .lesson-meta-skipped { text-align: right; }

.lesson-bubble.current {
  background: var(--accent-2);
  border-color: #2563eb;
  box-shadow: 0 0 0 6px rgba(59,130,246,.15);
  animation: pulseRing 2s ease-in-out infinite;
}

.lesson-bubble.locked {
  background: var(--bg-2);
  border-color: var(--border);
  opacity: .5;
  cursor: not-allowed;
}

.lesson-bubble.locked .lesson-emoji { filter: grayscale(1) opacity(.5); }

.lesson-bubble .lock-ico {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--surface-2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  border: 2px solid var(--bg);
}

.lesson-info {
  flex: 1;
  min-width: 0;
}

.lesson-node.right .lesson-info { text-align: right; }

.lesson-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
  letter-spacing: -.01em;
}

.lesson-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

.lesson-stars {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--accent-3);
}

.lesson-node.right .lesson-stars { justify-content: flex-end; }

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 6px rgba(59,130,246,.15); }
  50% { box-shadow: 0 0 0 10px rgba(59,130,246,.05); }
}

/* === VIEW: LESSON === */
.view-lesson {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bot);
}

.lesson-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
}

.back-btn, .close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.skip-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  flex-shrink: 0;
}

.script-toggle-mini {
  flex-shrink: 0;
  padding: 2px;
}
.script-toggle-mini .script-opt {
  padding: 5px 9px;
  font-size: 11px;
}

.lesson-progress {
  flex: 1;
  height: 12px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.lesson-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--good), #16a34a);
  width: 0%;
  transition: width .35s ease;
  border-radius: 999px;
}

.lesson-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 20px;
  overflow-y: auto;
}

.lesson-content.scroll {
  justify-content: flex-start;
  padding-top: 16px;
}

/* CARD (woord/zin tonen) */
.card-teach {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: cardIn .4s cubic-bezier(.2,.8,.2,1);
}

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

.card-emoji {
  font-size: 80px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}

.card-sr {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.card-pron {
  font-size: 17px;
  color: var(--accent-3);
  font-weight: 600;
  font-style: italic;
  letter-spacing: .02em;
}

.card-nl {
  font-size: 22px;
  color: var(--text-dim);
  font-weight: 500;
}

.card-note {
  font-size: 13px;
  color: var(--text-mute);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  max-width: 320px;
  line-height: 1.4;
}

/* Cyrillisch-lezen view: cyrillisch BIG, daaronder latijn + uitleg */
.card-cyr-big {
  font-size: 78px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  background: linear-gradient(135deg, #fef3c7, #fde68a 60%, #fbbf24);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 12px rgba(250,204,21,.25));
  padding: 4px 0;
}

.card-arrow {
  font-size: 22px;
  color: var(--text-mute);
  margin: -8px 0;
  line-height: 1;
}

.card-lat-mid {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
  margin-bottom: -4px;
}

.card-teach-lezen .card-emoji { font-size: 48px; margin-bottom: -6px; }
.card-teach-lezen .card-pron { font-size: 14px; }
.card-teach-lezen .card-nl { font-size: 18px; }

.speak-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-2);
  display: grid;
  place-items: center;
  font-size: 28px;
  color: white;
  margin-top: 8px;
  transition: transform .12s, background .15s;
  box-shadow: 0 4px 14px rgba(59,130,246,.4);
}

.speak-btn:active { transform: scale(.92); }
.speak-btn.speaking { background: var(--good); animation: pulseSpeak .8s ease-in-out infinite; }

/* Audio row: speak + mic naast elkaar */
.audio-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.audio-row .speak-btn { margin-top: 0; }

.mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 700;
  transition: transform .12s, background .15s, border-color .15s;
}

.mic-btn:active { transform: scale(.95); }

.mic-btn.listening {
  background: var(--bad);
  color: white;
  border-color: var(--bad);
  animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(244, 63, 94, 0); }
}

/* Mic-feedback popup */
.mic-feedback {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bot));
  transform: translateX(-50%) translateY(40px);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 14px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .3s cubic-bezier(.2,.8,.3,1);
  z-index: 250;
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
  max-width: 92vw;
  min-width: 200px;
}

.mic-feedback.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mic-feedback-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mic-feedback-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.mic-feedback-heard {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes pulseSpeak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* QUIZ */
.quiz {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: cardIn .4s cubic-bezier(.2,.8,.2,1);
}

.quiz-prompt {
  text-align: center;
  margin-bottom: 16px;
}

.quiz-prompt-label {
  font-size: 13px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}

.quiz-prompt-text {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.quiz-prompt-emoji { font-size: 56px; margin-bottom: 8px; line-height: 1; }

.quiz-prompt-pron {
  font-size: 15px;
  color: var(--accent-3);
  font-style: italic;
  font-weight: 600;
  margin-top: 4px;
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 17px;
  font-weight: 600;
  text-align: left;
  transition: background .15s, border-color .15s, transform .12s;
}

.quiz-option:active { transform: scale(.98); }

.quiz-option.correct {
  background: rgba(34,197,94,.15);
  border-color: var(--good);
  color: var(--good);
  animation: bounceCorrect .5s cubic-bezier(.5,1.7,.5,1);
}

.quiz-option.wrong {
  background: rgba(244,63,94,.12);
  border-color: var(--bad);
  color: var(--bad);
  animation: shakeWrong .4s ease;
}

@keyframes bounceCorrect {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes shakeWrong {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* Drijvende +XP popup */
.xp-pop {
  position: fixed;
  pointer-events: none;
  z-index: 250;
  font-weight: 800;
  font-size: 22px;
  color: var(--accent-3);
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  animation: xpPop 1.2s cubic-bezier(.2,.8,.3,1) forwards;
}

@keyframes xpPop {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.7); }
  20% { opacity: 1; transform: translate(-50%, -10px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(1); }
}

/* Streak vuurtje pulst alleen als streak > 0 */
.stat.streak-active .stat-icon {
  display: inline-block;
  animation: flicker 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(251,146,60,.5));
}

@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.12) rotate(3deg); }
}

.quiz-option.disabled { pointer-events: none; }

/* TYPE-IN */
.type-in input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 18px;
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color .15s;
}

.type-in input:focus { border-color: var(--accent-2); }
.type-in input.correct { border-color: var(--good); color: var(--good); }
.type-in input.wrong { border-color: var(--bad); color: var(--bad); }

.lesson-footer {
  padding: 16px 20px calc(16px + var(--safe-bot));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback {
  display: none;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  animation: cardIn .25s;
}

.feedback.show { display: block; }
.feedback.good { background: rgba(34,197,94,.15); color: var(--good); border: 1px solid rgba(34,197,94,.3); }
.feedback.bad { background: rgba(244,63,94,.12); color: var(--bad); border: 1px solid rgba(244,63,94,.3); }

.feedback-correct {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  margin-top: 4px;
}

.primary-btn {
  background: var(--accent-2);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
  transition: transform .12s, background .15s;
  box-shadow: 0 4px 14px rgba(59,130,246,.3);
}

.primary-btn:active { transform: scale(.97); }
.primary-btn:disabled { background: var(--surface-2); color: var(--text-mute); box-shadow: none; }

.secondary-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
}

/* === VIEW: PRACTICE === */
.view-practice { padding: 16px 20px; }

.practice-intro h2 {
  font-size: 26px;
  font-weight: 800;
  margin: 8px 0 6px;
  letter-spacing: -.02em;
}

.practice-sub {
  color: var(--text-dim);
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
}

.practice-session { padding: 8px 0; }

/* === VIEW: PROGRESS === */
.view-progress { padding: 16px 20px; }

.view-progress h2 {
  font-size: 26px;
  font-weight: 800;
  margin: 8px 0 16px;
  letter-spacing: -.02em;
}

.view-progress h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 12px;
  color: var(--text-dim);
}

.progress-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.pc-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.pc-label {
  font-size: 12px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 2px;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  position: relative;
  transition: transform .15s;
}

.badge.unlocked { background: linear-gradient(180deg, rgba(250,204,21,.1), var(--surface)); }
.badge.locked { opacity: .4; filter: grayscale(.7); }

.badge-emoji { font-size: 32px; line-height: 1; margin-bottom: 6px; }
.badge-name { font-size: 12px; font-weight: 600; }
.badge-desc { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.lb-row.you { border-color: var(--accent-2); }

.lb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}

.lb-avatar.revi { background: var(--revi); color: #0a1228; }
.lb-avatar.sjertsje { background: var(--sjertsje); color: #2a0a1a; }

.lb-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-xp { font-weight: 700; color: var(--accent-3); font-size: 14px; flex-shrink: 0; }
.lb-medal { font-size: 18px; flex-shrink: 0; }
.lb-edit {
  background: none;
  border: none;
  color: var(--text-mute);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.lb-edit:hover { background: var(--surface-2); }

/* === VIEW: TUTOR (AI chat) === */
.view-tutor {
  display: flex;
  flex-direction: column;
  padding: 0;
  height: calc(100vh - 280px);
  min-height: 480px;
}

.tutor-header {
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.tutor-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), #6366f1);
  display: grid; place-items: center;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(59,130,246,.4);
}

.tutor-meta { flex: 1; min-width: 0; }
.tutor-meta h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.tutor-meta p { margin: 2px 0 0; font-size: 12px; color: var(--text-mute); }

.tutor-clear {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 18px;
  line-height: 1.4;
  font-size: 15px;
  animation: cardIn .25s cubic-bezier(.2,.8,.2,1);
  position: relative;
  word-wrap: break-word;
}

.msg.user {
  background: var(--accent-2);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.msg-sr {
  font-weight: 600;
  font-size: 16px;
}

.msg-translate-btn {
  font-size: 11px;
  margin-top: 6px;
  color: var(--accent-2);
  font-weight: 600;
  background: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg.assistant .msg-translate-btn { color: var(--accent-3); }

.msg-translation {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}

.msg-speak {
  font-size: 14px;
  margin-left: 6px;
  opacity: .6;
  cursor: pointer;
  display: inline-block;
}

.typing {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-mute);
  animation: typing 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

@keyframes typing {
  0%,60%,100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(10px + var(--safe-bot));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.chat-input:focus { border-color: var(--accent-2); }

.chat-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent-2);
  color: white;
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
}

.chat-send:disabled { opacity: .5; background: var(--surface-2); box-shadow: none; }

.chat-suggestions {
  display: flex;
  gap: 6px;
  padding: 8px 14px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chat-suggestions::-webkit-scrollbar { display: none; }

.chat-suggestion {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-suggestion:active { background: var(--surface-2); }

.tutor-setup {
  padding: 40px 24px;
  text-align: center;
}

.tutor-setup .tutor-avatar { margin: 0 auto 16px; width: 64px; height: 64px; font-size: 30px; }
.tutor-setup h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; }
.tutor-setup p { color: var(--text-dim); font-size: 14px; line-height: 1.5; margin: 0 0 20px; }
.tutor-setup code { background: var(--surface); padding: 2px 8px; border-radius: 6px; font-size: 13px; color: var(--accent-3); }

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: var(--safe-bot);
  z-index: 40;
  backdrop-filter: blur(20px);
}

/* === REISGIDS-VIEW === */
.view-guide { padding: 16px 0 0; }

.guide-header {
  padding: 4px 20px 12px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg) 75%, transparent);
  z-index: 10;
}

.guide-header h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 4px 0 12px;
}

#guideSearch {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
#guideSearch:focus { border-color: var(--accent-2); }

.guide-categories {
  display: flex;
  gap: 8px;
  padding: 0 20px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.guide-categories::-webkit-scrollbar { display: none; }

.guide-cat-pill {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}

.guide-cat-pill.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: white;
}

.guide-content {
  padding: 0 20px 24px;
}

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

.guide-section-title {
  font-size: 13px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 16px 0 10px;
  font-weight: 700;
}

.guide-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background .15s, transform .12s;
}

.guide-row:active { transform: scale(.98); background: var(--surface-2); }

.guide-row-emoji { font-size: 24px; flex-shrink: 0; }

.guide-row-text {
  flex: 1;
  min-width: 0;
}

.guide-row-nl {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.3;
}

.guide-row-sr {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
  margin-top: 2px;
}

.guide-row-pron {
  font-size: 12px;
  color: var(--accent-3);
  font-style: italic;
  font-weight: 600;
  margin-top: 2px;
}

.guide-row-speak {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent-2);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
  transition: transform .12s, background .15s;
  border: none;
}
.guide-row-speak:active { transform: scale(.9); }
.guide-row-speak.speaking { background: var(--good); animation: pulseSpeak .8s ease-in-out infinite; }

.guide-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mute);
  font-size: 14px;
}

.guide-verbs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-verb-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background .15s;
}

.guide-verb-row:active { background: var(--surface-2); }

.guide-verb-inf {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.guide-verb-nl {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.guide-verb-arrow { color: var(--text-mute); font-size: 16px; }

/* Werkwoord-popover (zelfde overlay als letter-popover, eigen content) */
.verb-popover-content {
  text-align: left;
  max-width: 380px;
}

.verb-popover-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-align: center;
  margin: 0 0 4px;
}

.verb-popover-cyr {
  font-size: 18px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 4px;
}

.verb-popover-nl {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 14px;
  font-style: italic;
}

.verb-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.verb-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-mute);
  text-align: left;
  padding: 6px 8px;
  font-weight: 700;
  background: var(--surface-2);
}

.verb-table td {
  padding: 8px 8px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.verb-table td:first-child {
  color: var(--text-mute);
  font-weight: 600;
  width: 70px;
}

.verb-table td:nth-child(2) {
  font-weight: 700;
}

.verb-table-section {
  font-size: 12px;
  color: var(--accent-3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 16px 0 4px;
}

.verb-table-note {
  font-size: 12px;
  color: var(--text-mute);
  margin: 10px 0 0;
  line-height: 1.5;
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: 8px;
}

/* Tutor scenarios */
.scenarios-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 14px 8px;
  scrollbar-width: none;
}
.scenarios-row::-webkit-scrollbar { display: none; }

.scenario-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.scenario-pill:active { background: var(--surface-2); }

.tutor-scenario-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}
.tutor-scenario-btn:active { background: var(--surface-2); }

.nav-btn {
  padding: 10px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-mute);
  font-weight: 600;
  transition: color .15s;
}

.nav-btn.active { color: var(--accent-2); }

.nav-ico { font-size: 22px; line-height: 1; }
.nav-label { font-size: 11px; }

/* === TOAST === */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bot));
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 200;
  box-shadow: var(--shadow);
  white-space: nowrap;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.xp { background: linear-gradient(135deg, var(--accent-3), #f59e0b); color: #1a1206; border-color: transparent; }

/* === SETTINGS OVERLAY === */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: slideUp .3s cubic-bezier(.2,.8,.3,1);
  padding-bottom: var(--safe-bot);
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 20px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

.settings-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.settings-body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.settings-card-label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
  font-weight: 700;
}

.settings-card-value {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.settings-card-sub {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.settings-logout {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--bad);
  color: var(--bad);
  border-radius: 12px;
  padding: 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.settings-logout:active { background: rgba(244,63,94,.08); }

/* === AUTH OVERLAY === */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background:
    radial-gradient(circle at 30% 10%, rgba(239,68,68,.12), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(59,130,246,.12), transparent 50%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.auth-flag {
  font-size: 56px;
  text-align: center;
  line-height: 1;
  margin-bottom: 10px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-align: center;
  margin: 0 0 20px;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  background: none;
  border: none;
  transition: background .15s, color .15s;
}

.auth-tab.active {
  background: var(--accent-2);
  color: white;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}

.auth-form input:focus { border-color: var(--accent-2); }

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 50px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  padding: 8px 10px;
  cursor: pointer;
  line-height: 1;
  opacity: .75;
  transition: opacity .15s;
}

.password-toggle:hover { opacity: 1; }
.password-toggle:active { transform: translateY(-50%) scale(.92); }

.auth-form .primary-btn {
  margin-top: 4px;
}

.auth-error {
  color: var(--bad);
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 0;
  min-height: 16px;
}

.auth-error.success { color: var(--good); }

.auth-link {
  text-align: center;
  margin: 8px 0 0;
}

.auth-link button {
  background: none;
  border: none;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px 8px;
}

.auth-hint {
  font-size: 13px;
  color: var(--text-mute);
  text-align: center;
  margin: 0 0 6px;
  line-height: 1.5;
}

/* === OFFLINE-BAR === */
.offline-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: linear-gradient(90deg, #d97706, #f59e0b);
  color: #1a1206;
  padding: 6px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 700;
  animation: slideDown .35s cubic-bezier(.2,.8,.3,1);
}

.update-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: linear-gradient(90deg, var(--accent-2), #6366f1);
  color: white;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  z-index: 710;
  animation: slideDown .35s cubic-bezier(.2,.8,.3,1);
  padding-top: calc(8px + var(--safe-top));
}

.update-banner .ub-yes {
  background: white;
  color: var(--accent-2);
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.update-banner .ub-no {
  background: rgba(255,255,255,.15);
  border: none;
  color: white;
  border-radius: 50%;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 12px;
  cursor: pointer;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

body.offline .topbar { top: 30px; }
body.offline { padding-top: 30px; }

/* Tutor + mic uitgrijzen offline */
body.offline .nav-btn[data-view="tutor"] { opacity: .5; }
body.offline .mic-btn { opacity: .4; pointer-events: none; }

/* === INSTALL PROMPT === */
.install-prompt {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(80px + var(--safe-bot));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 350;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  animation: cardIn .4s cubic-bezier(.2,.8,.3,1);
}

.ip-icon { font-size: 28px; }
.ip-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ip-text strong { font-size: 14px; font-weight: 700; }
.ip-text span { font-size: 12px; color: var(--text-dim); }

.ip-yes {
  background: var(--accent-2);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.ip-no {
  background: none;
  border: none;
  color: var(--text-mute);
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
}

/* === RAINBOW TEXT (verjaardag-modal) === */
.rainbow-text {
  background: linear-gradient(
    90deg,
    #ff3b30 0%,
    #ff9500 14%,
    #ffcc00 28%,
    #34c759 42%,
    #00c7be 56%,
    #007aff 70%,
    #af52de 84%,
    #ff2d92 100%
  );
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: rainbowShift 5s linear infinite;
  filter: drop-shadow(0 2px 8px rgba(255,107,180,.25));
}

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

.rainbow-heart {
  display: inline-block;
  animation: heartHue 4s linear infinite, heartPulse 1.6s ease-in-out infinite;
  filter: hue-rotate(0deg);
}

@keyframes heartHue {
  0%   { filter: hue-rotate(0deg); }
  25%  { filter: hue-rotate(90deg); }
  50%  { filter: hue-rotate(180deg); }
  75%  { filter: hue-rotate(270deg); }
  100% { filter: hue-rotate(360deg); }
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

/* === CONFETTI === */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
}

/* === LETTER POPOVER === */
.letter-popover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn .2s;
}

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

.letter-popover-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: popIn .35s cubic-bezier(.3,1.4,.5,1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}

.letter-popover-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 14px;
  color: var(--text-dim);
}

.letter-popover-big {
  font-size: 84px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  background: linear-gradient(135deg, #fef3c7, #fbbf24);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}

.letter-popover-cyr {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .04em;
  margin-bottom: 14px;
}

.letter-popover-speak-letter,
.letter-popover-speak-word {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-2);
  color: white;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  width: auto;
  height: auto;
  box-shadow: 0 3px 10px rgba(59,130,246,.4);
}

.letter-popover-speak-word { background: var(--good); box-shadow: 0 3px 10px rgba(34,197,94,.4); }
.letter-popover-speak-letter.speaking,
.letter-popover-speak-word.speaking { animation: pulseSpeak .8s ease-in-out infinite; }

.letter-popover-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0 16px;
}

.letter-popover-example-label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.letter-popover-example {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.2;
  color: var(--text-mute);
  opacity: .3;
  transition: all .35s cubic-bezier(.3,1.4,.5,1);
  min-height: 36px;
  margin-bottom: 10px;
}

.letter-popover-example.revealed {
  color: var(--text);
  opacity: 1;
  transform: scale(1.05);
}

.letter-popover-example-nl {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 6px;
}

.letter-popover-pron {
  font-size: 12px;
  color: var(--text-mute);
  margin: 14px 0 0;
  line-height: 1.4;
}

/* === ALFABET SPECIAL === */
.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  padding: 8px 0;
}

.alpha-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: transform .12s, background .15s;
}

.alpha-cell:active { transform: scale(.94); }

.alpha-letter {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.alpha-lat {
  font-size: 11px;
  color: var(--accent-3);
  font-weight: 700;
  margin-top: 4px;
}

.alpha-pron {
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 2px;
}

/* Desktop tweaks */
@media (min-width: 720px) {
  body { max-width: 720px; margin: 0 auto; box-shadow: 0 0 60px rgba(0,0,0,.5); min-height: 100vh; }
  .bottom-nav { left: 50%; right: auto; width: 100%; max-width: 720px; transform: translateX(-50%); }
  .lesson-node { max-width: 560px; }
  .card-emoji { font-size: 96px; }
  .card-sr { font-size: 48px; }
}
