/* ============================================
   Quiz.exe — Cyberpunk Arcade Aesthetic
   ============================================ */

:root {
  --primary: #00f0ff;
  --secondary: #ff00aa;
  --accent: #ffe600;
  --bg-dark: #0a0a1a;
  --bg-panel: #12122a;
  --bg-card: #1a1a3e;
  --text: #e0e8ff;
  --text-dim: #6a6a9a;
  --correct: #00ff88;
  --wrong: #ff3355;
  --font-display: 'Press Start 2P', monospace;
  --font-body: 'Exo 2', sans-serif;
  --glow-primary: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 40px rgba(0, 240, 255, 0.15);
  --glow-secondary: 0 0 10px rgba(255, 0, 170, 0.5), 0 0 40px rgba(255, 0, 170, 0.15);
  --glow-accent: 0 0 10px rgba(255, 230, 0, 0.5), 0 0 40px rgba(255, 230, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-body);
  color: var(--text);
}

/* CRT Scanlines */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

/* Game container */
#game-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-container canvas {
  display: block;
}

/* ============================================
   Overlays
   ============================================ */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(8px);
  animation: overlayIn 0.3s ease-out;
}

.overlay.hidden {
  display: none;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   Glitch Text Effect
   ============================================ */

.glitch-text {
  position: relative;
  font-family: var(--font-display);
  color: var(--primary);
  text-shadow: var(--glow-primary);
  animation: glitch-anim 3s infinite;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch-text::before {
  color: var(--secondary);
  animation: glitch-1 0.3s infinite;
  clip-path: inset(20% 0 60% 0);
  z-index: -1;
}

.glitch-text::after {
  color: var(--accent);
  animation: glitch-2 0.3s infinite reverse;
  clip-path: inset(60% 0 10% 0);
  z-index: -1;
}

@keyframes glitch-1 {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, 1px); }
  80% { transform: translate(2px, -2px); }
}

@keyframes glitch-2 {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(3px, -2px); }
  40% { transform: translate(-3px, 1px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(-2px, -1px); }
}

@keyframes glitch-anim {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.8; transform: skewX(-2deg); }
  97% { opacity: 1; transform: skewX(0); }
  98% { opacity: 0.9; transform: skewX(1deg); }
}

/* ============================================
   Setup Panel
   ============================================ */

.setup-panel {
  background: var(--bg-panel);
  border: 2px solid var(--primary);
  box-shadow: var(--glow-primary), inset 0 0 60px rgba(0, 240, 255, 0.03);
  border-radius: 4px;
  padding: 28px 32px;
  max-width: 780px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.setup-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--secondary), var(--primary), var(--accent));
}

.setup-panel::-webkit-scrollbar {
  width: 6px;
}

.setup-panel::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

.setup-panel::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.setup-title {
  text-align: center;
  font-size: 14px;
  margin-bottom: 28px;
  letter-spacing: 4px;
}

.setup-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-label {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--secondary);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: var(--glow-secondary);
}

/* Style grid (quizmaster stijl) */
.style-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.style-btn {
  background: var(--bg-card);
  border: 1px solid rgba(255, 0, 170, 0.2);
  color: rgba(255,255,255,0.7);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  padding: 14px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  line-height: 1.4;
}

.style-btn:hover {
  transform: translateY(-2px);
  border-color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 12%, transparent);
  color: var(--secondary);
}

.style-btn.selected {
  border-color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 18%, transparent);
  color: var(--secondary);
  box-shadow: 0 0 12px color-mix(in srgb, var(--secondary) 50%, transparent),
              0 0 40px color-mix(in srgb, var(--secondary) 15%, transparent);
}

/* Theme grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.theme-btn {
  background: var(--bg-card);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  padding: 16px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  line-height: 1.4;
}

.theme-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.2);
}

/* Per-theme colors */
.theme-ai  { --t: #00f0ff; }
.theme-game { --t: #ff6b35; }
.theme-sd  { --t: #a855f7; }
.theme-ict { --t: #22c55e; }
.theme-tech { --t: #f59e0b; }

.theme-btn {
  border-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
}

.theme-btn:hover {
  border-color: var(--t, var(--primary));
  background: color-mix(in srgb, var(--t, var(--primary)) 12%, transparent);
  color: var(--t, var(--primary));
}

.theme-btn.selected {
  border-color: var(--t, var(--primary));
  background: color-mix(in srgb, var(--t, var(--primary)) 18%, transparent);
  color: var(--t, var(--primary));
  box-shadow: 0 0 12px color-mix(in srgb, var(--t, var(--primary)) 50%, transparent),
              0 0 40px color-mix(in srgb, var(--t, var(--primary)) 15%, transparent);
}

.custom-theme-row {
  margin-top: 4px;
}

/* Neon input */
.neon-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 3px;
  outline: none;
  transition: all 0.2s ease;
}

.neon-input:focus {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.neon-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

/* Neon select */
.neon-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%2300f0ff' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: all 0.2s ease;
}

.neon-select:focus {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

.neon-select option {
  background: var(--bg-dark);
  color: var(--text);
}

.style-info {
  margin-top: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--primary);
  opacity: 0.75;
  min-height: 20px;
  transition: opacity 0.2s ease;
}

/* Difficulty & type buttons */
.difficulty-row {
  display: flex;
  gap: 8px;
}

.modifier-row {
  flex-wrap: wrap;
}

/* Tooltip op modifier knoppen */
.modifier-btn {
  position: relative;
}

/* Generieke tooltip voor elk element met data-tooltip */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #0d0d2a;
  border: 2px solid var(--primary);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  white-space: normal;
  width: 210px;
  text-align: center;
  padding: 10px 14px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5), 0 4px 20px rgba(0,0,0,0.7);
  z-index: 9999;
  line-height: 1.5;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

.diff-btn, .type-btn, .mod-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  padding: 16px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.diff-btn:hover, .type-btn:hover, .mod-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.diff-btn.selected, .type-btn.selected, .mod-btn.selected {
  border-color: var(--accent);
  background: rgba(255, 230, 0, 0.12);
  color: var(--accent);
  box-shadow: var(--glow-accent);
}

/* Start button */
.start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 24px;
  padding: 16px 32px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(255, 0, 170, 0.15));
  border: 2px solid var(--primary);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 3px;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  text-shadow: var(--glow-primary);
  box-shadow: var(--glow-primary);
}

.start-btn::before {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(0, 240, 255, 0.08) 50%,
    transparent 70%
  );
  animation: btnShine 3s infinite linear;
}

@keyframes btnShine {
  from { transform: translateX(-30%) translateY(-30%) rotate(0deg); }
  to { transform: translateX(30%) translateY(30%) rotate(0deg); }
}

.start-btn:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(255, 0, 170, 0.25));
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 60px rgba(0, 240, 255, 0.15);
}

.start-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 18px;
}

/* ============================================
   Loading Panel
   ============================================ */

.loading-panel {
  text-align: center;
  padding: 40px;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 24px;
  border: 3px solid var(--bg-card);
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--primary);
  text-shadow: var(--glow-primary);
  margin-bottom: 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading-bar-container {
  width: 300px;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  margin: 0 auto;
  overflow: hidden;
}

.loading-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--primary);
}

/* ============================================
   Character Reveal
   ============================================ */

.character-panel {
  text-align: center;
  padding: 40px;
  background: var(--bg-panel);
  border: 2px solid var(--secondary);
  box-shadow: var(--glow-secondary);
  border-radius: 4px;
  max-width: 500px;
  width: 90%;
  animation: characterReveal 0.5s ease-out;
}

@keyframes characterReveal {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.character-emoji {
  font-size: 54px;
  line-height: 1;
  text-align: center;
  word-break: break-all;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.character-name {
  font-size: 20px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.character-catchphrase {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  color: var(--accent);
  text-shadow: var(--glow-accent);
  margin-bottom: 8px;
}

.character-desc {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

/* ============================================
   Quiz Panel
   ============================================ */

.quiz-panel {
  width: 95%;
  max-width: 700px;
  max-height: 98vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 24px;
  background: var(--bg-panel);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.06), inset 0 0 60px rgba(0, 0, 0, 0.2);
}

.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  align-items: stretch;
}

.quit-btn {
  background: var(--bg-card);
  border: 1px solid rgba(255, 51, 85, 0.3);
  color: var(--wrong);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
}

.quit-btn:hover {
  background: rgba(255, 51, 85, 0.15);
  border-color: var(--wrong);
  box-shadow: 0 0 10px rgba(255, 51, 85, 0.3);
}

.quiz-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid rgba(0, 240, 255, 0.2);
  padding: 8px 20px;
  border-radius: 4px;
  flex: 1;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--primary);
  text-shadow: var(--glow-primary);
}

.streak-stat .stat-value {
  color: var(--accent);
  text-shadow: var(--glow-accent);
}

/* Timer */
.timer-container {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.timer-text {
  position: absolute;
  right: 0;
  top: -22px;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--correct);
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.timer-text.warning {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
}

.timer-text.danger {
  color: var(--wrong);
  text-shadow: 0 0 8px rgba(255, 51, 85, 0.4);
  animation: timerPulse 0.5s ease infinite;
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--correct), var(--primary));
  border-radius: 3px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.timer-bar.warning {
  background: linear-gradient(90deg, var(--accent), orange);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.3);
}

.timer-bar.danger {
  background: linear-gradient(90deg, var(--wrong), #ff6600);
  box-shadow: 0 0 10px rgba(255, 51, 85, 0.3);
  animation: timerPulse 0.5s ease infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Quiz character bar (avatar + intro) */
.quiz-char-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.quiz-char-avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}

.quiz-char-avatar .char-avatar-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  image-rendering: pixelated;
  border-radius: 50%;
}

/* Quiz intro — speech bubble */
.quiz-intro {
  font-family: var(--font-body);
  font-size: 15px;
  font-style: italic;
  color: var(--secondary);
  flex: 1;
  background: var(--bg-card);
  border: 1px solid rgba(255, 0, 170, 0.35);
  border-radius: 12px 12px 12px 4px;
  padding: 10px 14px;
  position: relative;
  min-height: 24px;
  line-height: 1.5;
}

/* Tail pointing left naar de avatar */
.quiz-intro::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 8px 10px 8px 0;
  border-style: solid;
  border-color: transparent rgba(255, 0, 170, 0.35) transparent transparent;
}

.quiz-intro::after {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 7px 9px 7px 0;
  border-style: solid;
  border-color: transparent var(--bg-card) transparent transparent;
}

.quiz-question {
  font-family: var(--font-body);
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 800;
  text-align: center;
  color: var(--text);
  margin-bottom: 28px;
  line-height: 1.5;
  padding: 22px 20px;
  background: var(--bg-card);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 4px;
}

/* Answer buttons */
.quiz-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.answer-btn {
  background: var(--bg-card);
  border: 2px solid rgba(0, 240, 255, 0.2);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 18px;
  padding: 18px 16px 18px 56px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
}

.answer-label {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  background: rgba(0, 240, 255, 0.08);
  border-right: 1px solid rgba(0, 240, 255, 0.15);
  color: var(--primary);
  transition: all 0.15s ease;
}

.answer-text {
  flex: 1;
}


.answer-btn:hover:not(.disabled) {
  border-color: var(--primary);
  background: rgba(0, 240, 255, 0.06);
  transform: translateY(-2px);
  box-shadow: var(--glow-primary);
}

.answer-btn:hover:not(.disabled) .answer-label {
  background: rgba(0, 240, 255, 0.18);
  color: var(--primary);
}

.answer-btn.correct .answer-label {
  background: rgba(0, 255, 136, 0.25);
  color: var(--correct);
  border-right-color: rgba(0, 255, 136, 0.3);
}

.answer-btn.wrong .answer-label {
  background: rgba(255, 51, 85, 0.25);
  color: var(--wrong);
  border-right-color: rgba(255, 51, 85, 0.3);
}

.answer-btn.correct {
  border-color: var(--correct);
  background: rgba(0, 255, 136, 0.15);
  color: var(--correct);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
  animation: correctPop 0.4s ease;
}

@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.answer-btn.wrong {
  border-color: var(--wrong);
  background: rgba(255, 51, 85, 0.15);
  color: var(--wrong);
  animation: wrongShake 0.4s ease;
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.answer-btn.disabled {
  cursor: default;
  opacity: 0.4;
}

/* Feedback */
.quiz-feedback {
  text-align: center;
  padding: 16px;
  background: var(--bg-panel);
  border-radius: 4px;
  border: 1px solid rgba(0, 240, 255, 0.15);
  animation: feedbackIn 0.3s ease;
}

.quiz-feedback.hidden {
  display: none;
}

@keyframes feedbackIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.feedback-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.feedback-explanation {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.next-btn {
  display: inline-block;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(255, 0, 170, 0.12));
  border: 2px solid var(--primary);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 13px;
  padding: 16px 48px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 3px;
  transition: all 0.2s ease;
  text-shadow: var(--glow-primary);
  box-shadow: var(--glow-primary);
}

.next-btn:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(255, 0, 170, 0.22));
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.45), 0 0 60px rgba(0, 240, 255, 0.15);
}

.next-btn:active {
  transform: translateY(0);
}

.next-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* ============================================
   Game Over Panel
   ============================================ */

.gameover-panel {
  text-align: center;
  padding: 36px;
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  box-shadow: var(--glow-accent);
  border-radius: 4px;
  max-width: 520px;
  width: 90%;
  animation: characterReveal 0.5s ease-out;
}

.gameover-title {
  font-size: 24px;
  margin-bottom: 16px;
  color: var(--accent);
  text-shadow: var(--glow-accent);
}

/* Avatar op game over scherm */
.gameover-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.gameover-avatar-wrap .char-avatar-img {
  border-radius: 50%;
  border: 3px solid var(--primary);
  object-fit: cover;
  image-rendering: pixelated;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.5), 0 0 60px rgba(0, 240, 255, 0.15);
  animation: ringPulse 2.5s ease-in-out infinite;
}

.gameover-avatar-wrap:not(:empty) {
  font-size: 80px;
  line-height: 1;
}

.rank-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.rank-icon {
  font-size: 64px;
  animation: bounce 1.5s ease infinite;
}

.rank-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 4px;
  text-shadow: var(--glow-accent);
}

.player-title {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 800;
  color: var(--secondary);
  text-shadow: var(--glow-secondary);
  margin-bottom: 20px;
  font-style: italic;
}

.final-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.final-score-label {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 4px;
}

.final-score-value {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--primary);
  text-shadow: var(--glow-primary);
}

.final-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 20px;
}

.final-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.final-stat-value {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--primary);
}

.final-stat-label {
  font-family: var(--font-display);
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-top: 4px;
}

.gameover-story {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 12px;
  padding: 0 8px;
}

.gameover-closer {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--accent);
  text-shadow: var(--glow-accent);
  margin-bottom: 20px;
  letter-spacing: 1px;
}

.gameover-buttons {
  display: flex;
  gap: 10px;
}

.gameover-buttons .start-btn {
  flex: 1;
}

.home-btn {
  border-color: var(--secondary) !important;
  color: var(--secondary) !important;
  text-shadow: var(--glow-secondary) !important;
  box-shadow: var(--glow-secondary) !important;
}

/* ============================================
   Fun Fact Panel
   ============================================ */

.funfact-panel {
  text-align: center;
  padding: 40px;
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  box-shadow: var(--glow-accent);
  border-radius: 4px;
  max-width: 500px;
  width: 90%;
  animation: characterReveal 0.5s ease-out;
}

.funfact-panel.opleiding {
  border-color: var(--secondary);
  box-shadow: var(--glow-secondary);
}

.funfact-emoji {
  font-size: 56px;
  margin-bottom: 12px;
  animation: bounce 1s ease infinite;
}

.funfact-title {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--accent);
  text-shadow: var(--glow-accent);
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.funfact-panel.opleiding .funfact-title {
  color: var(--secondary);
  text-shadow: var(--glow-secondary);
}

.funfact-text {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 24px;
}

.funfact-btn {
  margin-top: 0 !important;
}

/* ============================================
   Score popup animation
   ============================================ */

.score-popup {
  position: fixed;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--accent);
  text-shadow: var(--glow-accent);
  pointer-events: none;
  z-index: 200;
  animation: scoreFloat 1s ease-out forwards;
}

@keyframes scoreFloat {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(1.3); opacity: 0; }
}

/* Streak flash */
.streak-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
  animation: streakFlash 0.6s ease-out forwards;
}

@keyframes streakFlash {
  0% { background: rgba(255, 230, 0, 0.2); }
  100% { background: transparent; }
}

/* ============================================
   Rank colors
   ============================================ */

.rank-bronze { --accent: #cd7f32; }
.rank-silver { --accent: #c0c0c0; }
.rank-gold { --accent: #ffd700; }
.rank-platinum { --accent: #e5e4e2; }
.rank-diamond { --accent: #b9f2ff; }

/* ============================================
   Loading question state
   ============================================ */

.quiz-question.loading-question {
  color: transparent;
  animation: pulse 1s ease-in-out infinite;
  position: relative;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-question.loading-question::after {
  content: '⚡ AI genereert je vraag...';
  position: absolute;
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-body);
  text-shadow: var(--glow-primary);
  letter-spacing: 1px;
}

/* ============================================
   Avatar
   ============================================ */

.avatar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.avatar-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 3px solid var(--primary);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 60px rgba(0, 240, 255, 0.15),
              inset 0 0 30px rgba(0, 240, 255, 0.05);
  animation: ringPulse 2s ease-in-out infinite;
  position: relative;
}

.avatar-ring::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, 0.2);
  animation: ringPulse 2s ease-in-out infinite reverse;
}

@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), 0 0 60px rgba(0, 240, 255, 0.15), inset 0 0 30px rgba(0, 240, 255, 0.05); }
  50% { box-shadow: 0 0 30px rgba(0, 240, 255, 0.6), 0 0 80px rgba(0, 240, 255, 0.25), inset 0 0 30px rgba(0, 240, 255, 0.08); }
}

#avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  image-rendering: pixelated;
}

.avatar-desc-label {
  margin-top: 8px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  max-width: 200px;
}

/* ============================================
   Highscore Submit
   ============================================ */

.highscore-submit {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  align-items: center;
}

.highscore-submit .neon-input {
  flex: 1;
}

.highscore-submit .next-btn {
  white-space: nowrap;
}

.highscore-submit.hidden {
  display: none;
}

/* ============================================
   Leaderboard
   ============================================ */

.leaderboard {
  margin: 16px 0;
  background: var(--bg-card);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 4px;
  padding: 16px;
  max-height: 250px;
  overflow-y: auto;
}

.leaderboard-title {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--accent);
  text-shadow: var(--glow-accent);
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-align: center;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto 70px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(0, 240, 255, 0.03);
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
}

.leaderboard-row.top-3 {
  background: rgba(255, 230, 0, 0.06);
  border: 1px solid rgba(255, 230, 0, 0.15);
}

.lb-rank {
  text-align: center;
  font-size: 16px;
}

.lb-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.lb-avatar-emoji {
  font-size: 20px;
  flex-shrink: 0;
}

.lb-theme {
  color: var(--text-dim);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

.lb-diff {
  font-family: var(--font-display);
  font-size: 7px;
  color: var(--secondary);
  letter-spacing: 1px;
}

.lb-score {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--accent);
  text-shadow: var(--glow-accent);
  text-align: right;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 700px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quiz-answers {
    grid-template-columns: 1fr;
  }

  .setup-title {
    font-size: 12px;
  }

  .quiz-question {
    font-size: 20px;
  }

  .difficulty-row {
    flex-wrap: wrap;
  }
}

/* ============================================
   MINI-GAME OVERLAY
   ============================================ */

.minigame-panel {
  background: var(--bg-panel);
  border: 2px solid var(--secondary);
  box-shadow: 0 0 14px rgba(255,0,170,.4), 0 0 50px rgba(255,0,170,.12);
  border-radius: 12px;
  padding: 24px 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 500px;
  width: 96%;
  animation: panel-in .25s ease-out;
}

.minigame-header {
  text-align: center;
  line-height: 1.3;
}

.minigame-eyebrow {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--secondary);
  letter-spacing: .12em;
  margin-bottom: 6px;
  animation: pulse-glow 1.2s ease-in-out infinite alternate;
}

.minigame-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--primary);
  text-shadow: var(--glow-primary);
  letter-spacing: .06em;
}

.minigame-stats {
  display: flex;
  gap: 20px;
  align-items: center;
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--text-dim);
  flex-wrap: wrap;
  justify-content: center;
}

.mg-val {
  color: var(--primary);
  font-size: 11px;
}

.mg-bonus {
  color: var(--accent);
  font-size: 11px;
  text-shadow: 0 0 10px rgba(255,230,0,.6);
  min-height: 1em;
  animation: pop-in .3s ease-out;
}

#minigame-canvas {
  border: 2px solid var(--primary);
  box-shadow: 0 0 12px rgba(0,240,255,.25);
  border-radius: 6px;
  display: block;
  max-width: 100%;
  cursor: none;
}

.mg-controls {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  min-height: 1.2em;
}

.skip-btn {
  background: transparent;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 9px;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
  letter-spacing: .08em;
}

.skip-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

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