@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&display=swap');

:root {
  --font: 'Baloo 2', 'Comic Sans MS', sans-serif;
  --bg: #FFF8ED;
  --text: #2D2A32;
  --purple: #A66CFF;
  --purple-dark: #7C3FE0;
  --blue: #4D96FF;
  --blue-dark: #2E6FDB;
  --green: #6BCB77;
  --green-dark: #3FA34D;
  --orange: #FF8B5E;
  --orange-dark: #E8632D;
  --red: #FF6B6B;
  --red-dark: #DB4444;
  --yellow: #FFD93D;
  --yellow-dark: #E8B800;
  --white: #FFFFFF;
  --radius: 28px;
  --radius-sm: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button {
  font-family: var(--font);
  border: none;
  cursor: pointer;
}

a {
  text-decoration: none;
  color: inherit;
}

/* --- Topbar (used on menu / category / game pages) --- */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
}

.home-btn {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 5px 0 rgba(0,0,0,0.12);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease;
}
.home-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.12); }

.topbar-title {
  font-size: clamp(20px, 4vw, 32px);
  font-weight: 800;
}

.spacer { flex: 1; }

.score-badge {
  background: var(--white);
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 5px 0 rgba(0,0,0,0.12);
}

/* --- Tile grid (category menu + game menu) --- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  padding: 10px 24px 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 14px;
  border-radius: var(--radius);
  color: var(--white);
  font-weight: 800;
  font-size: clamp(18px, 3vw, 24px);
  box-shadow: 0 8px 0 rgba(0,0,0,0.18);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-align: center;
}
.tile:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.18);
}
.tile .icon {
  font-size: clamp(44px, 8vw, 64px);
  line-height: 1;
}

.tile.purple { background: var(--purple); }
.tile.blue { background: var(--blue); }
.tile.green { background: var(--green); }
.tile.orange { background: var(--orange); }
.tile.red { background: var(--red); }

.menu-subtitle {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #b7a9c9;
  margin: -6px 0 8px;
}

.page-heading {
  text-align: center;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 800;
  margin: 4px 0 6px;
}

.page-sub {
  text-align: center;
  font-size: clamp(16px, 3vw, 20px);
  color: #6b6672;
  margin: 0 0 10px;
}

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px 30px;
}

/* --- Generic big round action button --- */
.big-btn {
  border-radius: 999px;
  padding: 18px 34px;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
  color: var(--white);
  background: var(--blue);
  box-shadow: 0 7px 0 var(--blue-dark);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--blue-dark); }

/* --- Celebration overlay (round complete) --- */
.celebrate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,248,237,0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  z-index: 50;
  text-align: center;
  padding: 20px;
}
.celebrate-overlay .big-emoji {
  font-size: clamp(70px, 16vw, 120px);
}
.celebrate-overlay h2 {
  font-size: clamp(28px, 6vw, 44px);
  margin: 0;
}

/* --- Naam-kiezer --- */
.player-picker-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}
.player-picker-row .tile {
  width: 130px;
  padding: 22px 10px;
}
.player-chip {
  background: var(--white);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.12);
  white-space: nowrap;
}

/* --- Confetti --- */
.confetti-piece {
  position: fixed;
  top: -20px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  z-index: 60;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.3; }
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes shake {
  10%, 90% { transform: translateX(-4px); }
  20%, 80% { transform: translateX(8px); }
  30%, 50%, 70% { transform: translateX(-14px); }
  40%, 60% { transform: translateX(14px); }
}
.shake { animation: shake 0.5s; }

/* --- Pincode-scherm --- */
.pin-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 20px;
}
.pin-mascot { font-size: clamp(56px, 14vw, 90px); }
.pin-title {
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 800;
  text-align: center;
  margin: 0;
}
.pin-dots {
  display: flex;
  gap: 16px;
}
.pin-dots span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: inset 0 0 0 3px #D9D3E6;
  transition: background 0.15s ease;
}
.pin-dots span.filled {
  background: var(--purple);
  box-shadow: inset 0 0 0 3px var(--purple-dark);
}
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: min(300px, 80vw);
}
.pin-key {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--white);
  font-size: clamp(24px, 6vw, 30px);
  font-weight: 800;
  color: var(--text);
  box-shadow: 0 6px 0 rgba(0,0,0,0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pin-key:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.12); }
.pin-key.pin-clear-key {
  background: var(--orange);
  color: var(--white);
  font-size: clamp(15px, 3.4vw, 18px);
  box-shadow: 0 6px 0 var(--orange-dark);
}
