/* byteomi-runtime-atlas/frame-budget-visualizer.html */

.doc-byteomi-preset.doc-byteomi-preset--hero.doc-byteomi-preset--frame-budget {
  max-width: min(100%, 72rem);
  width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}

.doc-byteomi-preset--frame-budget .doc-byteomi-preset__tag {
  color: rgba(255, 175, 120, 0.95);
}

/* Shared Atlas guide prose (mirrors event-loop) */
.doc-atlas-guide__read-list {
  --atlas-label-grad: linear-gradient(
    108deg,
    #6ee7c8 0%,
    #8ec5ff 30%,
    #b58cff 58%,
    #f0c4a0 92%
  );
  margin: 0.5rem 0 0;
  padding-left: 0;
  list-style: none;
  color: rgba(175, 192, 215, 0.92);
}

.doc-atlas-guide__read-list li {
  position: relative;
  margin-bottom: 0.7rem;
  padding-left: 1rem;
  line-height: 1.58;
}

.doc-atlas-guide__read-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6ee7c8 0%, #b58cff 100%);
}

.doc-atlas-guide__label {
  display: block;
  margin-bottom: 0.22rem;
  font-size: 0.88rem;
  font-weight: 700;
  background: var(--atlas-label-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #c4b0ff;
}

.doc-atlas-guide__read-list li em {
  font-style: normal;
  font-weight: 600;
  color: rgba(200, 195, 225, 0.92);
}

.doc-atlas-guide__tip {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 160, 100, 0.22);
  background: rgba(20, 12, 18, 0.5);
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(170, 188, 210, 0.9);
}

.doc-atlas-guide__steps {
  margin: 0.65rem 0;
  padding-left: 1.25rem;
  list-style: none;
  counter-reset: atlas-step;
}

.doc-atlas-guide__steps li {
  position: relative;
  margin-bottom: 0.45rem;
  padding-left: 0.35rem;
  line-height: 1.5;
  color: rgba(175, 200, 230, 0.92);
}

.doc-atlas-guide__steps li::before {
  counter-increment: atlas-step;
  content: counter(atlas-step);
  position: absolute;
  left: -1.25rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 700;
  color: rgba(255, 175, 100, 0.9);
}

.doc-atlas-guide__controls dt {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  background: linear-gradient(102deg, #7ee8d8 0%, #ffb88a 55%, #d4a8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.doc-atlas-guide__controls {
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.65rem;
}

.doc-atlas-guide__controls div {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(70, 110, 160, 0.2);
  background: rgba(6, 12, 24, 0.55);
}

.doc-atlas-guide__controls dd {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(165, 190, 225, 0.88);
}

.doc-atlas-guide__signals {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .doc-atlas-guide__signals {
    grid-template-columns: 1fr 1fr;
  }
}

.doc-atlas-guide__signal {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(80, 120, 170, 0.22);
}

.doc-atlas-guide__signal .doc-h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.doc-atlas-guide__signal ul {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.doc-atlas-guide__signal--ok {
  border-color: rgba(70, 180, 140, 0.35);
  background: rgba(8, 28, 22, 0.45);
}

.doc-atlas-guide__signal--ok .doc-h3 {
  color: rgba(100, 220, 170, 0.95);
}

.doc-atlas-guide__signal--warn {
  border-color: rgba(255, 175, 95, 0.35);
  background: rgba(28, 18, 8, 0.45);
}

.doc-atlas-guide__signal--warn .doc-h3 {
  color: rgba(255, 190, 120, 0.95);
}

.doc-atlas-guide__signal--bad {
  border-color: rgba(255, 100, 90, 0.35);
  background: rgba(28, 10, 12, 0.45);
}

.doc-atlas-guide__signal--bad .doc-h3 {
  color: rgba(255, 140, 120, 0.95);
}

.doc-atlas-guide__insight {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid rgba(255, 160, 90, 0.55);
  border-radius: 0 8px 8px 0;
  background: rgba(18, 12, 10, 0.55);
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(190, 210, 235, 0.92);
}

.doc-atlas-guide__stage-map {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

@media (min-width: 520px) {
  .doc-atlas-guide__stage-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .doc-atlas-guide__stage-map {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.doc-atlas-guide__stage-map li {
  margin: 0;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(90, 120, 170, 0.22);
  background: rgba(6, 12, 22, 0.65);
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(165, 190, 220, 0.9);
}

.doc-atlas-guide__stage-map strong {
  display: block;
  margin-bottom: 0.15rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(102deg, #ffb56a 0%, #ff8a6a 55%, #b58cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.doc-atlas-guide__control-insight {
  display: block;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(80, 110, 150, 0.25);
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(150, 175, 210, 0.88);
}

.doc-atlas-guide__control-insight em {
  font-style: normal;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: rgba(255, 175, 120, 0.85);
}

.doc-fb-lab__runtime-note {
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.55rem 0.45rem 0.65rem;
  border-left: 2px solid rgba(255, 160, 90, 0.5);
  border-radius: 0 6px 6px 0;
  background: rgba(12, 10, 18, 0.65);
  font-size: 0.68rem;
  line-height: 1.5;
  color: rgba(155, 185, 220, 0.88);
}

.doc-fb-lab__runtime-note-label {
  display: block;
  margin-bottom: 0.2rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 160, 120, 0.8);
}

.doc-fb-lab__toolbar,
.doc-fb-lab__hud-row,
.doc-fb-lab__timeline-wrap,
.doc-fb-lab__legend,
.doc-fb-lab__hud,
.doc-fb-lab__console,
.doc-fb-lab__hint {
  /* mirror doc-el-lab structure */
}

.doc-fb-lab__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(80, 120, 170, 0.2);
  background: rgba(6, 12, 22, 0.88);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.doc-fb-lab__rec {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ff8a6a;
}

.doc-fb-lab__rec::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffb56a, #ff6a6a);
  animation: fb-rec-pulse 1.2s ease-in-out infinite;
}

.doc-fb-lab__rec.is-paused {
  color: rgba(140, 160, 180, 0.8);
}

.doc-fb-lab__rec.is-paused::before {
  animation: none;
  background: rgba(120, 130, 150, 0.6);
}

@keyframes fb-rec-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.doc-fb-lab__pause-btn,
.doc-fb-lab__hz-btn,
.doc-fb-lab__scrub {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.55rem;
}

.doc-fb-lab__pause-btn {
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(100, 140, 190, 0.35);
  background: rgba(10, 18, 32, 0.9);
  color: rgba(190, 215, 245, 0.92);
  cursor: pointer;
}

.doc-fb-lab__scrub {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 10rem;
  color: rgba(140, 175, 210, 0.85);
}

.doc-fb-lab__scrub input {
  flex: 1;
  accent-color: #ffb56a;
}

.doc-fb-lab__hud-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.doc-fb-lab__metric {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(90, 130, 180, 0.22);
  background: rgba(6, 12, 22, 0.9);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.doc-fb-lab__metric-label {
  display: block;
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(120, 160, 200, 0.75);
  margin-bottom: 0.2rem;
}

.doc-fb-lab__metric strong {
  font-size: 0.78rem;
  color: rgba(200, 230, 255, 0.95);
}

.doc-fb-lab__metric--budget strong {
  color: #7ee8d8;
}

.doc-fb-lab__metric--killer strong {
  color: rgba(200, 200, 220, 0.9);
}

.doc-fb-lab__metric--killer.is-killer strong {
  color: #ff7a6a;
}

.doc-fb-lab__metric--budget.is-miss strong,
.doc-fb-lab__metric--budget.is-over strong {
  color: #ff6a6a;
}

.doc-fb-lab__killer-insight {
  margin: 0 0 0.55rem;
  padding: 0.5rem 0.6rem 0.5rem 0.65rem;
  border-left: 2px solid rgba(120, 150, 190, 0.35);
  border-radius: 0 8px 8px 0;
  background: rgba(8, 14, 24, 0.75);
  font-size: 0.68rem;
  line-height: 1.5;
  color: rgba(165, 190, 225, 0.9);
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.doc-fb-lab__killer-insight.is-active {
  border-left-color: rgba(255, 120, 90, 0.75);
  background: rgba(24, 12, 10, 0.7);
  color: rgba(210, 225, 245, 0.95);
}

.doc-fb-lab__killer-insight-label {
  display: block;
  margin-bottom: 0.2rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 160, 120, 0.8);
}

.doc-fb-lab__killer-insight.is-active .doc-fb-lab__killer-insight-label {
  color: rgba(255, 140, 100, 0.95);
}

.doc-fb-lab__stage-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.4rem;
  margin: 0 0 0.55rem;
}

.doc-fb-lab__stage-chip {
  padding: 0.35rem 0.45rem;
  border-radius: 7px;
  border: 1px solid rgba(80, 110, 150, 0.22);
  background: rgba(6, 12, 22, 0.8);
  font-size: 0.58rem;
  line-height: 1.4;
  color: rgba(150, 175, 210, 0.85);
}

.doc-fb-lab__stage-chip strong {
  display: block;
  margin-bottom: 0.12rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(200, 220, 245, 0.9);
}

.doc-fb-lab__stage-chip.is-active {
  border-color: rgba(255, 140, 90, 0.55);
  background: rgba(28, 14, 10, 0.75);
  color: rgba(220, 235, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 120, 80, 0.12);
}

.doc-fb-lab__stage-chip.is-active strong {
  color: #ff9a6a;
}

.doc-fb-lab__timeline-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 160, 100, 0.18);
  background: #060a10;
  min-height: 360px;
}

.doc-fb-lab__timeline {
  display: block;
  width: 100%;
  min-height: 360px;
}

.doc-fb-lab__tooltip {
  position: absolute;
  z-index: 4;
  max-width: 220px;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 160, 100, 0.35);
  background: rgba(8, 14, 26, 0.96);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.55rem;
  color: rgba(190, 215, 240, 0.92);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.doc-fb-lab__tooltip strong {
  display: block;
  color: #ffb56a;
  margin-bottom: 0.15rem;
}

.doc-fb-lab__tooltip p {
  margin: 0.25rem 0 0;
  line-height: 1.45;
}

.doc-fb-lab__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-top: 0.45rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.52rem;
  color: rgba(140, 170, 210, 0.8);
}

.doc-fb-lab__legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  font-style: normal;
  display: inline-block;
}

.doc-fb-lab__legend i[data-c="js"] {
  background: rgba(110, 175, 255, 0.85);
}

.doc-fb-lab__legend i[data-c="layout"] {
  background: rgba(255, 175, 95, 0.85);
}

.doc-fb-lab__legend i[data-c="paint"] {
  background: rgba(255, 125, 105, 0.85);
}

.doc-fb-lab__legend i[data-c="raster"] {
  background: rgba(255, 90, 70, 0.85);
}

.doc-fb-lab__legend i[data-c="limit"] {
  background: rgba(255, 255, 255, 0.5);
}

.doc-fb-lab__hud {
  margin-top: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(90, 130, 180, 0.2);
  background: rgba(6, 12, 24, 0.75);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
}

.doc-fb-lab__formula {
  margin: 0 0 0.3rem;
  color: rgba(255, 190, 130, 0.95);
  font-weight: 600;
}

.doc-fb-lab__readout {
  margin: 0;
  color: rgba(150, 185, 220, 0.88);
}

.doc-fb-lab__console {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 140, 80, 0.2);
  background: linear-gradient(180deg, rgba(12, 10, 18, 0.92), rgba(6, 8, 16, 0.95));
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.doc-fb-lab__console-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(80, 100, 140, 0.2);
}

.doc-fb-lab__console-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(200, 160, 120, 0.85);
}

.doc-fb-lab__hz {
  display: flex;
  gap: 0.35rem;
}

.doc-fb-lab__hz-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(100, 130, 180, 0.3);
  background: rgba(8, 16, 28, 0.85);
  color: rgba(180, 210, 240, 0.88);
  cursor: pointer;
}

.doc-fb-lab__hz-btn.is-active {
  border-color: rgba(255, 175, 100, 0.55);
  color: #ffb56a;
}

.doc-fb-lab__toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
}

.doc-fb-lab__toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.55rem;
  color: rgba(170, 195, 230, 0.88);
  cursor: pointer;
}

.doc-fb-lab__toggle input {
  accent-color: #ffb56a;
}

.doc-fb-lab__hint {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(170, 195, 230, 0.82);
}

@media (prefers-reduced-motion: reduce) {
  .doc-fb-lab__rec::before {
    animation: none;
  }
}

@media (max-width: 640px) {
  .doc-fb-lab__toolbar {
    gap: 0.4rem 0.5rem;
  }

  .doc-fb-lab__scrub {
    flex: 1 1 100%;
    min-width: 0;
  }

  .doc-fb-lab__hud-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-fb-lab__stage-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-fb-lab__timeline-wrap,
  .doc-fb-lab__timeline {
    min-height: 300px;
  }

  .doc-fb-lab__toggle {
    min-height: 1.75rem;
  }
}
