:root {
  --bg: #081529;
  --bg-card: #0f2342;
  --bg-card-alt: #142d54;
  --border: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --text-muted: #9fb3c8;
  --yellow: #ffd400;
  --yellow-hover: #ffdf33;
  --blue-accent: #00a8e8;
  --green: #10b981;
  --red: #ef4444;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top right, #132f5c 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.transit-stripe {
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--yellow) 0px,
    var(--yellow) 40px,
    var(--blue-accent) 40px,
    var(--blue-accent) 80px
  );
}

.app-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.metro-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #0b1f3a;
  border: 2px solid var(--yellow);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(255, 212, 0, 0.25);
}

h1, h2, h3 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

.brand h1 {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--yellow);
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.role-pill, .party-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
}

.role-pill.is-host {
  background: rgba(255, 212, 0, 0.18);
  border-color: var(--yellow);
  color: var(--yellow);
}

.btn-icon {
  background: var(--bg-card-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-icon:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 20px 48px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* LOBBY */
.lobby-card {
  max-width: 580px;
  margin: 28px auto;
}

.line-tag {
  display: inline-block;
  background: var(--yellow);
  color: #081529;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.lobby-hero h2 {
  font-size: 1.85rem;
  margin-bottom: 8px;
}

.lobby-hero p {
  color: var(--text-muted);
  font-size: 0.96rem;
  margin-bottom: 22px;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 6px;
}

input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #081529;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--yellow);
}

.party-input-row {
  display: flex;
  gap: 8px;
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-large {
  padding: 14px 22px;
  font-size: 1.08rem;
  width: 100%;
}

.btn-primary {
  background: var(--yellow);
  color: #081529;
}

.btn-primary:hover:not(:disabled) {
  background: var(--yellow-hover);
}

.btn-pause {
  background: #f97316;
  color: #ffffff;
}

.btn-pause:hover:not(:disabled) {
  background: #fb923c;
}

.btn-secondary {
  background: var(--bg-card-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--yellow);
}

.btn-bingo {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  flex: 1;
  font-size: 1.12rem;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-bingo:hover {
  filter: brightness(1.08);
}

.btn-danger-outline {
  width: 100%;
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
  font-size: 0.9rem;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.15);
}

.connection-log {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0, 168, 232, 0.14);
  border: 1px solid rgba(0, 168, 232, 0.35);
  font-size: 0.88rem;
  color: #bae6fd;
}

.places-preview {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.places-preview summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.places-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.place-chip {
  font-size: 0.78rem;
  padding: 4px 9px;
  border-radius: 8px;
  background: #081529;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* GAME LAYOUT */
.game-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 920px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

.play-column, .side-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ANNOUNCEMENT BOARD */
.announcement-board {
  background: linear-gradient(145deg, #0b1e3b, #112b52);
  border: 2px solid rgba(255, 212, 0, 0.45);
}

.board-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--yellow);
  margin-bottom: 8px;
}

.board-label.is-running {
  color: #34d399;
}

.current-call {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 900;
  background: #061020;
  border: 1px solid rgba(255, 212, 0, 0.35);
  border-radius: 12px;
  padding: 16px 18px;
  text-align: center;
  color: var(--yellow);
  letter-spacing: 0.01em;
  margin-bottom: 12px;
  transition: transform 0.2s ease;
}

.current-call.pop {
  transform: scale(1.03);
}

/* TIMER VOORTGANGSBALK */
.next-call-timer-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.timer-track {
  flex: 1;
  height: 8px;
  background: #061020;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-accent), var(--yellow));
  border-radius: 999px;
  transition: width 0.1s linear;
}

.timer-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 115px;
  text-align: right;
}

.recent-calls-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
}

.recent-label {
  color: var(--text-muted);
  font-weight: 600;
}

.recent-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recent-pill {
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.muted {
  color: var(--text-muted);
}

/* 4x4 BINGO GRID */
.bingo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.card-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.win-mode-badge {
  background: rgba(0, 168, 232, 0.16);
  border: 1px solid rgba(0, 168, 232, 0.4);
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.bingo-cell {
  aspect-ratio: 1 / 1;
  background: #081529;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all 0.15s ease;
  color: var(--text);
}

.bingo-cell:hover {
  border-color: rgba(255, 212, 0, 0.65);
  transform: translateY(-2px);
}

.bingo-cell .cell-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: clamp(0.76rem, 1.5vw, 0.96rem);
  word-break: break-word;
  line-height: 1.2;
}

.bingo-cell .cell-rank {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Afgestreept vakje */
.bingo-cell.marked {
  background: linear-gradient(135deg, #ffd400, #f59e0b);
  border-color: #fff3b0;
  color: #081529;
  box-shadow: 0 6px 16px rgba(255, 212, 0, 0.3);
}

.bingo-cell.marked .cell-rank {
  color: rgba(8, 21, 41, 0.75);
  font-weight: 700;
}

.bingo-cell.marked::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 8px;
  font-size: 0.85rem;
  font-weight: 900;
}

/* Winnende rij highlight */
.bingo-cell.winner-cell {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #a7f3d0;
  color: #ffffff;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* HOST CONTROLS */
.host-panel {
  border: 2px solid var(--yellow);
  background: linear-gradient(180deg, rgba(255, 212, 0, 0.08) 0%, var(--bg-card) 35%);
}

.host-crown {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--yellow);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.host-header h3 {
  margin-bottom: 4px;
}

.host-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.host-transport-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.host-transport-controls .btn-large {
  flex: 1;
}

.host-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.host-setting-item label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* PLAYERS & FEED */
.players-list {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #081529;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.player-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.badge-mini {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 800;
  background: var(--yellow);
  color: #081529;
}

.player-score {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

.event-feed {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.event-feed li {
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 20, 0.82);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 2px solid var(--yellow);
  border-radius: 20px;
  padding: 30px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-emoji {
  font-size: 2.8rem;
  margin-bottom: 10px;
}

.modal-card h2 {
  font-size: 2rem;
  color: var(--yellow);
  margin-bottom: 8px;
}

.winner-detail {
  margin: 14px 0 20px;
  padding: 10px;
  border-radius: 10px;
  background: #081529;
  font-size: 0.88rem;
  color: #6ee7b7;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}
