.hvHudDock {
  position: relative;
  left: auto;
  bottom: auto;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  flex-shrink: 0;
  max-width: min(248px, 28vw);
  pointer-events: none;
  align-self: flex-end;
  margin-bottom: 8px;
}

.hvHudDock > * {
  pointer-events: auto;
}

/* Unified SYS.PLAYER + TOOLS card */
.hv-hud-card {
  --hv-hud-cut: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  padding: 0;
  overflow: hidden;
  clip-path: polygon(
    0 0,
    calc(100% - var(--hv-hud-cut)) 0,
    100% var(--hv-hud-cut),
    100% 100%,
    var(--hv-hud-cut) 100%,
    0 calc(100% - var(--hv-hud-cut))
  );
}

.hv-hud-card-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(0, 255, 255, 0.32);
  background:
    linear-gradient(180deg, rgba(0, 255, 255, 0.07) 0%, transparent 28%),
    linear-gradient(135deg, rgba(8, 14, 28, 0.97) 0%, rgba(4, 8, 18, 0.98) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 0, 128, 0.06),
    0 14px 36px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 22px rgba(0, 255, 255, 0.1);
  overflow: hidden;
}

.hv-hud-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: rgba(0, 255, 255, 0.8);
  border-style: solid;
  filter: drop-shadow(0 0 4px rgba(0, 255, 255, 0.45));
  z-index: 2;
}

.hv-hud-corner-tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
.hv-hud-corner-tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.hv-hud-corner-bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.hv-hud-corner-br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.hv-hud-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 255, 255, 0.035) 48%,
    transparent 100%
  );
  animation: hvHudScan 5s linear infinite;
  opacity: 0.65;
}

@keyframes hvHudScan {
  from { transform: translateY(-100%); }
  to { transform: translateY(100%); }
}

.hv-hud-divider {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px;
  padding: 0;
}

.hv-hud-divider::before,
.hv-hud-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.35),
    transparent
  );
}

.hv-hud-divider-label {
  flex-shrink: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(143, 212, 255, 0.7);
}

.hvPingGraph {
  position: relative;
  left: auto;
  bottom: auto;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 8px;
  --hv-ping-cut: 5px;
  width: 168px;
  padding: 6px;
  border: 1px solid rgba(0, 255, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(0, 255, 255, 0.05) 0%, transparent 32%),
    linear-gradient(135deg, rgba(8, 14, 28, 0.96) 0%, rgba(4, 8, 18, 0.98) 100%);
  box-shadow:
    0 0 18px rgba(0, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  clip-path: polygon(
    0 0,
    calc(100% - var(--hv-ping-cut)) 0,
    100% var(--hv-ping-cut),
    100% 100%,
    var(--hv-ping-cut) 100%,
    0 calc(100% - var(--hv-ping-cut))
  );
  pointer-events: none;
}

.hvPingGraph-dock-right {
  order: 3;
}

.hvPingGraph-tag {
  display: block;
  margin: 0 0 5px 2px;
  font-family: "Rajdhani", sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(143, 212, 255, 0.72);
}

.hvPingGraph-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
  font-family: "Orbitron", sans-serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: rgba(143, 212, 255, 0.82);
}

.hvPingGraph-ping {
  color: #00ffff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.35);
}

.hvPingGraph-fps {
  color: rgba(220, 232, 239, 0.72);
  font-size: 8px;
}

.hvPingGraph-canvas-wrap {
  padding: 2px;
  border: 1px solid rgba(120, 180, 255, 0.22);
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 255, 255, 0.06), transparent 70%),
    rgba(0, 0, 0, 0.34);
  clip-path: polygon(
    0 0,
    calc(100% - 4px) 0,
    100% 4px,
    100% 100%,
    4px 100%,
    0 calc(100% - 4px)
  );
}

.hvPingGraph-canvas {
  display: block;
  width: 100%;
  height: 48px;
}

.hv-game-toolbar {
  position: relative;
  z-index: 1;
  padding: 6px 8px 8px;
  border: none;
  background: transparent;
  box-shadow: none;
  clip-path: none;
}

.hv-game-toolbar-tag {
  display: none;
}

.hv-game-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 36px;
  gap: 4px;
}

.hv-game-tool-btn {
  --hv-tool-accent: rgba(143, 212, 255, 0.82);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(120, 180, 255, 0.2);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.04), transparent 58%),
    rgba(0, 0, 0, 0.32);
  color: var(--hv-tool-accent);
  cursor: pointer;
  clip-path: polygon(
    0 0,
    calc(100% - 4px) 0,
    100% 4px,
    100% 100%,
    4px 100%,
    0 calc(100% - 4px)
  );
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    background 0.15s ease,
    transform 0.12s ease;
}

.hv-game-tool-btn:hover:not(:disabled) {
  border-color: rgba(0, 255, 255, 0.48);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.16);
}

.hv-game-tool-btn:focus-visible {
  outline: 1px solid rgba(0, 255, 255, 0.75);
  outline-offset: 1px;
}

.hv-game-tool-btn.is-active {
  --hv-tool-accent: #00ffff;
  border-color: rgba(0, 255, 255, 0.82);
  background:
    radial-gradient(circle at 50% 30%, rgba(0, 255, 255, 0.18), transparent 60%),
    linear-gradient(135deg, rgba(0, 56, 72, 0.92), rgba(56, 0, 72, 0.88));
  box-shadow:
    0 0 12px rgba(0, 255, 255, 0.28),
    inset 0 0 10px rgba(0, 255, 255, 0.1);
}

.hv-game-tool-btn.is-active .hv-game-tool-key {
  color: #8fd4ff;
  border-color: rgba(0, 255, 255, 0.55);
  background: rgba(0, 255, 255, 0.12);
}

.hv-game-tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: inherit;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.hv-game-tool-led {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff3b5c;
  box-shadow:
    0 0 5px rgba(255, 59, 92, 0.95),
    0 0 10px rgba(255, 59, 92, 0.55);
  pointer-events: none;
  animation: hvGameToolLedPulse 1.15s ease-in-out infinite;
}

.hv-game-tool-led[hidden] {
  display: none !important;
}

@keyframes hvGameToolLedPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.72;
    transform: scale(1.15);
  }
}

.hv-game-tool-btn.has-claim-pending {
  border-color: rgba(255, 59, 92, 0.45);
}

.hv-game-tool-icon svg,
.hv-game-tool-icon .hv-game-tool-svg,
.hv-game-tool-btn > svg.iconify {
  display: block;
  width: 18px;
  height: 18px;
}

.hv-game-tool-btn > svg.iconify {
  color: inherit;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.hv-game-tool-btn.is-active > svg.iconify {
  filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.75));
}

.hv-game-tool-btn.is-active .hv-game-tool-icon {
  filter: drop-shadow(0 0 5px rgba(0, 255, 255, 0.75));
}

.hv-game-tool-key {
  position: absolute;
  right: 2px;
  bottom: 1px;
  min-width: 10px;
  padding: 0 2px;
  border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.45);
  font-family: "Orbitron", sans-serif;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.3;
  color: rgba(220, 232, 239, 0.78);
}

.hv-game-tool-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.hv-hud-card.is-panel-open,
.hv-user-badge.is-panel-open {
  z-index: 120;
  pointer-events: auto;
}

.hv-hud-card.is-panel-open .hv-hud-card-frame,
.hv-user-badge.is-panel-open ~ .hv-hud-card-frame {
  border-color: rgba(0, 255, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 0, 128, 0.12),
    0 16px 42px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(0, 255, 255, 0.22);
}

.hv-hud-card:has(.hv-user-badge[hidden]) .hv-hud-divider {
  display: none;
}

.hv-hud-card:has(.hv-user-badge[hidden]) .hv-game-toolbar {
  padding-top: 8px;
}

@media (max-width: 720px) {
  .hvHudDock {
    max-width: min(220px, 42vw);
  }

  .hv-game-toolbar-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 32px;
    gap: 3px;
  }

  .hv-game-tool-btn {
    height: 32px;
  }

  .hv-game-tool-icon,
  .hv-game-tool-icon svg,
  .hv-game-tool-icon .hv-game-tool-svg,
  .hv-game-tool-btn > svg.iconify {
    width: 16px;
    height: 16px;
  }
}
