.lab {
  max-width: 1120px;
  margin-inline: auto;
  scroll-margin-top: 96px;
}
.lab * {
  box-sizing: border-box;
  min-width: 0;
}
.lab [hidden] {
  display: none !important;
}
.lab p {
  line-height: 1.45;
  margin-block: 0.55rem;
}
.lab h3 {
  margin-block: 0.6rem;
}
.lab button,
.lab select,
.lab textarea {
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.8rem;
  max-width: 100%;
}
.lab button {
  cursor: pointer;
  min-height: 44px;
}
.lab button:hover {
  border-color: var(--accent);
}
.lab button:disabled {
  opacity: 0.6;
  cursor: default;
}
.lab :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.lab label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.875rem;
}
.lab input[type="range"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--accent);
}
.lab input[type="radio"] {
  accent-color: var(--accent);
  width: 20px;
  height: 20px;
}
.lab select {
  width: 100%;
  min-height: 44px;
}
.lab-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.lab-toolbar > label {
  grid-template-rows: 1fr auto;
}
.lab-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 1fr);
  gap: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.25rem;
  background: var(--surface);
}
.lab-scenes {
  display: flex;
  gap: 0.75rem;
}
.lab-vessel {
  margin: 0;
  flex: 1;
  min-width: 0;
  text-align: center;
}
.lab-vessel svg {
  width: 100%;
  max-height: 330px;
  overflow: visible;
}
.lab-vessel figcaption,
.lab-caption,
.lab-phase,
.lab-onset {
  font-size: 0.875rem;
  color: var(--muted);
}
.lab-chamber-label {
  font-size: 9px;
  fill: currentColor;
}
.lab-temp {
  font-size: 18px;
  font-weight: 700;
  fill: var(--text);
}
.lab-probe {
  cursor: grab;
  touch-action: none;
  color: var(--accent);
}
.lab-probe.outside {
  transform: translate(35px, -24px);
}
.lab-water-bottom {
  stop-color: var(--lab-water-color, #95b5bf);
  stop-opacity: 0.95;
}
.lab-water-top {
  stop-color: var(--lab-water-color, #95b5bf);
  stop-opacity: 0.45;
}
.lab-surface {
  stroke: var(--lab-water-color, #95b5bf);
  stroke-width: 3;
  opacity: 0.9;
  animation: lab-liquid 3s ease-in-out infinite alternate;
}
.lab-vessel.boiling .lab-surface {
  animation-duration: var(--lab-boil-speed, 1s);
  stroke-width: 4;
}
.lab-steam {
  opacity: 0;
  stroke-width: 2.5;
  color: var(--lab-water-color, #95b5bf);
}
.lab-vessel.boiling .lab-steam {
  opacity: 0.8;
}
.lab-vessel.boiling .lab-steam path {
  animation: lab-steam var(--lab-boil-speed, 1.5s) ease-out infinite;
}
.lab-steam path:nth-child(2) {
  animation-delay: -0.4s;
}
.lab-steam path:nth-child(3) {
  animation-delay: -0.8s;
}
@keyframes lab-steam {
  from {
    transform: translateY(5px);
    opacity: 0;
  }
  25% {
    opacity: 0.8;
  }
  to {
    transform: translateY(-10px);
    opacity: 0;
  }
}
.lab-bubbles {
  color: var(--text);
  stroke-width: 1.5;
  opacity: 0;
}
.lab-vessel.boiling .lab-bubbles {
  opacity: 1;
}
.lab-vessel.boiling .lab-bubbles circle {
  animation: lab-bubble var(--lab-boil-speed, 1.5s) linear infinite;
}
.lab-vessel.boiling .lab-bubbles circle:nth-child(2n) {
  animation-delay: -0.7s;
}
.lab-vessel.boiling .lab-bubbles circle:nth-child(3n) {
  animation-delay: -1.1s;
}
.lab-vessel.intense.boiling svg {
  animation: lab-shimmer 0.3s ease-in-out infinite alternate;
}
@keyframes lab-shimmer {
  to {
    transform: translateX(0.6px) rotate(0.15deg);
  }
}
.lab-vessel.heating .lab-heater,
.lab-vessel.boiling .lab-heater {
  color: var(--accent);
}
.lab-measures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.lab-reading {
  color: var(--accent) !important;
  font-weight: 700 !important;
}
.lab .lab-controls {
  display: grid;
  gap: 0.7rem;
  align-content: start;
  padding: 0;
}
.lab .lab-controls output {
  font-weight: 700;
  color: var(--accent);
}
.lab-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-block: 1rem;
}
.lab-actions #lab-start {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.lab-actions #lab-status {
  font-size: 0.875rem;
}
.lab-chart-wrap,
#lab-mission,
.lab details,
.lab-save,
#lab-notebook {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  margin-block: 1rem;
  background: var(--surface);
}
#lab-chart {
  width: 100%;
  height: auto;
  touch-action: pan-y;
  color: var(--muted);
}
#lab-chart text {
  font-size: 12px;
  fill: currentColor;
}
#lab-line-a {
  color: var(--accent);
}
#lab-line-b {
  color: var(--cool);
}
.lab summary {
  cursor: pointer;
  min-height: 44px;
  display: list-item;
  padding: 0.5rem;
}
.lab fieldset {
  border: 0;
  padding: 0;
  margin: 1rem 0;
}
.lab fieldset label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  line-height: 1.3;
}
.lab-save {
  display: grid;
  gap: 0.7rem;
}
.lab-save button {
  justify-self: start;
}
#lab-entries article {
  border-bottom: 1px solid var(--line);
  padding-block: 1rem;
  overflow-wrap: anywhere;
}
#lab-entries button {
  margin: 0.3rem;
}
.lab-meter-details {
  font-variant-numeric: tabular-nums;
}
@keyframes lab-bubble {
  from {
    transform: translateY(0);
    opacity: 0.8;
  }
  to {
    transform: translateY(calc(-1 * var(--lab-bubble-rise, 55px)));
    opacity: 0;
  }
}
@keyframes lab-liquid {
  to {
    transform: translate(3px, -0.6px);
  }
}
@media (max-width: 700px) {
  .lab-workbench {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  .lab-toolbar {
    gap: 0.6rem;
  }
  .lab-scenes:has(.lab-vessel:nth-child(2)) .lab-measures {
    grid-template-columns: 1fr;
  }
  .lab-scenes:has(.lab-vessel:nth-child(2)) .lab-reading {
    padding: 0.45rem;
  }
  .lab-vessel svg {
    max-height: 260px;
  }
  .lab-actions {
    position: sticky;
    bottom: 8px;
    z-index: 2;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0.6rem;
  }
  .lab-actions #lab-status {
    flex-basis: 100%;
  }
  .lab-vessel figcaption {
    min-height: 3.8em;
  }
  .lab-scenes {
    gap: 0.4rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .lab-vessel.boiling .lab-bubbles circle,
  :root:not([data-motion="full"]) .lab-surface,
  :root:not([data-motion="full"]) .lab-steam path,
  :root:not([data-motion="full"]) .lab-vessel.intense.boiling svg {
    animation: none !important;
  }
}
.lab.is-paused .lab-bubbles circle,
.lab.is-paused .lab-steam path,
.lab.is-paused .lab-vessel svg,
.lab.motion-suspended .lab-bubbles circle,
.lab.motion-suspended .lab-surface,
.lab.motion-suspended .lab-steam path,
.lab.motion-suspended .lab-vessel svg {
  animation-play-state: paused !important;
}
