/* Secondary Work / Debug sub-tabs + API inspector */

.site-header .site-subtabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.4rem 1rem 0.55rem;
  border-top: 1px solid rgba(200, 140, 60, 0.18);
  box-sizing: border-box;
}

.site-subtab {
  font-size: 0.72rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(200, 140, 60, 0.28);
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 228, 190, 0.85);
  cursor: pointer;
}

.site-subtab:hover {
  border-color: rgba(255, 190, 90, 0.45);
  color: #ffe8c8;
}

.site-subtab.active {
  border-color: rgba(255, 190, 90, 0.6);
  background: rgba(70, 40, 12, 0.55);
  color: #ffd090;
  font-weight: 600;
}

.site-subtabs-label {
  font-size: 0.62rem;
  color: rgba(255, 220, 160, 0.55);
  margin-left: 0.25rem;
}

body.tab-debug-mode > .panel {
  display: none !important;
}

.tab-debug-host {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
}

.tab-debug-shell {
  border: 1px solid rgba(200, 140, 60, 0.28);
  border-radius: 10px;
  background: rgba(12, 8, 4, 0.92);
  overflow: hidden;
}

.tab-debug-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(200, 140, 60, 0.2);
  background: rgba(30, 18, 6, 0.65);
}

.tab-debug-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  color: #ffcc80;
}

.tab-debug-lead {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(255, 220, 160, 0.68);
  max-width: 42rem;
  line-height: 1.4;
}

.tab-debug-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.tab-debug-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: rgba(255, 220, 160, 0.75);
  margin-right: 0.25rem;
}

.tab-debug-btn {
  font-size: 0.68rem;
  padding: 0.32rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(200, 140, 60, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: #ffe8c8;
  cursor: pointer;
}

.tab-debug-btn:hover {
  border-color: rgba(255, 190, 90, 0.55);
}

.tab-debug-btn.active {
  border-color: rgba(255, 190, 90, 0.65);
  background: rgba(70, 40, 12, 0.55);
  color: #ffd090;
  font-weight: 600;
}

.tab-debug-filter {
  display: inline-flex;
  gap: 0.25rem;
}

.tab-debug-counts {
  margin: 0;
  padding: 0.35rem 1rem;
  font-size: 0.65rem;
  color: rgba(255, 220, 160, 0.55);
  border-bottom: 1px solid rgba(200, 140, 60, 0.12);
}

.tab-debug-guide {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(120, 180, 220, 0.28);
  background: rgba(20, 40, 55, 0.35);
}

.tab-debug-guide h3 {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  color: #9fd0ff;
}

.tab-debug-guide ol {
  margin: 0 0 0.5rem;
  padding-left: 1.2rem;
  font-size: 0.72rem;
  color: rgba(255, 230, 210, 0.88);
  line-height: 1.45;
}

.tab-debug-guide li {
  margin-bottom: 0.25rem;
}

.tab-debug-guide-note {
  margin: 0;
  font-size: 0.68rem;
  color: #ffcc80;
  line-height: 1.4;
}

.tab-debug-empty-body {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 160, 100, 0.3);
  background: rgba(60, 30, 10, 0.35);
  font-size: 0.72rem;
  color: rgba(255, 230, 200, 0.88);
  line-height: 1.4;
}

.tab-debug-empty-body h4 {
  margin: 0 0 0.35rem;
  color: #ffb070;
}

.tab-debug-log-empty .tab-debug-log-method {
  opacity: 0.65;
}

.tab-debug-log-payload .tab-debug-log-method {
  color: #a8e8a0;
}

.tab-debug-body {
  display: grid;
  grid-template-columns: minmax(12rem, 18rem) 1fr;
  min-height: 22rem;
}

.tab-debug-list {
  border-right: 1px solid rgba(200, 140, 60, 0.16);
  max-height: min(70vh, 40rem);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.25);
}

.tab-debug-log {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-bottom: 1px solid rgba(200, 140, 60, 0.1);
  background: transparent;
  color: rgba(255, 228, 190, 0.88);
  text-align: left;
  cursor: pointer;
  font-size: 0.68rem;
}

.tab-debug-log:hover {
  background: rgba(60, 35, 10, 0.35);
}

.tab-debug-log.active {
  background: rgba(80, 45, 12, 0.55);
  box-shadow: inset 3px 0 0 #d4a040;
}

.tab-debug-log-tab {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: rgba(90, 70, 160, 0.35);
  border: 1px solid rgba(160, 140, 220, 0.4);
  color: #d8d0ff;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-debug-log-gen {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.06rem 0.32rem;
  border-radius: 999px;
  background: rgba(40, 140, 90, 0.35);
  border: 1px solid rgba(100, 220, 150, 0.45);
  color: #b8ffd0;
}

.tab-debug-log-generated {
  border-color: rgba(100, 220, 150, 0.35);
}

.debug-ascii-wall-generated {
  border-color: rgba(100, 220, 150, 0.45);
}

.tab-debug-inline-tab {
  vertical-align: middle;
  margin-right: 0.25rem;
}

.tab-debug-log-method {
  font-weight: 700;
  color: #ffcc80;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.tab-debug-log-path {
  word-break: break-all;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.62rem;
}

.tab-debug-log-meta {
  color: rgba(255, 220, 160, 0.55);
  font-size: 0.58rem;
}

.tab-debug-main {
  padding: 0.85rem 1rem 1.25rem;
  max-height: min(85vh, 52rem);
  overflow-y: auto;
}

/* Colored ASCII art from 2×3 pixel parcels */
.debug-ascii-section {
  margin: 0 0 1.1rem;
  padding: 0.75rem 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(140, 160, 220, 0.35);
  background: linear-gradient(180deg, rgba(14, 16, 28, 0.98), rgba(8, 8, 14, 0.99));
}

.debug-ascii-title {
  margin: 0 0 0.35rem !important;
  font-size: 0.95rem !important;
  color: #c8d4ff !important;
}

.debug-ascii-banner {
  margin: 0.45rem 0 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.debug-ascii-banner-ok {
  background: rgba(70, 90, 180, 0.2);
  border: 1px solid rgba(140, 160, 240, 0.35);
  color: #d0d8ff;
}

.debug-ascii-banner-warn {
  background: rgba(180, 120, 40, 0.18);
  border: 1px solid rgba(255, 180, 80, 0.35);
  color: #ffe0b0;
}

.debug-ascii-empty {
  margin: 0.4rem 0 0;
  font-size: 0.7rem;
  color: rgba(255, 220, 160, 0.65);
  line-height: 1.4;
}

.debug-ascii-pending {
  margin: 0.5rem 0;
  font-size: 0.72rem;
  color: rgba(200, 210, 255, 0.65);
}

.debug-ascii-wall {
  margin: 0.55rem 0 0.85rem;
  padding: 0.65rem 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(140, 160, 220, 0.35);
  background: #08080c;
}

.debug-ascii-wall-demo {
  border-color: rgba(255, 180, 80, 0.4);
}

.debug-ascii-wall-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.debug-ascii-wall-head strong {
  display: block;
  font-size: 0.78rem;
  color: #e0e6ff;
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
}

.debug-ascii-wall-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  color: rgba(180, 190, 230, 0.55);
}

.debug-ascii-img-label {
  display: block;
  font-size: 0.62rem;
  color: rgba(180, 190, 230, 0.6);
  margin-bottom: 0.3rem;
}

.debug-ascii-art-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-start;
}

.debug-ascii-src-wrap {
  flex: 0 0 auto;
}

.debug-ascii-src {
  display: block;
  max-width: 140px;
  max-height: 140px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid rgba(140, 160, 220, 0.3);
  background: #111;
}

.debug-ascii-art-wrap {
  flex: 1 1 16rem;
  min-width: 0;
}

.debug-ascii-art-host {
  overflow: auto;
  max-height: min(55vh, 28rem);
  border-radius: 8px;
  border: 1px solid rgba(100, 110, 160, 0.35);
  background: #0a0a0c;
  padding: 0.35rem;
}

.debug-ascii-art-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
}

.debug-ascii-art-meta {
  margin: 0.35rem 0 0;
  font-size: 0.6rem;
  color: rgba(180, 190, 230, 0.5);
}

.tab-debug-guide {
  margin: 0 0 0.85rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(200, 140, 60, 0.2);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.72rem;
  color: rgba(255, 220, 160, 0.75);
}

.tab-debug-guide summary {
  cursor: pointer;
  color: #ffcc80;
  font-weight: 600;
  font-size: 0.75rem;
}

.tab-debug-guide ol {
  margin: 0.45rem 0 0.35rem 1.1rem;
  padding: 0;
  line-height: 1.45;
}

.tab-debug-detail h3 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: #ffe0a8;
  word-break: break-all;
}

.tab-debug-detail h4 {
  margin: 1rem 0 0.4rem;
  font-size: 0.78rem;
  color: #ffcc80;
}

.tab-debug-summary {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  color: rgba(255, 220, 160, 0.75);
  line-height: 1.4;
}

.tab-debug-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.tab-debug-stats span {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(200, 140, 60, 0.2);
  color: rgba(255, 228, 190, 0.85);
}

.tab-debug-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(200, 140, 60, 0.18);
  border-radius: 8px;
}

.tab-debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
}

.tab-debug-table th,
.tab-debug-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(200, 140, 60, 0.12);
  vertical-align: top;
  text-align: left;
}

.tab-debug-table th {
  background: rgba(40, 24, 8, 0.6);
  color: #ffcc80;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.tab-debug-table code {
  font-size: 0.64rem;
  color: #9fd0ff;
}

.tab-debug-num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tab-debug-muted {
  color: rgba(255, 220, 160, 0.5);
  font-size: 0.58rem;
}

.tab-debug-preview {
  max-width: 28rem;
  word-break: break-word;
  color: rgba(255, 235, 210, 0.88);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.62rem;
  line-height: 1.35;
}

.tab-debug-note {
  margin-top: 0.25rem;
  font-family: inherit;
  font-size: 0.6rem;
  color: #a8e0ff;
  line-height: 1.35;
}

.tab-debug-kind {
  display: inline-block;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: lowercase;
}

.tab-debug-kind-text {
  background: rgba(80, 120, 60, 0.35);
  color: #c8f0a8;
}

.tab-debug-kind-number,
.tab-debug-kind-boolean {
  background: rgba(60, 100, 140, 0.4);
  color: #b0d8ff;
}

.tab-debug-kind-base64-image,
.tab-debug-kind-base64-blob {
  background: rgba(140, 70, 40, 0.45);
  color: #ffc090;
}

.tab-debug-kind-array,
.tab-debug-kind-object {
  background: rgba(90, 70, 120, 0.4);
  color: #d8c0ff;
}

.tab-debug-pre {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(200, 140, 60, 0.16);
  font-size: 0.62rem;
  color: rgba(255, 230, 200, 0.85);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 12rem;
  overflow: auto;
}

.tab-debug-empty,
.tab-debug-detail-empty {
  padding: 0.85rem;
  font-size: 0.78rem;
  color: rgba(255, 220, 160, 0.75);
  line-height: 1.45;
}

.tab-debug-detail-empty h3 {
  margin: 0 0 0.5rem;
  color: #ffcc80;
}

.tab-debug-detail-empty p {
  margin: 0 0 0.65rem;
}

.tab-debug-detail-empty code {
  color: #9fd0ff;
  font-size: 0.72rem;
}

#panel-debug.panel[hidden] {
  display: none !important;
}

#panel-debug.panel.active {
  display: block;
}

.dbg-shell {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.1rem 1rem 2rem;
}

.dbg-shell h2 {
  margin: 0 0 0.35rem;
  font-weight: 400;
}

.dbg-shell p {
  margin: 0 0 0.75rem;
  line-height: 1.5;
  color: var(--text-muted, #c9b8a4);
}

.dbg-shell .dbg-open {
  font: inherit;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 190, 90, 0.45);
  background: rgba(70, 40, 12, 0.55);
  color: #ffd090;
  cursor: pointer;
}

@media (max-width: 820px) {
  .tab-debug-body {
    grid-template-columns: 1fr;
  }

  .tab-debug-list {
    max-height: 10rem;
    border-right: none;
    border-bottom: 1px solid rgba(200, 140, 60, 0.16);
  }
}
