:root {
  --achter: #0f1218; --vlak: #1a1e27; --vlak-2: #232836; --vlak-3: #2d3344;
  --lijn: #2f3646; --inkt: #eef0f5; --inkt-2: #b4bbca; --inkt-3: #8790a3;
  --paars: #7c5cf0; --paars-2: #9b82ff; --blauw: #3d7bf0; --groen: #34c38f; --rood: #e5484d; --geel: #f5c04a;
  --rond: 14px;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 15px; color: var(--inkt); background: var(--achter);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--achter); }
body { overflow: hidden; }
#app { height: 100%; height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--paars-2); outline-offset: 2px; }

/* ---------- Knoppen ---------- */
.knop-hoofd, .knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 12px; border: 0; font-weight: 600; text-decoration: none;
  transition: transform .1s, background .15s, filter .15s;
}
.knop-hoofd { background: linear-gradient(135deg, var(--paars), var(--blauw)); color: #fff; box-shadow: 0 6px 20px rgba(92, 80, 240, .35); }
.knop-hoofd:hover { filter: brightness(1.08); }
.knop-hoofd:active, .knop:active { transform: scale(.98); }
.knop-hoofd:disabled { filter: grayscale(.6) brightness(.8); cursor: default; }
.knop { background: var(--vlak-2); color: var(--inkt); border: 1px solid var(--lijn); }
.knop:hover { background: var(--vlak-3); }
.klein-knop { min-height: 36px; padding: 0 14px; font-size: 14px; }
.klein-knop svg.ic { width: 18px; height: 18px; }
.icoon-knop { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--inkt-2); }
.icoon-knop:hover { background: var(--vlak-3); color: var(--inkt); }

.merk { display: inline-flex; align-items: center; gap: 10px; color: var(--inkt); text-decoration: none; font-size: 17px; }
.merk img { border-radius: 9px; background: #fff; padding: 4px; }
.merk b { font-weight: 700; background: linear-gradient(135deg, #a58cff, #6ea2ff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Begin en einde ---------- */
.begin, .einde {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 16px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(124, 92, 240, .28), transparent 70%), var(--achter);
}
.begin h1, .einde h1 { font-size: clamp(28px, 5vw, 42px); letter-spacing: -.02em; margin: 28px 0 10px; }
.begin p, .einde p { color: var(--inkt-2); max-width: 460px; margin: 0 0 28px; line-height: 1.5; }
.einde img { border-radius: 14px; background: #fff; padding: 6px; }
.begin-knoppen { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: center; }
.code-form { display: flex; gap: 8px; }
.code-form input { min-height: 46px; width: 210px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--lijn); background: var(--vlak); }
@media (max-width: 520px) { .begin-knoppen { flex-direction: column; align-items: stretch; width: 100%; max-width: 340px; } .code-form input { flex: 1; width: auto; min-width: 0; } }

/* ---------- Voorportaal ---------- */
.portaal { height: 100%; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 40px; align-items: center; padding: 40px max(40px, 5vw); max-width: 1300px; margin: 0 auto; overflow: auto; }
.portaal-vak { display: flex; flex-direction: column; gap: 16px; max-width: 400px; }
.portaal-vak h1 { margin: 10px 0 0; font-size: 30px; letter-spacing: -.02em; }
.code-regel { margin: -8px 0 0; color: var(--inkt-3); }
.code-regel code, .zaal-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--inkt-2); letter-spacing: .03em; }
.veld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--inkt-3); font-weight: 600; }
.veld input, .veld select { min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--lijn); background: var(--vlak); color: var(--inkt); font-weight: 400; font-size: 16px; }
.veld select { font-size: 14px; }
.veld input:focus { border-color: var(--paars-2); outline: none; box-shadow: 0 0 0 3px rgba(124, 92, 240, .25); }
.apparaten summary { cursor: pointer; color: var(--inkt-2); font-size: 14px; padding: 4px 0; }
.apparaten[open] { display: flex; flex-direction: column; gap: 12px; }
.portaal-fout { margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(229, 72, 77, .14); color: #ffb3b5; font-size: 14px; line-height: 1.45; }
.klein { font-size: 13px; color: var(--inkt-3); margin: 0; line-height: 1.5; }
.portaal-knoppen { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 14px; z-index: 3; }
.rond-knop { width: 54px; height: 54px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(30, 34, 46, .78); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: background .15s; }
.rond-knop:hover { background: rgba(50, 56, 74, .9); }
.rond-knop.uit { background: var(--rood); }
.niveau { position: absolute; top: 14px; right: 14px; width: 6px; height: 46px; border-radius: 3px; background: rgba(0,0,0,.4); overflow: hidden; z-index: 3; display: flex; align-items: flex-end; }
.niveau span { display: block; width: 100%; height: 0; background: var(--groen); border-radius: 3px; transition: height .08s; }
@media (max-width: 820px) {
  .portaal { grid-template-columns: 1fr; gap: 20px; padding: 16px; align-content: start; }
  .portaal-vak { max-width: none; }
  .portaal-vak h1 { font-size: 24px; margin-top: 4px; }
}

/* ---------- Tegels ---------- */
.tegel { position: relative; overflow: hidden; border-radius: var(--rond); background: var(--vlak); aspect-ratio: 16 / 9; isolation: isolate; box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s; }
.tegel.groot { width: 100%; }
.tegel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tegel.eigen video.spiegel { transform: scaleX(-1); }
.tegel.scherm video { object-fit: contain; background: #05070a; }
.tegel-leeg { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, var(--vlak-2), var(--vlak) 70%); z-index: 1; }
.leeg-tekst { color: var(--inkt-3); font-size: 14px; text-align: center; padding: 0 16px; }
.avatar { width: clamp(48px, 22%, 96px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: clamp(18px, 3.4vw, 34px); color: #fff; background: linear-gradient(135deg, var(--paars), var(--blauw)); text-transform: uppercase; }
.tegel.praat { box-shadow: 0 0 0 3px var(--groen); }
.tegel.praat .avatar { box-shadow: 0 0 0 6px rgba(52, 195, 143, .25); }
.naam-label { position: absolute; left: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 5px 10px; border-radius: 8px; background: rgba(10, 12, 18, .66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 13px; font-weight: 600; }
.naam-label .mic:empty { display: none; }
.naam-label .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.naam-label svg.ic { width: 15px; height: 15px; }
.naam-label .mic-uit { color: #ff8a8d; }
.hand-teken { position: absolute; top: 10px; left: 10px; z-index: 2; padding: 4px 10px; border-radius: 8px; background: var(--geel); color: #1d1a10; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.hand-teken svg.ic { width: 16px; height: 16px; }
.verbinden { position: absolute; top: 10px; right: 10px; z-index: 2; padding: 4px 10px; border-radius: 8px; background: rgba(10, 12, 18, .66); color: var(--inkt-2); font-size: 12px; }
.zwevend { position: absolute; left: 50%; bottom: 30%; z-index: 4; font-size: 44px; pointer-events: none; animation: zweef 2.6s ease-out forwards; }
@keyframes zweef { 0% { transform: translate(-50%, 20px) scale(.6); opacity: 0; } 15% { transform: translate(-50%, 0) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -120px) scale(1); opacity: 0; } }

/* ---------- Zaal ---------- */
.zaal { height: 100%; display: flex; flex-direction: column; }
.zaal-kop { display: flex; align-items: center; gap: 14px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.zaal-merk { display: inline-flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-weight: 600; }
.zaal-merk img { background: #fff; border-radius: 6px; padding: 2px; }
.zaal-code { font-size: 13px; color: var(--inkt-3); }
.zaal-slot { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--geel); }
.zaal-slot svg.ic { width: 15px; height: 15px; }
.ruimte { flex: 1; }
.banner { margin: 0 16px 8px; padding: 10px 14px; border-radius: 10px; background: rgba(124, 92, 240, .18); color: #d6ccff; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.banner .knop { min-height: 32px; padding: 0 12px; font-size: 13px; margin-left: auto; }
.zaal-midden { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 0 16px; }
.podium { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.tegels { display: grid; gap: 10px; width: 100%; height: 100%; align-content: center; justify-content: center; }
.tegels .tegel { width: 100%; height: auto; }
/* Iemand deelt een scherm: dat groot links, de rest in een strook rechts */
.tegels.met-podium { position: relative; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-start; gap: 10px; overflow-y: auto; }
.tegels.met-podium .tegel:not(.hoofd) { width: 220px; flex: none; }
.tegels.met-podium .tegel.hoofd { position: absolute; left: 0; top: 0; bottom: 0; right: 230px; width: auto; aspect-ratio: auto; }
@media (max-width: 760px) {
  .tegels.met-podium { flex-direction: row; flex-wrap: wrap; align-content: flex-start; justify-content: flex-start; gap: 6px; }
  .tegels.met-podium .tegel.hoofd { position: relative; inset: auto; flex: 0 0 100%; aspect-ratio: 16 / 10; }
  .tegels.met-podium .tegel:not(.hoofd) { width: calc((100% - 12px) / 3); }
}
.alleen { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); z-index: 5; text-align: center; padding: 18px 22px; border-radius: 16px; background: rgba(26, 30, 39, .9); border: 1px solid var(--lijn); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); width: min(92%, 380px); }
.alleen p { margin: 0 0 14px; color: var(--inkt-2); line-height: 1.5; }
.alleen strong { color: var(--inkt); }

/* ---------- Paneel (chat en deelnemers) ---------- */
.paneel { width: 340px; flex: none; display: flex; flex-direction: column; background: var(--vlak); border: 1px solid var(--lijn); border-radius: var(--rond); overflow: hidden; }
.paneel-kop { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px; border-bottom: 1px solid var(--lijn); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { border: 0; background: transparent; color: var(--inkt-3); padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.tab.aan { background: var(--vlak-3); color: var(--inkt); }
.paneel-chat, .paneel-mensen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.berichten { list-style: none; margin: 0; padding: 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.berichten .leeg { color: var(--inkt-3); font-size: 14px; text-align: center; margin: auto 0; line-height: 1.5; }
.bericht { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
.bericht .wie { font-size: 12px; color: var(--inkt-3); }
.bericht .wie b { color: var(--inkt-2); font-weight: 600; margin-right: 6px; }
.bericht .tekst { padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: var(--vlak-3); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bericht .tekst a { color: #b9a8ff; }
.bericht.van-mij { align-self: flex-end; align-items: flex-end; }
.bericht.van-mij .tekst { background: linear-gradient(135deg, #5f46d6, #3567d6); border-radius: 14px 4px 14px 14px; }
.bericht.systeem { align-self: center; max-width: 100%; color: var(--inkt-3); font-size: 13px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--lijn); }
.chat-form textarea { flex: 1; resize: none; max-height: 120px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--lijn); background: var(--vlak-2); line-height: 1.4; font-size: 15px; }
.chat-form textarea:focus { outline: none; border-color: var(--paars-2); }
.verstuur { background: var(--paars); color: #fff; width: 42px; height: 42px; }
.verstuur:hover { background: var(--paars-2); color: #fff; }
.mensen { list-style: none; margin: 0; padding: 8px; flex: 1; overflow-y: auto; }
.mensen li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.mensen li .avatar { width: 34px; font-size: 14px; }
.mensen li .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mensen li .t small { color: var(--inkt-3); }
.mensen li svg.ic { width: 17px; height: 17px; color: var(--inkt-3); }
.mensen li .mic-uit, .mensen li .cam-uit { color: #ff8a8d; }
.mensen li .hand { color: var(--geel); }
.slot-regel { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-top: 1px solid var(--lijn); font-size: 14px; cursor: pointer; }
.slot-regel small { color: var(--inkt-3); }
.slot-regel input { margin-top: 3px; accent-color: var(--paars); width: 17px; height: 17px; }
@media (max-width: 900px) {
  .paneel { position: fixed; inset: 0; z-index: 20; width: auto; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- Onderbalk ---------- */
.balk { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
.balk-knop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; padding: 9px 10px 7px; border-radius: 12px; border: 0; background: var(--vlak-2); color: var(--inkt); font-size: 12px; font-weight: 500; transition: background .15s, color .15s; }
.balk-knop:hover { background: var(--vlak-3); }
.balk-knop.uit { background: rgba(229, 72, 77, .18); color: #ff9a9d; }
.balk-knop.aan { background: rgba(124, 92, 240, .3); color: #d6ccff; }
.balk-knop.weg { background: var(--rood); color: #fff; min-width: 80px; }
.balk-knop.weg:hover { background: #f05a5f; }
.balk-knop .stip { position: absolute; top: 6px; right: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--rood); box-shadow: 0 0 0 2px var(--vlak-2); }
.reactie-houder { position: relative; }
.reacties { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; border-radius: 14px; background: var(--vlak-2); border: 1px solid var(--lijn); box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 10; }
.reacties button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 24px; border-radius: 10px; }
.reacties button:hover { background: var(--vlak-3); transform: scale(1.12); }
@media (max-width: 640px) {
  .balk { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .balk-knop { min-width: 0; flex: 1 1 0; padding: 10px 4px 8px; }
  .balk-knop .lbl { display: none; }
  .balk-knop.weg { min-width: 0; }
  .reactie-houder { flex: 1 1 0; display: flex; }
  .reactie-houder .balk-knop { width: 100%; }
  .reacties { left: auto; right: -40px; transform: none; }
  #b-mensen, .zaal-code { display: none; }
  .zaal-midden { padding: 0 8px; }
  .tegels { gap: 6px; }
}

/* ---------- Melding ---------- */
.melding { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 50; max-width: min(92vw, 460px); padding: 11px 16px; border-radius: 12px; background: #2f3a55; color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: in .2s ease-out; }
@keyframes in { from { opacity: 0; transform: translate(-50%, -8px); } }
