/* Begrippenbingo: leerlingenpagina (iPad Safari, staand en liggend). Huisstijl: creme, amber, slate; Alegreya + Inter. */
:root {
  --creme: #fffdf7; --creme-d: #f4ead8; --amber: #f59e0b; --amber-l: #fef3c7; --amber-d: #92400e;
  --slate: #0f172a; --slate-2: #334155;
  --rood: #b91c1c; --rood-l: #fee2e2; --groen: #15803d; --groen-l: #dcfce7; --blauw: #1d4ed8; --blauw-l: #dbeafe;
  --kop: 'Alegreya', Georgia, 'Times New Roman', serif;
  --tekst: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav: 92px;
  --rk: var(--amber); --rk-d: var(--amber-d); --rk-l: var(--amber-l);   /* kleur van de ronde */
}
body[data-ronde="1"] { --rk: #f59e0b; --rk-d: #92400e; --rk-l: #fef3c7; }
body[data-ronde="2"] { --rk: #dc2626; --rk-d: #991b1b; --rk-l: #fee2e2; }
body[data-ronde="3"] { --rk: #2563eb; --rk-d: #1e3a8a; --rk-l: #dbeafe; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--creme); color: var(--slate); font-family: var(--tekst);
  font-size: 1.25rem; line-height: 1.5; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--blauw); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--kop); font-weight: 800; line-height: 1.1; margin: 0; color: var(--slate); }
h1 { font-size: 2.4rem; margin: 0.2rem 0 0.8rem; outline: none; }
h2 { font-size: 1.7rem; margin: 1.4rem 0 0.5rem; }
p { margin: 0 0 0.9rem; }

/* ---------- bovenbalk ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--slate); color: var(--creme-d); padding-top: env(safe-area-inset-top); }
.top-rij { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 4px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left)); max-width: 980px; margin: 0 auto; }
.top-icoon { width: 34px; height: 34px; color: var(--amber); flex: none; }
.top-titel { font-family: var(--kop); font-weight: 800; font-size: 1.5rem; flex: 1; }
.top-stap { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.top-opnieuw { min-width: 48px; min-height: 48px; padding: 0 12px; border-radius: 12px; font-weight: 700; font-size: 1.15rem; background: transparent; border: 2px solid rgba(244, 234, 216, 0.4); color: var(--creme-d); }
.top-opnieuw span { display: none; }
@media (min-width: 700px) { .top-opnieuw span { display: inline; } }
.voortgang { height: 8px; background: rgba(244, 234, 216, 0.18); }
.voortgang i { display: block; height: 100%; width: 0; background: var(--rk); transition: width 0.25s ease; }

/* ---------- inhoud ---------- */
main { max-width: 980px; margin: 0 auto; padding: 20px max(18px, env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
body.met-acties main { padding-bottom: calc(var(--nav) + 28px + env(safe-area-inset-bottom)); }
.stap { animation: opkomen 0.25s ease; }
@keyframes opkomen { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.kicker { margin: 0 0 4px; font-size: 1.15rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber-d); }
.klein { font-size: 1.15rem; }
.grijs { color: var(--slate-2); }
.vet { font-weight: 700; }
.hint { font-weight: 700; color: var(--amber-d); }

.knop { min-height: 56px; padding: 0 24px; border-radius: 14px; border: 3px solid var(--amber); background: var(--amber); color: var(--slate); font-weight: 800; font-size: 1.25rem; margin: 0 0 1rem; }
.knop--groot { min-height: 68px; font-size: 1.4rem; width: 100%; max-width: 480px; display: block; }
.knop--licht { background: transparent; border-color: var(--slate-2); color: var(--slate-2); font-weight: 700; }
.knop:disabled { opacity: 0.4; cursor: default; }
.knoppenrij { margin-top: 1rem; }

.verhaal { position: relative; margin: 0.6rem 0 1.2rem; padding: 18px 20px 6px 64px; border-radius: 0 16px 16px 0; background: linear-gradient(90deg, var(--creme-d), #f9f1e1); border-left: 8px solid var(--amber-d); font-family: var(--kop); font-style: italic; font-weight: 500; font-size: 1.45rem; line-height: 1.45; }
.verhaal::before { content: '\201C'; position: absolute; left: 16px; top: -2px; font-size: 4rem; line-height: 1; color: var(--amber-d); opacity: 0.55; font-style: normal; }
.kaartje { background: #fff; border: 3px solid var(--creme-d); border-radius: 16px; padding: 14px 20px; margin: 0 0 1rem; }
.kaartje--amber { background: var(--amber-l); border-color: var(--amber); }
.kaartje p:last-child, .kaartje ul:last-child { margin-bottom: 0; }
ul.lijst { list-style: none; margin: 0.3rem 0 0.9rem; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.lijst li { position: relative; padding-left: 28px; }
ul.lijst li::before { content: ''; position: absolute; left: 4px; top: 0.6em; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); }
.papier { display: flex; gap: 14px; align-items: center; background: var(--amber-l); border: 3px dashed var(--amber-d); border-radius: 16px; padding: 12px 18px; margin: 0 0 1rem; }
.papier svg { width: 46px; height: 46px; flex: none; color: var(--amber-d); }
.papier p { margin: 0; }

/* ---------- kaartnummer: bingoballen ---------- */
.nummers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 1rem 0; max-width: 640px; }
@media (max-width: 480px) { .nummers { grid-template-columns: repeat(2, 1fr); } }
.nummer {
  aspect-ratio: 1; min-height: 96px; border-radius: 50%; border: 5px solid var(--slate); background: #fff;
  font-family: var(--kop); font-weight: 800; font-size: 3.2rem; line-height: 1; color: var(--slate);
  box-shadow: inset 0 -6px 0 rgba(15, 23, 42, 0.08);
}
.nummer[aria-pressed="true"] { background: var(--amber); border-color: var(--amber-d); box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.3); }

/* ---------- rondes ---------- */
.rondes { display: grid; gap: 14px; margin: 1rem 0; }
.ronde-knop { display: flex; align-items: center; gap: 18px; text-align: left; width: 100%; min-height: 110px; padding: 14px 22px; border-radius: 18px; background: #fff; border: 4px solid var(--creme-d); }
.ronde-bal { flex: none; width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--kop); font-weight: 800; font-size: 2.6rem; color: #fff; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18), inset 0 6px 0 rgba(255, 255, 255, 0.25); }
.ronde-knop[data-r="1"] .ronde-bal { background: #f59e0b; color: var(--slate); }
.ronde-knop[data-r="2"] .ronde-bal { background: #dc2626; }
.ronde-knop[data-r="3"] .ronde-bal { background: #2563eb; }
.ronde-tekst b { display: block; font-family: var(--kop); font-size: 1.9rem; line-height: 1.1; }
.ronde-tekst span { display: block; font-size: 1.2rem; color: var(--slate-2); }
.ronde-tekst .win { color: var(--slate); font-weight: 700; }
.ronde-knop.klaar { background: var(--groen-l); border-color: var(--groen); }
.ronde-knop.klaar .ronde-tekst b::after { content: ' \2713'; color: var(--groen); }

/* ---------- machine ---------- */
.status { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { background: var(--creme-d); border-radius: 99px; padding: 4px 16px; font-weight: 700; font-size: 1.15rem; }
.chip--ronde { background: var(--rk); color: #fff; }
body[data-ronde="1"] .chip--ronde { color: var(--slate); }
.chip--win { background: var(--slate); color: var(--creme); }

.machine { display: flex; align-items: center; gap: 22px; background: var(--slate); color: var(--creme); border-radius: 22px; padding: 14px 22px; margin: 0 0 14px; position: relative; overflow: hidden; border-bottom: 8px solid var(--rk); }
.machine::before { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.14), rgba(255,255,255,0) 70%); }
.bal {
  flex: none; width: 112px; height: 112px; border-radius: 50%; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.55) 0, rgba(255,255,255,0) 32%), var(--rk);
  box-shadow: inset 0 -9px 0 rgba(0, 0, 0, 0.2), 0 6px 14px rgba(0, 0, 0, 0.4);
}
.bal span { width: 68px; height: 68px; border-radius: 50%; background: var(--creme); color: var(--slate); display: flex; align-items: center; justify-content: center; font-family: var(--kop); font-weight: 800; font-size: 2.6rem; line-height: 1; }
.machine-tekst { position: relative; z-index: 1; min-width: 0; }
.machine-groot { font-family: var(--kop); font-weight: 800; font-size: 2.1rem; line-height: 1.1; margin: 0 0 2px; }
.machine-klein { margin: 0; font-size: 1.2rem; color: var(--creme-d); }
.oud { background: var(--amber-l); border: 3px solid var(--amber); border-radius: 12px; padding: 8px 16px; font-weight: 700; margin: 0 0 12px; }

/* trek-animatie (alleen als de leerling bewegen goed vindt) */
@media (prefers-reduced-motion: no-preference) {
  .machine.rolt .bal { animation: bal-rol 0.85s cubic-bezier(.2, .8, .3, 1) both; }
  .machine.rolt::before { animation: draai 0.85s linear; }
  .machine.rolt .machine-tekst { animation: opkomen 0.4s ease 0.5s both; }
  .clue.nieuw { animation: clue-in 0.45s ease 0.45s both; }
  @keyframes bal-rol {
    0% { transform: translateX(-260px) rotate(-720deg) scale(0.5); opacity: 0; }
    30% { opacity: 1; }
    70% { transform: translateX(8px) rotate(14deg) scale(1.08); }
    100% { transform: none; }
  }
  @keyframes draai { from { transform: rotate(0); } to { transform: rotate(360deg); } }
  @keyframes clue-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  .uitslag.goed .groot { animation: pop 0.5s cubic-bezier(.2, 1.4, .4, 1) both; }
  @keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
  .confetti i { animation: val 1.8s ease-in forwards; }
  @keyframes val { from { transform: translateY(-30px) rotate(0); opacity: 1; } to { transform: translateY(240px) rotate(540deg); opacity: 0; } }
}

/* kaartje (clue) */
.clue { background: #fff; border: 4px solid var(--rk); border-radius: 20px; padding: 14px 22px 8px; margin: 0 0 14px; }
.clue .kicker { color: var(--rk-d); }
.clue-tekst { font-family: var(--kop); font-size: 1.8rem; line-height: 1.3; font-weight: 500; margin: 0 0 0.8rem; }
.clue-vraag { font-weight: 800; font-size: 1.35rem; margin: 0 0 0.8rem; }
.clue-streep { font-size: 1.15rem; color: var(--slate-2); }
.pil { display: inline-block; background: var(--rk); color: #fff; border-radius: 99px; padding: 2px 16px; font-weight: 800; font-size: 1.15rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 8px; }
body[data-ronde="1"] .pil { color: var(--slate); }
.bron-regel { font-weight: 700; margin: 0 0 6px; }
.bron { background: var(--creme); border-left: 8px solid var(--rk); border-radius: 0 14px 14px 0; padding: 10px 18px; margin: 0 0 0.8rem; box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08); }
.bron q { display: block; font-family: var(--kop); font-size: 1.6rem; line-height: 1.35; quotes: none; margin: 4px 0 10px; }
.uitleg { font-size: 1.15rem; color: var(--slate-2); background: var(--creme-d); border-radius: 12px; padding: 8px 14px; }

.beeld { margin: 0 0 0.8rem; }
.beeld-knop { display: block; width: 100%; padding: 0; border: 0; background: var(--creme-d); border-radius: 12px; overflow: hidden; position: relative; min-height: 48px; }
.beeld-knop::after { content: '\1F50D  Tik om te vergroten'; position: absolute; right: 10px; bottom: 10px; background: rgba(15, 23, 42, 0.78); color: #fff; border-radius: 99px; padding: 6px 14px; font-size: 1.15rem; font-weight: 600; pointer-events: none; }
.beeld-knop img { display: block; width: 100%; max-height: min(40vh, 420px); object-fit: contain; }
.beeld figcaption { font-size: 1.15rem; color: var(--slate-2); margin-top: 6px; line-height: 1.35; }
.heftig { background: var(--rood-l); border: 3px solid var(--rood); border-radius: 14px; padding: 12px 18px; margin: 0 0 0.8rem; }
.heftig p { margin: 0 0 10px; }
.heftig .knop { margin: 0; background: #fff; border-color: var(--rood); color: var(--rood); }

/* ---------- onderbalk met de vier knoppen ---------- */
.acties {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: stretch;
  padding: 12px max(18px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(255, 253, 247, 0.96); border-top: 3px solid var(--creme-d); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.act { min-height: 64px; border-radius: 16px; font-weight: 800; font-size: 1.2rem; border: 3px solid var(--slate); background: #fff; color: var(--slate); padding: 0 16px; }
.act-trek { background: var(--rk); border-color: var(--rk); color: #fff; font-size: 1.6rem; font-family: var(--kop); letter-spacing: 0.02em; }
body[data-ronde="1"] .act-trek { color: var(--slate); }
.act-bingo { background: var(--slate); color: var(--amber); border-color: var(--slate); font-family: var(--kop); font-size: 1.6rem; }
.act:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 700px) {
  .acties { grid-template-columns: 1fr 1fr 1fr; }
  .act-trek { grid-column: 1 / -1; grid-row: 1; }
  .act { padding: 0 8px; }
}

/* ---------- bingo-controle ---------- */
.bingo-wrap { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: 34px auto; gap: 6px; max-width: 760px; margin: 0 auto 1rem; }
.bingo-kol, .bingo-rij { display: grid; font-family: var(--kop); font-weight: 800; font-size: 1.5rem; color: var(--amber-d); text-align: center; align-items: center; }
.bingo-kol { grid-column: 2; grid-row: 1; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bingo-rij { grid-column: 1; grid-row: 2; grid-template-rows: repeat(4, 1fr); gap: 8px; }
.bingo-rooster { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(92px, auto); gap: 8px; }
.vakje {
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px 6px; border-radius: 14px;
  border: 3px solid var(--slate-2); background: #fff; font-weight: 700; font-size: 1.2rem; line-height: 1.2;
  overflow-wrap: anywhere; -webkit-hyphens: manual; hyphens: manual; min-width: 0;
}
.vakje[aria-pressed="true"] { background: var(--amber); border-color: var(--amber-d); text-decoration: line-through; text-decoration-thickness: 3px; }
.vakje.fout { background: var(--rood-l); border-color: var(--rood); border-style: dashed; text-decoration: none; }
.vakje.fout::after { content: ' \2715'; color: var(--rood); }
.uitslag { border-radius: 16px; padding: 14px 20px 6px; margin: 0 0 1rem; border: 3px solid; position: relative; overflow: hidden; }
.uitslag p { margin: 0 0 0.7rem; }
.uitslag .groot { font-family: var(--kop); font-weight: 800; font-size: 2.2rem; line-height: 1.1; margin-bottom: 0.5rem; }
.uitslag.goed { background: var(--groen-l); border-color: var(--groen); }
.uitslag.goed .groot { color: var(--groen); font-size: 3rem; }
.uitslag.bijna { background: var(--amber-l); border-color: var(--amber); }
.uitslag.fout { background: var(--rood-l); border-color: var(--rood); }
.uitslag.fout .groot { color: var(--rood); }
.uitslag ul { margin: 0 0 0.7rem; padding-left: 22px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: 0; width: 12px; height: 18px; border-radius: 3px; opacity: 0; }

/* ---------- bonus ---------- */
.starter { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; border: 3px solid; border-radius: 14px; padding: 10px 16px; margin: 0 0 10px; }
.starter p { margin: 0; font-weight: 600; }
.starter-label { font-family: var(--kop); font-weight: 800; font-size: 1.7rem; line-height: 1; }
@media (max-width: 560px) { .starter { grid-template-columns: 1fr; gap: 4px; } }
.zie { background: var(--blauw-l); border-color: var(--blauw); } .zie .starter-label { color: var(--blauw); }
.koppel { background: var(--groen-l); border-color: var(--groen); } .koppel .starter-label { color: var(--groen); }
.zin { font-family: var(--kop); font-size: 1.7rem; line-height: 1.35; font-weight: 700; background: #fff; border: 3px solid var(--slate); border-radius: 14px; padding: 12px 18px; margin: 0 0 1rem; }
.onthul { animation: opkomen 0.25s ease; }

/* ---------- foto vergroten ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, 0.94); display: flex; align-items: center; justify-content: center; padding: 70px 10px 10px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 6px; }
.lightbox-sluit { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; min-height: 52px; padding: 0 22px; border-radius: 14px; border: 3px solid var(--amber); background: var(--amber); color: var(--slate); font-weight: 800; font-size: 1.25rem; }

@media (prefers-reduced-motion: reduce) {
  .stap, .onthul { animation: none; }
  .voortgang i { transition: none; }
}
