#game {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

#game-ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#game-ui .ability-cooldowns,
#game-ui .loadout-hud-card-builtin,
#game-ui .ability-info-btn {
  pointer-events: auto;
}

/* ── Top-left overlay ── */
.game-overlay {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
  max-width: 240px;
  backdrop-filter: blur(4px);
}

.game-status {
  font-size: 0.72rem;
  color: #333;
  line-height: 1.35;
  margin-bottom: 3px;
}

.game-hint {
  font-size: 0.62rem;
  color: #aaa;
  line-height: 1.3;
}

.game-overlay .team-badge {
  width: 7px;
  height: 7px;
  margin-right: 4px;
}

/* ── Ability HUD (bottom-left) ── */
.ability-cooldowns,
.loadout-hud {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 190px;
  max-width: 240px;
}

.loadout-hud-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.loadout-hud-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.loadout-hud-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.loadout-hud-card-active.has-ability-info {
  padding-right: 28px;
}

.loadout-hud-card-passive {
  opacity: 0.92;
}

.loadout-hud-card.on-cooldown .loadout-hud-status {
  color: #3498db;
  font-weight: 600;
}

.loadout-hud-card.untouchable-active .loadout-hud-ring {
  background: conic-gradient(#f1c40f calc(var(--progress) * 360deg), #ffeaa7 0);
}

.loadout-hud-card-builtin {
  cursor: pointer;
  pointer-events: auto;
}

.loadout-hud-card-builtin .loadout-hud-name {
  color: #b7950b;
}

.loadout-hud-ring {
  --progress: 1;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(#3498db calc(var(--progress) * 360deg), #e8e8e8 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.loadout-hud-ring::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
}

.loadout-hud-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f4f4f4;
  border: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.loadout-hud-icon {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  line-height: 1;
}

.loadout-hud-info {
  min-width: 0;
}

.loadout-hud-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #222;
}

.loadout-hud-status {
  font-size: 0.72rem;
  color: #777;
  margin-top: 1px;
  line-height: 1.3;
}

/* ── Active skill info tooltip ── */
.ability-info-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  left: auto;
  z-index: 2;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid #d0d0d0;
  border-radius: 50%;
  background: #fff;
  color: #666;
  font-size: 0.58rem;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  cursor: help;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ability-info-btn:hover {
  border-color: #3498db;
  color: #3498db;
  background: #f0f7ff;
}

.ability-info-popup {
  position: fixed;
  z-index: 100;
  width: min(280px, calc(100vw - 24px));
  padding: 10px 12px 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #dce6ef;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  backdrop-filter: blur(6px);
}

.ability-info-popup.hidden {
  display: none;
}

.ability-info-popup-cd {
  text-align: right;
  font-size: 0.72rem;
  font-weight: 700;
  color: #3498db;
  margin-bottom: 8px;
  line-height: 1.2;
}

.ability-info-popup-cd[hidden] {
  display: none;
}

.ability-info-popup-desc {
  font-size: 0.76rem;
  color: #444;
  line-height: 1.45;
}

/* ── Victory banner ── */
.victory-banner {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.victory-banner.hidden {
  display: none;
}

.victory-banner-inner {
  background: #fff;
  border: 3px solid #3498db;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  min-width: 260px;
}

.victory-banner-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: #111;
}

.victory-banner-team {
  font-size: 1rem;
  color: #444;
  margin-bottom: 8px;
}

.victory-banner-hint {
  font-size: 0.82rem;
  color: #999;
}

/* ── Debuff bar (bottom center) ── */
.debuff-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.debuff-bar.hidden {
  display: none;
}

.debuff-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid var(--debuff-color, #999);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  color: #222;
}

.debuff-chip-icon {
  font-size: 1rem;
  line-height: 1;
}

.debuff-chip-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--debuff-color, #666);
}

.debuff-chip-timer {
  font-size: 0.78rem;
  font-weight: 700;
  color: #555;
  min-width: 2.4em;
  text-align: right;
}

/* ── Player stats (right side, pixel) ── */
.player-stats {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 9px;
  line-height: 2;
  color: #000;
  background: transparent;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.player-stats.hidden {
  display: none;
}

.player-stats-title {
  margin-bottom: 10px;
  text-align: center;
}

.player-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  min-width: 210px;
}

.player-stats-label {
  flex-shrink: 0;
}

.player-stats-value {
  text-align: right;
  flex-shrink: 0;
}

.player-stats-value.warn {
  color: #000;
  animation: stats-blink 0.8s step-end infinite;
}

.player-stats-value.debuff {
  color: #000;
}

.player-stats-value.buff {
  color: #27ae60;
  font-weight: 700;
}

@keyframes stats-blink {
  50% {
    opacity: 0.35;
  }
}
