.debug-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-height: min(58dvh, 560px);
  overflow: auto;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(20, 16, 14, 0.22);
  color: #fffaf1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px 18px 0 0;
  font: 13px/1.3 ui-monospace, Consolas, monospace;
  z-index: 20;
  display: none;
  -webkit-overflow-scrolling: touch;
}

.debug-panel.is-open {
  display: block;
}

.debug-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.debug-close {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(59, 50, 43, 0.42);
  color: #fffaf1;
}

.debug-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.debug-panel button {
  width: 100%;
  min-height: 44px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(43, 36, 31, 0.38);
  color: #fffaf1;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.debug-panel button:hover,
.debug-panel button:active {
  background: rgba(59, 50, 43, 0.55);
}

@media (min-width: 900px) and (orientation: landscape) {
  .debug-panel {
    left: auto;
    right: 16px;
    top: 64px;
    bottom: auto;
    width: 280px;
    max-height: calc(100dvh - 80px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
  }

  .debug-actions {
    grid-template-columns: 1fr;
  }

  .debug-panel button {
    text-align: left;
  }
}
