:root {
  --ink: #1d2b53;
  --sun: #ffd23f;
  --pink: #ff5d8f;
  --mint: #06d6a0;
  --sky: #4cc9f0;
  --card: #fffdf7;
  --good: #2ec27e;
  --bad: #ff5d5d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 30% 20%, #6a4be0, #2b1d6e 60%, #150f45);
}
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(2px 2px at 90px 120px, #ffe9a8, transparent),
    radial-gradient(1.5px 1.5px at 150px 60px, #fff, transparent),
    radial-gradient(2px 2px at 60px 170px, #cfe8ff, transparent);
  background-size: 190px 200px;
  opacity: .7;
}
#globe { position: fixed; left: 0; top: 0; width: 100%; height: 100%; }

/* knoppen */
.btn {
  border: 0; border-bottom: 5px solid rgba(0, 0, 0, .22);
  border-radius: 999px;
  padding: .55em 1.1em;
  font: inherit; font-size: 1.1rem; font-weight: 800;
  color: var(--ink); background: var(--sun);
  cursor: pointer;
  transition: transform .1s;
}
.btn:active { transform: translateY(3px); border-bottom-width: 2px; }
.btn.pink { background: var(--pink); color: #fff; }
.btn.mint { background: var(--mint); }
.btn.sky { background: var(--sky); }
.btn.white { background: #fff; }

#top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px;
  pointer-events: none;
}
#top > * { pointer-events: auto; }
#top .brand { display: flex; flex-direction: column; }
.credit { margin: 2px 0 0 4px; color: #ffe9a8; font-weight: 800; font-size: .95rem; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
#top h1 { margin: 0; color: #fff; font-size: 1.8rem; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
#top nav { display: flex; flex-wrap: wrap; gap: 8px; }

#hint {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 5;
  margin: 0; padding: .5em 1.2em;
  background: rgba(255, 255, 255, .92); border-radius: 999px;
  font-weight: 800; font-size: 1.05rem; text-align: center; max-width: 92vw;
  pointer-events: none;
}

/* vlag-knoppen op de bol */
.flag {
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1;
  background: #fff; border: 3px solid #fff; border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
  cursor: pointer; pointer-events: auto;
  transition: transform .15s;
}
.flag:hover { transform: scale(1.3); }
.flag.special {
  width: 54px; height: 54px; font-size: 32px;
  border-color: var(--sun);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 63, .8), 0 3px 8px rgba(0, 0, 0, .35); }
  50% { box-shadow: 0 0 0 14px rgba(255, 210, 63, 0), 0 3px 8px rgba(0, 0, 0, .35); }
}

body.far .flag.small { display: none; }

/* landenkaart */
#card {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: 396px; z-index: 20;
  background: var(--card); border-radius: 28px; padding: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
  overflow-y: auto;
  animation: slidein .35s ease-out;
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
#card .close {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: #ffe3ea; font-size: 1.1rem; cursor: pointer;
}
.hero { text-align: center; padding-top: 8px; }
.bigflag { font-size: 6.5rem; line-height: 1.1; }
.hero h2 { margin: 4px 0 10px; font-size: 2rem; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; }
.pill { padding: .35em .9em; border-radius: 999px; font-weight: 700; background: #e7f6ff; }
.pill.cap { background: #fff0b8; }
.speak { width: 100%; font-size: 1.3rem; padding: .6em; }
.speak.on { background: var(--bad); color: #fff; }
.blk { margin-top: 16px; }
.blk h3 { margin: 0 0 6px; font-size: 1.15rem; }
.blk p { margin: 0; font-size: 1.15rem; line-height: 1.5; }
.chips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.chips li { padding: .6em .9em; border-radius: 16px; font-size: 1.15rem; font-weight: 700; background: #fff0b8; }
.chips li:nth-child(2) { background: #d6f5ec; }
.chips li:nth-child(3) { background: #ffe0ea; }
.chips li:nth-child(4) { background: #e2e0ff; }
.chips li:nth-child(5) { background: #d9f1ff; }
.special-box { margin-top: 18px; padding: 14px; border-radius: 22px; background: linear-gradient(135deg, #d9f1ff, #fff0b8); border: 3px dashed var(--sky); }
.special-box > h3 { margin: 0 0 4px; font-size: 1.3rem; }
.words { display: grid; gap: 6px; margin-top: 6px; }
.word { display: flex; justify-content: space-between; gap: 10px; background: #fff; border-radius: 14px; padding: .5em .8em; font-size: 1.1rem; }
.word b { color: #1f6fb2; }

/* quiz */
#quiz {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 12px;
  background: rgba(21, 15, 69, .88);
  backdrop-filter: blur(4px);
}
#quiz-box {
  position: relative; width: 100%; max-width: 660px; max-height: 100%; overflow-y: auto;
  background: var(--card); border-radius: 28px; padding: 22px; text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
#quiz-box h2 { margin: 0 0 12px; font-size: 1.9rem; }
.qx { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #ffe3ea; font-size: 1.1rem; cursor: pointer; }
.levels { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.lvl { background: #eee; font-size: 1rem; }
.lvl.on { background: var(--sun); outline: 3px solid var(--ink); }
.menu { display: grid; gap: 12px; }
.menu .btn { font-size: 1.4rem; padding: .8em; }
.qmeta { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 6px; padding-right: 52px; }
.bar { height: 12px; background: #e6e1f5; border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.bar i { display: block; height: 100%; background: var(--mint); transition: width .3s; }
.qbig { font-size: 7rem; line-height: 1.15; }
.qtext { font-size: 1.6rem; font-weight: 800; margin: 6px 0 14px; }
.qspeak { font-size: 1.1rem; margin-bottom: 12px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  min-height: 84px; padding: .6em; font: inherit; font-size: 1.35rem; font-weight: 800;
  border: 0; border-bottom: 6px solid rgba(0, 0, 0, .15); border-radius: 22px;
  background: #e7f6ff; color: var(--ink); cursor: pointer;
}
.opt:nth-child(2) { background: #ffe0ea; }
.opt:nth-child(3) { background: #d6f5ec; }
.opt:nth-child(4) { background: #fff0b8; }
.opt.flagopt { font-size: 3.6rem; line-height: 1.1; }
.opt:disabled { cursor: default; }
.opt.ok { background: var(--good) !important; color: #fff; animation: pop .4s; }
.opt.bad { background: var(--bad) !important; color: #fff; animation: shake .4s; }
.feedback { min-height: 2.2em; font-size: 1.4rem; font-weight: 800; margin: 14px 0 6px; }
.next { font-size: 1.4rem; padding: .7em 1.6em; }
.score { font-size: 3rem; margin: 6px 0; }
.stars { font-size: 2.6rem; letter-spacing: 4px; }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.conf { position: fixed; top: -40px; font-size: 2rem; z-index: 60; pointer-events: none; animation: fall 1.7s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }

#toast {
  position: fixed; left: 50%; top: 80px; transform: translate(-50%, -20px); z-index: 70;
  padding: .7em 1.2em; border-radius: 999px; background: #fff; font-weight: 800; font-size: 1.1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3); opacity: 0; pointer-events: none; transition: .25s;
  max-width: 92vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 801px) {
  body.card-open #top { right: 420px; }
}
@media (max-width: 800px) {
  #top h1 { font-size: 1.4rem; }
  #top nav { width: 100%; gap: 6px; }
  .btn { font-size: .9rem; padding: .45em .8em; }
  body.card-open #top .brand { display: none; }
  #card { left: 0; right: 0; bottom: 0; top: 42%; width: auto; border-radius: 28px 28px 0 0; }
  .bigflag { font-size: 5rem; }
  .qbig { font-size: 5.5rem; }
  .opt { font-size: 1.15rem; min-height: 72px; }
  .opt.flagopt { font-size: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .flag.special, #card, .opt.ok, .opt.bad { animation: none; }
}
