/* ===== VARIABELEN ===== */
:root {
  --groen-donker: #1a5c2a;
  --groen-midden: #2d8a45;
  --groen-licht: #4db86a;
  --groen-heel-licht: #c8f0d0;
  --geel: #f9c623;
  --oranje: #f07d23;
  --bruin: #7a4419;
  --bruin-licht: #c8835a;
  --wit: #fffef5;
  --tekst: #1a2e1a;
  --radius: 20px;
  --radius-groot: 32px;
  --schaduw: 0 4px 20px rgba(0,0,0,0.18);
}

/* ===== RESET & BASIS ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: #0d2e10;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--tekst);
}

/* ===== JUNGLE ACHTERGROND ===== */
.jungle-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.jungle-illustratie {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  display: block;
}

/* ===== SCHERMEN ===== */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px 16px 24px;
  max-width: 560px;
  margin: 0 auto;
}
.screen.active { display: flex; flex-direction: column; }

/* Spelscherm vult exacte viewport - geen scroll */
#screen-spel {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

/* ===== HEADER KEUZE ===== */
.header {
  text-align: center;
  padding: 12px 0 8px;
  flex-shrink: 0;
}

.koala-mascot {
  margin-bottom: 4px;
}

.koala-img {
  width: clamp(70px, 18vw, 110px);
  height: clamp(70px, 18vw, 110px);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
  animation: bounce 2.5s ease-in-out infinite;
}

.koala-small {
  width: clamp(52px, 13vw, 72px);
  height: clamp(52px, 13vw, 72px);
}

.koala-result {
  width: clamp(90px, 22vw, 140px);
  height: clamp(90px, 22vw, 140px);
  animation: wiggle 1s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg) scale(1); }
  50% { transform: rotate(5deg) scale(1.05); }
}

h1 {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 800;
  color: var(--geel);
  text-shadow: 0 3px 8px rgba(0,0,0,0.4);
  line-height: 1.1;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--groen-heel-licht);
  margin-top: 6px;
  font-weight: 600;
}

/* ===== TAFEL GRID ===== */
.tafel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.tafel-btn {
  background: var(--wit);
  border: 3px solid var(--groen-midden);
  border-radius: var(--radius);
  padding: 14px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: var(--schaduw);
  -webkit-tap-highlight-color: transparent;
}

.tafel-btn:hover, .tafel-btn:active {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
  background: var(--geel);
  border-color: var(--oranje);
}

.tafel-btn.mixed {
  background: linear-gradient(135deg, #e8f5e9, #c8f0d0);
  border-color: var(--groen-licht);
  grid-column: span 2;
}
.tafel-btn.mixed:hover {
  background: linear-gradient(135deg, var(--geel), #ffd95a);
}

.tafel-num {
  font-family: 'Baloo 2', cursive;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--groen-donker);
  line-height: 1;
}

.tafel-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--bruin);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== SPEL HEADER ===== */
.spel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 10px;
  flex-shrink: 0;
}

.btn-back {
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 14px;
  color: white;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-back:hover { background: rgba(255,255,255,0.32); }

.voortgang-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.voortgang-bar {
  height: 12px;
  background: rgba(255,255,255,0.25);
  border-radius: 99px;
  overflow: hidden;
}

.voortgang-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--geel), var(--oranje));
  border-radius: 99px;
  width: 5%;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.voortgang-tekst {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  text-align: center;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 14px;
  padding: 6px 12px;
  min-width: 56px;
  justify-content: center;
}
.score-icon { font-size: 1rem; }
#score-live {
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--geel);
}

/* ===== VRAAG ===== */
.vraag-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.koala-spel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.speech-bubble {
  background: white;
  border-radius: 16px 16px 16px 4px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--groen-donker);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  max-width: 140px;
  text-align: center;
  animation: bubble-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bubble-in {
  from { opacity: 0; transform: scale(0.7) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.som-kaart {
  flex: 1;
  background: var(--wit);
  border-radius: var(--radius-groot);
  padding: clamp(14px, 3vh, 22px) 16px;
  text-align: center;
  box-shadow: var(--schaduw);
  border: 3px solid rgba(255,255,255,0.5);
  animation: kaart-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Som en antwoordveld naast elkaar */
.som-rij {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
}

@keyframes kaart-in {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.som-tekst {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  color: var(--groen-donker);
  line-height: 1.1;
}

/* ===== INVOER SECTIE ===== */
.invoer-sectie {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2vh, 16px);
  flex: 1;
  justify-content: center;
  min-height: 0;
}

/* Antwoordvak zit nu in de som-kaart naast de som */
.invoer-display {
  background: #f0faf3;
  border: 3px solid var(--groen-licht);
  border-radius: 14px;
  padding: 6px 14px;
  min-width: 72px;
  text-align: center;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.07);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.invoer-display.goed {
  background: #4caf50;
  border-color: #2e7d32;
  transform: scale(1.06);
}

.invoer-display.fout {
  background: #ef5350;
  border-color: #b71c1c;
  animation: shake 0.4s ease;
}

.invoer-display.goede-antwoord {
  background: #66bb6a;
  border-color: #2e7d32;
}

.invoer-waarde {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 800;
  color: var(--groen-donker);
  line-height: 1;
  display: block;
  min-width: 44px;
}

.invoer-display.goed .invoer-waarde,
.invoer-display.fout .invoer-waarde,
.invoer-display.goede-antwoord .invoer-waarde {
  color: white;
}

.invoer-waarde.heeft-waarde {
  color: var(--groen-donker);
}

/* ===== NUMPAD ===== */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(6px, 2vw, 12px);
  width: 100%;
  max-width: 380px;
  flex-shrink: 0;
}

.numpad-btn {
  background: var(--wit);
  border: 3px solid var(--groen-licht);
  border-radius: var(--radius);
  padding: clamp(12px, 3.5vh, 20px) 8px;
  font-family: 'Baloo 2', cursive;
  font-size: clamp(1.2rem, 4.5vw, 1.75rem);
  font-weight: 800;
  color: var(--groen-donker);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

.numpad-btn:active:not(:disabled) {
  transform: scale(0.92);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.numpad-btn:hover:not(:disabled) {
  background: var(--groen-heel-licht);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.numpad-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.numpad-wis {
  background: #fff3e0;
  border-color: var(--oranje);
  color: var(--oranje);
}
.numpad-wis:hover:not(:disabled) {
  background: #ffe0b2;
}

.numpad-ok {
  background: var(--geel);
  border-color: var(--oranje);
  color: var(--groen-donker);
  font-size: clamp(1.5rem, 5vw, 1.9rem);
}
.numpad-ok:hover:not(:disabled) {
  background: #ffd740;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}


@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ===== FEEDBACK OVERLAY ===== */
.feedback-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.feedback-overlay.zichtbaar {
  opacity: 1;
  pointer-events: all;
}

.feedback-inhoud {
  background: white;
  border-radius: var(--radius-groot);
  padding: 28px 36px;
  text-align: center;
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.feedback-inhoud.goed-feedback { color: #2e7d32; }
.feedback-inhoud.fout-feedback { color: #b71c1c; }

/* ===== RESULTAAT SCHERM ===== */
.resultaat-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 30px;
  gap: 16px;
}

.koala-groot { position: relative; }

.ster-regen {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.ster-deeltje {
  position: absolute;
  top: -20px;
  font-size: 1.5rem;
  animation: vallen linear forwards;
}

@keyframes vallen {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

#screen-resultaat h2 {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  color: var(--geel);
  text-shadow: 0 3px 8px rgba(0,0,0,0.4);
}

.score-cirkel {
  background: var(--wit);
  border-radius: 50%;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  border: 5px solid var(--geel);
}

#resultaat-score {
  font-family: 'Baloo 2', cursive;
  font-size: 3rem;
  font-weight: 800;
  color: var(--groen-donker);
  line-height: 1;
}

.score-van {
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--bruin);
  align-self: flex-end;
  padding-bottom: 12px;
}

.aanmoediging {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--groen-heel-licht);
  max-width: 320px;
  line-height: 1.4;
}

.resultaat-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
}

.btn-primair {
  background: var(--geel);
  border: none;
  border-radius: var(--radius);
  padding: 18px 24px;
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--groen-donker);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primair:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.btn-secundair {
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: var(--radius);
  padding: 16px 24px;
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secundair:hover { background: rgba(255,255,255,0.28); }

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
  .tafel-grid { grid-template-columns: repeat(3, 1fr); }
  .spel-header { gap: 6px; }
  .btn-back { padding: 6px 10px; font-size: 0.8rem; }
}

@media (min-width: 600px) {
  .tafel-grid { grid-template-columns: repeat(6, 1fr); }
  .tafel-btn.mixed { grid-column: span 3; }
  .numpad { max-width: 360px; }
}

/* Landscape op kleine schermen */
@media (max-height: 500px) and (orientation: landscape) {
  .koala-small { display: none; }
  .speech-bubble { display: none; }
  .vraag-container { margin-bottom: 6px; }
  .som-kaart { padding: 10px 16px; }
  #screen-spel { overflow-y: auto; height: auto; min-height: 100dvh; }
}

/* ===== OVERIGE ===== */
button { -webkit-tap-highlight-color: transparent; outline: none; }
