:root {
  --cream: #F6F1E4;
  --cream-dark: #EDE4D0;
  --moss-50: #EEF2EC;
  --moss-100: #D6E0D2;
  --moss-200: #AEC2A6;
  --moss-300: #87A47B;
  --moss-400: #5F7F55;
  --moss-500: #3E5C43;
  --moss-600: #324A37;
  --gold: #C6A15B;
  --gold-light: #DFC58C;
  --gold-dark: #9C7B3F;
  --berry: #A65B4F;
  --bark: #7A5B44;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--moss-600);
  font-family: var(--font-body);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100dvh;
  position: relative;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

button, input {
  font-family: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== layout helpers ===== */
.screen {
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

.screen-pad {
  padding: 40px 24px;
}

.max-sm { max-width: 380px; margin: 0 auto; }
.max-md { max-width: 460px; margin: 0 auto; }

.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.relative { position: relative; z-index: 1; }

/* ===== components ===== */
.card {
  background: rgba(255,255,255,0.75);
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 8px 30px -10px rgba(38,56,42,0.25);
  backdrop-filter: blur(4px);
  position: relative;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 20px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  border: none;
  width: 100%;
  transition: transform 0.1s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
  background: var(--moss-500);
  color: var(--cream);
  box-shadow: 0 8px 30px -10px rgba(38,56,42,0.25);
}
.btn-secondary {
  background: var(--cream);
  color: var(--moss-600);
  border: 2px solid var(--moss-300);
}
.btn-link {
  background: none;
  border: none;
  color: var(--moss-400);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  width: auto;
  padding: 0;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 20px;
  padding: 12px 16px;
  text-align: left;
  border: 2px solid var(--moss-200);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  width: 100%;
}
.option-btn.selected {
  border-color: var(--gold);
  background: rgba(223,197,140,0.3);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--moss-200);
  color: var(--moss-400);
  background: transparent;
}
.chip.active {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: rgba(223,197,140,0.3);
}

input[type="text"], input[type="password"], textarea {
  border-radius: 20px;
  border: 2px solid var(--moss-200);
  padding: 10px 16px;
  font-size: 15px;
  width: 100%;
}
input[type="range"] { width: 100%; accent-color: var(--moss-500); }

.speak-btn {
  height: 36px;
  width: 36px;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 2px solid var(--moss-200);
  background: #fff;
  color: var(--moss-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hero-img {
  width: 100%;
  max-width: 340px;
  border-radius: 28px;
  box-shadow: 0 8px 30px -10px rgba(38,56,42,0.25);
}

/* ===== Nola personage ===== */
.nola-avatar {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
}
.nola-avatar-small {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px -2px rgba(198,161,91,0.55);
  border: 2px solid var(--gold-light);
  background: var(--moss-50);
}
.speech-bubble {
  position: relative;
  background: #fff;
  border-radius: 22px;
  padding: 14px 16px;
  box-shadow: 0 4px 14px -4px rgba(38,56,42,0.2);
}
.speech-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 18px;
  width: 16px;
  height: 16px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 3px;
}
.nola-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* ===== ambient decor ===== */
.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.leaf {
  position: absolute;
  top: -10%;
  opacity: 0;
  animation-name: floatLeaf;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes floatLeaf {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.8; }
  100% { transform: translateY(115vh) translateX(40px) rotate(220deg); opacity: 0; }
}
.sunray {
  position: absolute;
  left: -80px;
  top: -80px;
  width: 380px;
  height: 380px;
  border-radius: 9999px;
  background: radial-gradient(circle, rgba(223,197,140,0.35), transparent 70%);
  filter: blur(10px);
  animation: sunPulse 8s ease-in-out infinite;
}
@keyframes sunPulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.45; }
}
.sparkle {
  animation: sparkle 2.4s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}
.bob {
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ===== confetti ===== */
.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.confetti-piece {
  position: absolute;
  top: -5%;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation-name: confettiFall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes confettiFall {
  0% { top: -5%; opacity: 1; }
  100% { top: 105%; opacity: 0; }
}

/* ===== map screen ===== */
.map-frame {
  position: relative;
  margin: 24px auto;
  max-width: 420px;
  aspect-ratio: 3 / 4;
  border-radius: 28px;
  background: var(--moss-50);
  box-shadow: 0 8px 30px -10px rgba(38,56,42,0.25);
  overflow: hidden;
}
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
}
.map-dot {
  position: relative;
  height: 30px;
  width: 30px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 4px 14px -2px rgba(198,161,91,0.55);
  border: 2px solid var(--moss-200);
  background: var(--moss-100);
  cursor: pointer;
}
.map-dot.current { border-color: var(--gold); background: #fff; color: var(--gold-dark); }
.map-dot.done { border-color: var(--gold); background: var(--gold); color: #fff; }
.map-dot[disabled] { cursor: default; }
.map-fog {
  position: absolute;
  inset: -24px;
  border-radius: 9999px;
  background: rgba(174,194,166,0.5);
  filter: blur(6px);
}
.map-label {
  display: block;
  margin-top: 4px;
  max-width: 88px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--moss-500);
}
.map-star {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 13px;
}
.nola-marker {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  transition: left 0.6s ease, top 0.6s ease;
}
.nola-walker {
  position: absolute;
  transform: translate(-50%, calc(-100% - 8px));
  z-index: 6;
  pointer-events: none;
  transition: left 1.1s cubic-bezier(0.45, 0.05, 0.55, 0.95), top 1.1s cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

/* ===== key ring ===== */
.keyring {
  position: relative;
  margin: 0 auto;
  height: 240px;
  width: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.keyring.spinning { animation: spin 3s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.keyring-item {
  position: absolute;
  font-size: 26px;
}

/* ===== sticker grid ===== */
.sticker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sticker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
}
.sticker-card.undiscovered { opacity: 0.4; filter: grayscale(1); }

/* ===== slotwoord ===== */
.letter-box {
  height: 46px;
  width: 34px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  border: 2px dashed var(--moss-200);
  color: var(--moss-200);
}
.letter-box.filled { border-style: solid; border-color: var(--moss-300); color: var(--moss-600); background: #fff; }
.letter-box.solved { border-color: var(--gold); background: rgba(223,197,140,0.4); color: var(--gold-dark); }
.letter-tile {
  height: 46px;
  width: 46px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  border: 2px solid var(--gold);
  background: #fff;
  color: var(--gold-dark);
}
.letter-tile.used { background: var(--moss-50); color: var(--moss-200); opacity: 0.4; cursor: default; }

/* ===== finale ===== */
.finale-page {
  background: linear-gradient(to bottom, rgba(223,197,140,0.3), var(--cream));
}
.chest-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}
.chest-btn img { width: 220px; animation: bob 2s ease-in-out infinite; }
.code-box {
  background: #fff;
  border-radius: 16px;
  padding: 12px 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold-dark);
  text-align: center;
}

/* ===== diploma (aangeleverde afbeelding + automatisch ingevulde naam/datum) ===== */
.diploma-wrap {
  position: relative;
  width: 100%;
  container-type: inline-size;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px -10px rgba(38,56,42,0.25);
}
.diploma-img {
  display: block;
  width: 100%;
  height: auto;
}
/* Percentages zijn afgestemd op de exacte pixelposities van het blanco
   vak/lijn in het aangeleverde diploma-sjabloon (1024x572). Wordt het
   sjabloon ooit vervangen door een andere afbeelding, dan moeten deze
   percentages opnieuw worden afgesteld op de nieuwe afbeelding. */
.diploma-name {
  position: absolute;
  left: 37%;
  width: 49%;
  top: 32%;
  height: 20%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 7.5cqw;
  color: #6B4226;
  text-align: center;
  line-height: 1.05;
  overflow: hidden;
}
.diploma-date {
  position: absolute;
  left: 41.5%;
  width: 11.5%;
  top: 80%;
  height: 7%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 2.6cqw;
  color: #6B4226;
  text-align: center;
}

/* ===== admin ===== */
.admin-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.admin-field label { font-size: 13px; font-weight: 700; color: var(--moss-500); }
.admin-section { margin-bottom: 24px; }
.admin-loc-block { border: 2px solid var(--moss-100); border-radius: 20px; padding: 12px; margin-bottom: 10px; }

@media (min-width: 640px) {
  .sticker-grid { grid-template-columns: repeat(3, 1fr); }
}
