body {
  overflow: hidden;
  background: #0b0e16;
}

#arena {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.hud-top {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 5;
}

.timer {
  min-width: 110px;
  text-align: center;
  padding: 8px 20px;
  border-radius: 14px;
  background: rgba(16, 20, 31, 0.85);
  border: 1px solid var(--line);
  font-size: 26px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}
.timer.low { color: var(--danger); animation: pulse 0.5s infinite alternate; }

@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.07); } }

.scoreboard {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
  min-width: 170px;
}
.sb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(16, 20, 31, 0.82);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
}
.sb-row.me-first { outline: 2px solid var(--accent); }
.sb-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sb-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.sb-score { font-variant-numeric: tabular-nums; color: var(--accent); }
.sb-off { opacity: 0.4; }

.lobby-card {
  background: rgba(20, 25, 40, 0.96);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 520px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.logo {
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 3px 0 #b89713, 0 6px 0 rgba(0, 0, 0, 0.4);
}

.qr-box {
  background: #fff;
  padding: 10px;
  border-radius: 14px;
  line-height: 0;
}
.qr-box img { width: min(38vh, 240px); height: min(38vh, 240px); image-rendering: pixelated; }

.room-code {
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 900;
  letter-spacing: 14px;
  padding-left: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.join-hint { color: var(--dim); font-size: 14px; word-break: break-all; text-align: center; }

.lineup {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 74px;
  max-width: 420px;
}
.lineup-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg2);
  animation: pop-in 0.25s ease-out;
}
.lineup-slot canvas { image-rendering: pixelated; }
.lineup-slot span { font-size: 12px; font-weight: 700; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lineup-slot.lineup-customizing { opacity: 0.5; border-style: dashed; }
.lineup-badge { color: var(--ok, #6bcb77); font-size: 14px; margin-left: 2px; }
.lineup-customizing .lineup-badge { color: var(--dim, #888); }
.lineup-empty { color: var(--dim); font-size: 14px; align-self: center; }

@keyframes pop-in { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.host-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }

.rounds-sel {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
}

.announce {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 8;
}

.controls-legend {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 5;
  background: rgba(16, 20, 31, 0.85);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dim);
  line-height: 1.6;
}
.controls-legend .cl-title {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.controls-legend .cl-row {
  white-space: nowrap;
}
.announce span {
  font-size: clamp(70px, 16vw, 160px);
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.45);
  animation: zoom-fade 0.9s ease-out forwards;
}
@keyframes zoom-fade {
  0% { transform: scale(2.4); opacity: 0; }
  25% { transform: scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: scale(0.92); opacity: 0; }
}

.results-card {
  background: rgba(20, 25, 40, 0.97);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
  max-height: 92vh;
  overflow: auto;
}
.podium { display: flex; align-items: flex-end; gap: 26px; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.podium-col canvas { image-rendering: pixelated; }
.podium-col .p-name { font-weight: 800; font-size: 15px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-col .p-score { color: var(--accent); font-weight: 900; font-size: 20px; }
.podium-block {
  width: 86px;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 30px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.75);
  padding-top: 6px;
}
.champ-banner {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 900;
  color: var(--accent);
  text-align: center;
  letter-spacing: 2px;
}
.round-label { color: var(--dim); font-size: 14px; font-weight: 700; letter-spacing: 2px; }

.results-table { display: flex; flex-direction: column; gap: 5px; width: 100%; }

.host-lost-card {
  background: rgba(60, 20, 24, 0.95);
  border: 1px solid var(--danger);
  border-radius: 22px;
  padding: 40px 60px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
}
