/* NPO FunX huisstijl: paars #7b38b4, donkerpaars #291436, geel #ffd176, roze #ffa49f, lichtpaars #b79fcf */
:root {
  --purple: #7b38b4;
  --dark: #291436;
  --panel: #3a1f4d;
  --line: #553570;
  --text: #ffffff;
  --muted: #cdb9e0;
  --yellow: #ffd176;
  --pink: #ffa49f;
  --lilac: #b79fcf;
  --ok: #2bd576;
  --live: #d20f1d;
  --radius: 14px;
  --head: "NPO Nova", "Arial Black", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--dark);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--purple);
  padding: 14px max(16px, env(safe-area-inset-left));
}
.logo { height: 28px; width: auto; display: block; }
.brand-sub { color: var(--yellow); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }

main { max-width: 520px; margin: 0 auto; padding: 22px 16px 48px; }
.screen[hidden] { display: none; }

h1 {
  font-family: var(--head); font-weight: 900; text-transform: uppercase;
  font-size: clamp(26px, 7.5vw, 36px); line-height: 1.05; letter-spacing: -0.01em; margin: 0 0 10px;
}
.lead { color: var(--muted); font-size: 16px; margin: 0 0 18px; }
.hint, .tips { color: var(--muted); font-size: 13px; margin: 8px 0 0; text-align: center; }

.btn {
  appearance: none; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 800; padding: 15px 24px; width: 100%;
  text-transform: uppercase; letter-spacing: .03em;
}
.btn.primary { background: var(--yellow); color: var(--dark); }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }
.btn:disabled { opacity: 0.4; cursor: default; }

.preview, .studio {
  position: relative; background: #000;
  border-radius: var(--radius); overflow: hidden; border: 2px solid var(--purple);
}
.preview { aspect-ratio: 4 / 3; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.preview video.no-mirror { transform: none; }
.preview-empty { position: absolute; inset: 0; display: grid; place-items: center; background: var(--panel); padding: 20px; text-align: center; color: var(--muted); }
.preview-empty .btn { width: auto; }
.tag { position: absolute; left: 10px; top: 10px; background: rgba(41,20,54,.8); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.icon-btn {
  position: absolute; bottom: 18px; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: rgba(41,20,54,.75); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.icon-btn[hidden] { display: none; }
.flip { right: 12px; }
.gear { left: 12px; }
.meter { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.4); }
#meter-bar { height: 100%; width: 0; background: var(--yellow); transition: width 60ms linear; }

.devices { display: grid; gap: 10px; margin-top: 12px; }
.devices[hidden] { display: none; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--panel);
  border: 2px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--yellow); }
form { display: grid; gap: 12px; margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-weight: 400; font-size: 14px; }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--yellow); }
.hp { position: absolute; left: -9999px; }

.error { background: rgba(210,15,29,.18); border: 2px solid var(--live); color: #ffd6d6; border-radius: 10px; padding: 12px; margin-top: 12px; }
.howto { color: var(--muted); padding-left: 20px; }

.wait-head { display: flex; align-items: center; gap: 8px; color: var(--yellow); font-weight: 800; text-transform: uppercase; font-size: 13px; letter-spacing: .06em; margin-bottom: 10px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); animation: pulse 1.6s infinite; }
.pulse.ok { background: var(--ok); }
.pulse.bad { background: var(--pink); animation: none; }
.pulse.live { background: var(--live); }
.live-label { color: var(--live); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,209,118,.6); } 100% { box-shadow: 0 0 0 12px rgba(255,209,118,0); } }
.message { background: var(--yellow); color: var(--dark); border-radius: var(--radius); padding: 14px 16px; font-weight: 800; font-size: 18px; }

/* wachtkamer/gesprek: vóór live alleen jezelf groot; live = studio groot, jezelf klein (FaceTime) */
.stage {
  position: relative; margin: 16px 0; aspect-ratio: 3 / 4; background: #000;
  border-radius: var(--radius); overflow: hidden; border: 2px solid var(--purple);
}
@media (min-width: 600px) { .stage { aspect-ratio: 16 / 9; } }
.stage.live { border-color: var(--live); }
#studio-video { display: none; width: 100%; height: 100%; object-fit: contain; object-position: top; }
.stage.live #studio-video { display: block; }
.self { position: absolute; inset: 0; overflow: hidden; transition: all .3s ease; }
.self video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.self video.no-mirror { transform: none; }
.stage.live .self {
  inset: auto; right: 10px; bottom: 10px; width: 30%; aspect-ratio: 3 / 4;
  border-radius: 10px; border: 2px solid #fff; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.stage.live .self .tag { display: none; }
.stage .flip { right: 12px; bottom: 12px; }
.stage.live .flip { right: auto; left: 12px; }
.unmute { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); width: auto; z-index: 2; }

.code-form { margin-top: 8px; }
.code-form input {
  font-family: var(--head); font-weight: 900; font-size: 34px; letter-spacing: .25em;
  text-align: center; text-transform: uppercase; padding: 14px;
}
