/* Gartic Phone: gedeelde huisstijl (spelers en hoofdscherm).
   Speels en vast: paars verloop, witte kaarten met dikke randen en een verschoven schaduw. */

:root {
  --inkt: #1c1240;
  --paars: #4527b8;
  --paars-licht: #7b5cff;
  --paars-donker: #1f0f5c;
  --papier: #ffffff;
  --papier-2: #f4f1ff;
  --tekst: #1c1240;
  --tekst-zacht: #5d5585;
  --geel: #ffd23f;
  --groen: #2ecc71;
  --rood: #ff4d5e;
  --roze: #ff5d8f;
  --blauw: #3fb6ff;
  --oranje: #ff9f43;
  --rol: #ff5d8f;
  --object: #3fb6ff;
  --actie: #ffc233;
  --plek: #2ecc71;
  --rand: 3px;
  --radius: 20px;
  --schaduw: 0 6px 0 var(--inkt);
  --schaduw-klein: 0 4px 0 var(--inkt);
  --font: 'Fredoka', 'Segoe UI Rounded', 'Arial Rounded MT Bold', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paars-donker);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.4;
  color: var(--tekst);
  background:
    radial-gradient(circle at 2px 2px, rgb(255 255 255 / 0.08) 2px, transparent 0) 0 0 / 28px 28px,
    linear-gradient(160deg, #5b34d6 0%, #3a1f9c 45%, var(--paars-donker) 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  line-height: 1.15;
  font-weight: 700;
}

p {
  margin: 0 0 0.8em;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

.verborgen-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- logo */

.logo {
  margin: 0;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--papier);
  text-shadow: 0 4px 0 var(--inkt);
  -webkit-text-stroke: 2px var(--inkt);
  paint-order: stroke fill;
  text-align: center;
}

.logo span {
  color: var(--geel);
}

.ondertitel {
  margin: 0.2em 0 1.2em;
  color: rgb(255 255 255 / 0.85);
  text-align: center;
  font-weight: 500;
}

/* ---------------------------------------------------------------- kaarten en knoppen */

.kaart {
  background: var(--papier);
  border: var(--rand) solid var(--inkt);
  border-radius: var(--radius);
  box-shadow: var(--schaduw);
  padding: 20px;
}

.kaart + .kaart {
  margin-top: 18px;
}

.kaart--zacht {
  background: var(--papier-2);
}

.knop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 52px;
  padding: 10px 22px;
  border: var(--rand) solid var(--inkt);
  border-radius: 16px;
  background: var(--papier);
  box-shadow: var(--schaduw-klein);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--inkt);
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background 0.15s ease;
  user-select: none;
}

.knop:hover {
  background: var(--papier-2);
}

.knop:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--inkt);
}

.knop:focus-visible,
.invoer:focus-visible,
.keuze:focus-visible {
  outline: 4px solid var(--geel);
  outline-offset: 2px;
}

.knop:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.knop--hoofd {
  background: var(--geel);
}

.knop--hoofd:hover {
  background: #ffdc66;
}

.knop--gevaar {
  background: var(--rood);
  color: var(--papier);
}

.knop--gevaar:hover {
  background: #ff6b79;
}

.knop--groot {
  min-height: 64px;
  font-size: 1.25rem;
  padding: 12px 28px;
}

.knop--klein {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 0.95rem;
  border-radius: 12px;
}

.knop--breed {
  width: 100%;
}

.knop--plat {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
  color: inherit;
}

.knoppen {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.knoppen > .knop {
  flex: 1 1 auto;
}

/* ---------------------------------------------------------------- formulieren */

.veld {
  display: block;
  margin-bottom: 14px;
}

.veld__label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.veld__hint {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--tekst-zacht);
}

.invoer {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: var(--rand) solid var(--inkt);
  border-radius: 14px;
  background: var(--papier);
  font-size: 1.1rem;
}

textarea.invoer {
  min-height: 120px;
  resize: vertical;
  line-height: 1.35;
}

.invoer--code {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
}

.teller {
  float: right;
  font-size: 0.85rem;
  color: var(--tekst-zacht);
}

/* Teamkeuze: grote knoppen in teamkleur. */
.keuzes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.keuze {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px 14px;
  border: var(--rand) solid var(--inkt);
  border-radius: 16px;
  background: var(--papier);
  box-shadow: var(--schaduw-klein);
  text-align: left;
  cursor: pointer;
  min-height: 84px;
}

.keuze[aria-pressed='true'] {
  background: var(--team, var(--geel));
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--inkt);
}

.keuze__naam {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.keuze__leden {
  font-size: 0.85rem;
  color: var(--tekst-zacht);
}

.keuze[aria-pressed='true'] .keuze__leden {
  color: var(--inkt);
}

/* ---------------------------------------------------------------- avatars en chips */

.avatar {
  --maat: 44px;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--maat);
  height: var(--maat);
  border: var(--rand) solid var(--inkt);
  border-radius: 50%;
  background: var(--team, var(--paars-licht));
  color: var(--inkt);
  font-weight: 700;
  font-size: calc(var(--maat) * 0.38);
  line-height: 1;
}

.avatar--klein {
  --maat: 28px;
  border-width: 2px;
}

.avatar--groot {
  --maat: 72px;
}

.stip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--inkt);
  border-radius: 50%;
  background: var(--team, var(--paars-licht));
  flex: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 2px solid var(--inkt);
  border-radius: 999px;
  background: var(--papier);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.chip--team {
  background: var(--team, var(--papier));
}

/* ---------------------------------------------------------------- speelkaarten (kaartje) */

.speelkaarten {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 12px;
  perspective: 900px;
}

.speelkaart {
  position: relative;
  min-height: 132px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.3, 1.4, 0.5, 1);
  border: 0;
  padding: 0;
  background: none;
  text-align: center;
}

.speelkaart.is-om {
  transform: rotateY(180deg);
}

.speelkaart__kant {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  border: var(--rand) solid var(--inkt);
  border-radius: 16px;
  box-shadow: var(--schaduw-klein);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.speelkaart__rug {
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg, rgb(255 255 255 / 0.18) 0 8px, transparent 8px 16px),
    var(--kleur, var(--paars-licht));
  font-size: 2.2rem;
  color: var(--papier);
  text-shadow: 0 2px 0 var(--inkt);
}

.speelkaart__voor {
  background: var(--papier);
  transform: rotateY(180deg);
}

.speelkaart__soort {
  padding: 6px 4px;
  background: var(--kleur);
  border-bottom: var(--rand) solid var(--inkt);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.speelkaart__waarde {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.speelkaart[data-soort='rol'] {
  --kleur: var(--rol);
}
.speelkaart[data-soort='object'] {
  --kleur: var(--object);
}
.speelkaart[data-soort='actie'] {
  --kleur: var(--actie);
}
.speelkaart[data-soort='plek'] {
  --kleur: var(--plek);
}

/* ---------------------------------------------------------------- polaroid en ballon */

.polaroid {
  display: inline-block;
  max-width: 100%;
  padding: 12px 12px 44px;
  background: var(--papier);
  border: var(--rand) solid var(--inkt);
  border-radius: 6px;
  box-shadow: var(--schaduw);
  transform: rotate(var(--draai, -1.5deg));
}

.polaroid img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  border: 2px solid var(--inkt);
  background: var(--papier-2);
}

.ballon {
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding: 16px 20px;
  background: var(--papier);
  border: var(--rand) solid var(--inkt);
  border-radius: 22px;
  box-shadow: var(--schaduw-klein);
  font-size: 1.25rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- tijd, meldingen */

.tijd {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border: 2px solid var(--inkt);
  border-radius: 999px;
  background: var(--papier);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tijd.is-krap {
  background: var(--geel);
}

.tijd.is-om {
  background: var(--rood);
  color: var(--papier);
  animation: puls 1s ease-in-out infinite;
}

.melding {
  padding: 12px 16px;
  border: 2px solid var(--inkt);
  border-radius: 14px;
  background: var(--geel);
  font-weight: 500;
}

.melding--fout {
  background: #ffd9dd;
}

.melding--info {
  background: #dff3ff;
}

.melding + .melding {
  margin-top: 8px;
}

.verbinding {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  padding: 8px 18px;
  border: 2px solid var(--inkt);
  border-radius: 999px;
  background: var(--geel);
  font-weight: 600;
  box-shadow: var(--schaduw-klein);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 12px 22px;
  border: var(--rand) solid var(--inkt);
  border-radius: 16px;
  background: var(--papier);
  box-shadow: var(--schaduw-klein);
  font-weight: 600;
  --tx: -50%;
  transform: translateX(var(--tx));
  animation: plop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.toast--fout {
  background: #ffd9dd;
}

/* ---------------------------------------------------------------- spelerspagina */

.speler {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.kop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--papier);
}

.kop__wie {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 600;
}

.kop__naam {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kop__code {
  font-weight: 700;
  letter-spacing: 0.15em;
  opacity: 0.8;
}

.taak__kop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.taak__label {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tekst-zacht);
}

.taak__titel {
  font-size: 1.6rem;
}

.taak__voorbeeld {
  margin: 16px 0;
  text-align: center;
}

.regels {
  margin: 14px 0 0;
  padding-left: 1.2em;
  font-size: 0.95rem;
  color: var(--tekst-zacht);
}

.regels li + li {
  margin-top: 4px;
}

.banner {
  margin: 12px 0;
  padding: 10px 14px;
  border: 2px solid var(--inkt);
  border-radius: 14px;
  background: var(--roze);
  color: var(--papier);
  font-weight: 700;
  text-align: center;
}

.wachten {
  text-align: center;
}

.wachten__emoji {
  display: inline-block;
  font-size: 4.5rem;
  animation: wiebel 2.4s ease-in-out infinite;
}

.voortgang {
  height: 18px;
  margin-top: 16px;
  border: 2px solid var(--inkt);
  border-radius: 999px;
  background: var(--papier-2);
  overflow: hidden;
}

.voortgang__balk {
  height: 100%;
  background: var(--groen);
  transition: width 0.6s ease;
}

.reacties {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.reactie {
  aspect-ratio: 1;
  border: var(--rand) solid var(--inkt);
  border-radius: 22px;
  background: var(--papier);
  box-shadow: var(--schaduw-klein);
  font-size: 2.6rem;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.reactie:active {
  transform: scale(0.9) translateY(3px);
  box-shadow: 0 1px 0 var(--inkt);
}

.reactie.is-verstuurd {
  animation: plop 0.4s cubic-bezier(0.3, 1.8, 0.5, 1);
  background: var(--geel);
}

.stand {
  margin: 0;
  padding: 0;
  list-style: none;
}

.stand li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 2px dashed var(--papier-2);
  font-weight: 600;
}

.stand li:last-child {
  border-bottom: 0;
}

.stand__plek {
  width: 1.8em;
  font-size: 1.3rem;
  text-align: center;
}

.stand__naam {
  flex: 1;
}

.stand__punten {
  font-size: 1.3rem;
  font-weight: 700;
}

.stand li.is-eigen {
  background: var(--papier-2);
  border-radius: 12px;
}

.fotokeuze {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fotokeuze .knop {
  position: relative;
  overflow: hidden;
  padding: 10px 12px;
  white-space: nowrap;
}

/* Visueel verborgen, maar wel klikbaar via het label (betrouwbaarder op iOS dan display: none). */
.fotokeuze input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.voorvertoning {
  margin: 16px 0 6px;
  text-align: center;
}

.laden {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: draai 0.8s linear infinite;
  vertical-align: middle;
}

/* ---------------------------------------------------------------- animaties */

@keyframes plop {
  0% {
    transform: translateX(var(--tx, 0)) scale(0.6);
    opacity: 0;
  }
  100% {
    transform: translateX(var(--tx, 0)) scale(1);
    opacity: 1;
  }
}

@keyframes binnen {
  from {
    transform: translateY(24px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes puls {
  50% {
    transform: scale(1.06);
  }
}

@keyframes wiebel {
  0%,
  100% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(8deg) translateY(-6px);
  }
}

@keyframes draai {
  to {
    transform: rotate(360deg);
  }
}

.binnen {
  animation: binnen 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
