:root {
  --rood: #8f1d1d;
  --rood-donker: #5e1010;
  --goud: #f4a300;
  --goud-licht: #ffd166;
  --creme: #fff8ea;
  --tekst: #2b1a12;
  --zacht: #7a6656;
  --goed: #2a9d5c;
  --fout: #c62828;
  --team: #8f1d1d;
  --radius: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tekst);
  background: radial-gradient(circle at 20% 0%, #a92a2a, var(--rood) 45%, var(--rood-donker));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.4;
}

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
img { max-width: 100%; display: block; }
a { color: var(--rood); }
.verborgen { display: none !important; }
.laden { color: #fff; text-align: center; padding: 3rem; }

/* ---------- Bouwstenen ---------- */

.kaart {
  background: var(--creme);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: 0 6px 24px rgb(0 0 0 / 25%);
}
.stapel { display: flex; flex-direction: column; gap: .8rem; }
.rij { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.rij.tussen { justify-content: space-between; }
.midden { text-align: center; }
.zacht { color: var(--zacht); }
.klein { font-size: .85rem; }
.groot { font-size: 1.25rem; }
.vol { width: 100%; }
.logo { font-size: 3.5rem; text-align: center; }

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; }
.rij label { flex: 1; min-width: 8rem; }
input, textarea, select {
  font: inherit;
  padding: .7rem .8rem;
  border: 2px solid #e2d3bf;
  border-radius: 12px;
  background: #fff;
  color: var(--tekst);
}
input:focus, textarea:focus, select:focus { outline: 3px solid var(--goud); border-color: var(--goud); }
input[type="color"] { padding: 0; width: 3rem; height: 3rem; }
input[type="range"] { padding: 0; }

.knop {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: .75rem 1.3rem;
  background: var(--goud);
  color: var(--tekst);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-shadow: 0 3px 0 #b37700;
}
.knop:active { transform: translateY(2px); box-shadow: 0 1px 0 #b37700; }
.knop:disabled { opacity: .5; }
.knop.groot { width: 100%; padding: 1.05rem; font-size: 1.15rem; }
.knop.licht { background: #efe2cf; box-shadow: 0 3px 0 #cdbba3; }
.knop.goed { background: var(--goed); color: #fff; box-shadow: 0 3px 0 #1d6b3f; }
.knop.fout { background: var(--fout); color: #fff; box-shadow: 0 3px 0 #8a1b1b; }
.team-knop { background: var(--team); color: #fff; box-shadow: 0 3px 0 rgb(0 0 0 / 30%); }
.link {
  font: inherit;
  background: none;
  border: none;
  color: var(--rood);
  text-decoration: underline;
  cursor: pointer;
  padding: .3rem;
}
.link:disabled { opacity: .3; text-decoration: none; }
.link.gevaar { color: var(--fout); }

.melding { padding: .8rem 1rem; border-radius: 12px; font-weight: 700; }
.melding.fout { background: #fde2e2; color: var(--fout); }
.melding.goed { background: #dcf3e5; color: var(--goed); }
.tip { background: #fff1c9; padding: .7rem .9rem; border-radius: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 150%);
  background: #222;
  color: #fff;
  padding: .8rem 1.2rem;
  border-radius: 999px;
  max-width: calc(100% - 2rem);
  transition: transform .25s;
  z-index: 50;
  text-align: center;
}
.toast.zichtbaar { transform: translate(-50%, 0); }
.toast-fout { background: var(--fout); }

.spinner {
  width: 2.5rem; height: 2.5rem; margin: .5rem auto;
  border: 4px solid #e8d7bf; border-top-color: var(--rood);
  border-radius: 50%;
  animation: draai 1s linear infinite;
}
@keyframes draai { to { transform: rotate(360deg); } }

/* ---------- Telefoon ---------- */

.welkom { max-width: 26rem; margin: 10vh auto 0; display: flex; flex-direction: column; gap: .8rem; }
.welkom h1 { text-align: center; }
.welkom form input { flex: 1; text-transform: uppercase; letter-spacing: .2em; font-size: 1.3rem; text-align: center; min-width: 0; }
@media (max-width: 30rem) { .welkom { margin: 1rem; } }

.kop {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1rem calc(.8rem) 1rem;
  padding-top: max(.8rem, env(safe-area-inset-top));
  background: var(--team);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 2px 12px rgb(0 0 0 / 30%);
}
.punten { background: rgb(255 255 255 / 22%); border-radius: 999px; padding: .2rem .8rem; }
.inhoud { max-width: 34rem; margin: 0 auto; padding: 1rem; }
.inhoud.breed { max-width: 60rem; }
.voet { text-align: center; padding: 1rem 1rem 2rem; }
.voet .link { color: #ffe9c2; }

.stap { color: #fff; font-weight: 700; text-align: center; }
.foto-kader { border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: 0 6px 24px rgb(0 0 0 / 35%); }
.foto { width: 100%; border-radius: var(--radius); }
.foto-kader .foto { border-radius: 0; max-height: 60vh; object-fit: contain; margin: 0 auto; }
.foto.klein { max-width: 12rem; margin: 0 auto; }
.inhoud > .stapel > .rij.tussen { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.inhoud > .stapel > .rij.tussen .zacht { color: #ffe0b0; }

.opdracht { text-align: center; }
.opdracht .goed { color: var(--goed); font-weight: 800; }
.opdracht .label { margin-top: .5rem; font-weight: 700; color: var(--zacht); }
.opdracht-tekst { font-size: 1.35rem; font-weight: 800; margin: .3rem 0 .8rem; }
.klok { font-variant-numeric: tabular-nums; font-weight: 900; }
.klok.groot { font-size: 3rem; color: var(--rood); }
.bijna { color: var(--fout); animation: knipper 1s steps(2) infinite; }
@keyframes knipper { 50% { opacity: .4; } }
.te-laat { color: var(--fout); font-weight: 700; }

.uitleg { padding-left: 1.2rem; margin: 0 0 .8rem; }
.uitleg li { margin-bottom: .4rem; }

.antwoord { font-size: 1.4rem; font-weight: 800; margin: .3rem 0; }
.keuzes { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.keuze {
  font: inherit; font-weight: 700;
  padding: 1rem .5rem;
  border-radius: 14px;
  border: 3px solid transparent;
  background: var(--creme);
  color: var(--tekst);
  cursor: pointer;
}
.keuze:disabled { cursor: default; }
.keuze.gekozen { border-color: var(--goud); background: #fff1c9; }
.keuze.juist { border-color: var(--goed); background: #dcf3e5; }
.keuze.onjuist { border-color: var(--fout); background: #fde2e2; }

.raster { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.stemfoto {
  position: relative; padding: 0; border: 4px solid transparent; border-radius: 14px;
  overflow: hidden; background: #000; cursor: pointer; aspect-ratio: 3 / 4;
}
.stemfoto img { width: 100%; height: 100%; object-fit: cover; }
.stemfoto.gekozen { border-color: var(--goud); }
.stemfoto:disabled { opacity: .45; cursor: default; }
.stemfoto .nr, .stem-paneel .nr {
  position: absolute; top: .4rem; left: .4rem;
  background: var(--goud); color: var(--tekst); font-weight: 900;
  border-radius: 999px; min-width: 2rem; padding: .1rem .5rem; text-align: center;
}
.stemfoto .eigen { position: absolute; bottom: .4rem; left: 0; right: 0; color: #fff; font-weight: 700; text-shadow: 0 1px 3px #000; }
.stemfoto .vinkje { position: absolute; top: .3rem; right: .5rem; font-size: 1.6rem; color: var(--goud); text-shadow: 0 1px 3px #000; }

.scores { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-direction: column; gap: .4rem; }
.scores li { display: flex; justify-content: space-between; padding: .6rem .9rem; border-radius: 12px; background: var(--team); color: #fff; font-weight: 700; }

/* ---------- Piet ---------- */

.tabs {
  position: sticky; top: 0; z-index: 5;
  display: flex; overflow-x: auto; gap: .3rem; padding: .5rem;
  background: var(--rood-donker);
}
.tabs button {
  font: inherit; font-weight: 700; white-space: nowrap;
  border: none; border-radius: 999px; padding: .55rem 1rem;
  background: transparent; color: #ffe0b0; cursor: pointer;
}
.tabs button.actief { background: var(--goud); color: var(--tekst); }

.programma { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem; }
.stap-knop {
  font: inherit; font-weight: 600; text-align: left;
  padding: .75rem .9rem; border-radius: 12px; border: 2px solid #e2d3bf;
  background: #fff; cursor: pointer; color: var(--tekst);
}
.stap-knop.actief { background: var(--rood); border-color: var(--rood); color: #fff; }

.beoordelen { border: 4px solid var(--goud); }
.beoordeel { border-left: 6px solid var(--team); padding: .6rem 0 .6rem .8rem; margin-bottom: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.beoordeel .foto { max-height: 50vh; object-fit: contain; background: #000; }
.naast { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.naast figure { margin: 0; }
.naast img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.naast figcaption { font-size: .85rem; color: var(--zacht); text-align: center; }

.team-status { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; padding: .5rem 0 .5rem .7rem; border-left: 6px solid var(--team); margin-bottom: .4rem; font-variant-numeric: tabular-nums; }

.tabel { width: 100%; border-collapse: collapse; }
.tabel th, .tabel td { padding: .4rem; text-align: left; border-bottom: 1px solid #ead9c2; }

.kolommen-klein { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.team-plekken { border-top: 6px solid var(--team); padding-top: .5rem; }
.plek { display: flex; gap: .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid #ead9c2; }
.plek img { width: 4rem; height: 4rem; object-fit: cover; border-radius: 8px; flex: none; }
.plek-info { flex: 1; min-width: 0; }
.plek-knoppen { display: flex; flex: none; }

.podium { position: relative; cursor: crosshair; touch-action: manipulation; }
.podium .bron { width: 100%; height: auto; display: block; border-radius: 8px; }
.uitsnede { position: absolute; border: 3px solid var(--goud); box-shadow: 0 0 0 9999px rgb(0 0 0 / 45%); border-radius: 4px; pointer-events: none; }
.podium { overflow: hidden; border-radius: 8px; }
.voorbeeld { max-width: 14rem; border-radius: 8px; margin-top: .3rem; }

.volwassene summary { cursor: pointer; font-weight: 700; padding: .4rem 0; }
.antwoorden { padding-left: 1rem; }
.antwoorden li { margin-bottom: .5rem; }
.quizlijst li { display: flex; justify-content: space-between; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid #ead9c2; }
.gevaar-kaart { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }

/* ---------- Tv ---------- */

.pagina-tv { overflow: hidden; }
.pagina-tv .welkom { color: var(--tekst); }
.tv { height: 100vh; padding: 2.5vh 3vw; color: #fff; display: flex; flex-direction: column; font-size: 2.2vh; }
.tv .zacht { color: #ffd9a8; }
.tv-midden { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; text-align: center; }
.tv-titel { font-size: 6vh; text-shadow: 0 4px 16px rgb(0 0 0 / 40%); }
.tv-kop { font-size: 3.6vh; font-weight: 800; margin-bottom: 2vh; }
.team-label { background: var(--team); padding: .1em .5em; border-radius: 999px; }

.meedoen { display: flex; gap: 3vw; align-items: center; background: var(--creme); color: var(--tekst); padding: 2.5vh 3vw; border-radius: 24px; text-align: left; }
.meedoen .zacht { color: var(--zacht); }
.qr { width: 24vh; height: 24vh; border-radius: 8px; image-rendering: pixelated; }
.url { font-size: 4vh; font-weight: 800; margin-bottom: 1.5vh; }
.spelcode { font-size: 9vh; font-weight: 900; letter-spacing: .15em; color: var(--rood); line-height: 1; }

.teams { display: flex; gap: 2vw; flex-wrap: wrap; justify-content: center; }
.team-blok { background: var(--team); padding: 1.5vh 2.5vw; border-radius: 18px; font-size: 3vh; min-width: 18vw; box-shadow: 0 4px 16px rgb(0 0 0 / 30%); }
.team-blok .naam { font-weight: 800; font-size: 3.6vh; }

.tv-zoeken { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.banner { background: var(--goud); color: var(--tekst); font-weight: 900; font-size: 4vh; text-align: center; border-radius: 16px; padding: 1vh; margin-bottom: 2vh; }
.kolommen { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2vw; min-height: 0; }
.kolom { background: rgb(0 0 0 / 22%); border-top: 1.2vh solid var(--team); border-radius: 18px; padding: 2vh 1.5vw; display: flex; flex-direction: column; gap: 1vh; min-height: 0; }
.kolom .naam { font-size: 4.2vh; font-weight: 900; }
.kolom .voortgang { font-size: 2.6vh; color: #ffd9a8; }
.kolom .status { font-size: 3.4vh; font-weight: 800; font-variant-numeric: tabular-nums; }
.kolom .status.klaar { color: #9ff0bf; }
.kolom .status.opdracht { color: var(--goud-licht); }
.tv-foto { flex: 1; min-height: 0; width: 100%; object-fit: contain; border-radius: 12px; background: rgb(0 0 0 / 30%); }
.tv-foto.leeg { display: flex; align-items: center; justify-content: center; font-size: 10vh; opacity: .4; }

.scorebalk { display: flex; gap: 2vw; justify-content: center; margin-top: 2vh; }
.score { background: var(--team); border-radius: 999px; padding: .8vh 2vw; font-size: 3vh; display: flex; gap: 1.5vw; }

.groot-scores { display: flex; flex-direction: column; gap: 1.5vh; width: min(70vw, 60rem); }
.groot-score { display: grid; grid-template-columns: 6vh 1fr auto; grid-template-areas: "plaats naam totaal" "plaats detail totaal"; align-items: center; background: var(--team); border-radius: 20px; padding: 1.5vh 2vw; text-align: left; box-shadow: 0 4px 16px rgb(0 0 0 / 30%); }
.groot-score .plaats { grid-area: plaats; font-size: 5vh; }
.groot-score .naam { grid-area: naam; font-size: 4.2vh; font-weight: 900; }
.groot-score .detail { grid-area: detail; font-size: 2.2vh; opacity: .9; }
.groot-score .totaal { grid-area: totaal; font-size: 6vh; font-weight: 900; }

.vraag { font-size: 3.6vh; color: #ffd9a8; }
.tv-antwoord { font-size: 7vh; font-weight: 900; max-width: 85vw; line-height: 1.15; }
.onthulling { font-size: 5vh; background: var(--goud); color: var(--tekst); padding: 1vh 3vw; border-radius: 999px; animation: plop .4s ease-out; }
@keyframes plop { from { transform: scale(.6); opacity: 0; } }

.tv-terugblik { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.drieluik { flex: 1; display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 1.5vw; min-height: 0; }
.paneel { margin: 0; display: flex; flex-direction: column; gap: 1vh; min-height: 0; animation: plop .5s ease-out; }
.paneel img { flex: 1; min-height: 0; width: 100%; object-fit: contain; border-radius: 14px; background: rgb(0 0 0 / 30%); }
.paneel figcaption { font-size: 3vh; font-weight: 700; text-align: center; }
.paneel .leeg { flex: 1; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 25%); border-radius: 14px; font-size: 3vh; }

.tv-stemmen { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 1vh; }
.tv-raster { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(18vw, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 1.2vw; min-height: 0; }
.stem-paneel { position: relative; margin: 0; border-radius: 14px; overflow: hidden; border: .6vh solid var(--team); min-height: 0; }
.stem-paneel img { width: 100%; height: 100%; object-fit: cover; }
.stem-paneel .nr { font-size: 3.5vh; }
.klein-meedoen { display: flex; align-items: center; gap: 1vw; }
.klein-meedoen .qr { width: 10vh; height: 10vh; }

.tv-eind { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2vh; position: relative; min-height: 0; }
.eind-raster { flex: 1; display: flex; gap: 3vw; align-items: center; justify-content: center; min-height: 0; width: 100%; }
.eind-raster .groot-scores { flex: 1; width: auto; max-width: 60rem; }
.beste { display: flex; flex-direction: column; gap: 1vh; max-height: 75vh; width: 28vw; flex: none; }
.beste .paneel { min-height: 0; flex: 1; }
.beste .paneel img { max-height: 30vh; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -5vh; width: 1vh; height: 2vh; animation: val linear infinite; }
@keyframes val { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } .bijna { animation: none; } }
