/* ---------------------------------------------------------------------------
   Imposter — mobile-first stijl. Ontworpen voor 380 px breed; desktop is bijzaak.
   Donker thema, grote raakvlakken, alles met één duim te bedienen.
--------------------------------------------------------------------------- */

:root {
  --bg: #12151d;
  --bg-raise: #1b2030;
  --bg-raise-2: #232a3d;
  --line: #2c3348;
  --text: #eef1f8;
  --muted: #97a0b8;
  --primary: #6c8cff;
  --primary-press: #587bff;
  --danger: #ff6b6b;
  --ok: #46d19e;
  --warn: #f7b955;
  --radius: 16px;
  --radius-sm: 11px;
  --tap: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
}

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fade .18s ease;
}
[hidden] { display: none !important; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* ---------------------------------------------------------------- Typografie */

h1, h2 { margin: 0; font-weight: 700; }
.muted { color: var(--muted); margin: 0; font-size: 15px; }
.hint { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.4; }
.tagline { color: var(--muted); margin: 6px 0 0; font-size: 16px; }

/* ------------------------------------------------------------------ Startscherm */

.hero { text-align: center; margin-top: 8vh; }
.logo {
  font-size: 44px;
  letter-spacing: -1px;
  background: linear-gradient(120deg, #8ea6ff, #b98cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.hero + .stack { margin-top: auto; margin-bottom: 4vh; }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 13px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.join-form label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.row { display: flex; gap: 10px; }

/* --------------------------------------------------------------------- Knoppen */

.btn {
  min-height: var(--tap);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-raise-2);
  cursor: pointer;
  padding: 0 20px;
  transition: transform .05s ease, background .15s ease, opacity .15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-lg { min-height: 60px; font-size: 18px; }
.btn-primary { background: var(--primary); color: #0b0f1a; }
.btn-primary:active { background: var(--primary-press); }
.btn-secondary { background: var(--bg-raise-2); }
.btn-ghost { background: transparent; color: var(--muted); min-height: 48px; font-weight: 500; }
.btn-leave { margin-top: auto; }

/* ----------------------------------------------------------------------- Input */

.input {
  width: 100%;
  min-height: var(--tap);
  background: var(--bg-raise);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 18px;
  padding: 0 16px;
  outline: none;
  transition: border-color .15s ease;
}
.input:focus { border-color: var(--primary); }
.input-code {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 8px;
  font-weight: 700;
  text-align: center;
  font-size: 24px;
}
.input-name { font-size: 20px; }

.field-error { color: var(--danger); font-size: 14px; margin: 0; }

/* --------------------------------------------------------------- Naamscherm */

.joining-head { text-align: center; margin-top: 6vh; }
.code-badge {
  font-size: 34px; font-weight: 800; letter-spacing: 6px;
  margin: 6px 0 0; color: var(--text);
}
.code-badge-lg { font-size: 40px; }
#form-join { margin-top: auto; margin-bottom: 4vh; }

/* --------------------------------------------------------------------- Lobby */

.lobby-head {
  display: flex; justify-content: space-between; align-items: flex-start;
}
.phase-pill {
  background: var(--bg-raise-2); color: var(--muted);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
}

.notice-banner {
  background: rgba(247,185,85,.14);
  border: 1px solid rgba(247,185,85,.4);
  color: var(--warn);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 1.4;
}

.players-block { flex: 1; }
.players-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.players-head h2 { font-size: 18px; }
.count {
  background: var(--bg-raise-2); color: var(--muted);
  border-radius: 999px; padding: 2px 10px; font-size: 14px; font-weight: 700;
}

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.player {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 14px;
  animation: fade .2s ease;
}
.player .avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px; color: #0b0f1a;
}
.player .pname { flex: 1; font-size: 17px; font-weight: 600; }
.player .tag {
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.tag-host { background: rgba(108,140,255,.18); color: var(--primary); }
.tag-you { background: rgba(70,209,158,.16); color: var(--ok); }
.tag-wait { background: rgba(247,185,85,.16); color: var(--warn); }
.player.disconnected { opacity: .5; }
.player .kick {
  border: none; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; width: 40px; height: 40px;
  border-radius: 10px; cursor: pointer; flex: none;
}
.player .kick:active { background: var(--bg-raise-2); }

.lobby-actions { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }

/* ------------------------------------------------------------------ QR-kaart */

.qr-card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.qr-frame {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 12px;
  padding: 14px;               /* extra witmarge rondom de QR */
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.qr-frame svg { display: block; width: 100%; height: 100%; }
.qr-code-under {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 6px;
}
.qr-tip { color: var(--muted); font-size: 13px; text-align: center; margin: 0; line-height: 1.4; }
.qr-actions { display: flex; gap: 10px; width: 100%; }
.qr-actions .btn { flex: 1; }
.btn-sm { min-height: 44px; font-size: 15px; }
.qr-show { align-self: center; }

/* --------------------------------------------------- Reveal + discussie */

.round-head { display: flex; justify-content: space-between; align-items: center; }
.round-timer {
  font-variant-numeric: tabular-nums;
  font-size: 26px; font-weight: 800; letter-spacing: 1px;
  background: var(--bg-raise-2); padding: 6px 16px; border-radius: 999px;
}
.round-title { font-size: 24px; margin-top: 4px; }

/* Discussietimer */
.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 8px 0; }
.timer-big {
  font-variant-numeric: tabular-nums;
  font-size: 72px; font-weight: 800; letter-spacing: -1px; line-height: 1;
}
.timer-big.urgent { color: var(--warn); }
.timer-big.done { color: var(--danger); }
.timer-bar { width: 100%; height: 8px; background: var(--bg-raise-2); border-radius: 999px; overflow: hidden; }
.timer-bar-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--primary), #b98cff);
  border-radius: 999px;
  transition: width .25s linear;
}
.timer-bar-fill.urgent { background: var(--warn); }

/* "Ingedrukt houden om te zien" */
.hold-card {
  position: relative;
  flex: 1;
  min-height: 240px;
  border-radius: var(--radius);
  border: 2px dashed var(--line);
  background: var(--bg-raise);
  display: grid;
  place-items: center;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;                 /* geen scroll/zoom tijdens ingedrukt houden */
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s ease, background .15s ease;
}
.hold-card.small { min-height: 150px; flex: none; }
.hold-card.holding { border-style: solid; border-color: var(--primary); background: var(--bg-raise-2); }

.hold-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; }
.hold-idle { color: var(--muted); font-size: 17px; font-weight: 600; }
.hold-lock { font-size: 40px; }

.rv-role { font-size: 26px; font-weight: 800; }
.rv-role.imposter { color: var(--danger); }
.rv-word { font-size: 40px; font-weight: 800; letter-spacing: -.5px; color: var(--text); }
.rv-word-es { font-size: 26px; font-weight: 700; color: var(--primary); margin-top: -2px; }
.rv-sub { color: var(--muted); font-size: 15px; }
.rv-cat { color: var(--primary); font-size: 15px; font-weight: 600; margin-top: 6px; }

.reveal-confirm { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }
.note { text-align: center; }
#btn-abort-reveal, #btn-abort-disc { align-self: center; }

/* ------------------------------------------------------------- Stemmen */

.vote-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.vote-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-raise);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: var(--tap);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .05s ease;
}
.vote-item:active { transform: scale(.99); }
.vote-item.chosen { border-color: var(--primary); background: var(--bg-raise-2); }
.vote-item .avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #0b0f1a; }
.vote-item .pname { flex: 1; font-size: 17px; font-weight: 600; }
.vote-mark { width: 28px; text-align: center; font-size: 20px; font-weight: 800; color: var(--primary); }

.vote-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; }

/* ------------------------------------------------------------- Uitslag */

.result-banner {
  text-align: center; font-size: 20px; font-weight: 800;
  padding: 16px; border-radius: var(--radius);
  background: var(--bg-raise-2);
}
.result-banner.win { background: rgba(70,209,158,.18); color: var(--ok); }
.result-banner.lose { background: rgba(255,107,107,.16); color: var(--danger); }
.result-banner.tie { background: rgba(247,185,85,.16); color: var(--warn); }

.result-word { text-align: center; display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.result-word-big { font-size: 38px; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.result-word-es { font-size: 24px; font-weight: 700; color: var(--primary); }
.result-line { text-align: center; margin: 0; font-size: 16px; }

.tally { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tally-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.tally-item.eliminated { border-color: var(--danger); }
.tally-name { flex: 1; font-size: 16px; font-weight: 600; }
.tally-votes {
  min-width: 30px; text-align: center; font-weight: 800;
  background: var(--bg-raise-2); border-radius: 999px; padding: 2px 10px;
}
.tag-imp { background: rgba(255,107,107,.18); color: var(--danger); }

/* -------------------------------------------------------------- Foutmelding */

.error-box { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.error-emoji { font-size: 48px; margin: 0; }

/* --------------------------------------------------------------------- Toast */

.toast {
  position: fixed;
  left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--bg-raise-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px; border-radius: 12px;
  font-size: 15px; max-width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
  animation: fade .2s ease;
  z-index: 50;
}
