#babylonUnmuteIcon { display: none !important; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#round-counter {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  color: #f6f2e8;
  background: rgb(18 23 25 / 78%);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 6px;
  font-size: 14px;
  pointer-events: none;
  display: none;
}

#round-counter.is-visible {
  display: block;
}

#hud {
  position: fixed;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  color: #f6f2e8;
  background: rgb(18 23 25 / 78%);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 6px;
  font-size: 14px;
}

#hud.hud-hidden,
#hud-opponent.hud-hidden,
#round-counter.hud-hidden {
  display: none !important;
}

#fullscreen-btn {
  position: fixed;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgb(18 23 25 / 78%);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s;
  z-index: 10;
  padding: 0;
}
#fullscreen-btn:hover { opacity: 1; }
#fullscreen-btn svg { width: 18px; height: 18px; fill: #fff; }

#media-controls {
  position: fixed;
  top: 100px;
  left: 12px;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgb(18 23 25 / 78%);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 6px;
  z-index: 10;
}

#media-controls.player-odd {
  background: rgb(160 30 30 / 78%);
  border-color: rgb(255 100 100 / 30%);
}

#media-controls.player-even {
  left: auto;
  right: 12px;
  background: rgb(30 60 160 / 78%);
  border-color: rgb(100 150 255 / 30%);
}

#player-portrait-left,
#player-portrait-right {
  position: fixed;
  top: 12px;
  width: auto;
  height: 80px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 10;
}

#player-portrait-left  { left: 12px; }
#player-portrait-right { right: 12px; }

#crowns-left,
#crowns-right {
  position: fixed;
  top: 16px;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
}

.win-crown-fly {
  position: fixed;
  font-size: 80px;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: 9999;
}

#crowns-left  { left: 104px; } /* overridden by JS repositionCrowns() */
#crowns-right { right: 104px; }

#player {
  color: #ffd166;
}

#hud-opponent {
  position: fixed;
  bottom: 12px;
  left: 12px;
  display: none;
  padding: 8px 10px;
  color: #f6f2e8;
  background: rgb(18 23 25 / 78%);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 6px;
  font-size: 14px;
}

#hud.player-odd,
#hud-opponent.player-odd {
  background: rgb(160 30 30 / 78%);
  border-color: rgb(255 100 100 / 30%);
}

#hud.player-even,
#hud-opponent.player-even {
  left: auto;
  right: 12px;
  background: rgb(30 60 160 / 78%);
  border-color: rgb(100 150 255 / 30%);
}

#music-toggle,
#sfx-toggle,
#reset,
#restart-server {
  appearance: none;
  padding: 5px 8px;
  color: #f6f2e8;
  background: rgb(255 255 255 / 10%);
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 5px;
  font: inherit;
  cursor: pointer;
}

#music-toggle,
#sfx-toggle {
  position: relative;
  width: 34px;
  min-width: 34px;
  padding: 5px 0;
}

#music-toggle::after,
#sfx-toggle::after {
  content: "";
  position: absolute;
  inset: 6px 15px 6px 15px;
  background: #ff6b6b;
  border-radius: 999px;
  transform: rotate(-34deg);
}

#music-toggle.is-enabled::after,
#sfx-toggle.is-enabled::after {
  display: none;
}

.music-note,
.sfx-speaker {
  display: inline-block;
  font-size: 21px;
  line-height: 1;
}

#music-toggle.is-enabled,
#sfx-toggle.is-enabled {
  color: #f4d35e;
  background: rgb(244 211 94 / 18%);
  border-color: rgb(244 211 94 / 32%);
}

#music-toggle:disabled,
#sfx-toggle:disabled {
  opacity: 0.7;
  cursor: wait;
}

#music-toggle:hover,
#sfx-toggle:hover,
#reset:hover,
#restart-server:hover {
  background: rgb(255 255 255 / 16%);
}

#lobby {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  color: #f6f2e8;
  pointer-events: none;
}

#lobby.is-visible {
  display: grid;
}

.lobby-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#lobby-title {
  width: 50vw;
  height: auto;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.lobby-panel.panel-hidden {
  display: none;
}

.lobby-panel.winner-odd {
  background: rgb(160 30 30 / 88%);
  border-color: rgb(255 100 100 / 30%);
}

.lobby-panel.winner-even {
  background: rgb(30 60 160 / 88%);
  border-color: rgb(100 150 255 / 30%);
}

.lobby-panel {
  width: min(360px, calc(100vw - 32px));
  padding: 18px 20px;
  background: rgb(18 23 25 / 88%);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 8px;
  text-align: center;
}


.lobby-panel p {
  margin: 0;
  color: #ffd166;
  font-size: 15px;
}

.copy-url-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #ffd166;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

#match-winner-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: rgb(0 0 0 / 78%);
  z-index: 9500;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

#match-winner-overlay.is-visible {
  opacity: 1;
}

.match-winner-crown {
  font-size: 110px;
  line-height: 1;
  display: block;
  margin-bottom: 6px;
}

#match-winner-portrait {
  height: 260px;
  width: auto;
  border-radius: 10px;
}

#match-winner-message {
  margin-top: 28px;
  color: #f6f2e8;
  font-size: 20px;
  text-align: center;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#match-winner-message.is-visible {
  opacity: 1;
}

.play-again-btn {
  color: #ffd166;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}
