/*
 * debug.css
 * Debug panel visible only when ?bolandila_debug=1 is active.
 */

.debug-panel {
  position: fixed;
  right: calc(8px + var(--safe-right));
  bottom: calc(8px + var(--safe-bottom));
  z-index: var(--z-debug);
  width: min(360px, calc(100vw - 16px));
  max-height: min(72dvh, 720px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255, 218, 155, 0.34);
  border-radius: 16px;
  background: rgba(4, 2, 2, 0.9);
  color: #fff3df;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
}

.debug-panel.is-collapsed {
  grid-template-rows: auto;
  max-height: none;
}

.debug-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 218, 155, 0.18);
  background: rgba(255, 218, 155, 0.08);
}

.debug-panel__header strong {
  color: #ffd18a;
  font-size: 12px;
  line-height: 1;
}

.debug-panel__toggle {
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 218, 155, 0.28);
  border-radius: 999px;
  background: rgba(255, 244, 226, 0.08);
  color: #fff3df;
  font-size: 11px;
  font-weight: 700;
}

.debug-panel__toggle:hover,
.debug-panel__toggle:focus-visible {
  background: rgba(255, 244, 226, 0.14);
  border-color: rgba(255, 218, 155, 0.56);
}

.debug-panel__body {
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.debug-panel.is-collapsed .debug-panel__body {
  display: none;
}

.debug-section {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.debug-section:last-child {
  border-bottom: 0;
}

.debug-section h2 {
  color: #ffd18a;
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.debug-section dl {
  display: grid;
  gap: 4px;
}

.debug-section dl > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.debug-section dt {
  color: rgba(255, 243, 223, 0.58);
}

.debug-section dd {
  min-width: 0;
  color: #fff3df;
  overflow-wrap: anywhere;
}

.debug-section pre {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 8px;
  overflow: auto;
  border-radius: 10px;
  background: rgba(255, 244, 226, 0.06);
  color: rgba(255, 243, 223, 0.9);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

body:not(.is-debug-enabled) .debug-panel {
  display: none !important;
}

@media (max-width: 520px) {
  .debug-panel {
    left: 8px;
    right: 8px;
    bottom: calc(8px + var(--safe-bottom));
    width: auto;
    max-height: 46dvh;
  }
}

@supports not (height: 100dvh) {
  .debug-panel {
    max-height: min(72vh, 720px);
  }
}
