.hud {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ui-surface-hud);
  padding: 10px;
  animation: rise 600ms ease-out 100ms forwards;
}

.hud-left,
.hud-right {
  display: flex;
  flex-wrap: wrap;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.hud-right {
  margin-left: auto;
  justify-content: flex-end;
}

.stat {
  min-width: 92px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, black 82%, var(--panel) 18%);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat span {
  font-size: 11px;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat strong {
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}

.btn-hud {
  flex: 0 0 auto;
  min-width: 124px;
  padding: 4px 5px;
}

.btn-hud--select.active:not(:disabled),
.btn-hud.is-active:not(:disabled) {
  background: var(--ui-tower-active-bg);
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--ui-tower-active-ring);
}

.tgl-hud {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--ui-ghost-border) 72%, var(--accent) 28%);
  background: color-mix(in srgb, var(--ui-ghost-bg) 82%, var(--panel) 18%);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 42px;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.tgl-hud:hover:not(:disabled),
.tgl-hud:focus-visible:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 58%, white 42%);
  background: color-mix(in srgb, var(--ui-ghost-bg) 70%, var(--accent) 30%);
}

.tgl-hud:active:not(:disabled) {
  transform: translateY(1px);
}

.tgl-hud.is-active:not(:disabled) {
  border-color: var(--accent);
  background: color-mix(in srgb, black 62%, var(--accent) 38%);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, white 82%, var(--accent) 18%),
    0 0 0 2px color-mix(in srgb, transparent 72%, var(--accent) 28%);
}

.tgl-hud:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 680px) {
  .stat {
    min-width: 72px;
  }

  .hud {
    align-items: stretch;
  }

  .hud-left,
  .hud-right {
    width: 100%;
  }

  .hud-right {
    margin-left: 0;
  }

  .btn-hud {
    flex: 0 0 calc(33.333% - 6x);
    min-width: 0;
    font-size: 12px;
    padding: 4px 5px;
  }
}