.crowd-page {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(220, 38, 38, 0.28), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 40%, rgba(234, 179, 8, 0.12), transparent 50%),
    #0a0e17;
}

.crowd-app {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 12px 12px 24px;
}

.crowd-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.crowd-title {
  margin: 0 0 4px;
  font-size: clamp(1.4rem, 5.5vw, 1.85rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(248, 113, 113, 0.35);
}

.crowd-hint {
  margin: 0;
  color: #fca5a5;
  font-size: 0.86rem;
  line-height: 1.4;
  max-width: 36ch;
  font-weight: 600;
}

.crowd-scores {
  display: flex;
  gap: 8px;
}

.crowd-stat {
  min-width: 58px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(127, 29, 29, 0.55), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(248, 113, 113, 0.35);
  text-align: center;
}

.crowd-stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fca5a5;
}

.crowd-stat-value {
  display: block;
  margin-top: 2px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.crowd-sync {
  margin: 0;
  color: #94a3b8;
  font-size: 0.8rem;
}

.crowd-sync a { color: #93c5fd; font-weight: 700; }

.crowd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
}

.crowd-mute {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(15, 23, 42, 0.85);
  color: #fecaca;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

.crowd-mute[aria-pressed="true"] {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
}

.crowd-stage-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(248, 113, 113, 0.45);
  background: #0b1220;
  box-shadow:
    0 0 0 1px rgba(253, 224, 71, 0.2),
    0 12px 40px rgba(127, 29, 29, 0.45);
  touch-action: none;
  user-select: none;
}

.crowd-stage-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  cursor: grab;
}

.crowd-stage-wrap.is-dragging canvas { cursor: grabbing; }

.crowd-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}

.crowd-overlay[hidden] { display: none !important; }

.crowd-overlay-card {
  width: min(320px, 100%);
  padding: 22px 18px;
  border-radius: 16px;
  border: 2px solid rgba(253, 224, 71, 0.45);
  background: linear-gradient(160deg, #7f1d1d, #0f172a 55%);
  text-align: center;
  box-shadow: 0 0 40px rgba(220, 38, 38, 0.35);
}

.crowd-overlay-card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fde68a;
}

.crowd-overlay-card p {
  margin: 0 0 16px;
  color: #94a3b8;
  line-height: 1.45;
  font-size: 0.92rem;
}

.crowd-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.crowd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #dc2626, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.crowd-btn[hidden] { display: none !important; }

.crowd-btn.secondary {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
}

.crowd-help {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.4;
}

.crowd-leaderboard {
  margin-top: 16px;
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
}

.crowd-leaderboard-title { margin: 0 0 4px; font-size: 1.05rem; }
.crowd-leaderboard-lead { margin: 0 0 12px; color: #94a3b8; font-size: 0.78rem; }
.crowd-leaderboard-lead a { color: #93c5fd; font-weight: 700; }
.crowd-leaderboard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.crowd-leaderboard-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.45);
}
.crowd-leaderboard-row.is-you {
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: rgba(37, 99, 235, 0.16);
}
.crowd-leaderboard-rank { font-weight: 800; color: #93c5fd; }
.crowd-leaderboard-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crowd-leaderboard-score {
  font-size: 0.78rem;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.crowd-leaderboard-empty { margin: 0; color: #64748b; font-size: 0.85rem; }

/* Hub card preview */
.crowd-preview {
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, #1e3a5f 0%, #0f172a 55%, #7f1d1d 100%);
  position: relative;
  overflow: hidden;
}
.crowd-preview-gate {
  position: absolute;
  top: 18%;
  left: 18%;
  padding: 4px 8px;
  border-radius: 6px;
  background: #16a34a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
}
.crowd-preview-mob {
  position: absolute;
  top: 22%;
  right: 16%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #b91c1c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.crowd-preview-squad {
  position: absolute;
  bottom: 14%;
  width: 56%;
  height: 18px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
