@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-400-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #16303d;
  --ink-soft: #415c69;
  --muted: #68808c;
  --faint: #8fa6b0;
  --line: #c5d5dc;
  --line-soft: #dbe7ec;
  --panel: rgba(248, 251, 252, 0.94);
  --panel-solid: #f8fbfc;
  --chamber-edge: #b7cbd5;
  --frost: #f5fafc;
  --ice: #eefaff;
  --cyan: #4a9fbe;
  --cyan-deep: #24718d;
  --cyan-pale: #d7eef6;
  --warning: #915b48;
  --shadow-blue: rgba(71, 132, 161, 0.18);
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  background:
    linear-gradient(115deg, rgba(255,255,255,0.66), rgba(230,241,245,0.36) 42%, rgba(215,231,238,0.52)),
    repeating-linear-gradient(90deg, rgba(112,150,166,0.025) 0 1px, transparent 1px 7px),
    #eaf2f5;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="range"],
textarea {
  color: var(--ink);
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}


button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

:focus-visible {
  outline: 2px solid var(--cyan-deep);
  outline-offset: 3px;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 64px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 251, 252, 0.91);
  backdrop-filter: blur(10px);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 31px;
  height: 31px;
  color: var(--cyan-deep);
  flex: 0 0 auto;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1;
  font-weight: 200;
  letter-spacing: 0.035em;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.top-actions,
.button-row,
.time-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.time-control {
  padding-right: 8px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.quiet-button,
.speed-button,
.tool-button,
.text-button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.65);
  border-radius: 7px;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 300;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.quiet-button:hover,
.speed-button:hover,
.tool-button:hover,
.text-button:hover {
  border-color: #91b6c4;
  background: #fff;
}

.quiet-button[aria-pressed="true"],
.speed-button.is-active,
.tool-button.is-active {
  border-color: var(--cyan-deep);
  color: #104c61;
  background: var(--cyan-pale);
}

.quiet-button.danger {
  color: var(--warning);
}

.text-button {
  min-height: 0;
  padding: 2px 5px;
  border-color: transparent;
  background: transparent;
  color: var(--cyan-deep);
  font-size: 12px;
}

.lab-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(236px, 22vw, 302px) minmax(390px, 1fr) clamp(286px, 25vw, 364px);
  gap: 14px;
  padding: 14px 16px 92px;
}

.panel {
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(63, 110, 134, 0.10), inset 0 1px 0 rgba(255,255,255,0.9);
  scrollbar-width: thin;
  scrollbar-color: #a8c0ca transparent;
}

.instrument-section {
  padding: 15px 15px 16px;
  border-bottom: 1px solid var(--line-soft);
}

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

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.section-key,
.section-heading output {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.dial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 11px;
}

.dial-instrument {
  min-width: 0;
  text-align: center;
}

.dial-control {
  width: 116px;
  height: 116px;
  margin: 0 auto;
  position: relative;
  border-radius: 50%;
  touch-action: none;
  color: var(--cyan-deep);
}

.dial-control svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.dial-face {
  fill: rgba(250,253,254,0.88);
  stroke: var(--line);
  stroke-width: 1;
}

.dial-tick {
  stroke: #8ca5b1;
  stroke-width: 1;
}

.dial-tick.minor {
  stroke: #bfced5;
  stroke-width: 0.7;
}

.dial-needle {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.dial-hub {
  fill: #f8fcfd;
  stroke: currentColor;
  stroke-width: 1;
}

.dial-arc {
  fill: none;
  stroke: #bde0eb;
  stroke-width: 3;
}

.dial-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.dial-value-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
  font-family: var(--mono);
}

.dial-value {
  border: 0;
  border-bottom: 1px solid transparent;
  width: 6.5ch;
  padding: 1px 0;
  color: var(--ink);
  background: transparent;
  text-align: right;
  font-family: var(--mono);
  font-size: 14px;
}

.dial-value:focus {
  border-bottom-color: var(--cyan-deep);
  outline: none;
}

.dial-unit {
  color: var(--muted);
  font-size: 11px;
}

.measured-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.measure-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.measure-value {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
}

.regime-note,
.microcopy,
.cell-inspector {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.tool-button {
  min-width: 0;
  padding: 7px 4px 6px;
  text-align: center;
}

.tool-button span {
  display: block;
  font-size: 12px;
}

kbd {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--muted);
  background: rgba(255,255,255,0.7);
  font-family: var(--mono);
  font-size: 9px;
}

.field-label {
  display: block;
  margin: 10px 0 5px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.025em;
}

.control-input,
.code-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,0.75);
  padding: 7px 8px;
  font-size: 13px;
}

.code-box {
  resize: vertical;
  min-height: 72px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  word-break: break-all;
}

.rotation-section {
  padding-bottom: 14px;
}

.tilt-slider {
  width: 100%;
  accent-color: var(--cyan-deep);
}

.solid-canvas {
  display: block;
  width: 100%;
  height: 150px;
  margin-top: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: linear-gradient(#f5fafc, #e6f0f4);
}

.chamber-column {
  min-width: 0;
  min-height: 0;
}

.chamber {
  position: relative;
  height: 100%;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid #9eb8c4;
  border-radius: 24px;
  background:
    linear-gradient(150deg, rgba(255,255,255,0.18), transparent 26%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 9px),
    linear-gradient(#cfdfe6, #b9cdd7 54%, #a9bfcc);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.65),
    inset 0 -18px 36px rgba(55,92,110,0.17),
    0 20px 55px rgba(60,103,127,0.18);
}

#plateCanvas {
  position: absolute;
  inset: 18px;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  border-radius: 17px;
  cursor: crosshair;
  touch-action: none;
}

#plateCanvas:focus-visible {
  outline-offset: -2px;
}

.chamber-label {
  position: absolute;
  top: 28px;
  left: 30px;
  display: flex;
  gap: 13px;
  color: rgba(34, 72, 89, 0.66);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

.scale-bar {
  position: absolute;
  left: 31px;
  bottom: 28px;
  color: rgba(21, 58, 74, 0.82);
  font-family: var(--mono);
  font-size: 10px;
  pointer-events: none;
}

.scale-bar span {
  display: block;
  width: 72px;
  height: 5px;
  border-left: 1px solid currentColor;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  margin-bottom: 3px;
}

.scale-bar b {
  font-weight: 500;
}

.plate-status {
  position: absolute;
  top: 28px;
  right: 30px;
  max-width: 270px;
  padding: 5px 7px;
  border: 1px solid rgba(151, 182, 196, 0.6);
  border-radius: 6px;
  color: rgba(23, 63, 80, 0.82);
  background: rgba(235, 245, 248, 0.72);
  font-family: var(--mono);
  font-size: 10px;
  pointer-events: none;
}

.chamber-hint {
  position: absolute;
  left: 150px;
  right: 24px;
  bottom: 29px;
  color: rgba(42, 79, 95, 0.63);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-canvas {
  display: block;
  width: 100%;
  height: 148px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f7fbfc;
}

.trace-legend {
  display: flex;
  gap: 16px;
  margin-top: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.trace-legend i {
  display: inline-block;
  width: 16px;
  height: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

.trace-temp { background: #3f97b7; }
.trace-sat { background: #718792; }

.specimen-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  min-height: 29px;
}

.specimen-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.66);
  padding: 5px 9px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.specimen-chip[aria-selected="true"] {
  border-color: var(--cyan-deep);
  color: #114f64;
  background: var(--cyan-pale);
}

.specimen-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0;
}

.specimen-metrics div {
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.specimen-metrics dt {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.specimen-metrics dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.experiment-card h3 {
  margin: 11px 0 4px;
  font-weight: 300;
  font-size: 17px;
}

.experiment-card p {
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.experiment-steps {
  margin: 0;
  padding-left: 21px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.experiment-steps li {
  margin: 6px 0;
  padding-left: 2px;
}

.experiment-steps li.is-done {
  color: #397486;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.experiment-steps li.is-current {
  color: var(--ink);
  font-weight: 400;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(218, 233, 238, 0.58);
  backdrop-filter: blur(3px);
}

.library-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  width: min(430px, 100vw);
  overflow-y: auto;
  border-left: 1px solid #a9bfca;
  background: var(--panel-solid);
  box-shadow: -22px 0 52px rgba(47, 90, 112, 0.19);
  padding: 18px;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.drawer-header h2 {
  margin: 0;
  font-weight: 200;
  font-size: 24px;
}

.drawer-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.library-list {
  display: grid;
  gap: 10px;
}

.library-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.library-item h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 300;
}

.library-item p {
  margin: 5px 0 8px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.48;
}

.library-conditions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(221, 235, 240, 0.76);
  backdrop-filter: blur(4px);
}

.compare-panel {
  width: min(850px, 100%);
  max-height: 100%;
  overflow: auto;
  border: 1px solid #a9bfca;
  border-radius: 15px;
  background: var(--panel-solid);
  padding: 18px;
  box-shadow: 0 26px 80px rgba(37, 78, 99, 0.24);
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.compare-grid figure {
  margin: 0;
}

.compare-grid canvas {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #e7f1f4;
}

.compare-grid figcaption {
  margin-top: 7px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-line;
}

.toast {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(460px, calc(100vw - 36px));
  padding: 9px 11px;
  border: 1px solid #93b5c2;
  border-radius: 7px;
  color: #16475a;
  background: rgba(243, 250, 252, 0.96);
  box-shadow: 0 10px 32px rgba(43, 86, 106, 0.16);
  font-size: 13px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .lab-layout {
    grid-template-columns: 230px minmax(360px, 1fr) 274px;
    gap: 10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .instrument-section {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 940px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .lab-layout {
    display: flex;
    flex-direction: column;
    padding-bottom: 100px;
  }

  .chamber-column {
    order: 1;
  }

  .panel-left {
    order: 2;
  }

  .panel-right {
    order: 3;
  }

  .panel {
    overflow: visible;
  }

  .chamber {
    height: min(68vh, 590px);
    min-height: 390px;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 9px 12px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .top-actions {
    width: 100%;
  }

  .lab-layout {
    padding-left: 8px;
    padding-right: 8px;
  }

  .chamber {
    min-height: 350px;
    height: 58vh;
    border-radius: 18px;
  }

  #plateCanvas {
    inset: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
  }

  .chamber-label,
  .chamber-hint {
    display: none;
  }

  .plate-status {
    top: 17px;
    right: 17px;
    max-width: 190px;
  }

  .scale-bar {
    left: 19px;
    bottom: 19px;
  }

  .dial-grid {
    grid-template-columns: repeat(2, minmax(96px, 1fr));
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
