:root {
  --study-accent: #a6f4ef;
  --study-bg: rgba(3, 16, 22, 0.92);
  --study-border: rgba(166, 244, 239, 0.22);
  --study-muted: #7d969d;
  --study-text: #e8f3f5;
}

:root[data-brand-theme="crimson"] {
  --study-accent: #e4002b;
  --study-bg: rgba(7, 20, 33, 0.94);
  --study-border: rgba(228, 0, 43, 0.3);
  --study-muted: #9ba9b7;
  --study-text: #f2f4f6;
}

.header__menu .header__menu_item--lab {
  justify-content: center;
}

.header__menu .header__menu_item--lab svg {
  display: none;
}

.header__menu_item--lab:not(.is-infinity-reply)::before {
  color: #fff;
  font-family: var(
    --brand-display-font,
    "Oxanium",
    "Arial Narrow",
    sans-serif
  );
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.header__menu_item--lab:not(.is-infinity-reply)::before {
  content: "INFINITY REPLY";
}

.study-inspector,
.study-inspector * {
  box-sizing: border-box;
}

.study-inspector {
  position: fixed;
  z-index: 10000;
  top: 92px;
  right: 20px;
  width: min(370px, calc(100vw - 40px));
  max-height: calc(100vh - 116px);
  overflow: hidden;
  color: var(--study-text);
  border: 1px solid var(--study-border);
  border-radius: 4px;
  background: var(--study-bg);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.46);
  font: 400 12px/1.45
    var(--brand-display-font, "Oxanium", "Arial Narrow", sans-serif);
  letter-spacing: 0;
  backdrop-filter: blur(18px);
}

.study-inspector.is-collapsed {
  width: auto;
  max-height: none;
}

.study-inspector.is-collapsed .study-inspector__body,
.study-inspector.is-collapsed .study-inspector__status {
  display: none;
}

.study-inspector__header {
  display: flex;
  align-items: center;
  min-height: 45px;
  padding: 8px 10px 8px 13px;
  border-bottom: 1px solid var(--study-border);
}

.study-inspector__eyebrow {
  color: var(--study-accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.study-inspector__title {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
}

.study-inspector__collapse {
  width: 30px;
  height: 30px;
  margin-left: auto;
  padding: 0;
  color: var(--study-text);
  border: 1px solid var(--study-border);
  background: transparent;
  cursor: pointer;
}

.study-inspector__status {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-bottom: 1px solid var(--study-border);
  background: var(--study-border);
}

.study-stat {
  padding: 8px;
  text-align: center;
  background: rgba(3, 16, 22, 0.98);
}

.study-stat span {
  display: block;
  color: var(--study-muted);
  font-size: 9px;
  text-transform: uppercase;
}

.study-stat strong {
  color: var(--study-accent);
  font-size: 12px;
  font-weight: 500;
}

.study-inspector__body {
  max-height: calc(100vh - 210px);
  overflow: auto;
  overscroll-behavior: contain;
}

.study-section {
  padding: 11px 13px 13px;
  border-bottom: 1px solid var(--study-border);
}

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

.study-section__title {
  display: flex;
  align-items: center;
  margin: 0 0 9px;
  color: var(--study-muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.study-section__title::after {
  flex: 1;
  height: 1px;
  margin-left: 9px;
  background: var(--study-border);
  content: "";
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.study-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.study-button,
.study-select {
  min-height: 30px;
  margin: 0;
  padding: 6px 8px;
  color: var(--study-text);
  border: 1px solid var(--study-border);
  border-radius: 2px;
  outline: 0;
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
}

.study-button {
  cursor: pointer;
}

.study-button:hover,
.study-button.is-active {
  color: #031016;
  border-color: var(--study-accent);
  background: var(--study-accent);
}

.study-button:disabled {
  cursor: wait;
  opacity: 0.35;
}

.study-check {
  display: flex;
  align-items: center;
  min-height: 28px;
  cursor: pointer;
}

.study-check input {
  width: 13px;
  height: 13px;
  margin: 0 8px 0 0;
  accent-color: var(--study-accent);
}

.study-offset-control {
  margin-top: 10px;
  color: var(--study-muted);
}

.study-offset-control > label {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.study-offset-control__inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 8px;
}

.study-offset-control input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--study-accent);
}

.study-offset-control input[type="number"] {
  width: 100%;
  height: 30px;
  padding: 5px 6px;
  color: var(--study-text);
  border: 1px solid var(--study-border);
  border-radius: 2px;
  outline: 0;
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.study-offset-control input:disabled {
  cursor: wait;
  opacity: 0.4;
}

.study-camera {
  margin-top: 9px;
  padding: 8px;
  color: var(--study-muted);
  border: 1px solid var(--study-border);
  white-space: pre-wrap;
}

[data-camera-readout] {
  height: 88px;
  overflow: hidden;
  white-space: pre;
}

.study-tree {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--study-border);
  background: rgba(0, 0, 0, 0.16);
}

.study-tree__row {
  display: block;
  width: 100%;
  min-height: 25px;
  overflow: hidden;
  padding: 4px 8px;
  color: var(--study-text);
  border: 0;
  border-bottom: 1px solid rgba(166, 244, 239, 0.08);
  background: transparent;
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.study-tree__row:hover,
.study-tree__row.is-selected {
  color: var(--study-accent);
  background: rgba(166, 244, 239, 0.08);
}

.study-tree__row.is-hidden {
  opacity: 0.45;
}

.study-object {
  min-height: 74px;
  max-height: 190px;
  margin: 8px 0 0;
  overflow: auto;
  padding: 8px;
  color: #b7c9cd;
  border: 1px solid var(--study-border);
  background: rgba(0, 0, 0, 0.22);
  font: inherit;
  white-space: pre-wrap;
}

.study-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.study-links a {
  color: var(--study-accent);
  text-decoration: none;
}

.study-links a:hover {
  text-decoration: underline;
}

.study-ready-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #e7ac57;
  box-shadow: 0 0 10px currentColor;
}

.study-inspector.is-ready .study-ready-dot {
  color: #78e6b0;
  background: currentColor;
}

/* Keep the home copy anchored consistently on the left while cameras change. */
body.is-page-home #shader-context,
body.is-page-home #shader-context.is-left,
body.is-page-home #shader-context.is-right {
  right: auto;
  left: 5%;
  text-align: left;
}

@media (max-width: 720px) {
  body.is-page-home #shader-context,
  body.is-page-home #shader-context.is-left,
  body.is-page-home #shader-context.is-right {
    right: 20px;
    left: 20px;
    width: auto;
  }

  .study-inspector {
    top: 76px;
    right: 10px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 86px);
  }

  .study-inspector__body {
    max-height: calc(100vh - 180px);
  }
}
