/* De schermen buiten het gevecht, als bladzijden uit dezelfde handleiding. */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 22px;
  border-bottom: 2px solid var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.topbar .hp, .topbar .gold { display: inline-flex; align-items: center; gap: 6px; }
.topbar .hp img, .topbar .gold img { width: 28px; height: 28px; }
.topbar .floor { color: var(--muted); font-weight: 400; }
/* Relics: alleen icoontjes, de hele strook is een knop naar het overzicht */
.topbar .relics {
  flex: 1; display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: none; border: none; box-shadow: none; padding: 0; min-height: 0; cursor: pointer; justify-content: flex-start;
}
.topbar .relics:disabled { cursor: default; }
@media (hover: hover) { .topbar .relics:hover:not(:disabled) .relic-icon { transform: translateY(-2px); } }
.relic-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--white);
  transition: transform 0.12s;
}
.relic-icon .art-img { width: 24px; height: 24px; }
.relics-label { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--muted); }

.relic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  padding: 1px 10px 1px 3px;
  background: var(--white);
  cursor: help;
}

.relic .art-img { width: 24px; height: 24px; }

button.small { padding: 6px 12px; font-size: 12px; }

.panel-area {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: auto;
}

/* margin: auto centreert, maar laat een te hoog paneel bovenaan beginnen (align-items: center snijdt de bovenkant af) */
.panel-area > * { margin: auto; }

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-size: clamp(16px, 1.1vw, 22px);
  max-width: max(760px, 50vw);
  padding: 24px;
  text-align: center;
}

.panel.wide { max-width: max(1000px, 70vw); }

.panel h2, .modal h2 {
  font-size: 1.6em;
  font-weight: 800;
  margin: 0;
}

.panel p { margin: 0; line-height: 1.4; }
.panel .story { max-width: 560px; }
.panel .outcome { max-width: 560px; font-style: italic; }
.loot { font-size: 1.3em; font-weight: 700; }
.relic-found { display: flex; align-items: center; gap: 10px; font-size: 1em; }

.art-img { display: block; object-fit: contain; pointer-events: none; }
.art-img.big { width: 3em; height: 3em; flex: none; }
.art-img.scene { width: 16em; height: auto; margin: 0 auto; }
.art-img.scene.small { width: 11em; }
.end-art { width: 140px; height: 140px; }

.choices { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.choices.column { flex-direction: column; align-items: stretch; min-width: 420px; }

.choices button, .shop-extras button, .chest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.choices button small, .shop-extras button small, .chest small {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.shop-extras { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.shop-extras button .art-img.big { margin: 0 auto 4px; }

.chest {
  padding: 16px 32px;
  animation: rattle 1.2s infinite;
}

.chest .art-img.scene { width: 110px; }

@keyframes rattle {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(-4deg); }
  80% { transform: rotate(4deg); }
  85% { transform: rotate(-3deg); }
  90% { transform: rotate(2deg); }
}

/* ---------------------------------------------------------------- map */

.map-board {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
}

.map-board svg { height: 100%; max-width: 100%; }
/* De liggende map is voor een telefoon in landscape; zie onderaan */
.map-board svg.horizontal { display: none; }

.map-board .edge {
  stroke: var(--rule);
  stroke-width: 2.5;
  stroke-dasharray: 6 6;
  stroke-linecap: round;
}

.map-board .edge.walked { stroke: var(--ink); stroke-dasharray: none; }
.map-board .edge.open { stroke: var(--ink); }

.map-board .node .disc { fill: var(--white); stroke: var(--ink); stroke-width: 2.5; }
.map-board .node .glyph { text-anchor: middle; fill: var(--ink); pointer-events: none; }
.map-board .node .node-art { pointer-events: none; }
.map-board .node.kind-boss .disc { stroke-width: 4; }
.map-board .node.visited { opacity: 0.35; }
.map-board .node.current { opacity: 1; }
.map-board .node.current .disc { fill: var(--shade); stroke-width: 4; }
.map-board .node.reachable { cursor: pointer; }
.map-board .node.reachable .disc { stroke-width: 3.5; }
@media (hover: hover) { .map-board .node.reachable:hover .disc { fill: var(--shade); } }

.map-board .node .pulse {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  animation: pulse 1.1s infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes pulse {
  0% { opacity: 0.9; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.25); }
}

.map-board .step circle { fill: var(--ink); }
.map-board .step text { fill: var(--white); font-weight: 700; font-size: 15px; text-anchor: middle; }

.legend {
  position: absolute;
  right: 22px;
  top: 22px;
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 6px;
  font-size: 15px;
}

.legend li { display: flex; align-items: center; gap: 8px; }
.legend .legend-art { width: 34px; height: 34px; }

/* ---------------------------------------------------------------- kaarten */

.card-row { display: flex; gap: clamp(16px, 1.6vw, 32px); flex-wrap: wrap; justify-content: center; }

/* Zelfde vorm als in de stage: wit kaartje, zwarte rand, binnenrand in de kleur van het type */
/* Alle maten in em: de tegel groeit mee met het scherm, van laptop tot beamer */
.card-tile {
  position: relative;
  font-size: clamp(13px, 1.05vw, 22px);
  width: 11.5em;
  height: 18em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45em;
  padding: 2.2em 0.75em 0.75em;
  background: var(--white);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 400;
}

.card-tile.kind-int { outline: 3px solid var(--int); outline-offset: -8px; }
.card-tile.kind-double { outline: 3px solid var(--double); outline-offset: -8px; }
.card-tile.kind-byte { outline: 3px solid var(--byte); outline-offset: -8px; }
.card-tile:hover:not(:disabled) { background: var(--white); }
@media (hover: hover) { .card-tile:hover:not(:disabled) { transform: translateY(-6px); } }
/* Zeldzaamheid als sterretjes in de hoek, zoals een moeilijkheidsgraad */
.card-tile.rarity-uncommon::after, .card-tile.rarity-rare::after {
  position: absolute;
  right: 0.8em;
  bottom: 0.5em;
  font-size: 0.9em;
}
.card-tile.rarity-uncommon::after { content: "★"; }
.card-tile.rarity-rare::after { content: "★★"; }
.card-tile:disabled { color: var(--ink); border-color: var(--ink); opacity: 0.45; box-shadow: none; }
.card-tile.preview:disabled { opacity: 1; box-shadow: 3px 3px 0 var(--ink); }
.card-tile.sold:disabled { opacity: 0.2; }

/* Kosten in een stapcirkel */
.card-tile .cost {
  position: absolute;
  left: -0.7em;
  top: -0.7em;
  width: 2em;
  height: 2em;
  line-height: 2em;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-size: 1.05em;
  font-weight: 700;
}

.card-tile .type-badge { position: absolute; right: 0.9em; top: 0.9em; font-size: 0.75em; }
.card-tile .name { font-size: 1.1em; font-weight: 700; line-height: 1.2; }
.card-tile .card-art { width: 6.5em; height: 6.5em; flex: none; }
.card-tile .cast { font-size: 1.2em; font-weight: 700; }
.card-tile .cast .type-badge { position: static; font-size: 0.65em; }
.card-tile .text { font-size: 1em; line-height: 1.25; }
.card-tile .footer { margin-top: auto; font-size: 1.15em; font-weight: 700; }

/* Zelfde kleur en vorm als in de stage: int hoekig, double rond, byte dubbele rand */
.type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  color: var(--white);
  background: var(--ink);
  border: 1.5px solid var(--ink);
}

.type-badge.int { background: var(--int); }
.type-badge.double { background: var(--double); border-radius: 9px; }
.type-badge.byte { background: var(--byte); outline: 1px solid var(--white); outline-offset: -4px; }

/* Beloningen draaien één voor één om */
.flip-in { animation: flip-in 420ms backwards; animation-delay: var(--delay, 0ms); }

@keyframes flip-in {
  from { transform: perspective(600px) rotateY(90deg) scale(0.8); opacity: 0; }
  to { transform: perspective(600px) rotateY(0) scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------- deck kiezen */

.modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 245, 238, 0.96);
}

/* Na "Spelen": de stage laadt nog. Pas na een tel zichtbaar, zodat een snelle start niet flitst */
.loading-cover {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 245, 238, 0.96);
  animation: loading-in 200ms ease-out 250ms both;
}
.loading-plate { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 240px; padding: 34px 28px 24px; }
.loading-plate p { margin: 0; font-weight: 800; font-size: 18px; }
.loading-count { font-size: 22px; font-weight: 800; }
@keyframes loading-in { from { opacity: 0; } to { opacity: 1; } }

.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 92vw;
  max-height: 92%;   /* van de modal, niet van vh: op een telefoon telt vh de browserbalken mee */
  overflow: auto;
  padding: 20px;
}

.modal .hint { margin: 0; color: var(--muted); }
.card-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; padding: 10px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pick .arrow { font-size: 22px; font-weight: 700; }

/* ---------------------------------------------------------------- meldingen */

.toasts {
  position: absolute;
  left: 50%;
  top: 70px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 6px 14px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 15px;
  font-weight: 700;
  animation: toast 2.6s forwards;
}

.toast.rejected { color: var(--muted); border-style: dashed; box-shadow: none; }

@keyframes toast {
  0% { opacity: 0; transform: translateY(-10px) scale(0.8); }
  8% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* ---------------------------------------------------------------- einde */

.end .stats { color: var(--muted); }
.end .score { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 8px 0; }
.end .score strong { font-size: 1.6rem; color: var(--zss); letter-spacing: .02em; }
.end .score small { color: var(--muted); }

/* Bijna gewonnen: hoeveel had de vijand nog? Gearceerd, zoals een maataanduiding */
.near-miss {
  width: 320px;
  height: 16px;
  background: var(--white);
  border: 2px solid var(--ink);
}

.near-miss div {
  height: 100%;
  background: repeating-linear-gradient(45deg, var(--ink) 0 2px, transparent 2px 7px);
}

/* Knoppen op een scherm groeien mee met de rest */
.panel > button, .choices button, .shop-extras button { font-size: 0.85em; }

/* Het echte verhaal achter een bug, als een notitiekader in de handleiding */
.codex {
  max-width: 34em;
  text-align: left;
  padding: 0.8em 1em;
  background: var(--white);
  border: 2px solid var(--ink);
  border-left-width: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}

.codex .codex-label {
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.codex p { font-size: 0.95em; }

/* ---------------------------------------------------------------- codex */

.codex-book { width: min(980px, 92vw); align-items: stretch; }
.codex-book h2, .codex-book > .hint { text-align: center; }
.codex-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.codex-page {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--ink);
}
.codex-page h3 { margin: 0; font-size: 1.15em; }
.codex-page p { margin: 0; line-height: 1.4; }
.codex-page button { align-self: flex-start; }
.codex-page .read { color: var(--ink); font-style: italic; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.codex-page.focus { box-shadow: 5px 5px 0 var(--ink); transform: translate(-2px, -2px); }

/* Een dichte pagina: een silhouet, zoals een leeg vak in een verzamelalbum */
.codex-page.locked {
  background: transparent;
  border-style: dashed;
  border-color: var(--muted);
  box-shadow: none;
  color: var(--muted);
  min-height: 90px;
  justify-content: center;
  align-items: center;
}

.codex-page .code {
  margin: 0;
  padding: 10px 12px;
  background: var(--ink);
  color: #f1eee4;
  border-radius: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.codex-new {
  border-style: dashed;
  font-size: 14px;
  padding: 6px 14px;
}

/* Tabbladen per hoofdstuk. Dichtgeniet: gestippeld, met een nietje, en een hoekje dat uitsteekt bij H5. */
.codex-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.codex-tab {
  position: relative;
  min-width: 46px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 6px 6px 0 0;
  box-shadow: none;
  background: var(--white);
}
.codex-tab.current { background: var(--ink); color: var(--white); }
.codex-tab.stapled {
  display: inline-flex;
  justify-content: center;
  color: var(--muted);
  border-color: var(--muted);
  border-style: dashed;
  background: transparent;
  cursor: default;
}
/* Het nietje */
.codex-tab.stapled::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 16px;
  height: 4px;
  margin-left: -8px;
  border: 2px solid var(--muted);
  border-bottom: none;
}
.codex-tab .corner {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--ink);
  border-top: none;
  padding: 1px 6px 3px;
  clip-path: polygon(0 0, 100% 0, 100% 60%, 70% 100%, 0 100%);
}
.codex-tab.leak { margin-bottom: 14px; }

/* Het boek dekt het titelscherm volledig af, anders schemert de titeltekening door */
.modal:has(.codex-book), .modal:has(.xregister), .modal:has(.picker), .modal:has(.deck-view), .modal:has(.relic-book) { background: var(--paper); }

/* ---- Codex: duidelijk dat er meer te lezen is ---- */

/* Randen van de bladen die nog onder deze pagina liggen, zoals een stapeltje papier */
.codex-page.sheets-3 { box-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--white), 7px 7px 0 var(--ink), 10px 10px 0 var(--white), 11px 11px 0 var(--ink); }
.codex-page.sheets-2 { box-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--white), 7px 7px 0 var(--ink); }
.codex-page.sheets-1 { box-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--white), 7px 7px 0 var(--ink); }

/* Ezelsoor: een omgevouwen hoek zolang je de pagina niet uitlas */
.codex-page .dog-ear {
  position: absolute;
  top: -2.5px;
  right: -2.5px;
  width: 22px;
  height: 22px;
  background: linear-gradient(225deg, var(--paper) 0 50%, var(--shade) 50% 100%);
  border-left: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
  border-bottom-left-radius: 4px;
}

.codex-page .page-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.codex-page .page-count { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.codex-page .read-on { font-size: 13px; padding: 6px 12px; background: var(--ink); color: var(--white); }
.codex-page .read-on:hover:not(:disabled) { background: #333; }

.codex-tab .unread-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--paper);
}

/* ---- Codex: mini-animatie van jouw moment ---- */

.replay { position: relative; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 8px 32px 8px 10px; background: var(--paper); border: 1.5px dashed var(--rule); border-radius: 4px; }
.replay-line { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 8px; font-weight: 800; }
.replay-again { position: absolute; right: 4px; top: 4px; padding: 0 6px; font-size: 13px; border-width: 1.5px; box-shadow: none; }
.tok { display: inline-block; animation: tok-in 220ms ease-out both; }
.tok.code { font-family: Consolas, "Courier New", monospace; font-size: 15px; }
.tok.num { font-size: 22px; }
.tok.muted { color: var(--muted); font-weight: 700; font-size: 14px; }
.tok.stamp { font-size: 22px; animation: tok-stamp 320ms cubic-bezier(.2, 1.6, .4, 1) both; }
.tok.freeze { animation: tok-freeze 400ms steps(2) both; }
.tok.wrap { font-size: 22px; animation: tok-wrap 500ms ease-in-out both; }
.tok.frac { animation: tok-in 200ms ease-out both, tok-fall 600ms ease-in 900ms forwards; }
.tok.scissors { font-size: 18px; animation: tok-snip 500ms ease-in both; }
.tok.glitch { color: var(--ink); font-family: Consolas, "Courier New", monospace; font-size: 15px; animation: tok-glitch 500ms steps(6) both; }

@keyframes tok-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes tok-stamp { from { opacity: 0; transform: scale(1.8); } }
@keyframes tok-freeze { 50% { opacity: 0.4; } }
@keyframes tok-wrap { from { transform: rotate(-270deg) scale(0.4); opacity: 0; } }
@keyframes tok-fall { to { transform: translate(10px, 40px) rotate(60deg); opacity: 0; } }
@keyframes tok-snip { from { transform: translateY(-20px) rotate(90deg); opacity: 0; } to { transform: rotate(90deg); } }
@keyframes tok-glitch { 0% { transform: translateX(-4px); opacity: 0; } 30% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .tok, .tok.stamp, .tok.freeze, .tok.wrap, .tok.scissors, .tok.glitch { animation: none; }
  .tok.frac { animation: none; opacity: 0.3; }
}

/* ---- ✗-register ---- */

.xregister { width: min(900px, 92vw); align-items: stretch; }
.xregister h2, .xregister > .hint { text-align: center; }
/* Een pagina per afdeling: haar naam als kop, met hoeveel je er al hebt */
.xregister-page { display: flex; flex-direction: column; gap: 10px; }
.xregister-page h3 { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 0; padding-bottom: 4px; font-size: 18px; font-weight: 900; border-bottom: 2px solid var(--ink); }
.xregister-page h3 small { font-size: 13px; font-weight: 700; color: var(--muted); }
.xpanels { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.xpanel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
  padding: 14px 14px 12px 52px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
}
.xpanel p { margin: 0; font-size: 13px; line-height: 1.35; }
/* Het kruis van een ✗-paneel uit een handleiding */
.xpanel .cross {
  position: absolute;
  left: 10px;
  top: 12px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  border: 2.5px solid currentColor;
  border-radius: 50%;
}
.xpanel.earned { box-shadow: 3px 3px 0 var(--ink); }
.xpanel.open { color: var(--muted); border-style: dashed; border-color: var(--muted); }
.xpanel.hidden { color: var(--muted); border-style: dashed; border-color: var(--rule); justify-content: center; }


/* ---- ✗-paneel verdiend: springt vanaf de onderkant op ---- */

.xpanel-popups {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.xpanel-popup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(460px, 90vw);
  padding: 14px 18px 14px 14px;
  text-align: left;
  font-weight: 400;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 6px 6px 0 var(--zss);
  pointer-events: auto;
  animation: popup-up 560ms cubic-bezier(.18, 1.6, .4, 1) both, popup-down 420ms ease-in 4.2s forwards;
}
.xpanel-popup:hover:not(:disabled) { background: var(--white); }
.xpanel-popup:active:not(:disabled) { transform: none; box-shadow: 6px 6px 0 var(--zss); }

/* Een oranje kenteken met het kruis, zoals op het ✗-paneel van een handleiding */
.xpanel-popup .badge {
  position: absolute;
  top: -16px;
  left: -16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  color: var(--white);
  background: var(--zss);
  border: 3px solid var(--ink);
  border-radius: 50%;
  animation: badge-pop 400ms cubic-bezier(.2, 1.8, .4, 1) 300ms both;
}

.xpanel-popup .popup-art {
  flex: none;
  width: 76px;
  height: 76px;
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
}

.xpanel-popup .words { display: flex; flex-direction: column; gap: 3px; }
.xpanel-popup .label { color: var(--zss); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.xpanel-popup strong { font-size: 19px; }
.xpanel-popup small { font-size: 13px; line-height: 1.35; color: var(--ink); }

@keyframes popup-up {
  from { transform: translateY(140%) scale(0.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes popup-down { to { transform: translateY(140%); opacity: 0; } }
@keyframes badge-pop { from { transform: scale(0) rotate(-90deg); } }

@media (prefers-reduced-motion: reduce) {
  .xpanel-popup { animation: popup-down 1ms linear 4.2s forwards; }
  .xpanel-popup .badge { animation: none; }
}

/* De tekening op een verdiend paneel in het register, en het oranje kruis */
.xpanel.earned .cross { color: var(--white); background: var(--zss); border-color: var(--ink); }
.xpanel.earned { box-shadow: 3px 3px 0 var(--zss); }
.xpanel .xpanel-art { width: 100%; height: 70px; object-fit: contain; margin-top: 4px; }

/* ---------------------------------------------------------------- titelscherm */

.title-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
}

/* De sfeerplaat vult de rechterkant en vloeit links weg in het papier */
.title-art-wide {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(78%, 1400px);
  background-size: cover;
  background-position: right center;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 28%);
  mask-image: linear-gradient(to right, transparent 0%, #000 28%);
}

.title-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  height: 100%;
  max-width: 460px;
  padding: 0 0 0 clamp(24px, 7vw, 110px);
}

.title-word {
  margin: 0;
  font-size: clamp(54px, 8.5vw, 120px);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: -0.04em;
}
.title-word span { color: var(--zss); }
/* Het spel is nog in ontwikkeling: een schuine sticker naast de titel */
.title-word .beta-badge {
  display: inline-block;
  margin-left: 0.25em;
  padding: 0.12em 0.45em;
  vertical-align: top;
  font-size: max(14px, 0.2em);
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--zss);
  transform: rotate(-8deg);
}

.tagline { margin: 0; font-size: 18px; color: var(--ink); max-width: 340px; }

.title-actions, .title-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.title-links { margin-top: 6px; }

/* De grote oranje knop: de enige plek waar het meteen duidelijk moet zijn wat je doet */
button.play-big {
  font-size: 22px;
  font-weight: 800;
  padding: 14px 40px;
  color: var(--white);
  background: var(--zss);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 5px 5px 0 var(--ink);
}
button.play-big:hover:not(:disabled) { background: #f08a1f; }
button.play-big:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }

button.title-button {
  font-size: 15px;
  padding: 10px 18px;
  background: var(--white);
  border: 2.5px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

@media (max-width: 760px) {
  .title-art-wide { width: 100%; opacity: 0.35; }
}

/* ---------------------------------------------------------------- intro en actkaart */

.story-card, .act-card {
  max-width: min(640px, 92vw);
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 6px 6px 0 var(--zss);
  padding: 26px 30px 28px;
  align-items: flex-start;
  text-align: left;
}
.story-card p, .act-card p { margin: 0; font-size: 17px; line-height: 1.5; }
.story-card button, .act-card button { align-self: flex-end; margin-top: 6px; }

.act-card { padding: 0 0 24px; overflow: hidden; gap: 10px; }
.act-card .act-art { display: block; width: 100%; height: auto; border-bottom: 3px solid var(--ink); }
.act-card .act-kicker, .act-card h2, .act-card p { padding: 0 28px; }
.act-card .act-kicker { color: var(--zss); font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; font-size: 13px; margin-top: 8px; }
.act-card h2 { margin: 0; font-size: 2em; }
.act-card button { margin-right: 28px; }

/* ---------------------------------------------------------------- banner boven de map */

.act-banner {
  position: relative;
  flex: none;
  height: 120px;
  margin: 0 0 8px;
  background-size: cover;
  background-position: center 62%;
  border-bottom: 2.5px solid var(--ink);
}
.act-banner span {
  position: absolute;
  left: 18px;
  bottom: 12px;
  padding: 4px 12px;
  font-weight: 800;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--zss);
}

.map-screen { display: flex; flex-direction: column; width: 100%; height: 100%; }
.map-screen .map-board { flex: 1; min-height: 0; height: auto; }

/* ---------------------------------------------------------------- teases voor de onthulling */

.map-screen { position: relative; }
.page-number { position: absolute; right: 18px; bottom: 12px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
/* Een gestippelde deur met een 5 erop, half weggedoken achter de map */
.dashed-door {
  position: absolute;
  right: 26px;
  bottom: 44px;
  width: 54px;
  height: 84px;
  border: 2.5px dashed var(--rule);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  opacity: 0.8;
}
.dashed-door span {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  border: 2px solid var(--rule);
  border-radius: 50%;
}
.tease { color: var(--muted); font-style: italic; }

/* Het vangnet: een barst in de muur van het titelscherm */
.wall-crack {
  position: absolute;
  right: 6%;
  bottom: 8%;
  padding: 10px 18px;
  font-size: 14px;
  background: var(--white);
  border: 2.5px dashed var(--ink);
  box-shadow: 3px 3px 0 var(--zss);
  animation: crack-wiggle 2.4s ease-in-out infinite;
}
@keyframes crack-wiggle { 0%, 90%, 100% { transform: none; } 93% { transform: rotate(-2deg); } 96% { transform: rotate(2deg); } }

/* ---------------------------------------------------------------- de plattegrond: één tekening van de fabrieksvloer
   (docs/wereld/README.md, Eén tekening). De vloer is 1100 bij 650 eenheden en schaalt mee; alles erop staat in
   procenten, en tekst in cqw, zodat de tekening op elk scherm dezelfde blijft. */

.world {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px 24px;
  padding: 16px clamp(16px, 3vw, 36px) 20px;
  background: var(--paper);
  overflow: auto;
}
.world-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 96px 12px 0;
  border-bottom: 3px solid var(--ink);
}
.world-head .hint { margin: 0; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 13px; }
.title-word.small { font-size: clamp(28px, 4vw, 44px); line-height: 1; }
.world-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }

/* De vloer, met een puntraster zoals het papier van een tekenaar */
.floor-plan-wrap { min-width: 0; min-height: 0; display: grid; justify-items: center; align-content: start; }
.floor-plan {
  position: relative;
  width: min(100%, calc((100dvh - 150px) * 1100 / 650));
  aspect-ratio: 1100 / 650;
  container-type: inline-size;
  background-image: radial-gradient(var(--rule) 1.2px, transparent 1.4px);
  background-size: 24px 24px;
}
.plan-heading { position: absolute; z-index: 1; left: 2%; top: 1%; pointer-events: none; }
.plan-heading h2 { margin: 0; font-size: clamp(26px, 5.4cqw, 64px); }
.plan-heading p { margin: 0.4em 0 0; font-size: clamp(12px, 1.4cqw, 17px); font-weight: 700; }

/* De band van het titelscherm: echte rollen waar de fabriek af is, een stippellijn waar nog niet */
.plan-belt { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plan-belt .belt-edge { fill: none; stroke: var(--ink); stroke-width: 22; stroke-linecap: round; }
.plan-belt .belt-face { fill: none; stroke: var(--white); stroke-width: 15; stroke-linecap: round; }
.plan-belt .belt-rollers { fill: none; stroke: var(--ink); stroke-width: 15; stroke-dasharray: 2 8; animation: plan-roll 0.8s linear infinite; }
.plan-belt .belt-ghost { fill: none; stroke: var(--muted); stroke-width: 3; stroke-dasharray: 10 9; stroke-linecap: round; }
.plan-belt .belt-card rect { fill: var(--white); stroke: var(--ink); stroke-width: 2; }
.plan-belt .belt-card path { fill: var(--zss); }
@keyframes plan-roll { to { stroke-dashoffset: -10; } }
/* Net uit de doos: de band wordt echt, van de vorige afdeling tot bij de nieuwe */
.plan-belt .belt-run.fresh .belt-edge, .plan-belt .belt-run.fresh .belt-face { stroke-dasharray: 100; animation: plan-draw 0.7s ease-out both; }
@keyframes plan-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

/* Een afdeling: haar tekening, haar stapnummer, haar naam. Gekozen staat ze op een oranje gestippelde ring */
button.dept-node {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  font-size: clamp(11px, 1.5cqw, 19px);
  font-weight: 400;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
@media (hover: hover) {
  button.dept-node:hover:not(:disabled) { background: transparent; }
  button.dept-node:hover .drawing { transform: translateY(-4px); }
}
button.dept-node:active:not(:disabled) { transform: none; box-shadow: none; }
.dept-node .drawing { position: relative; display: block; width: 100%; aspect-ratio: 1; container-type: inline-size; transition: transform 160ms; }
.dept-node.selected .drawing::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 6%;
  right: 6%;
  bottom: 0;
  height: 24%;
  border: 3px dashed var(--zss);
  border-radius: 50%;
}
/* Hoe meer onderdelen uitgepakt, hoe meer van de tekening ingekt; binnenkort is een vage schets */
.dept-node .dept-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(calc(1 - var(--inked, 0)));
  opacity: calc(0.35 + 0.65 * var(--inked, 0));
}
.dept-node .dept-art.sketch { filter: grayscale(1); opacity: 0.45; }
.dept-node .cardboard { display: block; width: 100%; height: 100%; }
.dept-node .step-badge { position: absolute; left: 0; top: 2%; font-size: 1em; box-shadow: 0 0 0 0.18em var(--paper); }
/* Het naambordje staat voor de band: papier met een dunne rand, op één regel */
.dept-node .name-plate { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0.15em 0.5em 0.2em; white-space: nowrap; background: var(--paper); border-radius: 6px; }
.dept-node .dept-name { font-size: 1.2em; font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; }
/* De ondertitel blijft binnen de breedte van de afdeling, anders schuift ze over de buren */
.dept-node small { max-width: 100%; font-size: 0.78em; font-weight: 700; color: var(--muted); white-space: normal; text-wrap: balance; }
/* Een afdeling met een sticker komt boven haar buren te liggen, zodat niets de sticker afdekt */
button.dept-node:has(.sticker) { z-index: 3; }
.dept-node.boxed .dept-name { color: var(--muted); }
.dept-node.soon small { color: var(--ink); text-transform: uppercase; letter-spacing: 0.06em; }
.dept-node .sticker {
  position: absolute;
  right: -4%;
  top: 10%;
  padding: 0.15em 0.5em;
  font-size: 0.7em;
  font-weight: 900;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--white);
  background: var(--zss);
  border: 2px solid var(--ink);
  transform: rotate(6deg);
}
.dept-node .sticker.key { background: var(--ink); }

/* Het figuurtje loopt naar de afdeling die je kiest */
.plan-you {
  position: absolute;
  z-index: 3;
  width: 5.5%;
  pointer-events: none;
  transition: left 600ms cubic-bezier(0.4, 0, 0.2, 1), top 600ms cubic-bezier(0.4, 0, 0.2, 1);
  animation: plan-bob 2.4s ease-in-out infinite;
}
@keyframes plan-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* De kartonnen doos (World/CardboardBox.razor) */
.cardboard polygon, .cardboard path { stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.cardboard .box-hole { fill: var(--ink); }
.cardboard .box-lid polygon { fill: var(--white); }
.cardboard .box-lid .tape { fill: var(--rule); stroke-width: 2; }
.cardboard .box-side.left { fill: var(--shade); }
.cardboard .box-side.right { fill: var(--paper); }
.cardboard .box-arrows { fill: none; stroke-width: 2.5; }
.cardboard .box-flap { fill: var(--white); transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }

/* ---------------------------------------------------------------- uit de doos (docs/wereld/README.md, Uit de doos)
   2,8 seconden, gelijk aan UnboxMs in WorldMap: de doos trilt, het deksel springt, de kamer stijgt op, de
   onderdelen hangen even in een explosietekening, de doos ligt plat en het stapnummer wordt zwart. */

.dept-node.unboxing .dept-art { animation: unbox-rise 2.8s ease-out both; }
.dept-node.unboxing .step-badge { animation: unbox-badge 2.8s ease-out both; }
.unbox { position: absolute; inset: 0; pointer-events: none; }
.unbox .cardboard { position: absolute; left: 12%; top: 16%; width: 76%; height: 76%; transform-origin: 50% 88%; animation: unbox-box 2.8s ease-out both; }
.unbox .box-lid { animation: unbox-lid 2.8s linear both; }
.unbox .box-flap { animation: unbox-flap 2.8s ease-out both; }
/* Lijnen die uit de doos schieten: spaken in een ring */
.unbox-rays { position: absolute; left: 50%; top: 42%; width: 0; height: 0; animation: unbox-rays 2.8s ease-out both; }
.unbox-rays::before {
  content: "";
  position: absolute;
  left: -46cqw;
  top: -46cqw;
  width: 92cqw;
  height: 92cqw;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--ink) 0 2.5deg, transparent 2.5deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 0 40%, #000 41% 70%, transparent 71%);
  mask: radial-gradient(circle, transparent 0 40%, #000 41% 70%, transparent 71%);
}
/* De onderdelen: kaarten, een bout, een schroef. Ze vliegen eruit en vallen dan op hun plaats */
.unbox-part { position: absolute; left: 46%; top: 40%; width: 7cqw; height: 9cqw; box-sizing: border-box; opacity: 0; background: var(--white); border: 2px solid var(--ink); border-radius: 2px; }
.unbox-part::after { content: ""; position: absolute; inset: 30%; background: var(--zss); transform: rotate(45deg); }
.unbox-part.p3 { width: 7cqw; height: 7cqw; border-radius: 50%; }
.unbox-part.p3::after { inset: 36%; background: var(--ink); border-radius: 50%; transform: none; }
.unbox-part.p4 { width: 3.5cqw; height: 11cqw; border-width: 2px 2px 2px 2px; border-top: 1.2cqw solid var(--ink); }
.unbox-part.p4::after { display: none; }
.unbox-part.p1 { animation: unbox-p1 2.8s ease-out both; }
.unbox-part.p2 { animation: unbox-p2 2.8s ease-out both; }
.unbox-part.p3 { animation: unbox-p3 2.8s ease-out both; }
.unbox-part.p4 { animation: unbox-p4 2.8s ease-out both; }
.unbox-part.p5 { animation: unbox-p5 2.8s ease-out both; }

@keyframes unbox-box {
  0% { transform: none; opacity: 1; }
  4% { transform: rotate(-2deg); }
  8% { transform: rotate(2deg); }
  12% { transform: rotate(-3deg); }
  16% { transform: rotate(3deg); }
  20% { transform: translateY(-3%) rotate(-4deg); }
  24% { transform: translateY(-5%) rotate(4deg); }
  28% { transform: none; }
  60% { transform: none; opacity: 1; }
  75%, 100% { transform: translateY(12%) scaleY(0.25); opacity: 0; }
}
@keyframes unbox-lid { 0%, 28% { opacity: 1; } 29%, 100% { opacity: 0; } }
@keyframes unbox-flap { 0%, 28% { transform: scaleY(0); } 32% { transform: scaleY(1.2); } 35%, 100% { transform: scaleY(1); } }
@keyframes unbox-rays { 0%, 28% { opacity: 0; transform: scale(0.3); } 33% { opacity: 1; transform: scale(1); } 46%, 100% { opacity: 0; transform: scale(1.4); } }
@keyframes unbox-rise { 0%, 38% { opacity: 0; transform: translateY(28%) scale(0.25); } 56% { opacity: 1; transform: translateY(-12%) scale(1.08); } 68%, 100% { opacity: 1; transform: none; } }
@keyframes unbox-badge { 0%, 74% { transform: scale(0); } 80% { transform: scale(1.35); } 86%, 100% { transform: scale(1); } }
@keyframes unbox-p1 { 0%, 40% { opacity: 0; transform: none; } 44% { opacity: 1; } 58%, 64% { opacity: 1; transform: translate(-48cqw, -40cqw) rotate(-40deg); } 74%, 100% { opacity: 0; transform: translate(0, -10cqw); } }
@keyframes unbox-p2 { 0%, 40% { opacity: 0; transform: none; } 44% { opacity: 1; } 58%, 64% { opacity: 1; transform: translate(46cqw, -44cqw) rotate(35deg); } 74%, 100% { opacity: 0; transform: translate(0, -10cqw); } }
@keyframes unbox-p3 { 0%, 40% { opacity: 0; transform: none; } 44% { opacity: 1; } 58%, 64% { opacity: 1; transform: translate(-56cqw, 6cqw) rotate(70deg); } 74%, 100% { opacity: 0; transform: translate(0, -10cqw); } }
@keyframes unbox-p4 { 0%, 40% { opacity: 0; transform: none; } 44% { opacity: 1; } 58%, 64% { opacity: 1; transform: translate(54cqw, 2cqw) rotate(-60deg); } 74%, 100% { opacity: 0; transform: translate(0, -10cqw); } }
@keyframes unbox-p5 { 0%, 40% { opacity: 0; transform: none; } 44% { opacity: 1; } 58%, 64% { opacity: 1; transform: translate(4cqw, -58cqw) rotate(20deg); } 74%, 100% { opacity: 0; transform: translate(0, -10cqw); } }

@media (prefers-reduced-motion: reduce) {
  .plan-belt .belt-rollers, .plan-you { animation: none; }
}

/* ---------------------------------------------------------------- het paneel: een blad uit de handleiding */

.dept-panel {
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 7px 7px 0 var(--zss);
}
.dept-panel .panel-head { display: flex; align-items: center; gap: 12px; }
.dept-panel .panel-head .step-badge { font-size: 22px; }
.dept-panel h2 { margin: 0; font-size: 28px; }
.dept-panel .panel-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.dept-panel .panel-art { display: block; width: 100%; height: 170px; object-fit: contain; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; }
.dept-panel .panel-art.sketch { filter: grayscale(1); opacity: 0.6; }
.dept-panel .panel-box { align-self: center; width: 140px; }
.dept-panel p { margin: 0; line-height: 1.45; }
.dept-panel h3 { margin: 4px 0 0; }
.dept-panel .parts-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dept-panel .parts-head h3 { margin: 0; }
.dept-panel .parts-head small { font-family: Consolas, "Courier New", monospace; font-size: 13px; font-weight: 700; }
/* De onderdelen als verzamelalbum: zwart is uitgepakt, gestippeld zit nog in de zak */
.dept-panel .parts-album { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.dept-panel .parts-album li { aspect-ratio: 1; box-sizing: border-box; border: 2px dashed var(--rule); border-radius: 4px; }
.dept-panel .parts-album li.unpacked { background: var(--ink); border: 2px solid var(--ink); }
.dept-panel .parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.dept-panel .parts li::before { content: "▢ "; color: var(--muted); }
.dept-panel .parts li.unpacked::before { content: "▣ "; color: var(--zss); }
.dept-panel .soon-note { padding: 8px 10px; border: 2px dashed var(--ink); font-weight: 700; }
.dept-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
a.play-big.as-link { display: inline-block; text-decoration: none; font-size: 18px; padding: 12px 22px; color: var(--white); background: var(--zss); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 5px 5px 0 var(--ink); font-weight: 800; }

@media (max-width: 860px) {
  .world { grid-template-columns: 1fr; }
  .world-head { padding-right: 0; }
  .world-tools { margin-left: 0; }
  .floor-plan { width: 100%; }
}

/* ---------------------------------------------------------------- je fabriek: account en klassen */

.account { gap: 12px; width: min(560px, 92vw); }
.account h2, .account h3 { margin: 0; }
.account h3 { margin-top: 8px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; }
.account p { font-size: 15px; }
.account .hint { color: var(--muted); font-size: 14px; }
.account-tabs, .account-footer, .account-release { display: flex; gap: 8px; flex-wrap: wrap; }
.account-footer { align-self: stretch; justify-content: flex-end; margin-top: 10px; border-top: 2px solid var(--rule); padding-top: 14px; }
.account-form { display: flex; flex-direction: column; gap: 10px; align-self: stretch; }
.account-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 13px; }
.account-form button { align-self: flex-end; }
.account input {
  font: inherit;
  font-size: 16px;
  padding: 8px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  background: var(--white);
  min-width: 0;
}
.account-inline { display: flex; gap: 8px; align-self: stretch; }
.account-inline input { flex: 1; }
.account-class { display: flex; flex-direction: column; gap: 6px; align-self: stretch; padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.account-error { color: #b3261e; font-weight: 700; }
.account button.danger { background: #b3261e; color: var(--white); }
.reveal-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; align-self: stretch; padding: 0 28px; }

/* ---------------------------------------------------------------- platen bij intro, onthulling, uitgang */

.story-card .story-art { width: 160px; height: auto; align-self: center; margin-bottom: 4px; }
.reveal-card .reveal-art { display: block; width: 100%; max-height: 300px; object-fit: contain; background: var(--paper); border-bottom: 3px solid var(--ink); padding: 14px 0; }
.end-scene { width: 200px; height: auto; }
.wall-crack { display: inline-flex; align-items: center; gap: 10px; }
.wall-crack .crack-art { width: 44px; height: 44px; }

/* Het zakje met onderdelen die nergens voor dienen */
.trinket-found { font-style: italic; color: var(--ink); max-width: 460px; }
.pouch { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pouch li { display: flex; align-items: baseline; gap: 10px; }
.pouch small { color: var(--muted); }
.pouch .tag-step { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; font-size: 12px; font-weight: 800; color: var(--white); background: var(--zss); border: 2px solid var(--ink); border-radius: 50%; }

/* ---------- Relic-overzicht ---------- */
.relic-book { max-width: 560px; }
.relic-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.relic-list li { display: flex; gap: 12px; align-items: center; border-bottom: 1px dashed var(--muted); padding-bottom: 8px; }
.relic-list .relic-art { width: 48px; height: 48px; flex: none; }
.relic-list p { margin: 2px 0 0; }

/* ---------- Deck bekijken: gelijke kaarten op een stapel ---------- */
.deck-view { max-width: 1000px; }
.deck-summary { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 0 0 8px; }
.deck-summary .type-badge.none { background: var(--white); color: var(--ink); border: 1.5px solid var(--ink); }
.card-grid.compact { gap: 22px 14px; max-height: 64vh; overflow-y: auto; padding-bottom: 22px; }
.card-grid.compact .card-tile { font-size: 12px; }
.stack { position: relative; }
.stack.many::before {
  content: ""; position: absolute; inset: 0; transform: translate(6px, 6px);
  border: 2px solid var(--ink); border-radius: 12px; background: var(--white); z-index: -1;
}
.stack { z-index: 0; }
.stack-count {
  position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); z-index: 2;
  background: var(--ink); color: var(--white); border-radius: 12px; padding: 1px 8px; font-weight: 700; font-size: 14px;
}

/* ---------- Kiezen uit je deck: lijst links, kaart rechts ---------- */
.picker { max-width: 860px; width: 92vw; }
.picker-layout { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: 18px; align-items: start; margin-bottom: 12px; }
.picker-list { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 56vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.picker-row {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 6px 10px; min-height: 0; font-size: 14px; font-weight: 400; box-shadow: 2px 2px 0 var(--ink);
  border-left-width: 6px;
}
.picker-row.kind-int { border-left-color: var(--int); }
.picker-row.kind-double { border-left-color: var(--double); }
.picker-row.kind-byte { border-left-color: var(--byte); }
.picker .picker-row.selected, .picker .picker-row.selected:hover:not(:disabled) { background: var(--ink); color: var(--white); }
.picker-row .row-cost {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid currentColor; font-weight: 700; font-size: 12px;
}
.picker-row .row-name { flex: 1; font-weight: 700; }
.picker-row .row-count { color: var(--muted); }
.picker-row.selected .row-count { color: var(--white); }
.picker-row .row-change { font-size: 12px; color: var(--zss); font-weight: 700; }
.picker-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview-cards { display: flex; align-items: center; gap: 12px; }
.preview-cards .arrow { font-size: 30px; font-weight: 700; }
.card-tile.upgraded { box-shadow: 0 0 0 3px var(--zss), 3px 3px 0 var(--ink); }
.change-line { margin: 0; text-align: center; max-width: 420px; }
.change-line .change-cost { display: inline-block; margin-right: 8px; font-weight: 700; color: var(--zss); }
.change-line mark { background: #ffe7b8; color: var(--ink); padding: 0 2px; border-radius: 3px; font-weight: 700; }

@media (max-width: 640px) {
  .picker-layout { grid-template-columns: 1fr; }
  .picker-list { max-height: 30vh; }
  .preview-cards { flex-direction: column; }
  .preview-cards .arrow { transform: rotate(90deg); }
}

/* ---------------------------------------------------------------- opties */

/* De optieknop: altijd linksboven, in elke afdeling. Op een scherm vooraan in de bovenbalk, in een gevecht in de lege hoek. */
button.options-button {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
.options-button.in-combat { position: absolute; left: 14px; top: 14px; z-index: 5; }
/* Het stapkader naast de optieknop: welke verdieping, en wat voor gevecht */
.step-plate {
  position: absolute;
  left: 66px;
  top: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 4px 4px;
  font-size: 15px;
  font-weight: 900;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  pointer-events: none;
}
.step-plate .step-no { display: grid; place-items: center; width: 30px; height: 30px; color: var(--white); background: var(--ink); border-radius: 50%; }

.options { min-width: min(380px, 88vw); align-items: stretch; }
.options h2 { text-align: center; }
.options p { margin: 0; text-align: center; }
.options .choices.column { min-width: 0; align-self: stretch; }
.options .choices.column button { align-self: stretch; margin: 0; }
.options-confirm button { margin: 0; }
.options > .play-big { align-self: center; }
.options-confirm { display: flex; gap: 12px; justify-content: center; }
.options button.danger { color: var(--white); background: #b3261e; }
@media (hover: hover) { .options button.danger:hover:not(:disabled) { background: #c8342b; } }

/* Verder spelen: de wachtende run staat in kleine letters onder de knop */
button.play-big.continue { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
button.play-big.continue small { font-size: 13px; font-weight: 700; opacity: 0.9; }

/* ---------------------------------------------------------------- telefoon */

/* Het spel is gemaakt voor een muis: een toestel zonder muis krijgt één keer die melding */
.mobile-notice { display: none; }
@media (hover: none) and (pointer: coarse) {
  .mobile-notice { display: flex; }
}

/* Rechtop op een telefoon: eerst draaien. Een tablet rechtop is breed genoeg en speelt gewoon. */
.rotate-hint { display: none; }

@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) {
  .rotate-hint {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    padding: 32px;
    text-align: center;
    background: var(--paper);
  }
  .rotate-hint p { margin: 0; max-width: 260px; font-size: 18px; font-weight: 700; line-height: 1.4; }
}

/* Een telefoon als lijntekening, die zich op zijn kant legt */
.rotate-phone {
  width: 54px;
  height: 92px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--zss);
  animation: rotate-phone 2.6s ease-in-out infinite;
}
@keyframes rotate-phone { 0%, 25% { transform: none; } 55%, 85% { transform: rotate(-90deg); } 100% { transform: none; } }

/* Een kort scherm: een telefoon liggend (een tablet of laptop is hoger dan 500px).
   Alles schuift dichter, de map ligt op haar kant, en wat niet past, scrolt. Het gevecht schaalt zelf mee. */
@media (max-height: 500px) {
  /* Bovenbalk: één smalle rij, die opzij schuift als hij niet past */
  .topbar {
    gap: 12px;
    padding: 4px 12px;
    font-size: 15px;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar .hp img, .topbar .gold img { width: 22px; height: 22px; }
  .topbar .relics { flex-wrap: nowrap; }
  .topbar button.small { flex: none; padding: 7px 10px; }
  .relic-icon { width: 26px; height: 26px; }
  .relic-icon .art-img { width: 20px; height: 20px; }
  .relics-label { display: none; }

  /* De map ligt: van links naar rechts, met de legenda als strookje eronder. De actnaam staat al in de bovenbalk. */
  .act-banner { display: none; }
  .map-board { flex-direction: column; align-items: center; }
  .map-board svg.vertical { display: none; }
  .map-board svg.horizontal { display: block; flex: 1 1 0; min-height: 0; width: 100%; height: auto; max-width: none; }
  .legend {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 14px;
    margin: 0 0 4px;
    padding: 3px 10px;
    font-size: 12px;
    border-width: 1.5px;
  }
  .legend li { gap: 4px; }
  .legend .legend-art { width: 20px; height: 20px; }
  .page-number { bottom: 6px; font-size: 11px; }
  .dashed-door { right: 14px; bottom: 30px; width: 30px; height: 46px; }
  .dashed-door span { top: 6px; width: 18px; height: 18px; font-size: 11px; }

  /* Schermen tussen de gevechten */
  .panel { gap: 6px; padding: 6px 16px 10px; font-size: 14px; max-width: 92vw; }
  .panel h2, .modal h2 { font-size: 1.35em; }
  .card-row { gap: 12px; }
  .card-tile { font-size: 10.5px; }
  .card-grid.compact .card-tile { font-size: 10px; }
  .choices { gap: 8px; }
  .choices.column { min-width: min(420px, 80vw); }
  .choices button, .shop-extras button { padding: 7px 14px; }
  .choices button small, .shop-extras button small, .chest small { font-size: 12px; }
  .codex { font-size: 13px; }
  .end-art { width: 70px; height: 70px; }
  .end-scene { width: 110px; }
  .near-miss { width: min(320px, 60vw); }

  /* Een plaat staat links naast de tekst in plaats van erboven, anders past een rustplaats of event niet */
  .panel:has(> .art-img.scene) {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 22px;
    row-gap: 8px;
    justify-items: center;
    align-items: center;
  }
  .panel > .art-img.scene { grid-column: 1; grid-row: 1 / span 5; width: 9em; }
  .panel:has(> .art-img.scene) > :not(.scene) { grid-column: 2; }
  .panel.wide > .art-img.scene { display: none; }
  .panel.wide:has(> .art-img.scene) { display: flex; }
  .chest .art-img.scene { width: 70px; }

  /* Modals: krapper, en platen niet hoger dan een derde van het scherm */
  .modal-body { padding: 12px; gap: 10px; }
  .story-card { padding: 16px 22px 18px; }
  .story-card p, .act-card p { font-size: 15px; line-height: 1.4; }
  .story-card .story-art { width: 80px; }
  .act-card { padding: 0 0 14px; gap: 6px; }
  .act-card .act-art { max-height: 36vh; object-fit: cover; }
  .act-card h2 { font-size: 1.5em; }
  .reveal-card .reveal-art { max-height: 34vh; padding: 6px 0; }
  .picker-list { max-height: 62vh; }

  /* Titelscherm */
  .title-panel { gap: 10px; }
  .title-word { font-size: clamp(40px, 17vh, 120px); }
  .tagline { font-size: 15px; }
  button.play-big { font-size: 19px; padding: 10px 30px; }
  button.title-button { font-size: 14px; padding: 8px 14px; }
  .wall-crack { padding: 6px 12px; font-size: 13px; }
  .wall-crack .crack-art { width: 30px; height: 30px; }

  /* Plattegrond: de vloer naast het paneel, want liggend is er breedte genoeg */
  .world { grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 8px 14px; padding: 8px 14px; }
  .world-head { padding-bottom: 6px; }
  .world-head .hint { display: none; }
  .floor-plan { width: min(100%, calc((100dvh - 70px) * 1100 / 650)); }
  .dept-panel { padding: 12px; gap: 8px; }
  .dept-panel h2 { font-size: 20px; }
  .dept-panel .panel-art { height: 90px; }

  button.options-button { width: 34px; height: 34px; font-size: 17px; }
  .options-button.in-combat { left: 8px; top: 8px; }
  .step-plate { left: 52px; top: 8px; padding: 2px 12px 2px 2px; font-size: 12px; }
  .step-plate .step-no { width: 24px; height: 24px; }

  /* Tijdens een gevecht: de knoppen onder elkaar in de hoek, naast de hand */
  .hud { right: 10px; bottom: 10px; flex-direction: column; align-items: flex-end; gap: 4px; }
  .hud .seed { font-size: 11px; }
  .hud button { padding: 7px 12px; font-size: 13px; }
  button.end-turn img { width: 22px; height: 22px; }

  /* Meldingen */
  .toasts { top: 44px; }
  .toast { font-size: 13px; }
  .xpanel-popups { bottom: 10px; }
  .xpanel-popup { gap: 10px; padding: 8px 12px 8px 10px; }
  .xpanel-popup .popup-art { width: 48px; height: 48px; }
  .xpanel-popup strong { font-size: 16px; }
  .xpanel-popup .badge { top: -12px; left: -12px; width: 28px; height: 28px; font-size: 16px; }
}

/* Taalknop: twee kleine knoppen tegen elkaar, de gekozen taal in inkt */
.lang-toggle { display: inline-flex; gap: 0; }
.lang-toggle button { padding: 4px 9px; font-size: 12px; box-shadow: 2px 2px 0 var(--ink); border-radius: 0; }
.lang-toggle button:first-child { border-radius: 5px 0 0 5px; }
.lang-toggle button:last-child { border-radius: 0 5px 5px 0; border-left-width: 0; }
.lang-toggle button.active { background: var(--ink); color: var(--paper); }
.lang-toggle.corner { position: absolute; right: 12px; top: 12px; z-index: 6; }
.options .lang-toggle { align-self: center; }
.lang-scope { display: contents; }

/* De verwijzing naar het handboek: een klein kaartje in de kleur van Zie Scherp Scherper */
.zss-link {
  display: inline-flex; flex-direction: column; align-self: flex-start; gap: 1px;
  padding: 6px 12px; border: 2px solid var(--zss); border-radius: 6px;
  color: var(--ink); background: var(--white); text-decoration: none; font-size: 13px;
  box-shadow: 2px 2px 0 var(--zss);
}
.zss-link .zss-ask { color: var(--muted); font-size: 12px; }
.zss-link strong { color: var(--zss); }
@media (hover: hover) { .zss-link:hover { background: var(--shade); } }
.world-tools .zss-link { align-self: center; }

/* Over dit spel: een bescheiden link onder de verwijzing naar het boek */
.about-link {
  align-self: flex-start; margin-top: 4px; padding: 2px 0; border: 0; background: none; box-shadow: none;
  color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer;
}
@media (hover: hover) { .about-link:hover { color: var(--ink); } }
.about-card { max-width: 560px; }
.about-card .about-games { font-weight: 700; }

/* Feedback voor de maker: klein en onderaan, nooit in de weg van de keuze die ertoe doet */
.feedback {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 10px;
  border-top: 1px dashed var(--muted); color: var(--muted); font-size: 13px;
}
.feedback button { padding: 4px 12px; font-size: 13px; }
.feedback .feedback-like { color: var(--zss); }
.feedback-comment { display: flex; flex-direction: column; gap: 4px; flex-basis: 100%; }
.feedback-comment textarea { font: inherit; font-size: 14px; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 4px; resize: vertical; background: #fff; color: var(--ink); }
.feedback-error { color: var(--zss); }

/* ---------------------------------------------------------------- de Prikklok */

/* Een prikkaart op een klembord: stempel en telwerk voor je score, het histogram in inkt en grijs, geen kleur */
.punch-clock { width: min(440px, 92vw); padding: 18px 0 12px; align-items: stretch; }
.punch-clock .sheet { display: flex; flex-direction: column; gap: 10px; }
.punch-clock h2 { margin: 0; font-size: 26px; }
.punch-clock h3 { margin: 6px 0 0; }
.punch-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 22px; }
.punch-card .rubber-stamp { font-size: 15px; }
.punch-card small { font-size: 12px; color: var(--muted); }
.punch-actions { display: flex; justify-content: center; }
.punch-bars { display: flex; align-items: flex-end; gap: 2px; height: 72px; padding-bottom: 2px; border-bottom: 2px solid var(--ink); }
.punch-bars .bar { flex: 1; display: flex; align-items: flex-end; height: 100%; min-width: 3px; max-width: 18px; }
.punch-bars .fill { width: 100%; background: var(--rule); border: 1px solid var(--muted); border-bottom: none; }
.punch-bars .bar.yours .fill { background: var(--ink); border-color: var(--ink); }
.punch-axis { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--muted); }
.punch-class { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.punch-class li span:first-child { display: inline-block; min-width: 150px; }
.punch-class li.you { font-weight: 900; }
.punch-clock .close { align-self: center; margin-top: 4px; }

/* Op het eindscherm van een dagelijkse run: telde ze? */
.end .punch-note { margin: 0 0 6px; font-weight: 700; }

/* ---------------------------------------------------------------- beheer: feedback en scores (D-013) */

.admin { width: min(820px, 94vw); }
.admin-scroll { align-self: stretch; max-height: 60vh; overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 4px 8px; border-bottom: 1px dashed var(--rule); }
.admin-table th { position: sticky; top: 0; background: var(--paper); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-comment { white-space: pre-wrap; overflow-wrap: anywhere; }
