/* Ray Budget Lab — raycaster-performance.html */

.doc-ray-budget-lab {
  margin: 1rem 0 1.1rem;
}

.doc-ray-budget-lab .doc-ray-budget-lab__layout {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.doc-ray-budget-lab .doc-ray-budget-lab__deck {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.05fr);
  gap: 0.85rem;
  align-items: stretch;
}

@media (max-width: 860px) {
  .doc-ray-budget-lab .doc-ray-budget-lab__deck {
    grid-template-columns: 1fr;
  }
}

.doc-ray-budget-lab .doc-two-gates__stage.doc-ray-budget-lab__viewport {
  position: relative;
  min-height: 420px;
}

.doc-ray-budget-lab .doc-two-gates__mount canvas {
  display: block;
}

.doc-ray-budget-lab__freeze-banner {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  background: rgba(4, 10, 22, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms ease;
}

.doc-ray-budget-lab__freeze-banner.is-on {
  opacity: 1;
  visibility: visible;
}

.doc-ray-budget-lab__freeze-inner {
  max-width: min(92%, 22rem);
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(46, 231, 242, 0.28);
  background: rgba(6, 14, 28, 0.92);
  color: rgba(220, 235, 255, 0.95);
  font-size: 0.82rem;
  line-height: 1.45;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.doc-ray-budget-lab__freeze-inner strong {
  color: rgba(255, 230, 160, 0.98);
}

.doc-ray-budget-lab .doc-two-gates__hud {
  position: static;
  margin: 0;
}

.doc-ray-budget-lab .doc-two-gates__controls {
  margin: 0;
}

.doc-ray-budget-lab__heat-hint {
  margin: 0 0 0.55rem;
  padding: 0.38rem 0.48rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.74rem;
  line-height: 1.4;
  color: rgba(200, 218, 248, 0.88);
}

.doc-ray-budget-lab__hint {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.14);
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(210, 225, 252, 0.92);
}

.doc-ray-budget-lab__hint[data-tone="warn"] {
  border-color: rgba(255, 140, 100, 0.35);
  background: rgba(40, 14, 8, 0.35);
}

.doc-ray-budget-lab__hint[data-tone="ok"] {
  border-color: rgba(80, 220, 140, 0.28);
  background: rgba(6, 28, 18, 0.28);
}

.doc-ray-budget-lab .doc-two-gates__seg-btn {
  font-size: 0.62rem;
  padding: 0.4rem 0.18rem;
}

.doc-ray-budget-lab__row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.doc-ray-budget-lab__row:has([data-ray-budget-complexity]) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.doc-ray-budget-lab__row:has([data-ray-budget-frequency]) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-ray-budget-lab__row:has([data-ray-budget-precision]) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 520px) {
  .doc-ray-budget-lab__row:has([data-ray-budget-complexity]) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.doc-ray-budget-lab [data-ray-budget-mode="low"].is-active {
  border-color: rgba(94, 200, 255, 0.4);
  background: linear-gradient(145deg, rgba(94, 200, 255, 0.35), rgba(46, 140, 220, 0.18));
}

.doc-ray-budget-lab [data-ray-budget-mode="medium"].is-active {
  border-color: rgba(120, 220, 140, 0.38);
  background: linear-gradient(145deg, rgba(120, 220, 140, 0.32), rgba(40, 140, 90, 0.18));
}

.doc-ray-budget-lab [data-ray-budget-mode="high"].is-active {
  border-color: rgba(255, 190, 90, 0.38);
  background: linear-gradient(145deg, rgba(255, 190, 90, 0.32), rgba(180, 120, 40, 0.2));
}

.doc-ray-budget-lab [data-ray-budget-mode="insane"].is-active {
  border-color: rgba(255, 90, 130, 0.42);
  background: linear-gradient(145deg, rgba(255, 90, 130, 0.34), rgba(180, 40, 80, 0.22));
}

.doc-ray-budget-lab__cpu {
  margin-top: 0.35rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.doc-ray-budget-lab__cpu-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ee7f2, #ff4466);
  transition: width 120ms ease-out;
}

.doc-ray-budget-lab__bd-title {
  margin-top: 0.55rem;
}

.doc-ray-budget-lab__bd-caption {
  margin: 0 0 0.45rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(165, 190, 230, 0.82);
}

.doc-ray-budget-lab__breakdown {
  margin-top: 0;
}

.doc-ray-budget-lab__breakdown-bar {
  display: flex;
  flex-direction: row;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  gap: 3px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.doc-ray-budget-lab__bd-seg {
  height: 100%;
  min-width: 0;
  flex: 1 1 0%;
  transition: flex-grow 220ms ease-out;
}

.doc-ray-budget-lab__bd-seg--rays {
  background: linear-gradient(180deg, #5aeffb, #1ea8c4);
}

.doc-ray-budget-lab__bd-seg--tris {
  background: linear-gradient(180deg, #d892ff, #a44dcf);
}

.doc-ray-budget-lab__bd-seg--objs {
  background: linear-gradient(180deg, #ffcc77, #dd8833);
}

.doc-ray-budget-lab__breakdown-legend {
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.72rem;
  line-height: 1.55;
  color: rgba(200, 218, 248, 0.92);
}

.doc-ray-budget-lab__breakdown-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.doc-ray-budget-lab__breakdown-legend strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.doc-ray-budget-lab__bd-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.doc-ray-budget-lab__bd-dot--rays {
  background: #3bdcf0;
  box-shadow: 0 0 8px rgba(62, 220, 255, 0.45);
}

.doc-ray-budget-lab__bd-dot--tris {
  background: #c078ee;
  box-shadow: 0 0 8px rgba(192, 120, 238, 0.45);
}

.doc-ray-budget-lab__bd-dot--objs {
  background: #eeaa44;
  box-shadow: 0 0 8px rgba(238, 170, 68, 0.38);
}

.doc-ray-budget-lab .doc-ray-budget-lab__viewport.doc-ray-budget-lab--spatial-flash {
  box-shadow: inset 0 0 0 2px rgba(72, 255, 168, 0.62);
  transition: box-shadow 140ms ease;
}
