/* Gedeelde basis voor de taalspellen van Mijn Leerplein (zelfde bestand in elke tool) */
@font-face { font-family: "Andika"; font-weight: 400; font-display: swap; src: url("andika-400.woff2") format("woff2"); }
@font-face { font-family: "Andika"; font-weight: 700; font-display: swap; src: url("andika-700.woff2") format("woff2"); }

:root {
  --bg1: #e0f2fe;
  --bg2: #f0f9ff;
  --ink: #0f172a;
  --muted: #475569;
  --kaart: #ffffff;
  --lijn: #cbd5e1;
  --accent: #2563eb;
  --accent2: #1d4ed8;
  --accent-zacht: #dbeafe;
  --goed: #16a34a;
  --goed-zacht: #dcfce7;
  --fout: #dc2626;
  --fout-zacht: #fee2e2;
  --goud: #f59e0b;
  --radius: 18px;
  --schaduw: 0 4px 0 rgba(15, 23, 42, .12), 0 8px 24px rgba(15, 23, 42, .08);
  --lees: "Andika", "Nunito", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(180deg, var(--bg1), var(--bg2)) fixed;
  color: var(--ink);
  font-family: "Nunito", "Segoe UI Rounded", "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.verborgen { display: none !important; }

/* ---------- bovenbalk ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 16px; height: 58px; position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--lijn);
}
.logo { font-weight: 900; font-size: 23px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.logo span.em { font-size: 28px; }
.top-acties { display: flex; gap: 8px; }
.top-knop {
  background: #fff; border: 2px solid var(--lijn); border-radius: 12px;
  padding: 6px 11px; font-size: 16px; font-weight: 800; white-space: nowrap;
}
.top-knop:hover { border-color: var(--accent); }
.hud { display: flex; align-items: center; gap: 14px; font-weight: 900; font-size: 18px; }
.hud .harten { letter-spacing: 2px; font-size: 20px; white-space: nowrap; }
.hud span { white-space: nowrap; }
.hud .teller { background: var(--accent-zacht); color: var(--accent2); padding: 3px 10px; border-radius: 999px; }
.hud .reeks { color: var(--goud); min-width: 3.5em; }

main { max-width: 1060px; margin: 0 auto; padding: 14px 16px 30px; }

/* ---------- startscherm ---------- */
.intro { text-align: center; margin: 6px auto 18px; max-width: 760px; }
.intro h1 { margin: 0 0 6px; font-size: 34px; line-height: 1.15; }
.intro p { margin: 0; color: var(--muted); font-size: 19px; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.level {
  background: var(--kaart); border: 3px solid var(--lijn); border-radius: var(--radius);
  padding: 12px 12px 10px; text-align: left; box-shadow: var(--schaduw);
  display: flex; flex-direction: column; gap: 4px; min-height: 150px; position: relative;
  transition: transform .12s, border-color .12s;
}
.level:hover:not(.dicht) { transform: translateY(-3px); border-color: var(--accent); }
.level .nr {
  width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 20px;
}
.level .naam { font-weight: 900; font-size: 18px; line-height: 1.2; }
.level .info { color: var(--muted); font-size: 15px; line-height: 1.25; flex: 1; }
.level .groep { position: absolute; top: 12px; right: 12px; font-size: 13px; font-weight: 800; color: var(--muted); background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }
.level .sterren { font-size: 20px; letter-spacing: 1px; }
.level .sterren .uit { filter: grayscale(1); opacity: .3; }
.level.dicht { opacity: .55; cursor: not-allowed; box-shadow: none; }
.level.dicht .nr { background: #94a3b8; }
.level.dicht .nr::after { content: "🔒"; font-size: 16px; }
.level.dicht .nr span { display: none; }
.level.uitdaging { border-color: var(--goud); }
.level.uitdaging .nr { background: var(--goud); }
.start-onder { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 15px; }
.uitleg-kaart {
  background: var(--kaart); border-radius: var(--radius); box-shadow: var(--schaduw);
  padding: 14px 18px; margin: 18px auto 0; max-width: 760px; font-size: 16px; color: var(--muted);
}
.uitleg-kaart h2 { margin: 0 0 6px; font-size: 18px; color: var(--ink); }
.uitleg-kaart ul { margin: 0; padding-left: 20px; }

/* ---------- knoppen ---------- */
.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 20px;
  padding: 12px 24px; border-radius: 16px; box-shadow: 0 4px 0 var(--accent2);
  transition: transform .08s, box-shadow .08s;
}
.knop:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent2); }
.knop.wit { background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--lijn); border: 2px solid var(--lijn); }
.knop.groen { background: var(--goed); box-shadow: 0 4px 0 #15803d; }

/* ---------- spelscherm ---------- */
.spel-kop { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.spel-kop .levelnaam { font-weight: 900; font-size: 18px; color: var(--muted); }
.voortgang { flex: 1; max-width: 420px; height: 14px; background: #fff; border: 2px solid var(--lijn); border-radius: 999px; overflow: hidden; }
.voortgang i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--goed), #4ade80); transition: width .3s; }
.tijdbalk { height: 10px; background: rgba(15, 23, 42, .08); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.tijdbalk i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 999px; }
.tijdbalk.krap i { background: var(--fout); }

/* ---------- melding (goed/fout) ---------- */
.plopje {
  position: fixed; left: 50%; top: 92px; transform: translateX(-50%);
  background: var(--goed); color: #fff; font-weight: 900; font-size: 22px;
  padding: 8px 20px; border-radius: 999px; z-index: 40; pointer-events: none;
  animation: plop .9s ease-out forwards;
}
@keyframes plop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -16px); } }

.laag {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45);
  display: grid; place-items: center; padding: 16px;
}
.laag .kaart {
  background: #fff; border-radius: 22px; padding: 20px 22px; max-width: 560px; width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: in .25s ease-out;
}
@keyframes in { from { transform: scale(.9); opacity: 0; } }
.laag .kaart h2 { margin: 0 0 10px; font-size: 24px; }
.laag .kaart.fout h2 { color: var(--fout); }
.laag .kaart .uitleg { font-size: 19px; line-height: 1.45; font-family: var(--lees); }
.laag .kaart .uitleg b.ok { color: var(--goed); }
.laag .kaart .uitleg b.nee { color: var(--fout); text-decoration: line-through; }
.laag .kaart .uitleg .tip { background: #fef9c3; border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 17px; }
.laag .kaart .acties { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- einde ---------- */
.einde { text-align: center; max-width: 640px; margin: 10px auto; background: #fff; border-radius: 24px; box-shadow: var(--schaduw); padding: 24px 20px; }
.einde h1 { margin: 0 0 4px; font-size: 32px; }
.einde .grote-sterren { font-size: 54px; letter-spacing: 6px; margin: 6px 0; }
.einde .grote-sterren .uit { filter: grayscale(1); opacity: .25; }
.einde p { color: var(--muted); margin: 6px 0; }
.einde .acties { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.foutlijst { text-align: left; margin: 14px auto 0; max-width: 520px; background: #f8fafc; border-radius: 14px; padding: 10px 16px; font-family: var(--lees); font-size: 17px; }
.foutlijst h3 { margin: 0 0 6px; font-size: 16px; font-family: inherit; color: var(--muted); }
.foutlijst ul { margin: 0; padding-left: 18px; }
.foutlijst li { margin: 3px 0; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: val 2.4s ease-in forwards; }
@keyframes val { to { transform: translateY(110vh) rotate(720deg); } }

.schud { animation: schud .4s; }
@keyframes schud { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

@media (max-width: 860px) { .levels { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  body { font-size: 17px; }
  .top { padding: 6px 10px; }
  .logo { font-size: 19px; }
  body.in-spel .logo .naam { display: none; }
  .top-acties { gap: 5px; }
  .top-knop { padding: 4px 7px; font-size: 15px; }
  .hud .reeks { min-width: 0; }
  .top-knop .bt { display: none; }
  .hud { gap: 6px; font-size: 15px; }
  .hud .harten { font-size: 16px; letter-spacing: 0; }
  .spel-kop .levelnaam { font-size: 15px; }
  .intro h1 { font-size: 27px; }
  .level { min-height: 130px; }
  .level .naam { font-size: 16px; }
  .level .info { font-size: 14px; }
}
@media print { .top, .acties { display: none !important; } }
