/* Stip. — één telefoon per persoon, in een hoekje bij elkaar.
 *
 * Alles is voor een telefoonscherm in de hand ontworpen: grote knoppen, de
 * matrix zo groot als past, geen scrollen tijdens een ronde.
 */

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

:root {
  --bg:      #0d0d12;
  --vlak:    #17171f;
  --rand:    #2c2c38;
  --ink:     #f1eee8;
  --ink-dim: #9a97a3;
  --accent:  #ffc94d;
  --lijn:    #4a4a5a;
  --gutter:  16px;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

.scherm {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: max(var(--gutter), env(safe-area-inset-top)) var(--gutter) max(var(--gutter), env(safe-area-inset-bottom));
  text-align: center;
}

.midden { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

/* ---- Logo ---- */
.logo {
  font-size: clamp(3.5rem, 18vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.logo .punt {
  display: inline-block;
  width: 0.24em; height: 0.24em;
  margin-left: 0.05em;
  border-radius: 50%;
  background: var(--accent);
}
.ondertitel { color: var(--ink-dim); font-size: 1.1rem; }

/* ---- Knoppen ---- */
.knop {
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  touch-action: manipulation;
}
.knop:disabled { opacity: 0.5; }
.knop.groot { font-size: 1.2rem; padding: 1rem 2rem; min-width: 14rem; }
.knop.klein { font-size: 0.85rem; padding: 0.35rem 0.85rem; background: var(--vlak); color: var(--ink-dim); border: 1px solid var(--rand); }
/* "Volgende" mag er zijn, maar trekt niet: niet doorklikken is ook goed. */
.knop.rustig { background: transparent; color: var(--ink-dim); border: 1px solid var(--rand); }

/* ---- Code invullen ---- */
.code-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.5rem; color: var(--ink-dim); }
.code-form .rij { display: flex; gap: 0.5rem; }
.code-form input {
  font: inherit;
  font-family: ui-monospace, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  width: 8rem;
  padding: 0.5rem;
  color: var(--ink);
  background: var(--vlak);
  border: 1px solid var(--rand);
  border-radius: 12px;
}
.melding { color: var(--accent); min-height: 1.4em; }

/* ---- Wachtkamer ---- */
.hint { color: var(--ink-dim); }
.qr { width: min(70vw, 18rem); aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
.code-groot { font-family: ui-monospace, monospace; font-size: 2.2rem; font-weight: 700; letter-spacing: 0.25em; padding-left: 0.25em; }
.stip-groot { width: 6rem; height: 6rem; border-radius: 50%; background: var(--k, var(--accent)); }
.binnen { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; max-width: 20rem; min-height: 1.25rem; }
.binnen span { width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--k); animation: plop-plat 0.3s ease-out; }
.binnen span.mijn { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

/* ---- Een ronde ---- */
#spel { gap: 0.75rem; }

.kop { width: 100%; max-width: 34rem; display: flex; align-items: center; justify-content: space-between; min-height: 2rem; }
.diepte { display: flex; gap: 0.35rem; }
.diepte i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--rand); }
.diepte i.aan { background: var(--ink-dim); }

.stelling {
  font-size: clamp(1.3rem, 5.6vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  max-width: 34rem;
  min-height: 3.75em;           /* ruimte voor drie regels: de matrix springt niet */
  display: flex; align-items: center; justify-content: center;
  text-wrap: balance;
}
.stelling.verborgen { visibility: hidden; }

.timer { width: 100%; max-width: 34rem; height: 4px; border-radius: 2px; background: var(--vlak); overflow: hidden; }
#timer-balk { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(1); }
.timer.weg { visibility: hidden; }

.matrix-kader {
  display: grid;
  grid-template-columns: 1.5rem auto 1.5rem;
  grid-template-rows: auto auto auto;
  grid-template-areas: ". boven ." "links matrix rechts" ". onder .";
  gap: 0.35rem;
  align-items: center;
  justify-items: center;
}
.as { color: var(--ink-dim); font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.as.boven  { grid-area: boven; }
.as.onder  { grid-area: onder; }
.as.links  { grid-area: links;  writing-mode: vertical-rl; transform: rotate(180deg); }
.as.rechts { grid-area: rechts; writing-mode: vertical-rl; }

.matrix {
  grid-area: matrix;
  position: relative;
  /* Zo groot als past: breedte min de aslabels, hoogte min stelling en knoppen. */
  width: min(calc(100vw - 2 * var(--gutter) - 3.7rem), calc(100vh - 19rem), 30rem);
  width: min(calc(100vw - 2 * var(--gutter) - 3.7rem), calc(100dvh - 19rem), 30rem);
  min-width: 12rem;
  aspect-ratio: 1;
  border: 2px solid var(--lijn);
  border-radius: 14px;
  background:
    linear-gradient(var(--lijn), var(--lijn)) center / 2px 100% no-repeat,
    linear-gradient(var(--lijn), var(--lijn)) center / 100% 2px no-repeat,
    var(--vlak);
  touch-action: none;           /* slepen = je stip verplaatsen, niet de pagina */
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}
.matrix.uit { cursor: default; }

.bericht {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700;
  color: var(--ink-dim);
  pointer-events: none;
}
.bericht.zacht { font-size: 1rem; font-weight: 500; }

.stip {
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--k);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.stip.mijn { width: 28px; height: 28px; box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px rgba(0, 0, 0, 0.5); z-index: 2; }
.stip.nieuw { animation: plop 0.35s ease-out backwards; animation-delay: var(--d, 0s); }

@keyframes plop {
  from { transform: translate(-50%, -50%) scale(0); }
  70%  { transform: translate(-50%, -50%) scale(1.25); }
  to   { transform: translate(-50%, -50%) scale(1); }
}
@keyframes plop-plat { from { transform: scale(0); } to { transform: scale(1); } }

#knop-volgende { margin-top: 0.5rem; }
/* Deze twee knoppen komen pas bij het onthullen. Hun ruimte blijft gereserveerd,
   anders springt de matrix weg op het moment dat iedereen ernaar kijkt. */
#knop-volgende[hidden], #knop-erbij[hidden] { display: inline-block !important; visibility: hidden; }

/* ---- Overlay, verbinding, voet ---- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13, 13, 18, 0.96);
  padding: var(--gutter);
}

.verbinding {
  position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 0.85rem; color: var(--ink-dim);
  background: var(--vlak); border: 1px solid var(--rand);
  border-radius: 999px; padding: 0.3rem 0.9rem;
}

.voet {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 0.75rem var(--gutter) max(0.75rem, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-dim);
}
.voet a { color: var(--ink-dim); }

@media (prefers-reduced-motion: reduce) {
  .stip.nieuw, .binnen span { animation: none; }
}
