/* ── WK Quiz 2026 — styling ──────────────────────────────────────
 * Basis = 800x600 logische layout. CSS gebruikt clamp() en min(800px, vw)
 * zodat de stage past op desktop, mobiel én fullscreen zonder scrollbars. */

:root {
  --orange: #ff7a1a;
  --orange-dark: #e35a00;
  --green: #2fa84f;
  --green-dark: #1e7a39;
  --grass-1: #41b964;
  --grass-2: #2f9c50;
  --blue: #0b67c2;
  --yellow: #ffd33a;
  --white: #ffffff;
  --cream: #fff8ea;
  --dark: #1f2937;
  --dark-soft: #2c3543;
  --correct: #1e9c4a;
  --wrong: #c92a2a;
  --shadow: 0 6px 0 rgba(31, 41, 55, 0.16), 0 14px 28px rgba(31, 41, 55, 0.18);
  --shadow-soft: 0 3px 0 rgba(31, 41, 55, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #0b1d3a;
  color: var(--dark);
  font-family: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ── App-shell: vol viewport, centreert de stage ─────────────────────── */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
}

/* ── Stage: logisch 800x600, scale-to-fit via container-units ────────── */
.stage {
  position: relative;
  width: min(100vw, calc((100vh) * (800 / 600)));
  height: min(100vh, calc((100vw) * (600 / 800)));
  max-width: 100vw;
  max-height: 100dvh;
  background: transparent;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
  z-index: 1;
}

/* Op echt kleine schermen (mobiel portrait) gebruiken we 100% width en
 * laten we de inhoud zelf scrollvrij stapelen via flexbox. */
@media (max-aspect-ratio: 800/600) {
  .stage {
    width: 100vw;
    height: 100dvh;
  }
}

/* ── Achtergrond: stadiongras + sky + confetti ───────────────────────── */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg__sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 600px at 20% 0%, #4e8ed8 0%, transparent 60%),
    radial-gradient(900px 600px at 80% 0%, #6aa6e6 0%, transparent 60%),
    linear-gradient(180deg, #2b69b3 0%, #3f88d6 55%, #5b9ddc 100%);
}
.bg__pitch {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  background:
    linear-gradient(180deg, var(--grass-1) 0%, var(--grass-2) 100%);
}
.bg__lines {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52%;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) 80px,
      rgba(255, 255, 255, 0.08) 80px,
      rgba(255, 255, 255, 0.08) 160px
    );
  pointer-events: none;
}
.bg__confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bg__confetti span {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.8;
  animation: confettiFall 9s linear infinite;
}
.bg__confetti span:nth-child(1)  { left: 8%;  background: var(--orange); animation-delay: -1s; }
.bg__confetti span:nth-child(2)  { left: 18%; background: var(--yellow); animation-delay: -3s; }
.bg__confetti span:nth-child(3)  { left: 28%; background: var(--white);  animation-delay: -5s; }
.bg__confetti span:nth-child(4)  { left: 38%; background: var(--blue);   animation-delay: -7s; }
.bg__confetti span:nth-child(5)  { left: 48%; background: var(--orange); animation-delay: -2s; }
.bg__confetti span:nth-child(6)  { left: 58%; background: var(--yellow); animation-delay: -4s; }
.bg__confetti span:nth-child(7)  { left: 68%; background: var(--white);  animation-delay: -6s; }
.bg__confetti span:nth-child(8)  { left: 78%; background: var(--green);  animation-delay: -8s; }
.bg__confetti span:nth-child(9)  { left: 88%; background: var(--orange); animation-delay: -0.5s; }
.bg__confetti span:nth-child(10) { left: 14%; background: var(--blue);   animation-delay: -2.5s; }
.bg__confetti span:nth-child(11) { left: 64%; background: var(--yellow); animation-delay: -4.5s; }
.bg__confetti span:nth-child(12) { left: 84%; background: var(--white);  animation-delay: -6.5s; }
@keyframes confettiFall {
  0%   { transform: translateY(-10vh) rotate(0); }
  100% { transform: translateY(110vh) rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) {
  .bg__confetti span { animation: none; }
}

/* ── Fullscreen knop ─────────────────────────────────────────────────── */
.icon-btn {
  position: absolute;
  top: clamp(8px, 1.5vh, 14px);
  right: clamp(8px, 1.5vw, 14px);
  z-index: 10;
  width: clamp(36px, 6vmin, 44px);
  height: clamp(36px, 6vmin, 44px);
  border-radius: 50%;
  border: 2px solid var(--dark);
  background: var(--white);
  font-size: clamp(16px, 3vmin, 20px);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s ease, background 0.15s ease;
}
.icon-btn:hover { background: var(--cream); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

/* ── Scherm-container ────────────────────────────────────────────────── */
.screen {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vmin, 28px);
  min-height: 0;
}

/* ── Card: standaard panel ───────────────────────────────────────────── */
.card {
  background: var(--cream);
  border: 4px solid var(--dark);
  border-radius: clamp(18px, 3vmin, 26px);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3.5vmin, 28px);
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vmin, 14px);
  min-height: 0;
}

/* ── Startscherm ─────────────────────────────────────────────────────── */
.start {
  text-align: center;
  align-items: center;
}
/* ── Quiz-logo (herbruikbare component, 2 varianten) ─────────────────── */
.quiz-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
  font-weight: 900;
  line-height: 1;
  color: var(--dark);
}
.quiz-logo-text {
  letter-spacing: -0.5px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}
.quiz-year-badge {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  border: 3px solid var(--dark);
  border-radius: 12px;
  padding: 4px 12px;
  transform: rotate(-2deg);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
/* Large variant — gebruikt op startscherm */
.quiz-logo--large .quiz-logo-text {
  font-size: clamp(26px, 6vw, 44px);
}
.quiz-logo--large .quiz-year-badge {
  font-size: clamp(22px, 5vw, 36px);
}
/* Small variant — gebruikt in de in-quiz header. Tekst is hier "WK Quiz"
 * dus er is meer ruimte voor groter formaat. Voelt meer als logo dan
 * als labeltje. */
.quiz-logo--small {
  gap: 8px;
}
.quiz-logo--small .quiz-logo-text {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 900;
  letter-spacing: -0.5px;
}
.quiz-logo--small .quiz-year-badge {
  font-size: clamp(22px, 3.6vw, 30px);
  padding: 4px 10px;
  border-radius: 9px;
  border-width: 2px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
@media (max-width: 480px) {
  .quiz-logo--small {
    gap: 6px;
  }
  .quiz-logo--small .quiz-logo-text {
    font-size: 22px;
  }
  .quiz-logo--small .quiz-year-badge {
    font-size: 20px;
    padding: 3px 8px;
  }
}
.intro {
  font-size: clamp(14px, 2.5vmin, 18px);
  font-weight: 700;
  color: var(--dark-soft);
  margin: 0;
  line-height: 1.4;
}
.level-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 2vmin, 16px);
  width: 100%;
}
@media (max-width: 540px) {
  .level-grid { grid-template-columns: 1fr; }
}
.level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: clamp(14px, 2.5vmin, 22px) clamp(12px, 2.5vmin, 18px);
  border: 4px solid var(--dark);
  border-radius: clamp(14px, 2.5vmin, 18px);
  font-weight: 900;
  font-size: clamp(18px, 3.4vmin, 22px);
  color: var(--white);
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, filter 0.15s ease;
  text-align: center;
  min-height: 64px;
}
.level-btn--easy {
  background: linear-gradient(180deg, #4cc171, var(--green));
}
.level-btn--hard {
  background: linear-gradient(180deg, #ff994b, var(--orange-dark));
}
.level-btn:hover { filter: brightness(1.05); }
.level-btn:active { transform: translateY(3px); box-shadow: var(--shadow-soft); }
.level-btn:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.level-btn__sub {
  display: block;
  font-size: clamp(11px, 1.8vmin, 13px);
  font-weight: 700;
  opacity: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}
.rules {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(6px, 1.4vmin, 10px) clamp(10px, 2vmin, 16px);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(12px, 2vmin, 14px);
  font-weight: 700;
  color: var(--dark-soft);
}
.rules li::before {
  content: '⚽';
  margin-right: 4px;
}

/* ── Game-header (in-card) ───────────────────────────────────────────── */
/* Compacte header bovenin de quiz-card op vraag-, feedback- en eindscherm.
 * 3-koloms grid waarbij links/rechts 1fr zijn → titel staat altijd
 * perfect gecentreerd ongeacht knop-breedte. */
.game-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(6px, 1.5vmin, 12px);
  margin-bottom: clamp(2px, 1vmin, 6px);
}
.home-btn {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 2.5px solid var(--dark);
  border-radius: 999px;
  padding: clamp(5px, 1.4vmin, 8px) clamp(10px, 2vmin, 14px);
  font-weight: 800;
  font-size: clamp(12px, 2vmin, 14px);
  color: var(--dark);
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s ease, background 0.15s ease;
  min-height: 36px;
}
.home-btn:hover { background: var(--cream); }
.home-btn:active { transform: translateY(2px); }
.home-btn:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.game-header .quiz-logo {
  justify-self: center;
}
.game-header__spacer {
  justify-self: end;
}

/* Mobile: home-knop wordt icon-only zodat titel ruimte houdt */
@media (max-width: 480px) {
  .home-btn__text { display: none; }
  .home-btn {
    padding: 6px 10px;
    font-size: 16px;
  }
}

/* ── Vraagscherm ─────────────────────────────────────────────────────── */
.qhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}
.pill {
  background: var(--white);
  border: 2.5px solid var(--dark);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 900;
  font-size: clamp(11px, 2vmin, 13px);
  letter-spacing: 0.04em;
  color: var(--dark);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill__num {
  font-size: clamp(13px, 2.4vmin, 16px);
  letter-spacing: 0;
  text-transform: none;
  color: var(--orange-dark);
}
.progress {
  width: 100%;
  height: 10px;
  background: rgba(31, 41, 55, 0.12);
  border: 2px solid var(--dark);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), var(--orange));
  transition: width 0.3s ease;
}
.question {
  font-size: clamp(16px, 3.2vmin, 22px);
  font-weight: 900;
  color: var(--dark);
  margin: clamp(6px, 1.5vmin, 12px) 0;
  line-height: 1.3;
  text-align: center;
}
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.5vmin, 12px);
  width: 100%;
}
@media (max-width: 540px) {
  .answers { grid-template-columns: 1fr; }
}
.answer {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.6vmin, 12px);
  padding: clamp(10px, 2vmin, 16px) clamp(12px, 2.4vmin, 18px);
  border: 3px solid var(--dark);
  border-radius: clamp(12px, 2vmin, 16px);
  background: var(--white);
  font-weight: 800;
  font-size: clamp(14px, 2.4vmin, 17px);
  color: var(--dark);
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
  min-height: 52px;
}
.answer:hover:not(:disabled) { background: var(--cream); }
.answer:active:not(:disabled) { transform: translateY(2px); }
.answer:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.answer__letter {
  flex: 0 0 auto;
  width: clamp(28px, 4.5vmin, 34px);
  height: clamp(28px, 4.5vmin, 34px);
  border-radius: 50%;
  background: var(--orange);
  color: var(--white);
  font-weight: 900;
  font-size: clamp(13px, 2.4vmin, 16px);
  display: grid;
  place-items: center;
  border: 2px solid var(--dark);
}
.answer__text { flex: 1 1 auto; min-width: 0; }
.answer:disabled { cursor: default; opacity: 0.95; }
.answer--correct {
  background: #d8f5e0;
  border-color: var(--correct);
}
.answer--correct .answer__letter { background: var(--correct); }
.answer--wrong {
  background: #fde0e0;
  border-color: var(--wrong);
}
.answer--wrong .answer__letter { background: var(--wrong); }
.answer--correct.answer--picked,
.answer--wrong.answer--picked {
  box-shadow: 0 0 0 4px rgba(255, 211, 58, 0.55), var(--shadow-soft);
}

/* ── Feedback-slot: extra lucht tussen feedback en "Volgende vraag" ──── */
.feedback-slot {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.5vmin, 18px);
}

/* ── Feedback ────────────────────────────────────────────────────────── */
.feedback {
  background: var(--white);
  border: 3px solid var(--dark);
  border-radius: clamp(12px, 2vmin, 16px);
  padding: clamp(10px, 2vmin, 14px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: feedbackPop 220ms ease-out;
}
@keyframes feedbackPop {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.feedback--correct { background: #e7faec; border-color: var(--correct); }
.feedback--wrong { background: #fdecec; border-color: var(--wrong); }
.feedback__title {
  font-weight: 900;
  font-size: clamp(15px, 2.6vmin, 18px);
  color: var(--dark);
}
.feedback--correct .feedback__title { color: var(--green-dark); }
.feedback--wrong .feedback__title { color: var(--wrong); }
.feedback__correct {
  font-weight: 800;
  font-size: clamp(13px, 2.2vmin, 15px);
  color: var(--dark);
}
.feedback__explain {
  font-weight: 600;
  font-size: clamp(13px, 2.2vmin, 15px);
  color: var(--dark-soft);
  line-height: 1.4;
}

/* ── Action-row + primary buttons ────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.6vmin, 12px);
  justify-content: center;
  width: 100%;
}
.btn {
  border: 3px solid var(--dark);
  border-radius: 999px;
  padding: clamp(10px, 2vmin, 14px) clamp(16px, 3vmin, 24px);
  font-weight: 900;
  font-size: clamp(14px, 2.4vmin, 16px);
  color: var(--white);
  background: var(--blue);
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, filter 0.15s ease;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: var(--shadow-soft); }
.btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.btn--primary { background: linear-gradient(180deg, #ff994b, var(--orange-dark)); }
.btn--secondary { background: var(--white); color: var(--dark); }

/* ── Eindscherm ──────────────────────────────────────────────────────── */
.end {
  align-items: center;
  text-align: center;
}
.trophy {
  font-size: clamp(40px, 9vmin, 64px);
  line-height: 1;
}
.score-line {
  font-size: clamp(22px, 5vmin, 34px);
  font-weight: 900;
  color: var(--dark);
}
.score-line strong {
  color: var(--orange-dark);
  font-variant-numeric: tabular-nums;
}
.verdict {
  font-size: clamp(14px, 2.5vmin, 18px);
  font-weight: 700;
  color: var(--dark-soft);
  margin: 0;
  line-height: 1.4;
  max-width: 480px;
}

/* ── Sr-only helper ──────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Fullscreen: laat de stage de volledige beschikbare ruimte vullen ── */
:fullscreen .stage,
:-webkit-full-screen .stage {
  width: min(100vw, calc(100vh * (800 / 600)));
  height: min(100vh, calc(100vw * (600 / 800)));
}
