/* buffer-and-attribute-logic — Attribute Layout Debugger */

#buffer-attribute-layout-debugger {
  scroll-margin-top: 5rem;
}

.doc-buffer-layout-demo {
  margin: 1.15rem 0 0;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(94, 180, 255, 0.26);
  background: linear-gradient(
    168deg,
    rgba(16, 22, 42, 0.82) 0%,
    rgba(10, 14, 28, 0.72) 48%,
    rgba(18, 14, 36, 0.78) 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.42) inset,
    0 12px 38px rgba(0, 0, 0, 0.38),
    0 0 42px rgba(46, 231, 242, 0.05);
  overflow: hidden;
}

.doc-buffer-layout-demo__layout {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Üst: tam genişlik canvas — odak burada */
.doc-buffer-layout-demo__canvas-stage {
  padding: 0.85rem 1rem 0.75rem;
  background: radial-gradient(
      110% 85% at 50% 12%,
      rgba(46, 231, 242, 0.06) 0%,
      transparent 52%),
    rgba(5, 8, 18, 0.52);
  border-bottom: 1px solid rgba(110, 150, 210, 0.14);
}

/* Sadece boyut + clip; iç çerçeve yok — tek görsel kutu üst figure */
.doc-buffer-layout-demo__canvas-inner {
  position: relative;
  width: 100%;
  margin: 0 auto;
  max-width: min(100%, 920px);
  height: clamp(280px, 48vmin, 520px);
  min-height: 280px;
  border-radius: 0;
  overflow: hidden;
  transform-origin: center center;
}

@keyframes doc-bal-canvas-pulse {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(0.98);
  }

  100% {
    transform: scale(1);
  }
}

.doc-buffer-layout-demo__canvas-inner--pulse {
  animation: doc-bal-canvas-pulse 145ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .doc-buffer-layout-demo__canvas-inner--pulse {
    animation: none !important;
  }
}

.doc-buffer-layout-demo__canvas-inner canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.doc-buffer-layout-demo__canvas-hint {
  margin: 0.55rem auto 0;
  max-width: min(100%, 920px);
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(150, 185, 235, 0.72);
}

.doc-buffer-layout-demo__stack {
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem 1rem;
  gap: 0;
}

.doc-buffer-layout-demo__meta {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.doc-buffer-layout-demo__rule {
  margin: 0.85rem 0;
  height: 1px;
  border: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(110, 150, 210, 0.28) 22%,
    rgba(110, 150, 210, 0.28) 78%,
    transparent 100%);
}

.doc-buffer-layout-demo__controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.doc-buffer-layout-demo__viz-block,
.doc-buffer-layout-demo__debug-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.doc-buffer-layout-demo__deck-head {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(210, 195, 255, 0.88);
}

.doc-buffer-layout-demo__error {
  margin: 0;
  padding: 0.55rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: rgba(80, 24, 28, 0.35);
  color: rgba(255, 210, 210, 0.94);
  font-size: 0.82rem;
}

.doc-buffer-layout-demo__insight {
  margin: 0;
  padding: 0.55rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(110, 170, 230, 0.22);
  background: rgba(8, 14, 28, 0.55);
  font-size: 0.84rem;
  line-height: 1.48;
  color: rgba(195, 212, 248, 0.94);
}

.doc-buffer-layout-demo__feedback {
  margin: 0;
  padding: 0.55rem 0.62rem;
  border-radius: 10px;
  font-size: 0.81rem;
  line-height: 1.45;
}

.doc-buffer-layout-demo__feedback--ok {
  border: 1px solid rgba(72, 210, 170, 0.38);
  background: rgba(16, 52, 42, 0.42);
  color: rgba(200, 242, 226, 0.94);
}

.doc-buffer-layout-demo__feedback--bad {
  border: 1px solid rgba(255, 170, 96, 0.42);
  background: rgba(58, 36, 14, 0.38);
  color: rgba(255, 226, 200, 0.96);
}

.doc-buffer-layout-demo__feedback-title {
  margin: 0 0 0.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.doc-buffer-layout-demo__feedback-list {
  margin: 0;
  padding-left: 1.05rem;
}

.doc-buffer-layout-demo__feedback-list li {
  margin: 0.28rem 0;
}

/* Visual byte bar */
.bal-byte-viz {
  margin: 0;
}

.bal-byte-viz__rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bal-byte-viz__block-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(160, 198, 248, 0.78);
  margin-bottom: 0.35rem;
}

.bal-byte-viz__track-wrap {
  position: relative;
  margin-bottom: 2px;
}

.bal-byte-viz__track {
  position: relative;
  display: flex;
  flex-direction: row;
  min-height: 32px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(100, 150, 210, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
}

.bal-byte-viz__seg {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.15rem 0.2rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(12, 14, 22, 0.92);
  box-sizing: border-box;
  border-right: 1px solid rgba(0, 0, 0, 0.2);
}

.bal-byte-viz__seg:last-child {
  border-right: none;
}

.bal-byte-viz__seg--pos {
  background: linear-gradient(180deg, #5ec8ff 0%, #3aa8e6 100%);
}

.bal-byte-viz__seg--col {
  background: linear-gradient(180deg, #d896ff 0%, #a855e8 100%);
}

.bal-byte-viz__seg--ubyte {
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 100%);
  color: rgba(28, 22, 8, 0.95);
}

.bal-byte-viz__seg--pad {
  background: repeating-linear-gradient(
    -45deg,
    rgba(60, 70, 95, 0.65),
    rgba(60, 70, 95, 0.65) 4px,
    rgba(40, 48, 68, 0.65) 4px,
    rgba(40, 48, 68, 0.65) 8px);
  color: rgba(210, 218, 235, 0.85);
  font-size: 0.58rem;
}

.bal-byte-viz__ghost-line {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 94, 94, 0.95);
  box-shadow: 0 0 10px rgba(255, 80, 80, 0.55);
  pointer-events: none;
  z-index: 2;
}

.bal-byte-viz__ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.28rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  color: rgba(150, 178, 220, 0.72);
}

.bal-byte-viz__tick {
  flex: 1;
  text-align: center;
}

.bal-byte-viz__tick:first-child {
  text-align: left;
}

.bal-byte-viz__tick:last-child {
  text-align: right;
}

.bal-byte-viz__note {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: rgba(175, 198, 235, 0.82);
}

.bal-byte-viz__note--warn {
  color: rgba(255, 200, 160, 0.9);
}

.doc-buffer-layout-demo__group-label {
  margin: 0.2rem 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(140, 205, 255, 0.72);
}

.doc-buffer-layout-demo__radios,
.doc-buffer-layout-demo__toggles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.doc-buffer-layout-demo__radio-row,
.doc-buffer-layout-demo__toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: rgba(188, 208, 240, 0.92);
  cursor: pointer;
}

.doc-buffer-layout-demo__radio-row input,
.doc-buffer-layout-demo__toggle-row input {
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: #5ec8ff;
}

.doc-buffer-layout-demo__radio-row code,
.doc-buffer-layout-demo__toggle-row code {
  font-size: 0.78em;
  font-weight: 600;
  color: rgba(120, 215, 248, 0.92);
}

.doc-buffer-layout-demo__byte-panel {
  margin: 0;
  padding: 0.55rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(94, 200, 255, 0.16);
  background: rgba(5, 10, 22, 0.62);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  color: rgba(175, 205, 248, 0.88);
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-buffer-layout-demo__byte-panel strong {
  color: rgba(230, 238, 255, 0.96);
  font-weight: 700;
}

.doc-buffer-layout-demo__byte-panel .bal-ref {
  display: block;
  margin-top: 0.45rem;
  padding-top: 0.42rem;
  border-top: 1px solid rgba(110, 150, 210, 0.14);
  color: rgba(160, 188, 228, 0.78);
}

.doc-buffer-layout-demo figcaption {
  margin: 0;
  padding: 0.65rem 1rem 0.85rem;
  font-size: 0.82rem;
  line-height: 1.52;
  color: rgba(165, 188, 228, 0.82);
  border-top: 1px solid rgba(110, 150, 210, 0.1);
}
