:root {
  --bg: #FFE8D1;
  --ink: #2B2B2B;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", "Varela Round", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: background-color .45s ease;
}
body.dark { --ink: #FFF7CC; }

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  touch-action: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2vmin;
  will-change: transform, opacity;
}

#art {
  width: min(78vmin, 560px);
  aspect-ratio: 1;
  cursor: pointer;
}
#art svg { width: 100%; height: 100%; display: block; overflow: visible; }

#label {
  margin: 0;
  font-size: clamp(48px, 13vmin, 120px);
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1;
  color: var(--ink);
}
#article { font-weight: 500; opacity: .45; font-size: .6em; }
body:not(.show-article) #article { display: none; }

/* Animaties */
.enter-next { animation: enterNext .35s cubic-bezier(.2,.9,.3,1.2); }
.enter-prev { animation: enterPrev .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes enterNext { from { transform: translateX(40vw) scale(.8); opacity: 0; } }
@keyframes enterPrev { from { transform: translateX(-40vw) scale(.8); opacity: 0; } }

.boing { animation: boing .6s cubic-bezier(.3,1.6,.5,1); }
@keyframes boing {
  0% { transform: scale(1); }
  30% { transform: scale(1.12) rotate(-3deg); }
  60% { transform: scale(.96) rotate(2deg); }
  100% { transform: scale(1); }
}
.word-pop { animation: pop .5s ease; }
@keyframes pop { 40% { transform: scale(1.15); } }

@media (prefers-reduced-motion: reduce) {
  .enter-next, .enter-prev, .boing, .word-pop { animation: none; }
}

/* Navigatie */
.nav {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 84px; height: 84px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.7);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.08);
}
.nav:active { transform: translateY(2px); box-shadow: none; }
.nav svg { width: 44px; height: 44px; fill: none; stroke: #2B2B2B; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.prev { left: calc(24px + env(safe-area-inset-left)); }
.next { right: calc(24px + env(safe-area-inset-right)); }
@media (orientation: landscape) {
  .nav { bottom: 50%; transform: translateY(50%); }
  .nav:active { transform: translateY(calc(50% + 2px)); }
}

/* Ouderknop */
#parent {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent;
  opacity: .3;
  display: grid; place-items: center;
  cursor: pointer;
  touch-action: none;
}
#parent svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
#parent .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--ink) calc(var(--p, 0) * 1%), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 17px, #000 18px);
          mask: radial-gradient(circle, transparent 17px, #000 18px);
}
#parent.holding { opacity: 1; }

/* Startscherm */
.overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: var(--bg);
  z-index: 10;
}
.overlay[hidden] { display: none; }
.overlay p { font-size: 22px; font-weight: 700; opacity: .6; margin: 0; }
#startBtn {
  width: 180px; height: 180px; border-radius: 50%; border: 0;
  background: #FF595E; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 8px 0 #D9383E;
  animation: breathe 2.4s ease-in-out infinite;
}
#startBtn svg { width: 90px; height: 90px; fill: #fff; margin-left: 10px; }
@keyframes breathe { 50% { transform: scale(1.06); } }

/* Instellingen */
dialog {
  border: 0; border-radius: 24px;
  width: min(92vw, 440px);
  padding: 24px;
  font-family: var(--font);
  color: #2B2B2B;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  user-select: auto;
}
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin: 0 0 16px; font-size: 24px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 700; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label {
  padding: 8px 14px; border-radius: 999px; background: #F2F2F2; cursor: pointer; font-weight: 600;
}
.chips input { display: none; }
.chips label:has(input:checked) { background: #2B2B2B; color: #fff; }
.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-size: 16px; }
.row input { width: 22px; height: 22px; accent-color: #2B2B2B; }
.col { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-weight: 700; }
.col select, .col input { font: inherit; font-weight: 400; }
.col select { padding: 8px; border-radius: 10px; border: 1px solid #ddd; }
.col input[type=range] { accent-color: #2B2B2B; }
.hint { font-size: 14px; background: #FFF4CC; padding: 10px 12px; border-radius: 12px; }
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.actions button {
  font: inherit; font-weight: 700; padding: 12px 18px; border-radius: 14px; border: 0;
  background: #F2F2F2; cursor: pointer;
}
.actions .primary { background: #2B2B2B; color: #fff; }
