#gameplay-root .debug-hud-shell {
  position: fixed;
  top: 92px;
  left: 16px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

#gameplay-root .debug-hud-toggle,
#gameplay-root .debug-hud-panel,
#gameplay-root .debug-hud-action {
  pointer-events: auto;
}

#gameplay-root .debug-hud-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(12, 16, 24, 0.82);
  color: rgba(245, 248, 255, 0.92);
  font: 700 12px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

#gameplay-root .debug-hud-toggle.is-active {
  background: rgba(26, 84, 196, 0.88);
  border-color: rgba(162, 194, 255, 0.34);
}

#gameplay-root .debug-hud-panel {
  width: min(420px, calc(100vw - 24px));
  max-height: min(78vh, 760px);
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(24, 31, 45, 0.94), rgba(12, 16, 24, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(240, 246, 255, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

#gameplay-root .debug-hud-panel.is-hidden {
  display: none;
}

#gameplay-root .debug-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#gameplay-root .debug-hud-title {
  font: 700 14px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#gameplay-root .debug-hud-actions {
  display: flex;
  gap: 8px;
}

#gameplay-root .debug-hud-action {
  border: 0;
  border-radius: 10px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 248, 255, 0.9);
  font: 600 11px/1 'IBM Plex Mono', monospace;
  cursor: pointer;
}

#gameplay-root .debug-hud-action:hover,
#gameplay-root .debug-hud-toggle:hover {
  transform: translateY(-1px);
}

#gameplay-root .debug-hud-compact,
#gameplay-root .debug-hud-section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#gameplay-root .debug-hud-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

#gameplay-root .debug-hud-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}

#gameplay-root .debug-hud-section-title {
  margin-bottom: 8px;
  color: rgba(179, 196, 224, 0.92);
  font: 700 11px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#gameplay-root .debug-hud-control-list {
  gap: 8px;
}

#gameplay-root .debug-hud-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#gameplay-root .debug-hud-control-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#gameplay-root .debug-hud-control-button {
  min-width: 30px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 248, 255, 0.94);
  font: 600 11px/1 'IBM Plex Mono', monospace;
  cursor: pointer;
}

#gameplay-root .debug-hud-control-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

#gameplay-root .debug-hud-control-value {
  min-width: 30px;
  text-align: center;
  color: rgba(244, 248, 255, 0.95);
  font: 600 11px/1 'IBM Plex Mono', monospace;
}

#gameplay-root .debug-hud-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font: 500 11px/1.3 'IBM Plex Mono', monospace;
}

#gameplay-root .debug-hud-label {
  color: rgba(170, 186, 212, 0.74);
  flex: 0 0 auto;
}

#gameplay-root .debug-hud-value {
  color: rgba(244, 248, 255, 0.95);
  text-align: right;
}

#gameplay-root .debug-hud-row.is-warn .debug-hud-value {
  color: #ffd27a;
}

#gameplay-root .debug-hud-row.is-bad .debug-hud-value {
  color: #ff8787;
}

body.touch-layout #gameplay-root .debug-hud-shell {
  top: max(86px, env(safe-area-inset-top) + 84px);
  left: max(10px, env(safe-area-inset-left) + 8px);
}

body.touch-layout #gameplay-root .debug-hud-toggle {
  min-width: 52px;
  height: 38px;
}

body.touch-layout #gameplay-root .debug-hud-panel {
  width: min(420px, calc(100vw - 20px));
  max-height: min(72vh, 640px);
}
