/* ===== Kleuren in de stijl van de digibordtools van Meester Dennis ===== */
:root {
  --teal: #5ac0c8;
  --panel: #ffffff;
  --text: #1d1d1d;
  --grey-1: #f7f7f7;
  --grey-2: #e3e3e3;
  --grey-border: #bdbdbd;
  --green-1: #55d255;
  --green-2: #3cb43c;
  --green-border: #2f962f;
  --slate: #747d8f;
  --slate-dark: #535a68;
  --badge: #31363f;
  --red: #e25555;
  --accent: #8bc34a;
  --cell: 40px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--teal);
  color: var(--text);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

.hidden { display: none !important; }

/* ===== Achtergrond-scene ===== */
.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.scene .ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 130px;
}
.scene .deco {
  position: absolute;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .15));
  user-select: none;
}
/* ===== Opbouw ===== */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 14px;
}

.topbar {
  text-align: center;
  padding: 10px 0 8px;
  color: #fff;
}
.topbar h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: .5px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
}
.topbar .subtitle {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: bold;
  opacity: .95;
}

.panel {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--panel);
  border-radius: 8px;
  padding: 18px 26px;
  overflow: auto;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .08);
}

.watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.watermark span {
  position: absolute;
  opacity: .08;
  line-height: 1;
}
.panel > *:not(.watermark) { position: relative; z-index: 1; }

h2 {
  font-size: 21px;
  font-weight: normal;
  margin: 14px 0 10px;
  text-align: center;
}

/* ===== Instellingen ===== */
.step-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e3e3e3;
}
.step-dot {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  font: inherit;
  color: #777;
  cursor: default;
  text-align: left;
}
.step-dot .num {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--grey-border);
  background: radial-gradient(circle at 78% 18%, var(--grey-1) 58%, var(--grey-2) 59%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #444;
}
.step-dot .txt { display: flex; flex-direction: column; line-height: 1.15; }
.step-dot b { font-size: 14px; }
.step-dot small { font-size: 11px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-dot.done { color: var(--text); }
.step-dot.done .num {
  background: radial-gradient(circle at 78% 18%, var(--green-1) 58%, var(--green-2) 59%);
  border-color: var(--green-border);
}
.step-dot.current { color: var(--text); background: #eef8ee; }
.step-dot.current .num {
  background: var(--green-2);
  border-color: var(--green-border);
  color: #fff;
}
.step h2 { font-size: 26px; margin: 22px 0 18px; }

.round-group.big { gap: 18px 28px; }
.round-group.big .round { width: 120px; }
.round-group.big .round .disc { width: 100px; height: 100px; font-size: 26px; }
.round-group.big .round .label { font-size: 15px; }
.round-group.big .round svg { width: 54px; height: 54px; }
.round-group.big .round .disc .emoji { font-size: 44px; }

.round-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 16px;
}

/* Ronde keuzeknop zoals bij Meester Dennis: grijs met lichte boog, groen als gekozen */
.round {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  width: 84px;
}
.round .disc {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--grey-border);
  background: radial-gradient(circle at 78% 18%, var(--grey-1) 58%, var(--grey-2) 59%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: transform .1s;
}
.round .disc .emoji { font-size: 34px; line-height: 1; }
.round .label {
  font-size: 13px;
  text-align: center;
  line-height: 1.15;
}
.round .label .sub {
  display: block;
  max-width: 130px;
  margin: 3px auto 0;
  font-size: 12px;
  font-weight: normal;
  color: #666;
}
.round:hover .disc { transform: scale(1.06); }
.round.selected .disc {
  background: radial-gradient(circle at 78% 18%, var(--green-1) 58%, var(--green-2) 59%);
  border-color: var(--green-border);
}
.round:focus-visible .disc { outline: 3px solid #2d7fd3; outline-offset: 2px; }
.round[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.round[aria-disabled="true"]:hover .disc { transform: none; }
.round svg { width: 40px; height: 40px; }
.themes .round { width: 80px; }
.themes .round .disc { width: 64px; height: 64px; }

.pill-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.pill {
  border: 1px solid var(--grey-border);
  background: linear-gradient(170deg, var(--grey-1) 60%, var(--grey-2) 61%);
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.pill small { display: block; font-size: 11px; color: #555; }
.pill.selected {
  background: linear-gradient(170deg, var(--green-1) 60%, var(--green-2) 61%);
  border-color: var(--green-border);
}
.pill.selected small { color: #133d13; }

.custom-actions { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.custom-actions + .hint { margin-top: 24px; }

.word-preview {
  margin: 14px auto 0;
  max-width: 560px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.word-preview .chip {
  background: #eef8f9;
  border: 1px solid #c6e7ea;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 13px;
  letter-spacing: .5px;
}
.word-preview .empty { color: #777; font-style: italic; }

.custom-size, .custom-solution {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.custom-size input { width: 64px; }
input[type="text"], input[type="number"], select, textarea {
  font: inherit;
  font-size: 16px;
  padding: 7px 9px;
  border: 1px solid var(--grey-border);
  border-radius: 6px;
}
.custom-solution input { width: 280px; text-transform: uppercase; }
.hint { text-align: center; color: #555; font-size: 14px; margin: 8px 0 0; }

/* ===== Knoppen ===== */
.btn {
  font: inherit;
  font-weight: bold;
  font-size: 19px;
  color: #fff;
  background: var(--slate);
  border: none;
  border-bottom: 4px solid var(--slate-dark);
  border-radius: 6px;
  padding: 9px 18px;
  cursor: pointer;
  letter-spacing: .3px;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn:disabled { opacity: .4; cursor: default; filter: none; transform: none; border-bottom-width: 4px; }
.btn.big { font-size: 24px; padding: 10px 30px; }
.btn.small { font-size: 15px; padding: 6px 12px; }
.btn.green { background: var(--green-2); border-bottom-color: var(--green-border); }
.btn.grey { background: #9aa1ad; border-bottom-color: #7b818c; }
.btn.red { background: var(--red); border-bottom-color: #b33c3c; }
.btn.icon { padding: 6px 8px; line-height: 0; }
.btn.active { background: var(--green-2); border-bottom-color: var(--green-border); }

/* ===== Onderbalk ===== */
.bottombar {
  --bar-h: clamp(40px, 4.3vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 22px;
  min-height: 86px;
}
.badge {
  display: block;
  height: var(--bar-h);
  flex-shrink: 0;
}
.badge img { display: block; height: 100%; width: auto; }
.badge:focus-visible, .tool-button:focus-visible { outline: 3px solid #fff3a2; outline-offset: 3px; }
/* Zelfde knoppen-sprite als de Circustimer */
.tool-button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  height: var(--bar-h);
  width: var(--bar-h);
  flex-shrink: 0;
  cursor: pointer;
}
.tool-button:hover { filter: brightness(1.04); }
.tool-button:active { filter: brightness(.92); }
.control-icon {
  display: block;
  width: 100%;
  height: 100%;
  background-image: url('../img/timer-controls.png');
  background-repeat: no-repeat;
  background-size: 700% 100%;
  background-position: calc(var(--icon-frame) * 100% / 6) 0;
}
.icon-expand { --icon-frame: 5; }
.icon-collapse { --icon-frame: 6; }
.bar-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ===== Speelveld ===== */
.play-layout {
  display: flex;
  gap: 28px;
  height: 100%;
  align-items: stretch;
}
.board-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.board {
  position: relative;
  touch-action: none;
  user-select: none;
}
.board-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: multiply;
}
.board-cells {
  position: relative;
  display: grid;
}
.cell {
  width: var(--cell);
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: calc(var(--cell) * .58);
  border: 1px solid #d7e8ea;
  margin: -0.5px;
  background: rgba(255, 255, 255, .55);
  cursor: pointer;
}
.cell.off { visibility: hidden; }
.board.done { animation: pop .5s ease both; }
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.side {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side h2 { margin: 6px 0 2px; font-weight: bold; }
.word-list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 14px;
  overflow: auto;
}
.word-list li {
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 5px;
  letter-spacing: 1px;
  break-inside: avoid;
  white-space: nowrap;
}
.word-list.compact li { font-size: 15px; letter-spacing: 0; padding: 4px 2px; }
.word-list.one-col { columns: 1; }
.word-list.one-col li { font-size: 17px; padding: 2px 6px; }
.word-list li::before { content: "\25CB  "; color: #999; }
.word-list li.found { text-decoration: line-through; color: #888; }
.word-list li.found::before { content: "\2714  "; color: var(--green-2); }

.solution-box { margin-top: 14px; text-align: center; }
.solution-box h3 { margin: 0 0 8px; font-size: 17px; }
.solution-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.solution-word { display: inline-flex; flex: none; gap: 4px; }
.slot {
  width: 26px;
  height: 30px;
  border: 2px solid var(--slate);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  background: #fff;
}
.slot.punct { border: none; width: 8px; background: none; align-items: flex-end; justify-content: flex-start; }
.slot.filled { background: #ffe066; border-color: #e0b400; }
.slot.hint { color: #e25555; }
.solution-hint {
  margin: 0 0 8px;
  font-weight: bold;
  color: #e25555;
}
.warning {
  background: #fff3cd;
  border: 1px solid #f0d27a;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}

@media (max-width: 900px) {
  .play-layout { flex-direction: column; }
  .side { flex: 0 0 auto; }
}

/* ===== Dialogen ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(30, 50, 55, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog {
  background: #fff;
  border-radius: 10px;
  padding: 20px 26px;
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.dialog h2 { margin-top: 0; font-weight: bold; }
.dialog p { text-align: center; }
.dialog .check { display: block; margin: 12px 0 0; font-size: 16px; }
.dialog-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; align-items: center; }
.dialog-buttons .spacer { flex: 1; }
.list-dialog { width: min(720px, 100%); }
.form-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.form-row label, label.block { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #444; }
label.block { margin-top: 12px; }
textarea { width: 100%; resize: vertical; text-transform: uppercase; }
.list-check { margin-top: 8px; font-size: 14px; }
.list-check .ok { color: var(--green-border); font-weight: bold; }
.list-check .bad { color: #b33c3c; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

@media (max-width: 640px) {
  #btnStepBack,
  #btnStepNext {
    width: 48px;
    min-width: 48px;
    padding: 8px;
    font-size: 0;
  }
  #btnStepBack::before,
  #btnStepNext::before {
    font-size: 28px;
    line-height: 1;
  }
  #btnStepBack::before { content: "\2190"; }
  #btnStepNext::before { content: "\2192"; }
}

.celebrate-dialog { text-align: center; position: relative; z-index: 2; overflow: hidden; }
.celebrate-emoji { display: inline-block; font-size: 64px; animation: pop 1s ease infinite; }
.celebrate-solution {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--green-2);
  margin: 6px 0 18px;
}
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.confetti span {
  position: absolute;
  top: -40px;
  font-size: 28px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(540deg); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  background: var(--badge);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 60;
  font-weight: bold;
  max-width: 90vw;
  text-align: center;
}

.toast.error { background: #b71c1c; }

/* ===== Afdrukken (A4) ===== */
.print-area { display: none; }

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  html, body { background: #fff !important; height: auto; }
  .scene, .app, .overlay, .toast { display: none !important; }
  .print-area { display: block; }

  .print-page {
    width: 190mm;
    height: 276mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    position: relative;
  }
}

/* Gedeelde printopmaak (ook bruikbaar voor een voorbeeld op het scherm) */
.print-page { font-family: Arial, Helvetica, sans-serif; color: #000; }
.print-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 3mm 4mm;
  margin-bottom: 4mm;
  border-bottom: .4mm solid #000;
}
.print-head h1 { font-size: 8mm; margin: 0; }
.print-head .sub { font-size: 3.6mm; margin-top: 1mm; }
.print-head .name { font-size: 4mm; text-align: right; line-height: 2; }
.print-grid {
  position: relative;
  margin: 0 auto;
}
.print-grid .pcells { position: relative; display: grid; }
.print-grid .pc {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  border: .2mm solid #999;
  margin: -.1mm;
}
.print-grid .pc.off { visibility: hidden; }
.print-words {
  width: 100%;
  margin-top: 5mm;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5mm 4mm;
  font-size: 4.2mm;
  letter-spacing: .3mm;
}
.print-words span::before { content: "\2610  "; }
.print-solution { margin-top: 5mm; text-align: center; }
.print-solution .lbl { font-size: 4mm; font-weight: bold; margin-bottom: 2mm; }
.print-solution .boxes { display: flex; flex-wrap: wrap; justify-content: center; gap: 1mm; }
.print-solution .box { width: 7mm; height: 8mm; border: .3mm solid #000; font-size: 5mm; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.print-solution .box.gap { border: none; width: 4mm; }
.print-solution .box.punct { border: none; width: 2.5mm; display: inline-flex; align-items: flex-end; font-weight: bold; }
.print-deco { position: absolute; font-size: 14mm; opacity: .35; line-height: 1; }
.print-footer {
  width: 100%;
  margin-top: auto;
  padding-top: 3mm;
  flex-shrink: 0;
  text-align: center;
  font-size: 3mm;
  line-height: 1.4;
  position: relative;
}
.print-footer img { display: block; width: 42mm; height: 10mm; margin: 0 auto 1mm; }

/* Kleurversie */
.print-color { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-color .print-head {
  background: var(--theme, #5ac0c8);
  color: #fff;
  border-radius: 3mm;
  border-bottom: none;
}
.print-color .print-grid .pc { border-color: #9fd3d8; }
.print-color .print-grid { border: .8mm solid var(--theme, #5ac0c8); border-radius: 2mm; padding: 1.5mm; background: #fff; }
.print-color .print-solution .box { border-color: var(--theme, #5ac0c8); }
.print-color .print-words span::before { color: var(--theme, #5ac0c8); }

/* Zwart-wit (weinig inkt) */
.print-bw .print-deco { display: none; }
.print-bw .print-grid .pc { border-color: #bbb; border-width: .15mm; }
.print-bw .print-head { border-bottom-width: .2mm; }
.print-bw .print-footer img { filter: grayscale(1); }

/* IJ = een letter in een vakje */
.ij { letter-spacing: 0; }
