:root {
  --bg-dark: #090615;
  --glass: rgba(13, 10, 28, 0.72);
  --glass-border: rgba(255, 215, 100, 0.28);
  --gold: #ffd447;
  --red: #ff3b5c;
  --blue: #2d9cff;
  --text: #ffffff;
  --muted: #c9c4e0;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  user-select: none;
}

.stage-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: calc(100vh * 9 / 16);
  margin: 0 auto;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #1d1140 0%, #070412 85%);
}

.stage-wrapper.chroma {
  background: #00b140;
}

#scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6.5% 4.2% 24% 4.2%;
}

.top-hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.round-badge {
  background: linear-gradient(90deg, rgba(255, 59, 92, 0.85), rgba(255, 179, 0, 0.85));
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow: 0 4px 18px rgba(255, 59, 92, 0.35);
}

.viewer-pill {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.leader-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(28, 17, 56, 0.72), rgba(62, 34, 12, 0.68));
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 212, 71, 0.85);
  border-radius: 16px;
  padding: 8px 12px;
  box-shadow: 0 8px 26px rgba(255, 212, 71, 0.18);
}

.leader-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
  background: #231942;
}

.leader-info {
  flex: 1;
  min-width: 0;
}

.leader-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
  text-transform: uppercase;
}

.leader-name {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leader-score {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.35);
  padding: 5px 10px;
  border-radius: 10px;
}

.team-bar-card {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 7px 10px;
}

.team-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 5px;
}

.team-red-label {
  color: #ff6b81;
}

.team-blue-label {
  color: #62b6ff;
}

.team-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
  overflow: hidden;
  display: flex;
}

.team-fill-red {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #ff1e4d, #ff6b81);
  transition: width 0.35s ease;
}

.top3-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.top3-item {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  gap: 4px;
}

.top3-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.top3-coins {
  color: var(--gold);
  font-weight: 800;
  flex-shrink: 0;
}

.event-banner {
  align-self: center;
  text-align: center;
  background: linear-gradient(90deg, rgba(255, 59, 92, 0.92), rgba(255, 195, 0, 0.92));
  color: #14081e;
  padding: 10px 18px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.event-banner.visible {
  opacity: 1;
  transform: scale(1);
}

.bottom-hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tempo-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 8px 12px;
}

.tempo-card.turbo {
  border-color: #ff477e;
  box-shadow: 0 0 22px rgba(255, 71, 126, 0.45);
}

.tempo-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.tempo-track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.tempo-fill {
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, #ffbe0b, #fb5607, #ff006e);
  transition: width 0.25s ease;
}

.cta-strip {
  background: rgba(9, 6, 21, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 7px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.audio-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  pointer-events: auto;
  display: flex;
  gap: 6px;
}

.audio-btn {
  background: rgba(15, 12, 32, 0.8);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.audio-btn.active {
  border-color: var(--gold);
  color: var(--gold);
}

.pip-guide {
  display: none;
  position: absolute;
  right: 4%;
  bottom: 4%;
  width: 28%;
  aspect-ratio: 3 / 4;
  border: 2px dashed rgba(255, 212, 71, 0.7);
  border-radius: 14px;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.3);
}

.pip-guide.visible {
  display: flex;
}
