* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Base Hidden State */
.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(20px) scale(0.98) !important;
  display: none !important;
}

/* ==========================================================================
   1. SCREENSAVER / LAADPAGINA
   ========================================================================== */
.screensaver-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vh, 40px);
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#animated-text {
  font-size: clamp(36px, 8vw, 96px);
  font-weight: 900;
  letter-spacing: clamp(1px, 0.5vw, 3px);
  line-height: 1.2;
  text-align: center;
  width: 100%;
  background: linear-gradient(45deg, #ff7e5f, #feb47b, #00c6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 1;
  transform: scale(1);
}

#animated-text.fade-out {
  opacity: 0;
  transform: scale(0.85);
}

.screensaver-flags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 1;
  transform: translateY(0);
}

.flag-prompt {
  font-size: clamp(16px, 3vw, 22px);
  color: #cbd5e0;
}

.flag-buttons-row {
  display: flex;
  gap: clamp(12px, 3vw, 25px);
  flex-wrap: wrap;
  justify-content: center;
}

.flag-card {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: clamp(15px, 3vh, 25px) clamp(20px, 4vw, 35px);
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  min-width: 120px;
}

.flag-card:hover, .flag-card:active {
  transform: translateY(-5px) scale(1.05);
  background: rgba(66, 153, 225, 0.25);
  border-color: #4299e1;
  box-shadow: 0 10px 25px rgba(66, 153, 225, 0.3);
}

.flag-img {
  width: 52px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.flag-label {
  color: #ffffff;
  font-size: clamp(14px, 2.5vw, 18px);
  font-weight: 600;
}

.btn-back-sub {
  background: transparent;
  border: none;
  color: #a0aec0;
  font-size: 14px;
  cursor: pointer;
  margin-top: 5px;
  transition: color 0.2s;
}

.btn-back-sub:hover {
  color: #ffffff;
}

/* ==========================================================================
   2. WELKOM & ONBOARDING CARDS
   ========================================================================== */
.welcome-card {
  background: rgba(45, 55, 72, 0.85);
  backdrop-filter: blur(12px);
  padding: 35px;
  border-radius: 24px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  max-width: 440px;
  width: 90%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 1;
  transform: translateY(0) scale(1);
  margin: 0 auto;
}

.card-title {
  font-size: 24px;
  color: #4299e1;
  margin-bottom: 8px;
}

.subtitle {
  color: #cbd5e0;
  font-size: 16px;
  margin-bottom: 25px;
}

.input-group {
  text-align: left;
  margin-bottom: 25px;
}

.input-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: #e2e8f0;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #4a5568;
  background-color: #1a202c;
  color: white;
  font-size: 18px;
  outline: none;
}

.input-group input:focus {
  border-color: #4299e1;
}

.btn-next {
  width: 100%;
  background: linear-gradient(45deg, #4299e1, #3182ce);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.btn-next:hover {
  transform: scale(1.02);
}

/* AVATAR CROPPER */
.avatar-cropper {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid #4299e1;
  margin: 0 auto 20px auto;
  overflow: hidden;
  position: relative;
  background-color: #1a202c;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  touch-action: none;
  user-select: none;
}

.avatar-cropper img {
  position: absolute;
  display: none;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  max-width: none;
}

.avatar-cropper img:active {
  cursor: grabbing;
}

.avatar-placeholder {
  font-size: 64px;
  color: #4a5568;
  pointer-events: none;
}

.cropper-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #4299e1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: absolute;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.photo-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.btn-photo-action {
  background: #4a5568;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-photo-action:hover {
  background: #718096;
}

.camera-btn {
  background: #2b6cb0;
}

.camera-btn:hover {
  background: #3182ce;
}

input[type="file"] {
  display: none;
}

.zoom-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  color: #cbd5e0;
  font-size: 14px;
  transition: opacity 0.3s;
}

.zoom-control input[type="range"] {
  accent-color: #4299e1;
  cursor: pointer;
}

/* MODAL UI */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.4s ease;
}

.modal-card {
  background: #2d3748;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  max-width: 380px;
  width: 85%;
  border: 1px solid rgba(255,255,255,0.1);
}

.modal-card h2 {
  color: #4299e1;
  margin-bottom: 12px;
}

.modal-card p {
  color: #e2e8f0;
  margin-bottom: 20px;
}

/* ==========================================================================
   3. HOOFD DASHBOARD UI
   ========================================================================== */
.dashboard-container {
  width: 100%;
  max-width: 1000px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  transition: opacity 0.5s ease;
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  padding: 12px 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #4299e1;
  overflow: hidden;
  background-color: #1a202c;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name-display {
  color: #ffffff;
  font-weight: 700;
  font-size: 18px;
}

.role-switch-link {
  color: #4299e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

.role-switch-link:hover {
  color: #63b3ed;
}

.app-logo {
  color: #4299e1;
  font-size: 22px;
  font-weight: 800;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  flex: 1;
}

.grid-card {
  background: rgba(45, 55, 72, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.grid-card:hover, .grid-card:active {
  transform: translateY(-6px) scale(1.02);
  border-color: #4299e1;
  box-shadow: 0 15px 30px rgba(66, 153, 225, 0.3);
}

.card-icon {
  font-size: clamp(48px, 6vw, 72px);
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.grid-card h3 {
  color: #ffffff;
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 700;
}

.talk-card { background: rgba(49, 130, 206, 0.2); }
.games-card { background: rgba(155, 89, 182, 0.2); }
.sounds-card { background: rgba(46, 204, 113, 0.2); }
.settings-card { background: rgba(149, 165, 166, 0.2); }

/* ==========================================================================
   4. MODALS & SPELLENMAP
   ========================================================================== */
.folder-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  padding: 20px;
  transition: opacity 0.4s ease;
}

.folder-content {
  background: #2d3748;
  border-radius: 28px;
  padding: 30px;
  max-width: 600px;
  width: 100%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.folder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  color: #ffffff;
}

.btn-close-folder {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-close-folder:hover {
  background: #e53e3e;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.game-item-btn {
  background: #1a202c;
  border: 2px solid #4a5568;
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.game-item-btn:hover {
  border-color: #9b59b6;
  background: #2d3748;
  transform: translateY(-3px);
}

.game-icon {
  font-size: 40px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.game-title {
  color: #e2e8f0;
  font-size: 16px;
  font-weight: 600;
}

/* ==========================================================================
   5. GELUIDEN QUIZ MODAL
   ========================================================================== */
.quiz-content {
  max-width: 700px;
}

.quiz-score-badge {
  background: rgba(241, 196, 15, 0.2);
  border: 1px solid #f1c40f;
  color: #f1c40f;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 18px;
}

.quiz-question-box {
  margin-bottom: 24px;
  text-align: center;
}

.btn-audio-repeat {
  background: linear-gradient(45deg, #2b6cb0, #3182ce);
  color: #ffffff;
  border: none;
  padding: 16px 28px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  transition: transform 0.2s, background 0.2s;
}

.btn-audio-repeat:hover {
  transform: scale(1.03);
  background: linear-gradient(45deg, #3182ce, #4299e1);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.quiz-card-btn {
  background: #1a202c;
  border: 3px solid #4a5568;
  border-radius: 20px;
  padding: 30px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.quiz-card-btn:hover {
  border-color: #4299e1;
  background: #2d3748;
  transform: translateY(-4px);
}

.quiz-card-label {
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
}

.quiz-card-btn.correct {
  border-color: #2ecc71 !important;
  background: rgba(46, 204, 113, 0.25) !important;
  animation: pulse-green 0.5s ease;
}

.quiz-card-btn.wrong {
  border-color: #e74c3c !important;
  background: rgba(231, 76, 60, 0.25) !important;
  animation: shake 0.4s ease;
}

/* ==========================================================================
   6. PUZZEL MODAL STYLING
   ========================================================================== */
.puzzle-content {
  max-width: 850px;
  background: #fdf6e3 !important;
  border: 4px solid #e0d6b8 !important;
  position: relative;
  overflow: hidden;
  height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 32px;
}

.puzzle-top-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  z-index: 10;
}

.btn-circle-nav {
  background: #00a8ff;
  border: 3px solid #ffffff;
  color: white;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,168,255,0.4);
  transition: transform 0.2s;
}

.btn-circle-nav:hover {
  transform: scale(1.1);
}

.puzzle-stage {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.puzzle-pieces-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.puzzle-silhouette {
  width: 200px;
  height: 200px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: grayscale(100%) brightness(0.7) opacity(0.35);
  user-select: none;
}

.puzzle-emoji-render {
  font-size: 160px;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  user-select: none;
}

.puzzle-piece {
  position: absolute;
  width: 100px;
  height: 100px;
  background: transparent;
  border: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
  z-index: 20;
  overflow: hidden;
}

.puzzle-piece-inner {
  position: absolute;
  width: 200px;
  height: 200px;
  font-size: 160px;
  line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

.puzzle-piece:active {
  cursor: grabbing;
  transform: scale(1.05);
}

.puzzle-piece.snapped {
  pointer-events: none;
  z-index: 10;
}

.puzzle-result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.puzzle-result-icon {
  font-size: 180px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.puzzle-word-label {
  font-size: 38px;
  font-weight: 900;
  color: #4a5568;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.balloon-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: auto;
  overflow: hidden;
  z-index: 30;
}

.floating-balloon {
  position: absolute;
  font-size: 55px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  cursor: pointer;
  animation: floatUp 8s linear forwards;
  user-select: none;
}

/* ==========================================================================
   7. KLANKBORD (SOUNDBOARD) STYLING
   ========================================================================== */
.soundboard-content {
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.soundboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.sb-tab-btn {
  background: #1a202c;
  color: #a0aec0;
  border: 2px solid #4a5568;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.sb-tab-btn:hover {
  color: #ffffff;
  border-color: #4299e1;
}

.sb-tab-btn.active {
  background: #3182ce;
  color: #ffffff;
  border-color: #63b3ed;
}

.soundboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 15px;
  overflow-y: auto;
  padding-right: 5px;
  flex: 1;
}

.sound-tile {
  background: #1a202c;
  border: 3px solid #4a5568;
  border-radius: 20px;
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.sound-tile:hover {
  border-color: #2ecc71;
  background: #2d3748;
  transform: translateY(-4px);
}

.sound-tile:active {
  transform: scale(0.95);
  border-color: #27ae60;
}

.sound-tile-icon {
  font-size: 42px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

.sound-tile-label {
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

/* ==========================================================================
   8. PRATEN (TALK) MODULE STYLING
   ========================================================================== */
.talk-content {
  max-width: 700px;
  display: flex;
  flex-direction: column;
}

.talk-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.talk-textarea {
  width: 100%;
  height: 250px;
  background-color: #1a202c;
  border: 3px solid #4a5568;
  border-radius: 16px;
  color: #ffffff;
  font-size: 24px;
  padding: 20px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.2);
}

.talk-textarea:focus {
  border-color: #4299e1;
}

.talk-textarea::placeholder {
  color: #718096;
}

.talk-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

.btn-talk-action {
  padding: 16px 24px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, filter 0.2s;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-talk-action:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-talk-action:active {
  transform: scale(0.98);
}

.btn-talk-clear {
  background: #e53e3e;
}

.btn-talk-speak {
  background: linear-gradient(45deg, #2b6cb0, #3182ce);
  flex: 1;
  justify-content: center;
}

/* ==========================================================================
   9. INSTELLINGEN MODULE STYLING
   ========================================================================== */
.settings-content {
  max-width: 500px;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-row label {
  color: #cbd5e0;
  font-size: 16px;
  font-weight: 600;
}

.settings-slider {
  width: 100%;
  accent-color: #4299e1;
  cursor: pointer;
}

.settings-lang-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-setting-lang {
  background: #1a202c;
  border: 2px solid #4a5568;
  color: #ffffff;
  padding: 10px 15px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-setting-lang:hover, .btn-setting-lang.active {
  background: #2b6cb0;
  border-color: #63b3ed;
}

/* ==========================================================================
   10. ANIMATIES
   ========================================================================== */
@keyframes floatUp {
  0% { transform: translateY(100vh) scale(0.8); opacity: 1; }
  100% { transform: translateY(-20vh) scale(1.1); opacity: 0.9; }
}

@keyframes pulse-green {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}