/* Klankherkenning Widget — volledig geïsoleerd, geen CSS variabelen */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

/* ── WIDGET CONTAINER ───────────────────────────────────────────── */
.kh-widget {
  all: initial;
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1e293b;
  background: #f0f7ff;
  border-radius: 14px;
  padding: 1.5rem 1rem 2rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}
.kh-widget *, .kh-widget *::before, .kh-widget *::after {
  box-sizing: border-box;
  font-family: 'Nunito', sans-serif;
}

/* ── HEADER ─────────────────────────────────────────────────────── */
.kh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.kh-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: -0.3px;
  margin: 0;
  line-height: 1.2;
}
.kh-sub {
  font-size: 0.82rem;
  color: #64748b;
  margin: 2px 0 0;
  font-weight: 600;
}
.kh-teacher-btn {
  all: unset;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.kh-teacher-btn:hover { border-color: #3b82f6; background: #eff6ff; }

/* ── NIVEAUKNOPPEN ──────────────────────────────────────────────── */
.kh-niveau-row {
  display: flex; gap: 10px; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.kh-niv-btn {
  all: unset;
  padding: 8px 18px;
  border-radius: 20px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  color: #64748b;
  display: inline-block;
}
.kh-niv-btn:hover { border-color: #3b82f6; color: #3b82f6; }
.kh-niv-btn.kh-active-0 { background: #dcfce7; border-color: #22c55e; color: #15803d; }
.kh-niv-btn.kh-active-1 { background: #dbeafe; border-color: #3b82f6; color: #1d4ed8; }
.kh-niv-btn.kh-active-2 { background: #fef3c7; border-color: #f59e0b; color: #92400e; }

/* ── VOORTGANG ──────────────────────────────────────────────────── */
.kh-progress-row {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.kh-prog-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: #e2e8f0;
  transition: background 0.25s;
}
.kh-prog-dot.kh-done   { background: #22c55e; }
.kh-prog-dot.kh-active { background: #3b82f6; }

/* ── OEFENKAART ─────────────────────────────────────────────────── */
.kh-card {
  background: #ffffff;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  padding: 1.5rem 1.25rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(59,130,246,.08);
}
.kh-teller {
  font-size: 0.75rem; color: #64748b; font-weight: 700;
  margin-bottom: 0.75rem; letter-spacing: 1px; text-transform: uppercase;
}
.kh-emoji {
  width: 138px; height: 138px;
  border-radius: 14px;
  background: #f0f7ff;
  margin: 0 auto 1.1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 76px; line-height: 1;
  border: 2px solid #e2e8f0;
  transition: transform 0.2s;
}
.kh-emoji:hover { transform: scale(1.04); }
.kh-instruction {
  font-size: 0.88rem; color: #64748b;
  margin-bottom: 0.55rem; font-weight: 600;
}
.kh-klank {
  display: inline-block;
  background: #dbeafe; color: #1d4ed8;
  border-radius: 8px;
  padding: 5px 20px;
  font-size: 1.2rem; font-weight: 800;
  margin-bottom: 1.1rem; letter-spacing: 1px;
  border: 2px solid #bfdbfe;
}

/* ── HOKJES ─────────────────────────────────────────────────────── */
.kh-hokjes-rij {
  display: flex; gap: 10px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 1.1rem;
}
.kh-hokje-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.kh-hokje {
  all: unset;
  width: 52px; height: 52px;
  border-radius: 8px;
  border: 2.5px solid #e2e8f0;
  background: #f0f7ff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800;
  transition: all 0.18s;
  user-select: none;
}
.kh-hokje:hover        { border-color: #3b82f6; background: #eff6ff; transform: translateY(-2px); }
.kh-hokje.kh-selected  { border-color: #3b82f6; background: #dbeafe; color: #1d4ed8; }
.kh-hokje.kh-correct   { border-color: #22c55e; background: #dcfce7; color: #15803d; }
.kh-hokje.kh-wrong     { border-color: #ef4444; background: #fee2e2; color: #b91c1c; }
.kh-hokje-letter {
  font-size: 0.78rem; font-weight: 800; color: #64748b;
  min-height: 17px; display: flex; align-items: center; justify-content: center;
}
.kh-hokje-num { font-size: 0.68rem; font-weight: 700; color: #cbd5e1; }

/* ── KNOPPEN ────────────────────────────────────────────────────── */
.kh-btn-rij { display: flex; gap: 10px; justify-content: center; }
.kh-btn {
  all: unset;
  padding: 10px 26px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: all 0.18s;
  color: #1e293b; display: inline-block;
}
.kh-btn:hover { background: #f0f7ff; }
.kh-btn:disabled, .kh-btn[disabled] { opacity: 0.4; cursor: default; }
.kh-btn.kh-primary { background: #3b82f6; color: #ffffff; border-color: #1d4ed8; }
.kh-btn.kh-primary:hover { background: #1d4ed8; }
.kh-btn.kh-sm { padding: 6px 13px; font-size: 0.8rem; }
.kh-btn.kh-danger { background: #fee2e2; color: #b91c1c; border-color: #ef4444; }
.kh-btn.kh-danger:hover { background: #fecaca; }

/* ── FEEDBACK ───────────────────────────────────────────────────── */
.kh-feedback {
  font-size: 0.98rem; font-weight: 700;
  margin-top: 1rem; min-height: 24px;
  animation: kh-fade 0.2s ease;
}
.kh-feedback.kh-correct { color: #15803d; }
.kh-feedback.kh-wrong   { color: #b91c1c; }
@keyframes kh-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── SCORE ──────────────────────────────────────────────────────── */
.kh-score { text-align: center; padding: 1.75rem 1rem; }
.kh-score-num { font-size: 3.2rem; font-weight: 800; color: #3b82f6; margin-bottom: 0.3rem; }
.kh-score-msg { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.2rem; color: #1e293b; }
.kh-score-sub { font-size: 0.88rem; color: #64748b; margin-bottom: 1.25rem; }
.kh-stars { font-size: 2.2rem; margin-bottom: 0.6rem; }

/* ── LAAD / LEEG ────────────────────────────────────────────────── */
.kh-info { text-align: center; padding: 2.5rem 1rem; color: #64748b; font-size: 0.95rem; font-weight: 600; }
.kh-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  animation: kh-spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes kh-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════
   OVERLAY & BEHEERPANEEL
   De overlay wordt aan document.body toegevoegd — buiten .kh-widget.
   Hier worden UITSLUITEND vaste hex-kleuren gebruikt.
   ══════════════════════════════════════════════════════════════════ */
.kh-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.6);
  z-index: 99999;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}
.kh-overlay.kh-open { display: flex; }

.kh-modal {
  background: #ffffff;
  border-radius: 14px;
  width: 100%; max-width: 700px;
  padding: 1.5rem;
  margin: auto;
  border: 2px solid #e2e8f0;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  color: #1e293b;
}
.kh-modal * { font-family: 'Nunito', sans-serif; box-sizing: border-box; }

.kh-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.kh-modal-title { font-size: 1.05rem; font-weight: 800; color: #1d4ed8; }

.kh-close {
  all: unset;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #f8fafc; cursor: pointer;
  font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; color: #64748b;
}
.kh-close:hover { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }

/* Wachtwoord scherm */
.kh-pw { text-align: center; padding: 1rem 0; }
.kh-pw p { font-size: 0.9rem; color: #64748b; font-weight: 600; margin-bottom: 1rem; margin-top: 0; }
.kh-pw-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 0.75rem; flex-wrap: wrap; }
.kh-pw-input {
  padding: 9px 14px; border-radius: 8px;
  border: 2px solid #e2e8f0;
  font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 700;
  width: 190px; text-align: center; letter-spacing: 2px;
  color: #1e293b; background: #f8fafc; outline: none;
}
.kh-pw-input:focus { border-color: #3b82f6; }
.kh-pw-fout { color: #b91c1c; font-size: 0.83rem; font-weight: 700; min-height: 20px; }

/* Beheer inhoud */
.kh-beheer { display: none; }
.kh-beheer.kh-zichtbaar { display: block; }

/* Wachtwoord wijzigen */
.kh-pw-blok {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.9rem 1rem; margin-bottom: 1rem;
  background: #f8fafc;
}
.kh-pw-blok h3 { font-size: 0.88rem; font-weight: 800; margin: 0 0 0.7rem; color: #1e293b; }
.kh-pw-change-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kh-pw-change-row input {
  padding: 7px 11px; border-radius: 8px;
  border: 2px solid #e2e8f0;
  font-family: 'Nunito', sans-serif; font-size: 0.88rem; font-weight: 700;
  color: #1e293b; background: #ffffff; outline: none;
  width: 175px; letter-spacing: 1px;
}
.kh-pw-change-row input:focus { border-color: #3b82f6; }
.kh-pw-ok { font-size: 0.82rem; font-weight: 700; color: #15803d; display: none; }

/* Niveau blokken */
.kh-niv-blok {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem; margin-bottom: 1rem;
  background: #ffffff;
}
.kh-niv-blok-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; margin-bottom: 0.75rem;
}
.kh-niv-blok-titel { font-size: 0.93rem; font-weight: 800; color: #1e293b; }
.kh-aantal-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: #64748b; font-weight: 600;
}
.kh-aantal-row input {
  width: 54px; padding: 4px 7px;
  border-radius: 8px; border: 2px solid #e2e8f0;
  font-family: 'Nunito', sans-serif; font-size: 0.83rem; font-weight: 700;
  color: #1e293b; background: #f8fafc; outline: none;
}
.kh-aantal-row input:focus { border-color: #3b82f6; }

/* Tabelrijen */
.kh-tabel-header {
  display: grid;
  grid-template-columns: 50px 1fr 78px 1fr 30px;
  gap: 5px; margin-bottom: 4px;
}
.kh-tabel-header span {
  font-size: 0.7rem; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.kh-woord-rij {
  display: grid;
  grid-template-columns: 50px 1fr 78px 1fr 30px;
  gap: 5px; align-items: center; margin-bottom: 5px;
}
.kh-woord-rij input {
  padding: 5px 7px; border-radius: 8px;
  border: 2px solid #e2e8f0;
  font-family: 'Nunito', sans-serif; font-size: 0.8rem; font-weight: 700;
  color: #1e293b; background: #f8fafc; outline: none; width: 100%;
}
.kh-woord-rij input:focus { border-color: #3b82f6; }

.kh-del {
  all: unset;
  width: 28px; height: 28px; border-radius: 8px;
  border: 2px solid #e2e8f0;
  background: #f8fafc; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; color: #64748b; transition: all 0.15s;
}
.kh-del:hover { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }

.kh-tip {
  font-size: 0.73rem; color: #64748b; font-weight: 600;
  margin-top: 0.5rem; line-height: 1.5;
  background: #f8fafc; border-radius: 8px; padding: 6px 10px;
}
.kh-tip code {
  background: #e2e8f0; border-radius: 4px;
  padding: 1px 4px; font-size: 0.72rem; font-weight: 700; font-family: monospace;
}

/* Opslaan rij */
.kh-opslaan-rij {
  display: flex; gap: 10px; align-items: center;
  justify-content: flex-end; flex-wrap: wrap;
  border-top: 2px solid #e2e8f0;
  padding-top: 1rem; margin-top: 0.5rem;
}
.kh-saved { font-size: 0.83rem; font-weight: 700; color: #15803d; display: none; }

/* Responsive */
@media (max-width: 480px) {
  .kh-tabel-header, .kh-woord-rij { grid-template-columns: 42px 1fr 64px 1fr 28px; }
  .kh-hokje { width: 44px; height: 44px; }
}
