/* Bijdehante Stad — avondsfeer in de huisstijlkleuren van de Bijdehante Boekhouder.
   Groot en goed leesbaar: basis 18px, knoppen minstens 48px hoog. */

:root {
  --navy: #061b3a;
  --navy-2: #0c2547;
  --navy-3: #13325c;
  --teal: #0f9ca3;
  --teal-licht: #5fd0d5;
  --oranje: #f26a21;
  --oranje-licht: #ff9a5c;
  --ivoor: #f9f7f1;
  --tekst: #eef1f6;
  --zacht: #a9b6c9;
  --goud: #ffcf7a;
  --rood: #ff8a7a;
  --groen: #7fd6a0;
  --rand: rgba(255, 255, 255, 0.12);
  --kaart: rgba(255, 255, 255, 0.05);
  --schaduw: 0 10px 30px rgba(0, 0, 0, 0.35);
  --serif: Georgia, Cambria, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(ellipse at top, #0f2a52 0%, var(--navy) 55%, #030d1f 100%) fixed;
  color: var(--tekst);
  font: 18px/1.5 var(--sans);
  min-height: 100vh;
  overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; color: var(--goud); }
p { margin: 0 0 .8em; }
a { color: var(--teal-licht); }
.zacht { color: var(--zacht); font-size: .92rem; }
.nadruk { color: var(--goud); font-weight: 600; }
.negatief { color: var(--rood) !important; }
.verborgen { display: none; }
.laden { padding: 2rem; text-align: center; color: var(--zacht); }

button {
  font: inherit; color: inherit; cursor: pointer;
  min-height: 48px; padding: .55em 1em; border-radius: 12px;
  background: var(--navy-3); border: 1px solid var(--rand);
  transition: transform .08s, background .2s;
}
button:hover:not(:disabled) { background: #1a4275; }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--goud); outline-offset: 2px; }
button.primair { background: var(--oranje); border-color: var(--oranje); color: #fff; font-weight: 700; }
button.primair:hover:not(:disabled) { background: #ff7d36; }
button.gevaar { background: transparent; border-color: var(--rood); color: var(--rood); }
button.groot { width: 100%; font-size: 1.15rem; margin-top: 1rem; min-height: 56px; }
button.aan { background: var(--teal); border-color: var(--teal); color: #fff; }
select, input[type=text] {
  font: inherit; color: var(--tekst); background: var(--navy-2); border: 1px solid var(--rand);
  border-radius: 10px; min-height: 48px; padding: .4em .6em; width: 100%;
}

/* ---------- start ---------- */
.start { min-height: 100vh; }
.startscene { max-height: 52vh; overflow: hidden; }
.start-inhoud { max-width: 720px; margin: 0 auto; padding: 1.2rem 16px 3rem; }
.start-inhoud h1 { color: var(--ivoor); margin-top: -.3em; }
.start-ondertitel { color: var(--zacht); font-size: 1.05rem; }

/* ---------- spelscherm ---------- */
.spel { max-width: 900px; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.balk {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: rgba(6, 27, 58, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--rand);
}
.balk > div { display: flex; flex-direction: column; line-height: 1.2; }
.balk span { font-size: .78rem; color: var(--zacht); }
.balk-geld, .balk-rep { text-align: right; }
.balk-geld strong { color: var(--goud); }
.stadvak { height: 30vh; min-height: 190px; max-height: 340px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; -webkit-overflow-scrolling: touch; border-bottom: 1px solid var(--rand); }
.stadvak svg { height: 100%; width: auto; display: block; }
.stad .gebouw { cursor: pointer; }
.stad .gebouw:focus { outline: none; }
.stad .gebouw:focus-visible > g { filter: drop-shadow(0 0 6px #ffcf7a); }
.stad .bouwplaats { animation: knipper 2.4s ease-in-out infinite; }
@keyframes knipper { 50% { opacity: .55; } }

.paneel { padding: 16px; }
.paneel-kop { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.dagdelen { display: flex; gap: 6px; font-size: 1.4rem; }
.dagdelen .vrij { color: var(--goud); }
.dagdelen .op { color: var(--zacht); }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center;
  background: rgba(3, 13, 31, .96); border-top: 1px solid var(--rand); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { flex: 1; max-width: 180px; border: 0; border-radius: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .78rem; padding: 8px 4px; min-height: 64px; color: var(--zacht); }
.tabs button.aan { color: var(--goud); background: rgba(255, 207, 122, .08); }
.tab-icoon { font-size: 1.35rem; line-height: 1; }

.kaarten { display: grid; gap: 10px; }
.opdracht {
  display: grid; grid-template-columns: 44px 1fr 24px; gap: 12px; align-items: center; text-align: left;
  background: var(--kaart); padding: 12px; border-radius: 16px; width: 100%;
}
.opdracht .icoon { font-size: 1.8rem; text-align: center; }
.opdracht-tekst { display: flex; flex-direction: column; gap: 2px; }
.opdracht .meta, .meta { font-size: .82rem; color: var(--teal-licht); }
.opdracht .status { font-size: 1.4rem; color: var(--zacht); }
.opdracht.af { opacity: .5; }
.opdracht.af .status { color: var(--groen); }
.opdracht.sprookjes { border-color: rgba(95, 208, 213, .45); background: linear-gradient(135deg, rgba(15, 156, 163, .14), rgba(255, 255, 255, .03)); }
.opdracht.bijzonder { border-color: var(--goud); background: linear-gradient(135deg, rgba(255, 207, 122, .16), rgba(255, 255, 255, .03)); }

.hoofdstuk-kop { margin-top: 1.4rem; }
.gebouwkaart { display: flex; flex-direction: column; gap: 10px; background: var(--kaart); border: 1px solid var(--rand); border-radius: 16px; padding: 14px; }
.gebouwkaart.dicht { opacity: .55; }
.gebouwkaart p { margin: .2em 0; }
.label { display: inline-block; padding: .25em .7em; border-radius: 999px; font-size: .85rem; font-weight: 600; align-self: flex-start; }
.label.klaar { background: rgba(127, 214, 160, .18); color: var(--groen); }
.label.bouw { background: rgba(242, 106, 33, .18); color: var(--oranje-licht); }
.label.dicht { background: rgba(255, 255, 255, .08); color: var(--zacht); }

.blok { background: var(--kaart); border: 1px solid var(--rand); border-radius: 16px; padding: 14px; margin: 12px 0; }
table.cijfers { width: 100%; border-collapse: collapse; margin: .3em 0 .8em; font-variant-numeric: tabular-nums; }
table.cijfers th, table.cijfers td { padding: .35em .2em; border-bottom: 1px solid var(--rand); text-align: left; font-weight: 400; }
table.cijfers td { text-align: right; white-space: nowrap; padding-left: .8em; }
table.cijfers tr.nadruk th, table.cijfers tr.nadruk td { font-weight: 700; color: var(--goud); }
table.cijfers.breed th, table.cijfers.breed td { text-align: right; }
table.cijfers.breed th:first-child, table.cijfers.breed td:first-child { text-align: left; }
.knoppenrij, .keuzerij { display: flex; flex-wrap: wrap; gap: 8px; }
.stapper { display: grid; grid-template-columns: 1fr 48px auto 48px; gap: 8px; align-items: center; margin-bottom: .6em; }
.stapper output { min-width: 4.5em; text-align: center; font-weight: 700; color: var(--goud); }
.stapper p { grid-column: 1 / -1; margin: 0; }
.aangifte { border: 1px solid var(--oranje); border-radius: 12px; padding: 10px; margin: 8px 0; background: rgba(242, 106, 33, .08); }
.aangifte.te-laat { border-color: var(--rood); background: rgba(255, 138, 122, .1); }
.doelen { list-style: none; padding: 0; margin: 0; }
.doelen li { padding: .35em 0; border-bottom: 1px solid var(--rand); }
.doelen li.gehaald { color: var(--groen); }
.sprookjesblok { background: linear-gradient(160deg, rgba(15, 156, 163, .12), rgba(255, 255, 255, .03)); }
.herkomst { font-style: italic; color: var(--zacht); font-size: .9rem; }
.les { font-family: var(--serif); font-style: italic; color: var(--goud); }
.krant { list-style: none; padding: 0; margin: 0; font-size: .95rem; }
.krant li { padding: .35em 0; border-bottom: 1px dashed var(--rand); }
.padkaart { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border-radius: 16px; background: var(--kaart); width: 100%; }
.padkaart strong { font-family: var(--serif); font-size: 1.15rem; }
.padkaart.dicht { opacity: .55; }
.padkaart.gekozen { border-color: var(--goud); }

.ekster { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; background: rgba(255, 255, 255, .06); border-radius: 16px; padding: 10px 12px; margin: 1rem 0; }
.ekster img { border-radius: 50%; background: #fff; }
.ekster p { margin: 0; font-size: .98rem; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(92vw, 520px); z-index: 50; background: var(--ivoor); color: var(--navy); padding: .8em 1.1em; border-radius: 14px; box-shadow: var(--schaduw); font-weight: 600; transition: opacity .5s; }
.toast.weg { opacity: 0; }

/* ---------- vensters ---------- */
dialog { border: 0; padding: 0; color: var(--tekst); background: transparent; }
dialog::backdrop { background: rgba(2, 8, 20, .75); backdrop-filter: blur(3px); }
.venster { width: min(94vw, 560px); max-height: 88vh; }
.venster.breed { width: min(96vw, 720px); }
.venster-binnen { background: linear-gradient(180deg, var(--navy-2), var(--navy)); border: 1px solid var(--rand); border-radius: 20px; padding: 20px 18px; max-height: 88vh; overflow-y: auto; box-shadow: var(--schaduw); }
.venster-knoppen { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 1rem; }
.venster.verhaal .venster-binnen { background: linear-gradient(180deg, #102d52, #071a35); }
.groot-getal { font-size: 2rem; font-family: var(--serif); color: var(--goud); margin: 0; }
.meldingen { padding-left: 1.2em; }
.kwartaalblok { border-top: 1px solid var(--rand); margin-top: .8rem; padding-top: .8rem; }

/* ---------- puzzel ---------- */
dialog.puzzel { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; background: var(--navy); }
dialog.puzzel[open] { display: flex; flex-direction: column; overflow: hidden; }
.puzzel-kop { flex: none; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: rgba(6, 27, 58, .97); border-bottom: 1px solid var(--rand); }
.puzzel-kop h2 { font-size: 1.05rem; margin: 0; }
.puzzel-info { margin: 0; font-size: .82rem; color: var(--zacht); }
.puzzel-knoppen { display: flex; gap: 6px; flex-shrink: 0; }
.puzzel-knoppen button { padding: .4em .7em; }
.puzzel-paneel { flex: 1; min-height: 0; width: 100%; padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); overflow-y: auto; outline: none; }
.puzzel-paneel > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.uitleg { color: var(--zacht); font-size: .95rem; }
.opdrachttekst { font-style: italic; }
.wacht { text-align: center; color: var(--zacht); padding: 2rem; }
.sprookje { background: rgba(15, 156, 163, .1); border: 1px solid rgba(95, 208, 213, .3); border-radius: 14px; padding: 8px 12px; margin-bottom: 12px; }
.sprookje summary { cursor: pointer; font-family: var(--serif); color: var(--teal-licht); min-height: 40px; display: flex; align-items: center; }
.gelukt { background: linear-gradient(135deg, rgba(127, 214, 160, .2), rgba(255, 207, 122, .15)); border: 1px solid var(--groen); border-radius: 16px; padding: 14px; margin-bottom: 12px; animation: binnen .4s ease-out; }
.gelukt-kop { font-family: var(--serif); font-size: 1.6rem; color: var(--groen); margin: 0; }
.mislukt { text-align: center; padding: 2rem 0; display: flex; flex-direction: column; gap: 10px; align-items: center; }
@keyframes binnen { from { transform: translateY(-8px); opacity: 0; } }
.melding { min-height: 1.5em; color: var(--oranje-licht); font-weight: 600; }
.teller { color: var(--zacht); font-size: .9rem; margin: 0 0 .5em; }

/* sudoku */
.sudoku { display: grid; gap: 0; width: min(100%, 520px); margin: 0 auto; aspect-ratio: 1; border: 3px solid var(--goud); border-radius: 8px; overflow: hidden; }
.sudoku.n9 { grid-template-columns: repeat(9, 1fr); }
.sudoku.n6 { grid-template-columns: repeat(6, 1fr); }
.sudoku .cel { min-height: 0; padding: 0; border-radius: 0; border: 1px solid rgba(255, 255, 255, .14); background: #0b2244; font-size: clamp(1rem, 5vw, 1.6rem); color: var(--teal-licht); font-weight: 600; }
.sudoku .cel.vast { color: var(--ivoor); background: #102b52; }
.sudoku .cel.hint { color: var(--goud); }
.sudoku .cel.rand-r { border-right: 3px solid var(--goud); }
.sudoku .cel.rand-o { border-bottom: 3px solid var(--goud); }
.sudoku .cel.lijn { background: #15345f; }
.sudoku .cel.zelfde { background: #1d4a6e; }
.sudoku .cel.gekozen { background: var(--oranje); color: #fff; }
.cijfers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(100%, 520px); margin: 12px auto 0; }
.cijfer { font-size: 1.3rem; font-weight: 700; }
.cijfer.wis { font-size: 1rem; }

/* kleurpuzzel */
.modi { display: flex; gap: 8px; margin-bottom: 10px; }
.kleur-schuif { overflow-x: auto; padding-bottom: 6px; }
.kleur {
  --cel: min(calc((100vw - 40px - var(--maxrij) * 15px) / (var(--kol) - 1)), 34px);
  display: grid; grid-template-columns: calc(var(--maxrij) * 15px + 6px) repeat(calc(var(--kol) - 1), var(--cel));
  grid-auto-rows: var(--cel); grid-template-rows: calc(var(--maxkol) * 15px + 6px); width: max-content; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none;
}
.kleur .hoek { }
.kop-kol { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; font-size: 12px; line-height: 15px; color: var(--teal-licht); padding-bottom: 3px; }
.kop-rij { display: flex; justify-content: flex-end; align-items: center; gap: 5px; font-size: 12px; color: var(--teal-licht); padding-right: 5px; }
.kop-kol.af, .kop-rij.af { color: var(--groen); font-weight: 700; }
.kop-rij.af::after { content: '✓'; margin-left: 2px; }
.kop-kol.af::after { content: '✓'; }
.vak { border: 1px solid rgba(255, 255, 255, .14); background: #0b2244; }
.vak.rand-r { border-right: 2px solid var(--goud); }
.vak.rand-o { border-bottom: 2px solid var(--goud); }
.vak.aan { background: var(--goud); }
.vak { display: flex; align-items: center; justify-content: center; font-size: calc(var(--cel) * .62); line-height: 1; font-weight: 700; color: var(--oranje-licht); }
.vak.kruis { background: #0b2244; }
.vak.vast.aan { background: #e6b65c; }
.vak.hint { box-shadow: inset 0 0 0 2px var(--teal-licht); }
.kleur.opgelost .vak { border-color: transparent; }
.kleur.opgelost .vak.kruis { color: transparent; }

/* woordzoeker */
.woordrooster { display: grid; grid-template-columns: repeat(var(--maat), 1fr); width: min(100%, 560px); margin: 0 auto; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; background: #0b2244; border-radius: 10px; padding: 4px; }
.letter { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: clamp(.8rem, 4.4vw, 1.3rem); border-radius: 6px; cursor: pointer; }
.letter.selectie { background: var(--oranje); color: #fff; }
.letter.gevonden { color: var(--navy); }
.letter.k0 { background: #ffcf7a; } .letter.k1 { background: #5fd0d5; } .letter.k2 { background: #ff9a5c; } .letter.k3 { background: #7fd6a0; }
.letter.k4 { background: #c9a7ff; } .letter.k5 { background: #ff8a9a; } .letter.k6 { background: #a6d96a; } .letter.k7 { background: #f4ecd2; }
.letter.rest { background: transparent; color: var(--goud); text-decoration: underline; text-decoration-thickness: 3px; }
.letter.hintletter { box-shadow: 0 0 0 3px var(--goud); }
.woordlijst { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0; font-weight: 600; letter-spacing: .03em; }
.woordlijst li.af { text-decoration: line-through; color: var(--zacht); }
.oplossingszin { font-family: var(--serif); font-size: 1.2rem; color: var(--goud); }

/* doolhof */
.doolhof { width: 100%; max-width: 560px; max-height: 62vh; display: block; margin: 0 auto; touch-action: manipulation; }
.doolhof-grond { fill: #0d2a1f; }
.doolhof .muur { stroke: #c8e6c9; stroke-width: 3; stroke-linecap: round; fill: none; }
.doolhof .spoor { stroke: var(--oranje); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.doolhof .hintspoor { stroke: var(--goud); stroke-width: 6; stroke-dasharray: 4 8; stroke-linecap: round; }
.doolhof text.weg { display: none; }
.pijlen { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(2, 56px); gap: 6px; justify-content: center; margin-top: 10px; }
.pijl { font-size: 1.5rem; padding: 0; }
.pijl.r1 { grid-column: 2; grid-row: 1; } .pijl.r8 { grid-column: 1; grid-row: 2; } .pijl.r4 { grid-column: 2; grid-row: 2; } .pijl.r2 { grid-column: 3; grid-row: 2; }

/* logica */
.aanwijzingen { padding-left: 1.4em; }
.aanwijzingen li { padding: .3em 0; cursor: pointer; }
.aanwijzingen li.doorgestreept { text-decoration: line-through; color: var(--zacht); }
table.logica { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.logica-schuif { overflow-x: auto; }
table.logica select { font-size: .9rem; padding: .3em .2em; min-height: 44px; }
table.logica th.staldeur { text-align: center; background: linear-gradient(180deg, #2f6a4a, #1f4a33); border-radius: 10px 10px 0 0; padding: .4em .2em; color: var(--ivoor); font-size: .9rem; }
table.logica tbody th { font-size: .9rem; width: 4.5em; }
table.logica th { color: var(--goud); font-weight: 600; text-align: left; }

/* memory */
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 560px) { .memory { grid-template-columns: repeat(5, 1fr); } .memory.paren6, .memory.paren8 { grid-template-columns: repeat(4, 1fr); } }
.memkaart { aspect-ratio: 3 / 4; min-height: 0; padding: 4px; background: linear-gradient(145deg, var(--teal), #0a5d66); border: 2px solid rgba(255, 255, 255, .2); font-size: .82rem; line-height: 1.2; display: flex; align-items: center; justify-content: center; text-align: center; hyphens: auto; overflow-wrap: anywhere; }
.memkaart.symbool { font-size: 2rem; }
.memkaart.open { background: var(--ivoor); color: var(--navy); }
.memkaart.kop.open { font-weight: 700; }
.memkaart.paar { background: rgba(127, 214, 160, .9); color: var(--navy); }

/* schuifpuzzel */
.schuif { display: grid; grid-template-columns: repeat(var(--maat), 1fr); gap: 6px; width: min(100%, 420px); margin: 0 auto; aspect-ratio: 1; }
.tegel { min-height: 0; padding: 0; font-size: 1.5rem; font-weight: 700; background: linear-gradient(145deg, #6b4a32, #3a281e); border: 2px solid #8a6a4a; color: var(--ivoor); }
.tegel.goed { border-color: var(--groen); }
.tegel.gat { background: transparent; border: 2px dashed var(--rand); border-radius: 12px; }
.schuif.toon-doel .tegel:not(.gat) { outline: 3px solid var(--goud); }

/* bonnetjes, wisselgeld, kasboek, quiz */
.bon { background: var(--ivoor); color: #222; font-family: 'Courier New', monospace; padding: 14px 16px; border-radius: 4px; max-width: 360px; margin: 0 auto 12px; box-shadow: var(--schaduw); }
.bon p { margin: .2em 0; }
.bon-kop { text-align: center; letter-spacing: .2em; font-weight: 700; border-bottom: 1px dashed #999; padding-bottom: .3em; }
.bon-wat { font-size: 1.1rem; margin-top: .6em !important; }
.bon-bedrag { font-size: 1.4rem; font-weight: 700; text-align: right; }
.bon-regel { display: flex; justify-content: space-between; gap: 12px; }
.bon-regel.totaal { font-weight: 700; border-top: 1px dashed #999; padding-top: .2em; }
.bon-regel.klein { font-size: .8rem; color: #666; }
.bonknoppen, .antwoorden { display: grid; gap: 8px; margin: 10px 0; }
.bonknop.juist, .antwoord.juist { background: rgba(127, 214, 160, .3); border-color: var(--groen); opacity: 1; }
.bonknop.onjuist, .antwoord.onjuist { background: rgba(255, 138, 122, .25); border-color: var(--rood); opacity: 1; }
.weggestreept { text-decoration: line-through; }
.bon-uitleg.goed { color: var(--groen); }
.bon-uitleg.fout { color: var(--oranje-licht); }
.vraag { font-size: 1.15rem; font-family: var(--serif); }
.antwoord { text-align: left; }
.lade { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.munt { border-radius: 999px; background: linear-gradient(145deg, #d9b25a, #8f6a2a); color: #1a1205; font-weight: 700; font-size: .9rem; padding: .3em; }
.munt.biljet { border-radius: 6px; background: linear-gradient(145deg, #7fb3d9, #3e6f99); color: #fff; }
.teruggeven { font-weight: 700; margin: 10px 0 4px; }
.terugbak { display: flex; flex-wrap: wrap; gap: 6px; min-height: 52px; padding: 6px; border: 1px dashed var(--rand); border-radius: 12px; margin-bottom: 10px; }
.invoer { display: flex; gap: 8px; align-items: center; }
.invoer input { flex: 1; font-size: 1.2rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 700px) {
  .kaarten { grid-template-columns: 1fr 1fr; }
  .stadvak { height: 40vh; }
}

/* muziekknop */
.muziekknop { min-width: 48px; padding: .3em .5em; font-size: 1.3rem; background: transparent; }
.start-kop { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* ---------- de plattegrond ---------- */
.kaartvak { height: 46vh; min-height: 260px; max-height: 560px; overflow: auto; border-bottom: 1px solid var(--rand); background: #6f8f3a; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.kaart { position: relative; width: 160%; aspect-ratio: 1672 / 941; container-type: inline-size; user-select: none; -webkit-user-select: none; }
.kaart > * { position: absolute; }
.kaart-grond { inset: 0; width: 100%; height: 100%; }
.kaart .gebouw { pointer-events: none; }
.kaart .gebouw.schim { opacity: .45; filter: grayscale(.6) brightness(1.1); }
.steiger { font-size: 3.2cqw; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); animation: wiebel 2.4s ease-in-out infinite; }
@keyframes wiebel { 50% { transform: rotate(-6deg); } }
.bord {
  transform: translate(-50%, -50%); width: 11cqw; min-height: 0; padding: .35cqw .5cqw; border-radius: .5cqw;
  display: flex; flex-direction: column; align-items: center; gap: .1cqw;
  background: linear-gradient(180deg, #f4e3bf, #e3c995); color: #3a2614; border: .18cqw solid #7a5530;
  box-shadow: 0 .3cqw .5cqw rgba(0,0,0,.35); font-family: var(--serif); line-height: 1.1;
}
.bord:hover:not(:disabled) { background: linear-gradient(180deg, #fff1cf, #ecd4a2); }
.bord-1 { font-weight: 700; font-size: 1.2cqw; }
.bord-2 { font-size: 1cqw; font-family: var(--sans); color: #5a3a1c; }
.bord.vrij { border-style: dashed; }
.bord.vrij .bord-2 { color: #a0420f; font-weight: 700; }
.bord.dicht { opacity: .8; }
.bord.kan .bord-2 { color: #a0420f; font-weight: 700; }
.bord.bouw { background: linear-gradient(180deg, #ffd9a8, #f2b56b); }
.bord .bord-2 { letter-spacing: .05em; }

/* licht en seizoen over de getekende kaart */
.kaart-tint { inset: 0; pointer-events: none; }
.kaart.licht-schemer .kaart-tint { background: linear-gradient(180deg, rgba(255,140,60,.28), rgba(60,40,110,.32)); mix-blend-mode: multiply; }
.kaart.licht-nacht .kaart-tint { background: rgba(12,22,70,.62); mix-blend-mode: multiply; }
.kaart.licht-nacht .kaart-grond, .kaart.licht-nacht .gebouw { filter: saturate(.7); }
.kaart.seizoen-herfst .gebouw { filter: sepia(.22) saturate(1.1) hue-rotate(-12deg); }
.kaart.seizoen-winter .gebouw { filter: saturate(.45) brightness(1.08) contrast(.95); }
.kaart.seizoen-lente .gebouw { filter: saturate(1.12) brightness(1.03); }
.lampgloed { width: 7cqw; height: 7cqw; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255,210,120,.75), rgba(255,190,90,0) 65%); mix-blend-mode: screen; }

/* gebouwvenster */
.gebouwvenster .niveau { font-size: 1.1rem; }
.sterren { color: var(--goud); letter-spacing: .1em; }
.niveaus { padding-left: 1.1em; }
.niveaus li { margin: .35em 0; color: var(--zacht); }
.niveaus li.bereikt { color: var(--groen); }
.niveaus li.volgend { color: var(--tekst); }
.venster-actie { margin-top: .8rem; }
.venster-actie button { width: 100%; }
.startscene .kaart { width: 100%; }

.kaartkader { position: relative; }
.zoomknoppen { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.zoomknoppen button { width: 48px; height: 48px; padding: 0; font-size: 1.5rem; font-weight: 700; background: rgba(6,27,58,.85); border-color: rgba(255,255,255,.3); }
.kaartvak { touch-action: none; cursor: grab; overflow: hidden; }
.kaartvak:active { cursor: grabbing; }
/* bordjes blijven op het scherm ongeveer even groot, hoe ver je ook in- of uitzoomt */
.kaart .bord { width: calc(11cqw * 1.6 / var(--z, 1.6)); padding: calc(.35cqw * 1.6 / var(--z, 1.6)) calc(.5cqw * 1.6 / var(--z, 1.6)); border-width: calc(.18cqw * 1.6 / var(--z, 1.6)); }
.kaart .bord-1 { font-size: calc(1.2cqw * 1.6 / var(--z, 1.6)); }
.kaart .bord-2 { font-size: calc(1cqw * 1.6 / var(--z, 1.6)); }
.kaart .bord.teaser-bord { width: auto; }
.kaart .steiger { font-size: calc(3.2cqw * 1.6 / var(--z, 1.6)); }
/* helemaal uitgezoomd: alleen de namen, kleiner */
.kaartvak.uitgezoomd .bord { width: auto; padding: .3cqw .8cqw; }
.kaartvak.uitgezoomd .bord-1 { font-size: 1.6cqw; white-space: nowrap; }
.kaartvak.uitgezoomd .bord-2 { display: none; }
.kaart img.gebouw { height: auto; }

/* begrijpend lezen en speurwerk */
.leestekst { background: var(--ivoor); color: #2a2118; border-radius: 6px; padding: 16px 18px; margin: 0 auto 14px; box-shadow: var(--schaduw); font-family: var(--serif); font-size: 1.08rem; line-height: 1.6; }
.leestekst h3 { color: #6b3a14; font-size: 1.2rem; }
.leestekst.brief { font-family: 'Courier New', monospace; font-size: 1rem; }
.leestekst.contract p { margin-bottom: .6em; }
.leestekst.verborgen { display: none; }
.dossier-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dossier-tabs button { flex: 1 1 auto; font-size: .95rem; }
.dossier-blad { background: var(--ivoor); color: #2a2118; border-radius: 6px; padding: 10px; overflow-x: auto; margin-bottom: 12px; }
table.dossier { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.dossier th { text-align: left; color: #6b3a14; border-bottom: 2px solid #c9b48a; padding: .3em .4em; }
table.dossier td { border-bottom: 1px solid #e2d5b8; padding: .35em .4em; }
.notities { margin: 0; padding-left: 1.2em; font-family: var(--serif); }
.notities li { margin: .4em 0; }

/* verhaal, personages, hoefijzers, dagboek */
.personage { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px 12px; margin: 10px 0; }
.personage img { border-radius: 50%; background: #fff; }
.personage-icoon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.9rem; background: linear-gradient(145deg, #f4e3bf, #d9b97e); }
.personage p { margin: .15em 0 0; font-style: italic; }
.opdracht .wie { font-size: .85rem; color: var(--goud); }
.opdracht img.rond { border-radius: 50%; background: #fff; }
.opdracht.hoefijzer { border-color: var(--goud); box-shadow: 0 0 0 2px rgba(255,207,122,.35), 0 0 22px rgba(255,207,122,.25); }
.hoefijzers { display: flex; gap: 6px; font-size: 1.5rem; }
.hoefijzers .nog { color: var(--zacht); opacity: .6; }
.hoefijzers .gevonden { filter: drop-shadow(0 0 6px rgba(255,207,122,.8)); }
.groot-hoefijzer { font-size: 4rem; text-align: center; margin: 0; filter: drop-shadow(0 0 14px rgba(255,207,122,.9)); }
.brief { background: var(--ivoor); color: #3a2614; font-family: 'Snell Roundhand', 'Segoe Script', var(--serif); font-style: italic; font-size: 1.15rem; padding: 14px 16px; border-radius: 6px; box-shadow: var(--schaduw); margin: 10px 0; }
.brief p { margin: .4em 0; }
.hoefijzer-aanloop { font-style: normal; background: rgba(255,207,122,.08); border-left: 3px solid var(--goud); padding: 8px 12px; border-radius: 6px; }
.dagboek ul { list-style: none; padding: 0; margin: 0; }
.dagboek li { display: grid; grid-template-columns: 1.6em 1fr auto; gap: 8px; align-items: center; padding: .4em 0; border-bottom: 1px solid var(--rand); }
.dagboek li .zacht { display: block; font-size: .82rem; }
button.klein { min-height: 40px; padding: .3em .7em; font-size: .9rem; }
.fout-info { color: var(--oranje-licht); }

/* denkspellen */
.breinbreker { background: var(--ivoor); color: #2a2118; border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--schaduw); font-family: var(--serif); font-size: 1.08rem; }
.breinbreker h3 { color: #6b3a14; }
.breinbreker .vraag { font-weight: 700; color: #2a2118; }
.bb-uitleg { background: rgba(127,214,160,.15); border-left: 3px solid var(--groen); padding: 8px 12px; border-radius: 6px; color: inherit; font-family: var(--sans); font-size: 1rem; }
.hintlijst { padding-left: 1.3em; color: var(--goud); }
.hintlijst li { margin: .4em 0; }
.oversteek { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin: 12px 0; align-items: stretch; }
.oever { background: #2c4a2e; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 180px; }
.oever.boer-hier { box-shadow: inset 0 0 0 2px var(--goud); }
.oever-naam { margin: 0; font-size: .85rem; color: var(--zacht); }
.oever .boer { font-size: 1.8rem; }
.ding.in-boot { background: var(--teal); }
.sloot { background: linear-gradient(180deg, #2a6f9a, #1b4a6b); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; justify-content: center; gap: 6px; text-align: center; max-width: 9.5em; }
.sloot p { margin: 0; font-size: .85rem; }
.filippine { display: grid; gap: 3px; margin: 0 auto 12px; width: 100%; max-width: calc(var(--breedte) * 38px + 2em); }
.fil-rij { display: grid; grid-template-columns: 1.6em repeat(var(--breedte), minmax(0, 1fr)); gap: 2px; align-items: center; }
.fil-nr { text-align: right; padding-right: 6px; color: var(--zacht); font-size: .9rem; }
.fil-vak { width: 100%; aspect-ratio: 1; min-height: 0; min-width: 0; padding: 0; text-align: center; font-size: clamp(.8rem, 4vw, 1.1rem); font-weight: 700; text-transform: uppercase; border-radius: 4px; border: 1px solid #b9a77f; background: var(--ivoor); color: #2a2118; }
.fil-vak.fil-kolom { background: #ffd98a; border-color: var(--oranje); }
.fil-vak.gegeven { color: #8a6a3a; }
.fil-vak.goed { border-color: var(--groen); box-shadow: inset 0 0 0 1px var(--groen); }
.fil-omschrijvingen li { margin: .3em 0; }
.coord { display: grid; grid-template-columns: 1.8em repeat(var(--b), minmax(22px, 30px)); gap: 2px; width: max-content; margin: 0 auto; }
.coord-kop { display: flex; align-items: center; justify-content: center; font-size: .8rem; color: var(--teal-licht); }
.coord-vak { min-height: 0; padding: 0; aspect-ratio: 1; border-radius: 2px; background: #0b2244; border: 1px solid rgba(255,255,255,.15); }
.coord-vak.aan { background: var(--goud); }
.coord-vak.hint { box-shadow: inset 0 0 0 2px var(--teal-licht); }
.coord.opgelost .coord-vak { border-color: transparent; }
.coord-lijst { display: flex; flex-wrap: wrap; gap: 4px 10px; background: var(--ivoor); color: #2a2118; padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; font-family: 'Courier New', monospace; font-weight: 700; }
.coord-lijst.per-rij { flex-direction: column; }
.situatie { background: var(--ivoor); color: #2a2118; padding: 12px 14px; border-radius: 6px; font-family: var(--serif); font-size: 1.05rem; }
.bon-regel.uit span:last-child { color: #a3311a; }
.bon-regel.in span:last-child { color: #2f6a3a; }

/* de lucht boven de plattegrond: gloed bij schemer, sterren en maan 's nachts */
.kaart-lucht { left: 0; top: 0; width: 100%; pointer-events: none; -webkit-mask-image: url(../img/kaart/lucht-masker.webp); mask-image: url(../img/kaart/lucht-masker.webp); -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.kaart-lucht svg { width: 100%; height: 100%; display: block; }
.kaart-lucht.schemer { background: linear-gradient(180deg, #3b2a6b 0%, #b04f78 10%, #f2875a 22%, #ffc37a 30%); }
.kaart-lucht.nacht { background: linear-gradient(180deg, #030817 0%, #0b1838 20%, #1a2a52 30%); }
.kaart-lucht .ster { fill: #fff; animation: twinkel 3.5s ease-in-out infinite; animation-delay: var(--vertraging, 0s); }
.kaart-lucht.schemer .ster { opacity: .5; }
@keyframes twinkel { 50% { opacity: .25; } }
.kaart-lucht .maan { fill: #f6efd4; }
.kaart-lucht .maan-donker { fill: #1a2442; }

/* ---------- verhaalscènes ---------- */
dialog.scene { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; background: transparent; }
dialog.scene::backdrop { background: linear-gradient(180deg, rgba(2,8,20,.35), rgba(2,8,20,.82)); backdrop-filter: blur(2px); }
dialog.scene[open] { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); }
.scene-titel { max-width: calc(100% - 170px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 16px; margin: 0; font-family: var(--serif); color: var(--goud); font-size: 1.1rem; text-shadow: 0 2px 6px #000; }
.scene-overslaan { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 12px; background: rgba(6,27,58,.8); font-size: .9rem; }
.scene-vak { position: relative; width: min(100%, 760px); min-height: 170px; display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: end; cursor: pointer;
  background: linear-gradient(180deg, #f6ead0, #ead7b0); color: #2a2118; border: 3px solid #7a5530; border-radius: 16px; padding: 14px 18px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.scene-vak:focus-visible { outline: 3px solid var(--goud); outline-offset: 3px; }
.scene-portret { align-self: end; margin: -70px 0 -16px -6px; height: 190px; display: flex; align-items: flex-end; justify-content: center; }
.scene-portret img { max-height: 190px; max-width: 150px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.scene-portret.leeg { display: none; }
.scene-vak.verteller, .scene-vak.brief { grid-template-columns: 1fr; }
.scene-icoon { width: 96px; height: 96px; margin-bottom: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3rem; background: linear-gradient(145deg, #fff3dc, #d9b97e); border: 3px solid #7a5530; }
.scene-woorden { text-align: left; align-self: center; }
.scene-naam { margin: 0 0 .25em; font-family: var(--serif); font-weight: 700; color: #7a3a10; font-size: 1.05rem; min-height: 1.2em; }
.scene-tekst { margin: 0; font-size: 1.2rem; line-height: 1.5; min-height: 3em; font-family: var(--serif); }
.scene-vak.verteller .scene-tekst { font-style: italic; color: #4a3a28; }
.scene-vak.verteld .scene-tekst { font-style: italic; }
.scene-vak.brief { background: #fbf6ea; border-style: double; border-width: 5px; }
.scene-vak.brief .scene-tekst { font-family: 'Snell Roundhand', 'Segoe Script', var(--serif); font-size: 1.35rem; color: #3a2614; }
.scene-verder { position: absolute; right: 16px; bottom: 8px; color: #7a5530; opacity: 0; }
.scene-verder.zichtbaar { opacity: 1; animation: wip 1s ease-in-out infinite; }
@keyframes wip { 50% { transform: translateY(4px); } }
.scene-vak.wacht { cursor: default; }
.scene-keuzes { width: min(100%, 760px); display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.scene-vraag { margin: 0; font-family: var(--serif); color: var(--goud); font-size: 1.15rem; text-shadow: 0 2px 6px #000; }
.scene-optie { display: flex; flex-direction: column; }
.scene-keuze { text-align: left; background: rgba(6,27,58,.92); border: 2px solid var(--goud); font-size: 1.05rem; }
.scene-keuze:hover:not(:disabled) { background: #163a66; }
.scene-reden { font-size: .85rem; color: var(--oranje-licht); padding-left: 6px; }
.verborgen-voor-oog { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 520px) {
  .scene-vak { grid-template-columns: 92px 1fr; padding: 12px 14px 14px; }
  .scene-portret { height: 140px; margin-top: -60px; }
  .scene-portret img { max-height: 140px; max-width: 110px; }
  .scene-icoon { width: 72px; height: 72px; font-size: 2.2rem; }
  .scene-tekst { font-size: 1.08rem; }
}

/* teaser: een stukje van iets dat je nog niet kent, half achter de bomen */
.kaart img.teaser { pointer-events: none; -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 42%); mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 42%); opacity: .95; animation: draai-langzaam 14s ease-in-out infinite; transform-origin: 50% 40%; }
@keyframes draai-langzaam { 50% { transform: rotate(4deg); } }
.bord.teaser-bord { width: auto; min-width: 3cqw; padding: .3cqw .9cqw; border-style: dashed; animation: wiebel 2.4s ease-in-out infinite; }
.bord.teaser-bord .bord-1 { font-size: 1.6cqw; }
.personeel table.cijfers td { white-space: normal; }
