@font-face { font-family: Fraunces; src: url(fonts/fraunces-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Atkinson; src: url(fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Atkinson; src: url(fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --rood: #7a1520; --diep: #3a0a0f; --goud: #d4a94c; --goud-licht: #f0d58c;
  --perkament: #f4e8cc; --perkament-donker: #e6d2a4; --inkt: #2e1d12; --groen: #2f6b3a;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  font-family: Atkinson, system-ui, sans-serif; color: var(--inkt); line-height: 1.5;
  background:
    radial-gradient(ellipse at top, #8d1d29 0%, transparent 60%),
    repeating-linear-gradient(45deg, rgba(212,169,76,.05) 0 2px, transparent 2px 22px),
    var(--diep);
  padding-bottom: 90px;
}
h1, h2, .merk { font-family: Fraunces, Georgia, serif; font-weight: 700; }

/* ---- balk bovenin ---- */
.balk { position: sticky; top: 0; z-index: 5; padding: 10px 16px 8px; padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(#2b070b, rgba(43,7,11,.92)); border-bottom: 1px solid rgba(212,169,76,.35); }
.balk-rij { display: flex; justify-content: space-between; align-items: center; max-width: 640px; margin: 0 auto; }
.merk { color: var(--goud-licht); font-size: 1.02rem; letter-spacing: .02em; }
.timer { font-variant-numeric: tabular-nums; color: var(--goud-licht); font-weight: 700;
  border: 1px solid rgba(212,169,76,.5); border-radius: 999px; padding: 2px 12px; font-size: .95rem; }
.voortgang { max-width: 640px; margin: 8px auto 4px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
#voortgang-vul { height: 100%; width: 0; background: linear-gradient(90deg, var(--goud), var(--goud-licht)); transition: width .8s ease; }
.kamers { max-width: 640px; margin: 0 auto; color: rgba(240,213,140,.75); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }

/* ---- perkament ---- */
main { max-width: 640px; margin: 18px auto; padding: 0 14px; position: relative; z-index: 1; }
.laden { color: var(--goud-licht); text-align: center; margin-top: 30vh; }
.perkament {
  position: relative; overflow: hidden; padding: 26px 22px 24px; border-radius: 6px;
  background: radial-gradient(ellipse at 30% 20%, #fbf3df 0%, var(--perkament) 45%, var(--perkament-donker) 100%);
  box-shadow: 0 0 0 1px rgba(122,21,32,.25), 0 0 0 6px var(--perkament-donker), 0 0 0 7px var(--goud), 0 18px 40px rgba(0,0,0,.45);
  animation: in .5s ease;
}
@keyframes in { from { opacity: 0; transform: translateY(12px); } }
.perkament h1 { color: var(--rood); font-size: 1.6rem; line-height: 1.15; margin: 0 0 4px; }
.perkament .sub { color: #8a6a3a; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 14px; }
.perkament p { margin: 0 0 12px; }
.intro { font-style: italic; }
.vers { font-family: Fraunces, Georgia, serif; font-size: 1.04rem; line-height: 1.6; margin: 14px 0 18px; padding-left: 12px; border-left: 3px solid var(--goud); }
.vers div { min-height: .8em; }

.brief { font-family: "Courier New", ui-monospace, monospace; font-size: 1.02rem; line-height: 1.7; letter-spacing: .04em; word-spacing: .15em;
  background: #fffaf0; border: 1px dashed #b08a4a; padding: 14px; border-radius: 4px; transform: rotate(-.6deg); margin: 14px 0 18px; }

.bord { background: #233025; color: #eef3e4; border: 8px solid #6b4a2b; border-radius: 6px; padding: 12px 14px; margin: 14px 0 18px;
  font-family: "Courier New", ui-monospace, monospace; }
.bord div { display: flex; gap: 12px; padding: 5px 0; border-bottom: 1px dashed rgba(255,255,255,.18); }
.bord div:last-child { border: 0; }
.bord b { font-size: 1.25rem; letter-spacing: .25em; min-width: 3.6em; color: #ffe9a8; }

/* ---- invoer ---- */
form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
label.vraag { display: block; font-weight: 700; margin: 6px 0 2px; width: 100%; }
input[type=text] { flex: 1 1 200px; font: inherit; font-size: 1.1rem; padding: 12px 14px; border: 2px solid #b08a4a; border-radius: 6px;
  background: #fffdf6; color: var(--inkt); text-transform: uppercase; letter-spacing: .08em; min-width: 0; }
input[type=text]:focus { outline: 3px solid var(--goud); outline-offset: 1px; }
button { font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 6px; padding: 12px 20px; color: #fff8e6;
  background: linear-gradient(#9a1e2b, var(--rood)); box-shadow: inset 0 0 0 1px var(--goud), 0 3px 0 #4a0d12; }
button:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px var(--goud), 0 1px 0 #4a0d12; }
button:disabled { opacity: .6; cursor: wait; }
.melding { min-height: 1.5em; margin: 10px 0 0; font-weight: 700; }
.melding.fout { color: #a3141f; }
.melding.goed { color: var(--groen); }
.schud { animation: schud .4s; }
@keyframes schud { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }

/* ---- hints ---- */
.hints { margin-top: 20px; border-top: 1px solid rgba(122,21,32,.2); padding-top: 12px; }
.hint { background: #fff6dd; border-left: 4px solid var(--rood); padding: 8px 12px; margin: 8px 0; border-radius: 0 4px 4px 0; animation: in .6s ease; }
.hint b { color: var(--rood); }
.hint-wacht { color: #8a6a3a; font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.zegel { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c23a45, #6e0f18); flex: none; }

/* ---- kluis ---- */
.kluisdeur { margin: 16px auto 10px; max-width: 360px; padding: 22px 14px; border-radius: 14px;
  background: radial-gradient(circle at 50% 40%, #5a5f66, #2c3036 70%); box-shadow: inset 0 0 0 4px #1d2024, inset 0 0 0 7px #7c838c, 0 10px 24px rgba(0,0,0,.4); }
.wielen { display: flex; justify-content: center; gap: 10px; }
.wiel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wiel button { padding: 4px 0; width: 56px; font-size: 1rem; background: linear-gradient(#e2c06c, #a77f2c); color: #3a2608; box-shadow: 0 2px 0 #5d4512; }
.cijfer { width: 56px; height: 70px; display: grid; place-items: center; font-family: Fraunces, Georgia, serif; font-size: 2.2rem; color: #2a1a05;
  border-radius: 8px; background: linear-gradient(#fff3c9, #e3c272 45%, #b8913b 55%, #f2dc98); box-shadow: inset 0 2px 6px rgba(0,0,0,.45); }
.cijfer.draai { animation: draai .18s; }
@keyframes draai { 50% { transform: scaleY(.7); filter: brightness(.8); } }
.kluis-open { display: block; width: 100%; margin-top: 16px; }

/* ---- finale ---- */
.scene { perspective: 900px; width: 220px; height: 220px; margin: 10px auto 18px; position: relative; }
.binnen { position: absolute; inset: 0; border-radius: 16px; background: radial-gradient(circle, #ffe9a8, #d4a94c 40%, #6b4a12);
  box-shadow: inset 0 0 30px rgba(0,0,0,.6); display: grid; place-items: center; font-size: 4rem; }
.deur { position: absolute; inset: 0; border-radius: 16px; transform-origin: left center; transition: transform 1.8s cubic-bezier(.5,0,.2,1);
  background: radial-gradient(circle at 50% 50%, #6b7179, #30343a 70%); box-shadow: inset 0 0 0 5px #1d2024, inset 0 0 0 9px #8a919a, 0 12px 26px rgba(0,0,0,.5); }
.deur::after { content: ""; position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; margin: -45px; border-radius: 50%;
  background: repeating-conic-gradient(#c9a24a 0 8deg, #8a6a24 8deg 16deg); box-shadow: 0 0 0 6px #2a2d31, 0 0 0 9px #c9a24a; transition: transform 1.2s; }
.scene.open .deur { transform: rotateY(-115deg); }
.scene.draait .deur::after { transform: rotate(540deg); }

.bon { margin-top: 18px; background: #fffdf6; border: 2px solid var(--goud); border-radius: 10px; padding: 18px; text-align: center; position: relative; }
.bon::before { content: ""; position: absolute; inset: 5px; border: 1px dashed #b08a4a; border-radius: 6px; pointer-events: none; }
.bon .winkel { font-family: Fraunces, Georgia, serif; font-size: 1.3rem; color: var(--rood); margin: 0; }
.bon .bedrag { overflow-wrap: anywhere; font-family: Fraunces, Georgia, serif; font-size: 2.4rem; margin: 2px 0 8px; color: var(--inkt); }
.bon .code { font-family: "Courier New", ui-monospace, monospace; font-size: 1.25rem; font-weight: 700; letter-spacing: .12em;
  background: #f4e8cc; padding: 8px 10px; border-radius: 6px; display: inline-block; word-break: break-all; user-select: all; }
.bon .qr { margin: 14px auto 6px; width: 170px; }
.bon .qr img, .bon .qr svg { width: 100%; height: auto; display: block; }
.bon small { display: block; color: #6b5636; margin-top: 8px; }
.knoppen { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }

/* ---- stoomboot ---- */
.boot { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; max-width: 520px; margin: 0 auto; height: 70px; z-index: 0; fill: rgba(212,169,76,.22); pointer-events: none; }
.boot .golf { fill: none; stroke: rgba(212,169,76,.3); stroke-width: 2; }

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

@media print {
  body { background: #fff; padding: 0; }
  .balk, .boot, #confetti, .knoppen, .scene, .perkament > :not(.bon) { display: none !important; }
  .perkament { box-shadow: none; background: #fff; padding: 0; }
  main { margin: 0 auto; }
}
