/* Operatie Sinterklaas — stijl. Mobiel eerst; strenge CSP: geen inline stijl, alleen dit bestand.
   Inktblauw + mijter-goud + Sint-rood. Big Shoulders voor koppen (zinszin, geen kapitalen), Lexend voor tekst. */
@font-face { font-family: "Big Shoulders"; src: url(fonts/bigshoulders.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Lexend"; src: url(fonts/lexend.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --inkt: #0d131a;
  --staal: #17212c;
  --staal2: #223041;
  --lijn: #31465c;
  --goud: #e8b84a;
  --goud-d: #b88a24;
  --rood: #d9343b;
  --papier: #ece6d6;
  --dim: #93a1b1;
  --groen: #5fbf8a;
  --blauw: #4d8be8;
  --kop: "Big Shoulders", "Arial Narrow", sans-serif;
  --tekst: "Lexend", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--inkt); color: var(--papier); overscroll-behavior: none; }
body { font: 400 16px/1.5 var(--tekst); -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
button { touch-action: manipulation; user-select: none; -webkit-user-select: none; }

#app {
  height: 100dvh; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column;
  background:
    linear-gradient(var(--lijn) 1px, transparent 1px) 0 0 / 100% 36px,
    linear-gradient(90deg, var(--lijn) 1px, transparent 1px) 0 0 / 36px 100%,
    var(--inkt);
  background-blend-mode: soft-light, soft-light, normal;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- balk ---------- */
#balk { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(13, 19, 26, .92); border-bottom: 1px solid var(--lijn); }
.merk { font: 700 1.2rem/1 var(--kop); letter-spacing: .02em; color: var(--goud); flex: 1; white-space: nowrap; }
#pips { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
#pips i { display: block; width: 15px; height: 8px; background: var(--staal2); border: 1px solid var(--lijn); transform: skewX(-20deg); }
#pips i.nu { background: transparent; border-color: var(--goud); }
#pips i.klaar { background: var(--goud); border-color: var(--goud); }
#geluid { width: 40px; height: 40px; background: none; border: 1px solid var(--lijn); border-radius: 4px; cursor: pointer; display: grid; place-items: center; }
#geluid svg { width: 22px; height: 22px; fill: none; stroke: var(--papier); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#geluid.uit svg { stroke: var(--dim); }

#scherm { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 16px 28px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- tekst ---------- */
h1, h2, h3 { font-family: var(--kop); font-weight: 800; line-height: 1; margin: 0; letter-spacing: .005em; }
h1 { font-size: 3.4rem; }
h2 { font-size: 2.3rem; }
h3 { font-size: 1.5rem; }
p { margin: 0; }
.klein { color: var(--dim); font-size: .875rem; }
.dim { color: var(--dim); }
.goud { color: var(--goud); }
.melding { min-height: 1.5em; color: var(--rood); font-weight: 500; }
.melding.goed { color: var(--groen); }

/* ---------- kaart / dossier ---------- */
.kaart { background: var(--staal); border: 1px solid var(--lijn); border-left: 4px solid var(--goud); padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.kaart.rood { border-left-color: var(--rood); }
.tip { border-left: 2px solid var(--lijn); padding-left: 12px; color: var(--dim); font-size: .9rem; }

/* ---------- knoppen ---------- */
.knop {
  appearance: none; border: 0; cursor: pointer; min-height: 56px; padding: 0 22px;
  background: var(--goud); color: #1a1405; font: 800 1.35rem/1 var(--kop); letter-spacing: .03em;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.knop:active { background: var(--goud-d); }
.knop:focus-visible { outline: 3px solid var(--papier); outline-offset: -6px; }
.knop[disabled] { background: var(--staal2); color: var(--dim); cursor: default; }
.knop.groot { min-height: 76px; font-size: 1.8rem; width: 100%; }
.knop.rood { background: var(--rood); color: #fff; }
.knop.stil { background: transparent; color: var(--dim); border: 1px solid var(--lijn); clip-path: none; min-height: 44px; font: 500 .9rem var(--tekst); }
.link { appearance: none; background: none; border: 0; padding: 6px 0; color: var(--dim); text-decoration: underline; cursor: pointer; font-size: .9rem; align-self: flex-start; }

/* ---------- invoer ---------- */
.invoer { display: flex; flex-direction: column; gap: 12px; }
.invoer input {
  background: var(--inkt); border: 2px solid var(--lijn); border-radius: 0; min-height: 64px; padding: 0 16px;
  font: 800 2rem/1 var(--kop); letter-spacing: .25em; text-transform: uppercase; text-align: center; color: var(--goud);
}
.invoer input:focus { outline: none; border-color: var(--goud); }
.invoer input.fout { border-color: var(--rood); animation: schud .35s; }
.invoer input.naam { font-size: 1.5rem; letter-spacing: .05em; text-transform: none; }

/* ---------- appje van papa tussen twee deuren ---------- */
.chat { background: var(--inkt); border: 1px solid var(--lijn); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 240px; }
.chat-kop { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--lijn); }
.chat-kop > div { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.chat-kop small { color: var(--dim); font-size: .75rem; }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--staal2); border: 1px solid var(--lijn); display: grid; place-items: center; font: 800 1rem/1 var(--kop); color: var(--goud); }
.bellen { display: flex; flex-direction: column; gap: 8px; }
.bel { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: .95rem; line-height: 1.35; animation: bel-in .18s ease-out; }
.bel.papa { align-self: flex-start; background: var(--staal2); border-bottom-left-radius: 4px; }
.bel.fedde { align-self: flex-end; background: #1f4d3b; border-bottom-right-radius: 4px; }
.bel.buur { align-self: flex-start; background: #3a3320; border-bottom-left-radius: 4px; }
.bel .naam { display: block; font-size: .72rem; font-weight: 600; color: var(--goud); margin-bottom: 2px; }
.bel.buur.typt { background: #3a3320; }
.antwoorden { display: flex; flex-direction: column; gap: 8px; }
.antwoorden:empty { display: none; }
.typ { display: flex; gap: 8px; }
.typ input { flex: 1; min-width: 0; min-height: 50px; background: var(--inkt); border: 2px solid #2f7a58; border-radius: 25px; color: var(--papier); padding: 0 18px; font: inherit; font-size: 1rem; }
.typ input:focus { outline: none; border-color: var(--goud); }
.typ .stuur { flex: none; width: 50px; height: 50px; border: 0; border-radius: 50%; background: var(--goud); color: #1a1405; font-size: 1.25rem; cursor: pointer; }
.typ .stuur:active { background: var(--goud-d); }
.ideeen { display: flex; flex-direction: column; gap: 8px; }
.ideeen:empty { display: none; }
.chip { appearance: none; text-align: left; cursor: pointer; background: transparent; color: var(--papier); border: 1px solid #2f7a58; border-radius: 14px; padding: 12px 14px; font-size: .95rem; line-height: 1.3; }
.chip:active { background: #1f4d3b; }
.chip:focus-visible { outline: 2px solid var(--papier); outline-offset: 2px; }
.kaart h1.titel { font-size: 2.7rem; line-height: .98; }
.bel.typt { display: flex; gap: 4px; padding: 13px 14px; }
.bel.typt i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); animation: stip 1s infinite; }
.bel.typt i:nth-child(2) { animation-delay: .15s; } .bel.typt i:nth-child(3) { animation-delay: .3s; }
@keyframes bel-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes stip { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
@keyframes schud { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- gedeeld in de spellen ---------- */
.spel { display: flex; flex-direction: column; gap: 14px; flex: 1; position: relative; }
.status { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .9rem; color: var(--dim); }
.status b { color: var(--papier); font-weight: 600; }
.hartjes { display: flex; gap: 6px; }
.hartjes svg { width: 22px; height: 22px; fill: var(--rood); }
.hartjes svg.weg { fill: var(--staal2); }
.overlay { position: absolute; inset: 0; background: rgba(13, 19, 26, .94); display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px; z-index: 5; text-align: left; }
.overlay.goed h2 { color: var(--groen); }
.overlay.fout h2 { color: var(--rood); }
.overlay.daglicht { background: linear-gradient(#bfe3ff, #fff1c9); color: #1a2330; }
.overlay.daglicht h2 { color: #b8660a; font-size: 3rem; }

/* ---------- spel 1: muur openbreken ---------- */
.muur { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.paneel { height: 92px; background: repeating-linear-gradient(0deg, var(--staal2) 0 22px, #2c3d50 22px 24px); border: 2px solid var(--lijn); display: grid; place-items: center; position: relative; }
.paneel svg { width: 38px; height: 38px; fill: var(--dim); }
.paneel.nu { border-color: var(--goud); }
.paneel.nu svg { fill: var(--goud); }
.paneel.gebroken { background: repeating-linear-gradient(135deg, #1c2530 0 8px, #101820 8px 16px); border-color: var(--groen); }
.paneel.gebroken svg { fill: var(--groen); }
.balk { position: relative; height: 64px; background: var(--staal); border: 2px solid var(--lijn); overflow: hidden; margin-top: 8px; }
.zone { position: absolute; top: 0; bottom: 0; background: rgba(232, 184, 74, .35); border-left: 3px solid var(--goud); border-right: 3px solid var(--goud); }
.zone.goed { background: rgba(95, 191, 138, .45); border-color: var(--groen); }
.streep { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: var(--papier); box-shadow: 0 0 10px var(--papier); }
.balk.mis { border-color: var(--rood); animation: schud .3s; }

/* ronde 1, Siege: verdedig je kamer */
.siege .muur { grid-template-columns: repeat(4, 1fr); }
.siege .paneel { height: 56px; }
.siege .paneel svg { width: 28px; height: 28px; }
.siege .balk { height: 54px; margin-top: 0; }
.siege .knop.plaats { min-height: 60px; font-size: 1.5rem; }
.siege { gap: 10px; }
.balk .lag { display: none; position: absolute; right: 8px; top: 4px; font: 800 .8rem var(--tekst); color: var(--rood); }
.balk.laggy { border-color: var(--rood); }
.balk.laggy .lag { display: block; }
.balk.laggy .zone { opacity: .25; }
.deur-kop { display: flex; justify-content: space-between; align-items: center; font-weight: 500; font-size: .9rem; border-top: 1px solid var(--lijn); padding-top: 10px; }
.deur-hp { width: 52%; height: 10px; background: var(--staal2); border: 1px solid var(--lijn); }
.deur-hp i { display: block; height: 100%; width: 100%; background: var(--groen); transition: width .25s; }
.deur-hp i.laag { background: var(--rood); }
.papa-roep { min-height: 2.5em; margin: 0; padding: 8px 13px; background: var(--staal2); border-radius: 14px 14px 14px 4px; font-weight: 500; line-height: 1.3; font-size: .92rem; }
.papa-roep.luid { background: #5a2024; color: #fff; }
.siege canvas { display: block; margin: 0 auto; border: 2px solid var(--lijn); touch-action: none; }

/* ---------- spel 2: invasie ---------- */
.invasie canvas { display: block; margin: 0 auto; background: #0b1016; border: 2px solid var(--lijn); touch-action: none; }

/* ---------- spel 3: schip bouwen ---------- */
.romp { display: grid; gap: 3px; justify-content: center; }
.cel { padding: 0; border: 0; }
.cel.romp-cel { background: linear-gradient(#2c3d50, #1f2c3b); border: 1px solid var(--lijn); cursor: pointer; display: grid; place-items: center; }
.cel.leeg { visibility: hidden; }
.cel.romp-cel:active { border-color: var(--goud); }
.cel svg { width: 70%; height: 70%; }
.cel.slecht { background: rgba(217, 52, 59, .28); border-color: var(--rood); }
.cel.slecht svg { opacity: .55; }
.lade { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.lade button { background: var(--staal); border: 2px solid var(--lijn); min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; padding: 4px 0; }
.lade button.gekozen { border-color: var(--goud); background: var(--staal2); }
.lade svg { width: 24px; height: 24px; }
.lade small { font-size: .66rem; color: var(--papier); line-height: 1; }
.hint { min-height: 2.6em; font-size: .88rem; color: var(--dim); }
.stats { display: flex; flex-direction: column; gap: 6px; background: var(--staal); border: 1px solid var(--lijn); padding: 12px; }
.stat { display: grid; grid-template-columns: 92px 1fr 58px; gap: 10px; align-items: center; font-size: .85rem; }
.stat span { color: var(--dim); }
.stat b { text-align: right; font-variant-numeric: tabular-nums; }
.balkje { height: 8px; background: var(--staal2); }
.balkje i { display: block; height: 100%; background: var(--goud); }
.balkje i.slecht { background: var(--rood); }
.waarschuwing { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--rood); }
.waarschuwing li { border-left: 3px solid var(--rood); padding-left: 10px; }
.schip canvas { display: block; margin: 0 auto; background: #070b10; border: 2px solid var(--lijn); }
.duel { color: var(--papier); font-weight: 500; }

/* ---------- spel 4: de bunker (Doom) ---------- */
.doom canvas { display: block; margin: 0 auto; background: #0b1016; border: 2px solid var(--lijn); image-rendering: pixelated; touch-action: none; }
.scherm { position: relative; }
.toast { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0 auto; width: max-content; max-width: 92%; padding: 6px 12px; background: rgba(13, 19, 26, .88); border: 1px solid var(--lijn); font-size: .88rem; font-weight: 500; text-align: center; pointer-events: none; }
.toast:empty { display: none; }
.gezond { width: 90px; height: 10px; background: var(--staal2); border: 1px solid var(--lijn); }
.gezond i { display: block; height: 100%; background: var(--rood); }
.bediening { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 0; }
.stick { position: relative; width: 148px; height: 148px; border-radius: 50%; border: 2px solid var(--lijn); background: rgba(34, 48, 65, .6); touch-action: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: var(--goud); opacity: .9; pointer-events: none; }
.vuurknop { width: 120px; height: 120px; border-radius: 50%; border: 4px solid #8f1f25; background: var(--rood); color: #fff; font: 800 1.7rem/1 var(--kop); letter-spacing: .04em; cursor: pointer; touch-action: none; }
.vuurknop:active { background: #a82a30; transform: scale(.96); }

/* ---------- ronde 5: de stekker (wifi) ---------- */
.wifi { gap: 10px; }
.wifi canvas { display: block; margin: 0 auto; border: 2px solid var(--lijn); touch-action: none; }

/* ---------- eind ---------- */
.schip-kaart { display: flex; align-items: center; gap: 14px; }
.schip-kaart svg { width: 150px; height: auto; flex: none; }
.tijden { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tijden td { padding: 6px 0; border-bottom: 1px solid var(--lijn); }
.tijden td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--goud); }
.tijden tr.totaal td { border-bottom: 0; font-weight: 600; color: var(--papier); }

.noscript { padding: 24px; }

@media (max-width: 380px) { .merk { font-size: 1.05rem; } #balk { gap: 8px; padding: 10px 12px; } }
@media (max-width: 360px) { h1 { font-size: 2.8rem; } }
@media (prefers-reduced-motion: reduce) { .bel, .bel.typt i { animation: none; } .invoer input.fout, .balk.mis { animation: none; } }

