:root{
  --pink:#ff8acb;
  --lilac:#b38cff;
  --bg1:#ffe6f0;
  --bg2:#f3e8ff;
  --muted:#666;
  --card:#fff;
  --opt:#f7f3ff;
  --optHover:#fff0f7;
  --good:#c9f7d6;
  --bad:#ffd6d6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
}

.card {
  background: var(--card);
  padding: 26px;
  border-radius: 24px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  position: relative;
}

h1 {
  margin: 0;
  text-align: center;
  font-weight: 900;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  margin: 14px 0 20px;
}

input, select {
  width: 100%;
  height: 48px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1px solid #ddd;
  font-size: 14px;
  outline: none;
  background: #fff;
}

input:focus, select:focus {
  border-color: color-mix(in srgb, var(--lilac) 55%, #ddd);
  box-shadow: 0 0 0 4px rgba(179, 140, 255, 0.18);
}

/* Buttons */
button {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(90deg, var(--pink), var(--lilac));
  color: white;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease;
}

button:hover { transform: translateY(-1px); opacity: 0.95; }
button:disabled { opacity: 0.55; cursor:not-allowed; transform:none; filter: grayscale(0.15); }

button.secondary{
  background: #fff;
  color: #222;
  border: 1px solid #ddd;
}

.hidden { display: none !important; } /* belangrijk voor popup etc */

/* Slider label + hint */
.slider-label{
  display:block;
  margin: 4px 0 6px;
  font-size: 14px;
  font-weight: 800;
}

.duration-hint{
  font-size: 13px;
  color: #666;
  margin: -4px 0 12px;
}

/* --- Pretty range slider --- */
input[type="range"]{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(179,140,255,0.18);
  outline: none;
  margin: 6px 0 10px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.06);
  padding: 0;
}

/* Track (WebKit) */
input[type="range"]::-webkit-slider-runnable-track{
  height: 14px;
  border-radius: 999px;
  background: transparent; /* we paint via JS for perfect "filled" */
}

/* Thumb (WebKit) */
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(179,140,255,0.9);
  box-shadow: 0 10px 18px rgba(0,0,0,0.18);
  margin-top: -4px;
  cursor: pointer;
}

/* Firefox track */
input[type="range"]::-moz-range-track{
  height: 14px;
  border-radius: 999px;
  background: rgba(179,140,255,0.18);
}

/* Firefox fill */
input[type="range"]::-moz-range-progress{
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--lilac));
}

/* Firefox thumb */
input[type="range"]::-moz-range-thumb{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid rgba(179,140,255,0.9);
  box-shadow: 0 10px 18px rgba(0,0,0,0.18);
  cursor: pointer;
}

/* Focus glow */
input[type="range"]:focus::-webkit-slider-thumb{
  box-shadow: 0 0 0 6px rgba(179,140,255,0.22), 0 10px 18px rgba(0,0,0,0.18);
}
input[type="range"]:focus::-moz-range-thumb{
  box-shadow: 0 0 0 6px rgba(179,140,255,0.22), 0 10px 18px rgba(0,0,0,0.18);
}

/* Quiz */
.question {
  font-weight: 900;
  margin: 4px 0 12px;
  font-size: 16px;
  line-height: 1.35;
}

.option {
  background: var(--opt);
  padding: 12px;
  border-radius: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, filter 180ms ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.option:hover {
  background: var(--optHover);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 28px rgba(0,0,0,0.10);
  filter: brightness(1.02);
}

.option.correct { background: var(--good); }
.option.wrong { background: var(--bad); }

.explain {
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #fff7fb;
  border: 1px solid rgba(179, 140, 255, 0.25);
  color: #444;
  font-size: 13px;
  line-height: 1.4;
}

.hint{
  display:block;
  margin-top:6px;
  color:#666;
  font-size: 12px;
}

/* Footer layout */
.quiz-actions{
  position: relative;
  margin-top: 14px;
  padding-bottom: 20px;
}

.quiz-actions .btn-row{
  display: flex;
  gap: 12px;
}

.quiz-actions .btn-row button{
  flex: 1;
  width: auto;
}

.progress-corner{
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 13px;
  font-weight: 800;
  color: #666;
  white-space: nowrap;
}

/* Loader */
.spinner-wrap{
  padding: 18px 8px 6px;
  text-align: center;
}

.spinner{
  width: 46px;
  height: 46px;
  margin: 8px auto 14px;
  border-radius: 50%;
  border: 6px solid rgba(179,140,255,0.25);
  border-top-color: rgba(255,138,203,0.9);
  animation: spin 0.9s linear infinite;
}

.spinner.small{
  width: 34px;
  height: 34px;
  border-width: 5px;
  margin: 6px auto 12px;
}

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

.loading-text{
  font-weight: 900;
  color: #333;
  margin-bottom: 6px;
}

.loading-sub{
  color: var(--muted);
  font-size: 13px;
}

/* Confetti canvas */
#confettiCanvas{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* Popup */
.popup-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 14px;
}

.popup-card{
  width: min(760px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
}

.popup-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(255,138,203,0.18), rgba(179,140,255,0.18));
}

.popup-title{
  font-weight: 950;
}

.popup-close{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor: pointer;
  padding: 0;
}

.popup-close svg{
  width: 22px;
  height: 22px;
  stroke: #222;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
}

.popup-body{
  padding: 14px;
  color: #222;
}

.popup-content ul{
  margin: 10px 0;
  padding-left: 18px;
}

.popup-box{
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #fff7fb;
  border: 1px solid rgba(179, 140, 255, 0.25);
}

.popup-error{
  color: #b00020;
  font-size: 13px;
  white-space: pre-wrap;
}

.popup-overlay.hidden{
  display:none !important;
}



/* --- Bronkeuze (Onderwerp / Upload) --- */
.source-toggle{
  display:flex;
  gap: 10px;
  margin: 2px 0 12px;
}

.source-pill{
  flex: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  height: 44px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(179,140,255,0.10);
  cursor: pointer;
  user-select: none;
  font-weight: 800;
  color: #333;
}

.source-pill input{
  width: 16px;
  height: 16px;
  margin: 0;
}

.file-hint{
  margin: -4px 0 10px;
  font-size: 12px;
  color: #666;
}

.file-status{
  margin: -2px 0 12px;
  font-size: 12px;
  color: #444;
  background: #fff7fb;
  border: 1px solid rgba(179, 140, 255, 0.25);
  border-radius: 14px;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.file-status.good{ border-color: rgba(0,0,0,0.08); }
.file-status.bad{ border-color: rgba(176,0,32,0.35); color: #b00020; }

