/* Huisstijl "Manga-schrift": zie DESIGN.md */
@import url('/static/fonts/fonts.css');

:root {
  --papier: #fff8f0;
  --wit: #ffffff;
  --inkt: #1d1b26;
  --grijs: #6e6878;
  --citroen: #ffe04a;
  --goed: #17a96f;
  --goed-licht: #dcf7ea;
  --fout: #ef4b3c;
  --fout-licht: #ffe5e1;
  --rand: 3px solid var(--inkt);
  --rand-dun: 2.5px solid var(--inkt);
  --schaduw: 5px 5px 0 var(--inkt);
  --schaduw-klein: 4px 4px 0 var(--inkt);
  --display: 'Dela Gothic One', 'Arial Black', sans-serif;
  --tekst: 'M PLUS Rounded 1c', 'Segoe UI', system-ui, sans-serif;

  /* Thema: Sakura (standaard) */
  --accent: #ff4f8b;
  --accent-diep: #d92d6a;
  --accent-licht: #ffe3ee;
  --tweede: #3d7bff;
  --tweede-licht: #e4edff;
}
[data-thema="nachtlucht"] { --accent: #3d7bff; --accent-diep: #2557d6; --accent-licht: #e4edff; --tweede: #ff4f8b; --tweede-licht: #ffe3ee; }
[data-thema="lavendel"]   { --accent: #9b6bff; --accent-diep: #7445e0; --accent-licht: #efe7ff; --tweede: #13b9a5; --tweede-licht: #dcf6f2; }
[data-thema="matcha"]     { --accent: #13b9a5; --accent-diep: #0b8a7a; --accent-licht: #dcf6f2; --tweede: #9b6bff; --tweede-licht: #efe7ff; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--papier);
  color: var(--inkt);
  font: 500 17px/1.5 var(--tekst);
  position: relative;
}
/* Rastertint (screentone) linksboven */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(var(--accent) 1.2px, transparent 1.4px);
  background-size: 10px 10px; opacity: .22;
  -webkit-mask-image: linear-gradient(160deg, #000 0%, transparent 35%);
          mask-image: linear-gradient(160deg, #000 0%, transparent 35%);
}
main { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 18px 56px; }
.scherm { display: flex; flex-direction: column; gap: 18px; animation: in .25s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
[hidden] { display: none !important; }

h1 { font-family: var(--display); font-weight: 400; font-size: 2.1rem; line-height: 1.08; margin: 0; }
h1 em { font-style: normal; background: linear-gradient(transparent 58%, var(--citroen) 58%); padding: 0 3px; }
h2 { font-family: var(--display); font-weight: 400; font-size: 1.1rem; margin: 10px 0 0; }
.kana { font-weight: 800; color: var(--accent-diep); font-size: .9rem; letter-spacing: .03em; margin: 0; }
.label { margin: 0 0 6px; font-weight: 800; font-size: .85rem; color: var(--accent-diep); text-transform: uppercase; letter-spacing: .05em; }
.klein { font-size: .88rem; color: var(--grijs); }
.melding { background: var(--citroen); border: var(--rand-dun); border-radius: 6px; padding: 10px 14px; margin: 0; font-size: .92rem; font-weight: 700; }

/* Kop met themakeuze */
.kop { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 10px; }
.themas { display: flex; gap: 7px; padding-top: 4px; flex-shrink: 0; }
.themas button {
  width: 26px; height: 26px; border-radius: 50%; border: var(--rand-dun); cursor: pointer; padding: 0;
  box-shadow: 2px 2px 0 var(--inkt); transition: transform .1s;
}
.themas button[aria-pressed="true"] { transform: scale(1.18); box-shadow: 0 0 0 3px var(--papier), 0 0 0 5.5px var(--inkt); }

/* Panelen */
.kaart { background: var(--wit); border: var(--rand); border-radius: 6px; box-shadow: var(--schaduw); padding: 18px; position: relative; }
.midden { text-align: center; }
textarea, input[type=text] {
  width: 100%; border: var(--rand-dun); border-radius: 6px; padding: 13px;
  font: inherit; color: inherit; background: var(--wit); resize: vertical;
}
textarea::placeholder, input::placeholder { color: #9a93a3; }
textarea:focus, input[type=text]:focus { outline: none; box-shadow: 3px 3px 0 var(--accent); }
.rij { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-top: 14px; }
.rij.tussen { justify-content: space-between; align-items: center; margin-top: 0; }
.knoppen { display: flex; flex-direction: column; gap: 12px; }

/* Knoppen */
.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  border: var(--rand); border-radius: 8px; padding: 12px 18px; font: 800 1.02rem var(--tekst); color: var(--inkt);
  cursor: pointer; box-shadow: var(--schaduw-klein); transition: transform .08s, box-shadow .08s;
  -webkit-tap-highlight-color: transparent;
}
.knop:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--inkt); }
.knop svg { width: 20px; height: 20px; }
.hoofd { background: var(--accent); flex: 1; }
.zacht { background: var(--tweede-licht); }
.tekst { background: none; border-color: transparent; box-shadow: none; color: var(--grijs); text-decoration: underline; text-underline-offset: 3px; }
.breed { width: 100%; }
.knop:disabled { opacity: .55; cursor: default; }
.knop:focus-visible, .optie:focus-visible, .flip:focus-visible, .themas button:focus-visible { outline: 3px solid var(--tweede); outline-offset: 3px; }
.terug { align-self: flex-start; background: none; border: 0; color: var(--grijs); font: 700 .95rem var(--tekst); padding: 4px 0; cursor: pointer; }

/* Foto's */
.fotos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fotos:empty { display: none; }
.foto { position: relative; width: 72px; height: 72px; border-radius: 6px; overflow: hidden; border: var(--rand-dun); }
.foto img { width: 100%; height: 100%; object-fit: cover; }
.foto button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--inkt); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }

/* Eerder geleerd */
.lijst { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lijst li { background: var(--wit); border: var(--rand-dun); border-radius: 6px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; }
.lijst .naam { flex: 1; min-width: 0; }
.lijst .naam b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-weight: 800; overflow: hidden; line-height: 1.3; }
.lijst .naam span { font-size: .82rem; color: var(--grijs); }
.lijst .sticker { background: var(--citroen); border: 2px solid var(--inkt); border-radius: 99px; padding: 1px 9px; font-weight: 800; font-size: .8rem; transform: rotate(-4deg); white-space: nowrap; }
.lijst .knop { padding: 7px 12px; font-size: .9rem; box-shadow: 3px 3px 0 var(--inkt); }
.lijst .weg { background: none; border: 0; color: #a59eae; cursor: pointer; font-size: 1.3rem; padding: 2px 4px; }

/* Laden: snelheidslijnen + ster */
.laden { position: relative; min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.lijnen {
  position: absolute; inset: -30%; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(29,27,38,.10) 0deg 1.4deg, transparent 1.4deg 9deg);
  -webkit-mask-image: radial-gradient(circle, transparent 18%, #000 55%);
          mask-image: radial-gradient(circle, transparent 18%, #000 55%);
  animation: draai 40s linear infinite;
}
@keyframes draai { to { transform: rotate(360deg); } }
.laden > *:not(.lijnen) { position: relative; z-index: 1; }
.ster {
  width: 96px; height: 96px; background: var(--inkt); animation: hup 1.1s ease-in-out infinite;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  display: grid; place-items: center;
}
.ster::after {
  content: ''; width: 82px; height: 82px; background: var(--citroen); margin-top: 4px;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
@keyframes hup { 50% { transform: translateY(-10px) rotate(8deg); } }
.laden .groot { font-family: var(--display); font-size: 1.4rem; margin: 20px 0 6px; }
.laden .kana { font-size: 1.05rem; }
.laden .klein { margin-top: 10px; }

/* Uitleg */
.uitlegtekst p { margin: 10px 0 0; }
.uitlegtekst ul { margin: 10px 0 0; padding-left: 22px; }
.uitlegtekst li::marker { color: var(--accent-diep); }

/* Oefenen */
.voortgang { height: 14px; border: var(--rand-dun); border-radius: 99px; background: var(--wit); overflow: hidden; }
#balk { height: 100%; width: 0; transition: width .3s; background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, var(--accent-diep) 8px 16px); }
.vraagkaart { min-height: 180px; margin-top: 8px; }
.vraagtag {
  position: absolute; top: -15px; left: 14px; background: var(--tweede); color: var(--wit);
  border: var(--rand-dun); border-radius: 4px; padding: 1px 10px; font: 400 .85rem var(--display); transform: rotate(-3deg);
}
.vraagkaart .vraag { font-family: var(--display); font-size: 1.3rem; line-height: 1.28; margin: 8px 0 16px; white-space: pre-wrap; }
.opties { display: flex; flex-direction: column; gap: 10px; }
.optie {
  text-align: left; border: var(--rand-dun); background: var(--wit); border-radius: 6px;
  padding: 12px 14px; font: 700 1rem var(--tekst); cursor: pointer; color: inherit; transition: transform .08s, box-shadow .08s;
}
.optie:hover:not(:disabled) { box-shadow: 3px 3px 0 var(--accent); transform: translate(-1px, -1px); }
.optie.goed { border-color: var(--goed); background: var(--goed-licht); box-shadow: 3px 3px 0 var(--goed); }
.optie.fout { border-color: var(--fout); background: var(--fout-licht); box-shadow: 3px 3px 0 var(--fout); }
.optie:disabled { cursor: default; }
.optie.dim { opacity: .45; }
.invoer { display: flex; gap: 10px; }
.invoer input { flex: 1; min-width: 0; }
.invoer .knop { flex: 0 0 auto; }

/* Flashcard */
.flip { perspective: 1000px; cursor: pointer; border-radius: 6px; }
.flip-binnen { position: relative; min-height: 190px; transition: transform .45s; transform-style: preserve-3d; }
.flip.om .flip-binnen { transform: rotateY(180deg); }
.zijde {
  position: absolute; inset: 0; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; border: var(--rand); border-radius: 6px; padding: 16px; overflow: hidden;
  font-family: var(--display); font-size: 1.7rem; line-height: 1.2;
}
.zijde::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(var(--accent) 1.2px, transparent 1.4px); background-size: 10px 10px; opacity: .3; }
.zijde > * , .zijde { z-index: 0; }
.zijde span, .zijde small { position: relative; }
.voor { background: var(--accent-licht); }
.achter { background: var(--goed-licht); transform: rotateY(180deg); }
.achter::before { background-image: radial-gradient(var(--goed) 1.2px, transparent 1.4px); }
.zijde small { font: 700 .85rem var(--tekst); color: var(--grijs); margin-top: 10px; }
#vraagkaart.flashkaart { background: none; border: 0; box-shadow: none; padding: 0; }
#vraagkaart.flashkaart .flip-binnen { box-shadow: var(--schaduw); border-radius: 6px; }

/* Feedback als tekstballon */
.feedback { background: var(--wit); border: var(--rand); border-radius: 22px; padding: 13px 18px; position: relative; margin-top: 6px; }
.feedback::before, .feedback::after { content: ''; position: absolute; left: 30px; width: 0; height: 0; border-style: solid; }
.feedback::before { top: -19px; border-width: 0 0 19px 22px; border-color: transparent transparent var(--inkt) transparent; }
.feedback::after { top: -13px; left: 33.5px; border-width: 0 0 14px 15px; border-color: transparent transparent var(--wit) transparent; }
.feedback.goed { padding-right: 84px; }
.feedback b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.08rem; }
.feedback.goed b { color: var(--goed); }
.feedback.fout b { color: var(--fout); }
.feedback b small { font: 800 .8rem var(--tekst); color: var(--grijs); margin-left: 6px; }
.feedback p { margin: 4px 0 0; }
.feedback.fout { animation: schud .35s; }
@keyframes schud { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* YATTA-explosie */
.boem {
  position: absolute; right: -14px; top: -70px; width: 100px; height: 100px; z-index: 3; pointer-events: none;
  background: var(--inkt); display: grid; place-items: center; transform: rotate(10deg);
  clip-path: polygon(50% 0, 60% 22%, 84% 8%, 80% 33%, 100% 42%, 80% 56%, 94% 80%, 68% 76%, 60% 100%, 47% 80%, 26% 96%, 26% 72%, 0 70%, 18% 52%, 4% 30%, 28% 28%, 26% 4%);
  animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both;
}
.boem::before {
  content: ''; position: absolute; inset: 5px; background: var(--citroen);
  clip-path: polygon(50% 0, 60% 22%, 84% 8%, 80% 33%, 100% 42%, 80% 56%, 94% 80%, 68% 76%, 60% 100%, 47% 80%, 26% 96%, 26% 72%, 0 70%, 18% 52%, 4% 30%, 28% 28%, 26% 4%);
}
.boem span { position: relative; font-family: var(--display); font-size: .95rem; line-height: 1; text-align: center; }
.boem small { display: block; font: 800 .7rem var(--tekst); margin-top: 3px; }
@keyframes pop { from { transform: scale(.3) rotate(-20deg); opacity: 0; } to { transform: rotate(10deg); } }

/* Klaar */
.score-kaart { text-align: center; overflow: hidden; padding: 28px 18px 22px; }
.score-kaart .lijnen { inset: -60%; }
.score-kaart > *:not(.lijnen) { position: relative; }
.score { font-family: var(--display); font-size: 4.6rem; line-height: 1; margin: 6px 0 0; color: var(--accent); -webkit-text-stroke: 2px var(--inkt); text-shadow: 4px 4px 0 var(--inkt); }
.score .van { font-size: 1.8rem; color: var(--inkt); -webkit-text-stroke: 0; text-shadow: none; }
.sterren { font-size: 1.8rem; letter-spacing: 5px; margin-top: 8px; -webkit-text-stroke: 1.5px var(--inkt); color: transparent; }
.sterren .aan { color: var(--citroen); }
#scoretekst { font-weight: 700; margin: 8px 0 0; }

/* Melding onderin */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  background: var(--inkt); color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: 4px 4px 0 var(--accent);
  max-width: calc(100% - 36px); width: max-content; margin: 0; font-weight: 700;
}

/* Fases */
.fases { display: flex; gap: 6px; }
.fases button {
  flex: 1; border: var(--rand-dun); background: var(--wit); border-radius: 99px; padding: 6px 4px;
  font: 800 .82rem var(--tekst); color: var(--grijs); cursor: pointer; white-space: nowrap;
}
.fases button b {
  display: inline-grid; place-items: center; width: 21px; height: 21px; margin-right: 4px; border-radius: 50%; line-height: 1; vertical-align: -5px;
  background: var(--papier); border: 2px solid currentColor; font: 400 .74rem/1 var(--display); padding-top: 1px;
}
.fases button.actief { background: var(--accent); color: var(--inkt); box-shadow: 3px 3px 0 var(--inkt); }
.fases button.actief b { background: var(--wit); }
.fase-uitleg { margin: -6px 0 0; font-size: .88rem; font-weight: 700; color: var(--grijs); }

/* Snappen */
.introtekst { margin: 6px 0 0; color: var(--grijs); }
.staptitel { font-size: 1.35rem; line-height: 1.2; margin: 2px 0 0; }
.voorbeeld, .ezelsbrug { margin-top: 14px; border: var(--rand-dun); border-radius: 6px; padding: 10px 13px; }
.voorbeeld { background: var(--tweede-licht); }
.ezelsbrug { background: #fff6c7; transform: rotate(-.6deg); }
.voorbeeld b, .ezelsbrug b { display: block; font: 400 .8rem var(--display); text-transform: uppercase; letter-spacing: .04em; }
.voorbeeld p, .ezelsbrug p { margin: 2px 0 0; }
.checkkaart { background: var(--accent-licht); }
#checkfeedback.goed { padding-right: 18px; }
.checkkaart .vraag { font-family: var(--display); font-size: 1.15rem; line-height: 1.28; margin: 0 0 12px; }

/* Tip bij oefenen */
.tipknop {
  border: 2px dashed var(--inkt); background: #fff6c7; border-radius: 99px; padding: 4px 14px; margin: -6px 0 14px;
  font: 800 .88rem var(--tekst); cursor: pointer;
}
.tip { background: #fff6c7; border: var(--rand-dun); border-radius: 6px; padding: 8px 12px; margin: -6px 0 14px; font-weight: 700; }
.tip::before { content: 'Tip: '; font-weight: 800; color: var(--accent-diep); }

/* Herhalen op het startscherm */
.herhaalkaart { background: var(--tweede-licht); }
.herhaaltekst { margin: 0 0 12px; font-weight: 700; }
.herhaaltekst b { font-weight: 800; font-size: 1.15rem; color: var(--accent-diep); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
