:root {
  --bg: #0f1b2d;
  --panel: #172a44;
  --panel-2: #1f3656;
  --text: #f4f7fb;
  --muted: #9fb2cc;
  --accent: #ffb020;
  --ok: #2ecc8f;
  --bad: #ff5a5f;
  --a0: #ff6b57; /* koraal */
  --a1: #19b7c9; /* teal */
  --a2: #f2b632; /* amber */
  --a3: #7a6cf0; /* indigo */
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 20% 0%, #1d3557 0%, var(--bg) 60%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 18px; text-align: center; }
.logo { font-weight: 900; font-size: 2.4rem; letter-spacing: -1px; }
.logo span { color: var(--accent); }
.card { background: var(--panel); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
input, select, textarea {
  width: 100%; font: inherit; font-size: 1.1rem; padding: 14px; border-radius: 10px;
  border: 2px solid transparent; background: #0c1626; color: var(--text); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.big-input { text-align: center; font-size: 1.6rem; font-weight: 700; letter-spacing: 4px; }
button {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 10px; padding: 14px 18px;
  background: var(--accent); color: #1a1200; font-size: 1.05rem; transition: transform .05s, filter .15s;
}
button:active { transform: scale(.97); }
button:disabled { filter: grayscale(1) brightness(.6); cursor: default; }
button.secondary { background: var(--panel-2); color: var(--text); }
button.danger { background: var(--bad); color: white; }
button.small { padding: 8px 12px; font-size: .9rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.error { color: var(--bad); min-height: 1.2em; font-weight: 600; }
.muted { color: var(--muted); }
.big { font-size: 1.6rem; font-weight: 800; }
.huge { font-size: 3rem; font-weight: 900; }

/* Antwoordknoppen */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.ans { display: flex; align-items: center; gap: 12px; color: white; text-align: left; padding: 18px; border-radius: var(--radius); font-size: 1.2rem; min-height: 80px; }
.ans .letter { flex: none; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-weight: 900; }
.ans.c0 { background: var(--a0); } .ans.c1 { background: var(--a1); } .ans.c2 { background: var(--a2); color: #2b1d00; } .ans.c3 { background: var(--a3); }
.ans.dim { opacity: .3; }
.ans.right { outline: 4px solid white; }

/* Speler */
.player-answers { flex: 1; width: 100%; max-width: 600px; }
.player-answers .ans { min-height: 120px; justify-content: center; font-size: 1.1rem; }
.player-answers .ans.nolabel { font-size: 2.5rem; }
.result-ok { background: var(--ok); }
.result-bad { background: var(--bad); }
.result-screen { width: 100%; min-height: 100vh; }
.topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 10px 16px; background: rgba(0,0,0,.25); font-weight: 700; }

/* Host */
.host-wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px; }
.pin-box { background: white; color: var(--bg); border-radius: var(--radius); padding: 14px 28px; display: inline-block; }
.pin-box .pin { font-size: 4rem; font-weight: 900; letter-spacing: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { background: var(--panel-2); padding: 8px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.chip:hover { background: var(--bad); }
.question-title { font-size: 2.2rem; font-weight: 800; background: white; color: var(--bg); border-radius: var(--radius); padding: 18px 24px; width: 100%; }
.timer { width: 90px; height: 90px; border-radius: 50%; background: var(--accent); color: #1a1200; display: grid; place-items: center; font-size: 2.2rem; font-weight: 900; }
.bars { display: flex; gap: 18px; align-items: flex-end; height: 200px; }
.bar { width: 90px; border-radius: 8px 8px 0 0; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; color: white; font-weight: 800; padding-top: 6px; min-height: 34px; transition: height .6s; }
.bar.c0 { background: var(--a0); } .bar.c1 { background: var(--a1); } .bar.c2 { background: var(--a2); } .bar.c3 { background: var(--a3); }
.leader { width: 100%; max-width: 700px; display: flex; flex-direction: column; gap: 10px; }
.leader .line { display: flex; justify-content: space-between; align-items: center; background: var(--panel); padding: 14px 20px; border-radius: 10px; font-size: 1.4rem; font-weight: 700; animation: slidein .4s both; }
.leader .line .plus { color: var(--ok); font-size: 1rem; margin-left: 10px; }
@keyframes slidein { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.podium { display: flex; align-items: flex-end; gap: 16px; }
.podium .step { width: 180px; background: var(--panel-2); border-radius: 10px 10px 0 0; display: flex; flex-direction: column; justify-content: flex-start; padding-top: 14px; font-weight: 800; }
.podium .p1 { height: 240px; background: var(--accent); color: #1a1200; }
.podium .p2 { height: 180px; }
.podium .p3 { height: 130px; }

/* Beheer / editor */
.admin { text-align: left; align-items: stretch; justify-content: flex-start; max-width: 900px; margin: 0 auto; }
.quiz-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--panel); padding: 14px 18px; border-radius: 10px; }
.q-edit { background: var(--panel); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.a-edit { display: flex; gap: 8px; align-items: center; }
.a-edit .swatch { width: 14px; align-self: stretch; border-radius: 4px; flex: none; }
.a-edit label { white-space: nowrap; display: flex; gap: 4px; align-items: center; font-size: .9rem; }
.a-edit input[type=checkbox], label input[type=checkbox] { width: 22px; height: 22px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings-grid label { display: flex; gap: 8px; align-items: center; }
.field-label { font-size: .85rem; color: var(--muted); margin-bottom: 4px; display: block; }
@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; }
  .question-title { font-size: 1.4rem; }
  .answers { grid-template-columns: 1fr; }
  .player-answers .answers { grid-template-columns: 1fr 1fr; }
}
.ans { min-width: 0; overflow-wrap: anywhere; }
.player-answers { display: flex; padding-bottom: 8px; }
.player-answers .answers { flex: 1; grid-auto-rows: 1fr; max-height: 70vh; }
.player-answers .ans { flex-direction: column; text-align: center; gap: 8px; }

/* Teams */
.team-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.team-btn { border: 3px solid transparent; }
.team-btn.picked { border-color: var(--accent); background: #2a4a75; }
.t0 { --tc: #ff6b57; } .t1 { --tc: #19b7c9; } .t2 { --tc: #f2b632; } .t3 { --tc: #7a6cf0; }
.t4 { --tc: #2ecc8f; } .t5 { --tc: #ff8fc7; } .t6 { --tc: #a3e635; } .t7 { --tc: #f97316; }
.team-btn, .team-tag { box-shadow: inset 6px 0 0 var(--tc); }
.team-tag { display: inline-block; font-size: .75em; padding: 2px 8px 2px 12px; border-radius: 6px; background: rgba(255,255,255,.1); margin-left: 8px; vertical-align: middle; }
.team-cols { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.team-col { background: var(--panel); border-radius: 12px; padding: 12px 16px; min-width: 160px; box-shadow: inset 0 6px 0 var(--tc); }
.result-neutral { background: var(--a3); }

/* Woordwolk */
.cloud { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; align-items: center; max-width: 900px; padding: 10px; }
.cloud span { font-weight: 800; line-height: 1.1; }
.cloud span:nth-child(4n+1) { color: var(--a0); } .cloud span:nth-child(4n+2) { color: var(--a1); }
.cloud span:nth-child(4n+3) { color: var(--a2); } .cloud span:nth-child(4n+4) { color: #b3a9ff; }

/* Tabs en resultaten */
.tabs { display: flex; gap: 8px; }
.tabs button.active { background: var(--accent); color: #1a1200; }
.tabs button { background: var(--panel-2); color: var(--text); }
.type-tag { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.pct-bar { height: 10px; border-radius: 5px; background: #0c1626; overflow: hidden; }
.pct-bar > div { height: 100%; }
.opt-line { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.r-table { width: 100%; border-collapse: collapse; }
.r-table td, .r-table th { padding: 8px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); }
.hard { box-shadow: inset 4px 0 0 var(--bad); }
.easy { box-shadow: inset 4px 0 0 var(--ok); }
.code-box { background: white; color: var(--bg); border-radius: 10px; padding: 8px 16px; font-weight: 900; font-size: 1.8rem; letter-spacing: 4px; display: inline-block; }
textarea { min-height: 80px; resize: vertical; }

/* Foto's */
.img-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.img-field { display: flex; flex-direction: column; gap: 6px; }
.img-prev { height: 120px; border-radius: 10px; background: #0c1626; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: .9rem; }
.img-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
label.button { font-weight: 700; cursor: pointer; border-radius: 10px; display: inline-block; }
label.button.secondary { background: var(--panel-2); color: var(--text); }
label.button.small { padding: 8px 12px; font-size: .9rem; }
.reveal-img { max-width: 60%; max-height: 45vh; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
@media (max-width: 640px) { .img-fields { grid-template-columns: 1fr; } }

/* Antwoord E en F (meerkeuze tot 6) */
:root { --a4: #2ecc8f; --a5: #ff8fc7; }
.ans.c4 { background: var(--a4); color: #062b1c; } .ans.c5 { background: var(--a5); color: #3a0d24; }
.bar.c4 { background: var(--a4); } .bar.c5 { background: var(--a5); }

/* Automatisch door + wie heeft geantwoord */
.auto-toggle { position: fixed; top: 12px; right: 16px; z-index: 10; display: flex; gap: 8px; align-items: center; background: var(--panel); padding: 8px 12px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.auto-toggle input { width: 20px; height: 20px; }
.chips.who .chip { cursor: default; opacity: .45; }
.chips.who .chip:hover { background: var(--panel-2); }
.chips.who .chip.done { opacity: 1; background: var(--ok); color: #062b1c; }
.chips.who .chip.done::after { content: ' ✓'; }
