:root {
  --green: #8cc152;
  --green-deep: #5f9a2c;
  --ink: #3a0e0e;
  --ink-soft: #6b5a55;
  --paper: #ffffff;
  --paper-2: #f6f4f2;
  --line: #ebe5e2;
  --gold: #f6c343;
  --gold-dark: #c98a12;
  --red: #e32b2b;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(58,14,14,.08), 0 8px 24px rgba(58,14,14,.10);
  --chunky: 0 4px 0 var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
button { font: inherit; color: inherit; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -100px, #a6d46c 0, transparent 70%),
    var(--green);
  color: var(--ink);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Kop ---------- */
.awning {
  height: 54px;
  background: url("img/luifel.svg") repeat-x 0 0 / auto 54px;
  filter: drop-shadow(0 3px 0 rgba(58,14,14,.12));
}
.top { text-align: center; padding: 6px 16px 0; }
.logo { width: min(230px, 64vw); height: auto; display: block; margin: 0 auto; filter: drop-shadow(0 4px 0 rgba(58,14,14,.15)); }
.subtitle {
  display: inline-block; margin: 6px 0 0; padding: 0 14px;
  background: var(--ink); color: #fff; border-radius: 999px;
  font-weight: 700; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- Stappen ---------- */
.steps {
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 640px; margin: 14px auto 16px; padding: 0 16px;
  position: relative;
}
.steps::before { /* verbindingslijn */
  content: ""; position: absolute; left: calc(16px + 12.5%); right: calc(16px + 12.5%); top: 17px;
  height: 3px; background: rgba(58,14,14,.2); border-radius: 3px;
}
.steps button {
  position: relative; display: grid; justify-items: center; gap: 2px;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.steps .dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  background: #fff; border: 3px solid rgba(58,14,14,.25); color: var(--ink-soft);
  transition: background .2s, border-color .2s, transform .2s;
}
.steps .lbl { font-size: 13px; font-weight: 700; color: rgba(58,14,14,.65); }
.steps .past .dot { background: #fff; border-color: var(--ink); color: var(--ink); }
.steps .current .dot { background: var(--ink); border-color: var(--ink); color: #fff; transform: scale(1.08); }
.steps .current .lbl { color: var(--ink); }
.steps button:disabled { cursor: default; }
.steps button:disabled .dot { opacity: .55; }

main { max-width: 640px; margin: 0 auto; padding: 0 16px 8px; }

/* ---------- Panelen ---------- */
.panel {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
h2 { margin: 0 0 6px; font-size: 21px; line-height: 1.15; font-weight: 800; }
.hint { color: var(--ink-soft); font-size: 15px; margin: 0 0 14px; }
.tip {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255,255,255,.75); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 15px; font-weight: 600;
}

/* ---------- Knoppen ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 8px 16px;
  font-weight: 800; font-size: 17px; text-align: center;
  border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: var(--chunky);
  cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--gold); }
.btn.ghost { background: #fff; }
.btn.soft { background: var(--paper-2); border-color: transparent; box-shadow: none; color: var(--ink); font-weight: 700; }
.btn.camera { background: var(--red); color: #fff; margin: 4px 0 12px; }
.btn:disabled, .btn.disabled { opacity: .4; pointer-events: none; }

.nav {
  position: sticky; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr 1.8fr; gap: 10px;
  margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--green) 70%, rgba(140,193,82,0));
}
.nav.single { grid-template-columns: 1fr; }

.link { background: none; border: 0; color: rgba(58,14,14,.75); text-decoration: underline; cursor: pointer; font-weight: 600; }
.foot { text-align: center; padding: 4px 16px 28px; }

/* ---------- Spelers ---------- */
.row { display: flex; gap: 8px; margin-bottom: 8px; }
.name {
  flex: 1; min-width: 0; font: inherit; font-weight: 700; color: var(--ink);
  background: var(--paper-2); border: 2px solid transparent; border-radius: 14px; padding: 10px 14px;
  outline: none; transition: border-color .15s, background .15s;
}
.name:focus { border-color: var(--ink); background: #fff; }
.icon-btn {
  width: 48px; flex: none; font-size: 16px;
  border: 0; border-radius: 14px; background: var(--paper-2); color: var(--ink-soft); cursor: pointer;
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.row + .btn { margin-top: 4px; }

/* Groente aan/uit */
.switches { display: grid; gap: 8px; }
.veg-switch {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 16px; cursor: pointer;
  border: 2px solid var(--veg);
  background: color-mix(in srgb, var(--veg) 10%, #fff);
  transition: background .2s, border-color .2s;
}
.veg-switch input { position: absolute; opacity: 0; pointer-events: none; }
.veg-switch-text { flex: 1; display: grid; line-height: 1.1; }
.veg-switch-text small { font-size: 13px; font-weight: 700; color: color-mix(in srgb, var(--veg) 75%, var(--ink)); }
.switch {
  width: 52px; height: 30px; flex: none; border-radius: 999px; position: relative;
  background: var(--veg); transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 25px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s;
}
.veg-switch.off { border-color: var(--line); border-style: dashed; background: var(--paper-2); }
.veg-switch.off .veg { filter: grayscale(1); opacity: .4; }
.veg-switch.off b { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 2px; }
.veg-switch.off small { color: var(--ink-soft); }
.veg-switch.off .switch { background: #cfc7c4; }
.veg-switch.off .switch::after { left: 3px; }
.veg-switch:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }

.veg { width: 30px; height: 30px; object-fit: contain; flex: none; }
.veg.lg { width: 38px; height: 38px; }
.veg.sm { width: 20px; height: 20px; vertical-align: -4px; }

/* ---------- Prijzen (stijl Prijskaart) ---------- */
.price-cards { display: grid; gap: 12px; }
.price-card {
  border-radius: 18px; padding: 10px 10px 12px;
  background: linear-gradient(180deg, #f1f1f1, #e4e4e4);
  border: 2px solid #d6d6d6;
}
.price-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; }
.price-head b { flex: 1; font-size: 18px; }
.price-value {
  font-weight: 800; font-size: 14px; padding: 2px 12px; border-radius: 999px;
  background: var(--veg); color: #fff;
}
.price-value.unset { background: #fff; color: var(--ink-soft); border: 2px dashed #c9c9c9; }

.ladder { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.rung {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  height: 92px; padding: 6px 2px 4px;
  background: #fff; border: 2px solid #d2d2d2; border-radius: 12px;
  cursor: pointer; transition: transform .1s, border-color .15s, background .15s;
}
.rung:nth-child(even) { background: #fafafa; }
.rung::before { /* pijltje omhoog zoals op de kaart */
  content: "▲"; position: absolute; top: 3px; left: 5px; font-size: 8px; color: var(--gold-dark); opacity: .7;
}
.rung:first-child::before { content: none; }
.rung .num { font-weight: 800; font-size: 22px; line-height: 1; }
.rung.sel {
  background: var(--veg); border-color: var(--ink);
  box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px);
}
.rung.sel .num { color: #fff; }
.rung.sel::before { color: #fff; opacity: 1; }
.rung:active { transform: translateY(1px); }

/* Muntjes: van opzij gezien, als stapel */
.pile { display: flex; flex-direction: column-reverse; align-items: center; }
.pile.empty { height: 8px; width: 22px; border-radius: 50%; border: 2px dashed #c9c9c9; }
.coin {
  display: block; width: 24px; height: 9px; border-radius: 50%;
  background: linear-gradient(180deg, #ffe08a 0 45%, var(--gold) 45% 100%);
  border: 1.5px solid var(--ink);
}
.pile .coin + .coin { margin-bottom: -3px; }
.coin.mini {
  display: inline-block; width: 13px; height: 13px; margin: 0 1px 0 3px; vertical-align: -2px;
  background: radial-gradient(circle at 50% 50%, var(--gold) 0 45%, #ffe08a 46% 100%);
  border-width: 1.5px;
}

/* ---------- Kaarten tellen ---------- */
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.player-head h2 { margin: 0; overflow-wrap: anywhere; }
.score-pill {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  background: var(--gold); border: 2px solid var(--ink); border-radius: 999px; padding: 0 12px; font-weight: 800;
}
.counters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.counter {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 10px; border-radius: 16px;
  background: var(--paper-2); border: 2px solid transparent;
}
.counter.has { background: color-mix(in srgb, var(--veg) 12%, #fff); border-color: color-mix(in srgb, var(--veg) 55%, #fff); }
.counter .count { flex: 1; font-weight: 800; font-size: 24px; text-align: center; }
.counter-btns { display: grid; gap: 4px; }
.step-btn {
  width: 34px; height: 28px; font-size: 18px; font-weight: 800; line-height: 1;
  border: 0; border-radius: 9px; background: #fff; color: var(--ink); cursor: pointer;
  box-shadow: 0 1px 2px rgba(58,14,14,.2);
}
.step-btn:disabled { opacity: .35; cursor: default; }

.status { margin: 0 0 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.status.ok { color: var(--green-deep); }
.status.err { color: var(--red); }
.check { margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: 15px; }
.check.ok { background: #e8f5dc; color: var(--green-deep); }
.check.warn { background: #fff4dc; color: #9a4b00; border: 2px solid var(--gold); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 3px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Uitslag ---------- */
.headline { text-align: center; font-size: 26px; margin: 4px 0 14px; }
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ranking li { display: flex; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--paper-2); }
.ranking li.winner { background: #fff6dc; box-shadow: inset 0 0 0 2px var(--gold); }
.rank {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: #fff; border: 2px solid var(--ink);
}
.winner .rank { background: var(--gold); }
.who { flex: 1; min-width: 0; }
.who-line { display: flex; justify-content: space-between; gap: 8px; font-size: 19px; }
.who-line b { overflow-wrap: anywhere; }
.pts { font-weight: 800; }
.calcs { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 14px; color: var(--ink-soft); }
.calc b { color: var(--ink); }

/* Ingesloten in een andere pagina: hoogte volgt de inhoud, geen eigen scrollbalk */
html.embedded, html.embedded body { overflow: hidden; }
html.embedded body { min-height: 0; }
html.embedded .nav { position: static; background: none; margin: 0; padding: 4px 0 8px; }

@media (min-width: 560px) {
  .counters { grid-template-columns: repeat(3, 1fr); }
  .switches { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .spinner { animation-duration: 2.4s; }
}
