:root {
  color-scheme: light;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #aeb4b9;
  --ink: #20282b;
  --muted: #6b767a;
  --line: rgb(48 59 63 / 18%);
  --panel: rgb(241 244 244 / 88%);
  --panel-solid: #eef1f1;
  --dark-panel: rgb(28 35 38 / 90%);
  --cyan: #1a9eb1;
  --cyan-strong: #087e90;
  --amber: #d6a646;
  --danger: #b54a4a;
  --success: #2b806e;
  --edge: max(12px, env(safe-area-inset-left));
  --edge-right: max(12px, env(safe-area-inset-right));
  --edge-bottom: max(12px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #aeb4b9;
}

button {
  letter-spacing: 0;
}

#app {
  position: relative;
  isolation: isolate;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene:active {
  cursor: grabbing;
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.prototype-label {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: var(--edge);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  max-width: min(220px, 34vw);
  color: #273236;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgb(255 255 255 / 72%);
}

.status-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border: 1px solid rgb(30 43 47 / 28%);
  border-radius: 50%;
  background: #8c979a;
}

.status-dot.is-active {
  border-color: var(--cyan-strong);
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgb(26 158 177 / 14%);
}

.status-dot.is-loading {
  border-color: #aa7625;
  background: var(--amber);
}

.status-dot.is-error {
  border-color: #873434;
  background: var(--danger);
}

.gesture-state {
  position: absolute;
  top: max(37px, calc(env(safe-area-inset-top) + 25px));
  left: calc(var(--edge) + 15px);
  min-height: 16px;
  max-width: min(220px, 38vw);
  overflow: hidden;
  color: #4d5a5e;
  font-size: 10px;
  line-height: 16px;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgb(255 255 255 / 76%);
  white-space: nowrap;
}

.reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  translate: -50% -50%;
  opacity: 0.62;
}

.reticle span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 1px;
  translate: -50% -50%;
  background: rgb(25 51 57 / 88%);
  box-shadow: 0 1px 1px rgb(255 255 255 / 55%);
}

.reticle span:last-child {
  rotate: 90deg;
}

.experiment-strip {
  position: absolute;
  z-index: 3;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  max-width: min(440px, calc(100vw - 500px));
  padding: 0 11px;
  translate: -50% 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: rgb(241 244 244 / 78%);
  box-shadow: 0 5px 16px rgb(20 27 30 / 10%);
  backdrop-filter: blur(9px) saturate(90%);
  white-space: nowrap;
  pointer-events: none;
}

.experiment-strip strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
}

.experiment-number,
.lab-stage {
  flex: 0 0 auto;
  color: #657176;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.experiment-number {
  padding-right: 9px;
  border-right: 1px solid var(--line);
}

.lab-stage {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #435257;
  font-weight: 700;
}

.lab-stage::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
}

.lesson-guide {
  position: absolute;
  z-index: 3;
  left: var(--edge);
  bottom: var(--edge-bottom);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  width: min(392px, calc(100vw - 400px));
  min-height: 52px;
  padding: 8px 11px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-left: 2px solid var(--cyan);
  border-radius: 4px;
  color: #f2f5f5;
  background: var(--dark-panel);
  box-shadow: 0 8px 20px rgb(11 17 19 / 17%);
  backdrop-filter: blur(10px) saturate(85%);
  pointer-events: none;
}

.lesson-guide-heading {
  display: grid;
  gap: 3px;
  min-width: 74px;
  padding-right: 11px;
  border-right: 1px solid rgb(255 255 255 / 13%);
  color: #aeb9bc;
  font-size: 9px;
}

.lesson-guide-heading strong {
  color: #f0f4f5;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.lesson-steps {
  display: none;
}

.lesson-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding-left: 11px;
}

.lesson-current span {
  color: #8f9b9e;
  font-size: 8px;
}

.lesson-current strong {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab-readout {
  position: absolute;
  z-index: 3;
  top: 68px;
  right: 0;
  width: 184px;
  padding: 9px 10px 10px;
  border: 1px solid var(--line);
  border-right: 0;
  border-left: 2px solid var(--cyan);
  border-radius: 4px 0 0 4px;
  color: #273135;
  background: rgb(241 244 244 / 82%);
  box-shadow: -5px 7px 18px rgb(19 26 29 / 9%);
  backdrop-filter: blur(9px) saturate(85%);
  pointer-events: auto;
}

.readout-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 25px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

.readout-heading > strong {
  overflow: hidden;
  color: #354247;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readout-heading > strong.is-complete {
  color: var(--success);
}

.readout-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.readout-tabs button {
  min-height: 24px;
  padding: 0 0 3px;
  border: 0;
  border-bottom: 1px solid transparent;
  color: #788387;
  background: transparent;
  font: inherit;
  font-size: 9px;
  cursor: pointer;
}

.readout-tabs button[aria-selected="true"] {
  border-bottom-color: var(--cyan);
  color: #31464c;
  font-weight: 700;
}

.readout-tabs button:focus-visible,
.performance-modes button:focus-visible,
.command-button:focus-visible,
.presentation-toggle:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid rgb(26 158 177 / 52%);
  outline-offset: 2px;
}

#observation-count {
  margin-left: 1px;
  color: #8a6a2a;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.readout-grid {
  display: grid;
  gap: 0;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.readout-grid div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  min-height: 25px;
  padding: 4px 0;
  border-bottom: 1px solid rgb(48 59 63 / 9%);
}

.readout-grid div:last-child {
  border-bottom: 0;
}

.readout-grid span,
.reagent-status span,
.reaction-equation span {
  display: block;
  color: #697579;
  font-size: 8px;
}

.readout-grid strong {
  min-width: 66px;
  color: #273438;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.reagent-status {
  display: grid;
  gap: 2px;
  padding-top: 5px;
}

.reagent-status > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}

.reagent-status span {
  color: #4c5a5f;
  font-family: "SFMono-Regular", Menlo, Consolas, "Microsoft YaHei", monospace;
}

.reagent-status strong {
  color: #556165;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reaction-equation {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.reaction-equation strong {
  display: block;
  margin-top: 2px;
  color: #25464d;
  font-family: "SFMono-Regular", Menlo, Consolas, "Microsoft YaHei", monospace;
  font-size: 8px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.observation-panel {
  min-height: 0;
}

.observation-list {
  margin: 0;
  padding: 4px 0 0;
  list-style: none;
}

.observation-list li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 7px;
  min-height: 43px;
  padding: 7px 0;
  border-bottom: 1px solid rgb(48 59 63 / 10%);
}

.observation-list li:last-child {
  border-bottom: 0;
}

.observation-marker {
  width: 6px;
  height: 6px;
  margin-top: 3px;
  border: 1px solid #8f9a9d;
  border-radius: 50%;
  background: transparent;
}

.observation-list li > span:last-child {
  display: grid;
  gap: 2px;
}

.observation-list strong {
  color: #354247;
  font-size: 9px;
}

.observation-list small {
  color: #6d797d;
  font-size: 8px;
  line-height: 1.35;
}

.observation-list li[data-status="watching"] .observation-marker {
  border-color: #a97724;
  background: var(--amber);
}

.observation-list li[data-status="recorded"] .observation-marker {
  border-color: var(--success);
  background: var(--success);
}

.reaction-announcement {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 56px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 32px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 7px 12px;
  translate: -50% 0;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 4px;
  color: #f4f8f8;
  background: rgb(31 48 53 / 90%);
  box-shadow: 0 8px 20px rgb(13 22 25 / 19%);
  pointer-events: none;
  animation: reaction-rise 320ms ease-out both;
}

.reaction-announcement[data-tone="reaction"] {
  border-left: 2px solid var(--cyan);
}

.reaction-announcement[data-tone="progress"] {
  border-left: 2px solid var(--amber);
}

.reaction-announcement[data-tone="complete"] {
  border-left: 2px solid #63af9e;
}

.reaction-announcement span {
  color: #b8c3c6;
  font-size: 9px;
}

.reaction-announcement strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes reaction-rise {
  from { opacity: 0; translate: -50% 5px; }
  to { opacity: 1; translate: -50% 0; }
}

.icon-button,
.presentation-toggle {
  position: absolute;
  z-index: 3;
  top: max(14px, env(safe-area-inset-top));
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #37464b;
  background: rgb(241 244 244 / 78%);
  box-shadow: 0 5px 16px rgb(20 27 30 / 9%);
  backdrop-filter: blur(9px) saturate(90%);
  cursor: pointer;
}

.icon-button {
  right: var(--edge-right);
  display: grid;
  place-items: center;
  width: 34px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
}

.presentation-toggle {
  right: calc(var(--edge-right) + 42px);
  min-width: 54px;
  padding: 0 9px;
  font: inherit;
  font-size: 9px;
  font-weight: 700;
}

.icon-button:hover,
.presentation-toggle:hover,
.command-button:hover {
  background: var(--panel-solid);
}

.presentation-toggle[aria-pressed="true"] {
  border-color: #98712c;
  color: #242d30;
  background: #ddbd75;
}

.command-button {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: var(--edge-bottom);
  translate: -50% 0;
  min-width: 126px;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgb(47 61 65 / 24%);
  border-radius: 4px;
  color: #253136;
  background: rgb(239 242 242 / 90%);
  box-shadow: 0 6px 18px rgb(18 26 29 / 14%);
  backdrop-filter: blur(9px);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.sound-toggle {
  position: absolute;
  z-index: 3;
  left: calc(50% + 82px);
  bottom: var(--edge-bottom);
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgb(47 61 65 / 16%);
  border-radius: 999px;
  color: #34505b;
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 10px 22px rgb(45 75 87 / 14%);
  backdrop-filter: blur(16px) saturate(130%);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.sound-toggle:hover {
  background: #ffffff;
}

.sound-toggle[aria-pressed="true"] {
  border-color: rgb(0 113 227 / 30%);
  color: #006edb;
  background: rgb(232 245 255 / 94%);
}

@media (max-width: 640px) {
  .sound-toggle {
    left: calc(50% + 70px);
    min-height: 36px;
    padding: 0 11px;
    font-size: 10px;
  }
}

.command-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.performance-control {
  position: absolute;
  z-index: 3;
  right: var(--edge-right);
  bottom: var(--edge-bottom);
  width: 110px;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #303d41;
  background: rgb(241 244 244 / 78%);
  box-shadow: 0 5px 16px rgb(20 27 30 / 9%);
  backdrop-filter: blur(9px) saturate(90%);
  outline: none;
  transition: width 150ms ease, background-color 150ms ease;
}

.performance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-height: 20px;
  color: #697478;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.performance-summary strong {
  overflow: hidden;
  color: #4b5a5f;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.performance-modes {
  position: absolute;
  right: -1px;
  bottom: calc(100% + 5px);
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 3px;
  width: max-content;
  padding: 4px;
  visibility: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgb(241 244 244 / 96%);
  box-shadow: 0 7px 18px rgb(19 26 29 / 13%);
  opacity: 0;
  pointer-events: none;
  translate: 0 4px;
  transition: opacity 120ms ease, translate 120ms ease, visibility 120ms;
}

.performance-control:hover,
.performance-control:focus,
.performance-control:focus-within {
  width: 126px;
  background: rgb(241 244 244 / 94%);
}

.performance-control:hover .performance-modes,
.performance-control:focus .performance-modes,
.performance-control:focus-within .performance-modes {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  translate: 0 0;
}

.performance-control:focus-visible {
  outline: 2px solid rgb(26 158 177 / 52%);
  outline-offset: 2px;
}

.performance-modes button {
  min-width: 0;
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #58666a;
  background: transparent;
  font: inherit;
  font-size: 9px;
  cursor: pointer;
}

.performance-modes button[aria-pressed="true"] {
  border-color: var(--cyan-strong);
  color: #f5fbfc;
  background: var(--cyan-strong);
}

.camera-preview {
  position: absolute;
  z-index: 3;
  left: var(--edge);
  bottom: calc(var(--edge-bottom) + 64px);
  width: clamp(116px, 14vw, 156px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgb(233 239 239 / 74%);
  border-radius: 4px;
  background: #20292c;
  box-shadow: 0 7px 18px rgb(18 27 30 / 17%);
  pointer-events: auto;
  user-select: none;
}

.camera-preview video,
.camera-preview canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.camera-preview video {
  transform: scaleX(-1);
}

.camera-resize-handle {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0 3px 0 4px;
  color: #ffffff;
  background: rgb(31 47 52 / 78%);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: nesw-resize;
  touch-action: none;
}

.camera-resize-handle:hover,
.camera-preview.is-resizing .camera-resize-handle {
  background: var(--cyan-strong);
}

.camera-resize-handle:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

.loading,
.error {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 76px;
  translate: -50% 0;
  width: max-content;
  max-width: calc(100vw - 32px);
  color: #2e393d;
  font-size: 11px;
  text-align: center;
}

.loading {
  animation: breathe 1.1s ease-in-out infinite alternate;
}

.error {
  padding: 8px 11px;
  border: 1px solid rgb(137 54 54 / 22%);
  border-radius: 4px;
  color: #782d2d;
  background: rgb(255 247 246 / 93%);
  box-shadow: 0 6px 18px rgb(80 30 24 / 12%);
}

@keyframes breathe {
  from { opacity: 0.48; }
  to { opacity: 1; }
}

#app.is-presentation .experiment-strip {
  min-height: 38px;
  max-width: 520px;
}

#app.is-presentation .experiment-strip strong {
  font-size: 14px;
}

#app.is-presentation .lesson-guide {
  display: none;
}

#app.is-presentation .lesson-current strong,
#app.is-presentation .lesson-guide-heading strong {
  font-size: 12px;
}

#app.is-presentation .lab-readout {
  width: 206px;
}

#app.is-presentation .readout-grid strong,
#app.is-presentation .reagent-status strong,
#app.is-presentation .observation-list strong {
  font-size: 10px;
}

#app.is-presentation .reaction-announcement {
  min-height: 38px;
}

#app.is-presentation .performance-control {
  display: none;
}

#app.is-presentation .command-button {
  display: none;
}

@media (max-width: 760px) {
  .prototype-label {
    max-width: calc(100vw - 116px);
  }

  .experiment-strip {
    top: max(58px, calc(env(safe-area-inset-top) + 48px));
    right: var(--edge-right);
    left: var(--edge);
    max-width: none;
    translate: 0 0;
  }

  .lesson-guide {
    right: var(--edge-right);
    width: auto;
    bottom: calc(var(--edge-bottom) + 56px);
  }

  .lab-readout {
    top: max(108px, calc(env(safe-area-inset-top) + 98px));
  }

  .command-button {
    min-height: 44px;
  }

  .icon-button,
  .presentation-toggle {
    min-height: 40px;
  }

  .icon-button {
    width: 40px;
  }

  .presentation-toggle {
    right: calc(var(--edge-right) + 48px);
  }
}

@media (max-width: 560px) {
  .prototype-label {
    top: max(10px, env(safe-area-inset-top));
    max-width: calc(100vw - 76px);
    font-size: 10px;
  }

  .gesture-state {
    display: none;
  }

  .experiment-strip {
    display: none;
  }

  .lab-readout {
    top: max(58px, calc(env(safe-area-inset-top) + 48px));
    right: var(--edge-right);
    width: 44px;
    height: 44px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 3px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .readout-heading {
    display: block;
    min-height: 44px;
    padding: 0;
    border-bottom: 0;
  }

  .readout-tabs {
    display: block;
  }

  .readout-tabs button {
    display: none;
    width: 44px;
    min-height: 44px;
    padding: 0 2px;
    border: 1px solid transparent;
    border-radius: 3px;
  }

  .readout-tabs button[aria-selected="true"] {
    display: block;
    border-color: rgb(48 59 63 / 20%);
    color: #31464c;
    background: rgb(241 244 244 / 90%);
    box-shadow: 0 3px 10px rgb(20 27 30 / 10%);
  }

  .readout-heading > strong,
  .lab-readout [data-readout-panel] {
    display: none;
  }

  .lab-readout:focus-within {
    width: 156px;
    height: auto;
    padding: 7px 8px 8px;
    overflow: visible;
    border: 1px solid var(--line);
    border-left: 2px solid var(--cyan);
    background: rgb(241 244 244 / 96%);
    box-shadow: -5px 7px 18px rgb(19 26 29 / 9%);
  }

  .lab-readout:focus-within .readout-heading {
    display: grid;
    min-height: 0;
    gap: 2px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }

  .lab-readout:focus-within .readout-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
  }

  .lab-readout:focus-within .readout-tabs button,
  .lab-readout:focus-within .readout-heading > strong {
    display: block;
  }

  .lab-readout:focus-within [data-readout-panel]:not([hidden]) {
    display: block;
  }

  .readout-grid strong {
    min-width: 58px;
    font-size: 9px;
  }

  .reagent-status > div {
    display: grid;
    gap: 1px;
    min-height: 30px;
  }

  .reagent-status strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .observation-list li {
    min-height: 48px;
  }

  .lesson-guide {
    left: var(--edge);
    right: calc(var(--edge-right) + 80px);
    bottom: var(--edge-bottom);
    width: auto;
    height: 44px;
    min-height: 44px;
    padding: 0 8px;
    border-left-width: 2px;
    background: rgb(28 35 38 / 94%);
    box-shadow: 0 4px 12px rgb(11 17 19 / 14%);
    backdrop-filter: none;
  }

  .lesson-guide-heading {
    min-width: 45px;
    gap: 1px;
    padding-right: 6px;
  }

  .lesson-guide-heading > span {
    display: none;
  }

  .lesson-guide-heading strong {
    font-size: 10px;
  }

  .lesson-current {
    display: block;
    padding-left: 8px;
  }

  .lesson-current span {
    display: none;
  }

  .lesson-current strong {
    display: block;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .presentation-toggle {
    display: none;
  }

  .icon-button {
    top: max(10px, env(safe-area-inset-top));
    width: 44px;
    height: 44px;
    border: 0;
    color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .icon-button::before {
    content: "\21bb";
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 3px;
    color: #37464b;
    background: rgb(241 244 244 / 90%);
    box-shadow: 0 3px 10px rgb(20 27 30 / 10%);
    font-size: 17px;
  }

  .reaction-announcement {
    top: max(142px, calc(env(safe-area-inset-top) + 132px));
    min-height: 32px;
    max-width: min(260px, calc(100vw - 32px));
  }

  .performance-control {
    display: none;
  }

  .camera-preview {
    top: max(58px, calc(env(safe-area-inset-top) + 48px));
    bottom: auto;
    width: 92px;
  }

  .camera-resize-handle {
    width: 44px;
    height: 44px;
  }

  .command-button {
    bottom: var(--edge-bottom);
    right: var(--edge-right);
    left: auto;
    width: 72px;
    min-width: 72px;
    min-height: 44px;
    padding: 0 7px;
    translate: 0 0;
    font-size: 10px;
    line-height: 1.15;
  }

  .loading,
  .error {
    bottom: calc(var(--edge-bottom) + 54px);
    font-size: 10px;
  }

  #app.is-presentation .lesson-guide {
    width: auto;
  }

  #app.is-presentation .lab-readout:not(:focus-within) {
    width: 44px;
  }
}

@media (max-height: 620px) and (min-width: 561px) {
  .lab-readout {
    top: 56px;
  }

  .readout-grid div {
    min-height: 22px;
    padding: 2px 0;
  }

  .reagent-status > div {
    min-height: 19px;
  }

  .camera-preview {
    width: 112px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading,
  .reaction-announcement {
    animation: none;
  }

  .performance-control,
  .performance-modes {
    transition: none;
  }
}

/* Apple Education visual layer: bright, calm and classroom-first. */
:root {
  background: #edf4f5;
  --ink: #1d2a30;
  --muted: #607078;
  --line: rgb(41 73 82 / 13%);
  --panel: rgb(255 255 255 / 76%);
  --panel-solid: #f9fbfb;
  --dark-panel: rgb(28 47 56 / 86%);
  --cyan: #0071e3;
  --cyan-strong: #0064c8;
  --amber: #f5a524;
  --success: #2e9b67;
}

body {
  background: radial-gradient(circle at 50% 0%, #ffffff 0, #edf4f5 48%, #dfeaec 100%);
}

.prototype-label {
  padding: 6px 10px;
  border: 1px solid rgb(255 255 255 / 66%);
  border-radius: 999px;
  background: rgb(255 255 255 / 56%);
  box-shadow: 0 8px 24px rgb(49 77 88 / 10%);
  backdrop-filter: blur(18px) saturate(150%);
}

.gesture-state {
  left: calc(var(--edge) + 10px);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 38%);
}

.experiment-strip,
.icon-button,
.presentation-toggle,
.performance-control {
  border-color: rgb(255 255 255 / 76%);
  border-radius: 14px;
  background: rgb(255 255 255 / 72%);
  box-shadow: 0 12px 30px rgb(47 76 88 / 13%), inset 0 1px 0 rgb(255 255 255 / 78%);
  backdrop-filter: blur(20px) saturate(155%);
}

.experiment-strip {
  min-height: 38px;
  padding: 0 14px;
}

.experiment-strip strong {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.experiment-number,
.lab-stage {
  font-size: 10px;
}

.lesson-guide {
  width: min(392px, calc(100vw - 400px));
  min-height: 56px;
  padding: 8px 11px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-left: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgb(35 63 75 / 90%), rgb(23 43 53 / 88%));
  box-shadow: 0 16px 34px rgb(25 49 59 / 22%), inset 0 1px 0 rgb(255 255 255 / 12%);
  backdrop-filter: blur(20px) saturate(120%);
}

.lesson-guide::before {
  content: "";
  width: 5px;
  height: 28px;
  margin-right: 1px;
  border-radius: 99px;
  background: linear-gradient(#62b9ff, #0071e3);
  box-shadow: 0 0 14px rgb(0 113 227 / 55%);
}

.lesson-guide-heading {
  min-width: 72px;
}

.lesson-current strong {
  font-size: 11px;
}

.lab-readout {
  top: 72px;
  right: var(--edge-right);
  width: 188px;
  padding: 9px 10px 10px;
  border: 1px solid rgb(255 255 255 / 78%);
  border-left: 0;
  border-radius: 16px;
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 14px 34px rgb(52 80 91 / 15%), inset 0 1px 0 rgb(255 255 255 / 85%);
  backdrop-filter: blur(20px) saturate(155%);
}

.readout-heading,
.readout-grid,
.reaction-equation {
  border-color: rgb(41 73 82 / 10%);
}

.readout-tabs {
  gap: 10px;
}

.readout-tabs button {
  min-height: 26px;
  font-size: 10px;
}

.readout-grid strong {
  color: #0b568f;
  font-size: 11px;
}

.reaction-announcement {
  min-height: 38px;
  border: 1px solid rgb(255 255 255 / 26%);
  border-left: 0;
  border-radius: 14px;
  background: rgb(25 53 64 / 90%);
  box-shadow: 0 14px 30px rgb(28 52 62 / 20%);
  backdrop-filter: blur(18px) saturate(130%);
}

.icon-button,
.presentation-toggle {
  height: 38px;
}

.icon-button {
  width: 38px;
}

.presentation-toggle {
  right: calc(var(--edge-right) + 47px);
  min-width: 62px;
}

.command-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgb(0 79 165 / 32%);
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(180deg, #1585ef, #006bd6);
  box-shadow: 0 12px 24px rgb(0 96 196 / 25%), inset 0 1px 0 rgb(255 255 255 / 32%);
  letter-spacing: 0.01em;
}

.command-button:hover {
  background: linear-gradient(180deg, #2594fa, #0878e2);
}

.performance-control {
  width: 118px;
}

.performance-control:hover,
.performance-control:focus,
.performance-control:focus-within {
  width: 134px;
  background: rgb(255 255 255 / 90%);
}

.performance-modes {
  border-color: rgb(255 255 255 / 82%);
  border-radius: 12px;
  background: rgb(255 255 255 / 91%);
  box-shadow: 0 12px 26px rgb(47 76 88 / 16%);
  backdrop-filter: blur(18px);
}

.performance-modes button {
  border-radius: 8px;
}

.camera-preview {
  border-color: rgb(255 255 255 / 72%);
  border-radius: 14px;
  box-shadow: 0 14px 28px rgb(41 67 77 / 20%);
}

@media (max-width: 560px) {
  .prototype-label {
    padding: 4px 8px;
  }

  .experiment-strip,
  .icon-button::before {
    border-radius: 12px;
  }

  .lesson-guide {
    border-radius: 14px;
  }

  .lab-readout {
    right: var(--edge-right);
    border-radius: 14px;
  }
}

/* Course rail: a readable Apple Education companion, kept outside the bench view. */
.experiment-course-panel {
  position: fixed;
  z-index: 9;
  top: 64px;
  right: calc(var(--edge-right) + 202px);
  width: min(382px, 28vw);
  max-height: calc(100dvh - 132px);
  overflow: auto;
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 22px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 18px 42px rgb(38 65 76 / 17%), inset 0 1px 0 rgb(255 255 255 / 92%);
  backdrop-filter: blur(20px) saturate(155%);
  scrollbar-width: thin;
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1), box-shadow 180ms ease, opacity 180ms ease;
}

.experiment-course-dragbar { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; cursor: grab; touch-action: none; user-select: none; }
.experiment-course-dragbar:active { cursor: grabbing; }
.experiment-course-drag-hint { color: #6c7d84; font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.course-panel-collapse { display: inline-flex; min-height: 30px; align-items: center; gap: 3px; padding: 0 9px; border: 1px solid rgb(24 78 108 / 14%); border-radius: 10px; color: #0968ae; background: #eef8ff; font: 700 11px/1 var(--font-sans, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif); cursor: pointer; }
.course-panel-collapse > span:first-child { font-size: 19px; font-weight: 500; line-height: .7; }
.experiment-course-panel.is-dragging { transition: none; box-shadow: 0 25px 56px rgb(27 55 65 / 26%); }
.experiment-course-panel.is-collapsed { right: 12px; width: 56px; max-height: 52px; overflow: visible; padding: 8px; transform: none; box-shadow: 0 11px 26px rgb(38 65 76 / 18%); }
.experiment-course-panel.is-collapsed > :not(.experiment-course-dragbar) { display: none; }
.experiment-course-panel.is-collapsed .experiment-course-dragbar { min-height: 34px; margin: 0; justify-content: flex-end; }
.experiment-course-panel.is-collapsed .experiment-course-drag-hint { display: none; }
.experiment-course-panel.is-positioned { transform: none; }
.experiment-course-panel.is-positioned.is-collapsed { transform: none; }

.experiment-course-heading,
.experiment-course-title-row,
.course-color,
.course-sound {
  display: flex;
  align-items: center;
}

.experiment-course-heading {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.experiment-course-heading span,
.experiment-course-heading strong,
.course-color span,
.course-sound span,
.course-status-note {
  display: block;
  color: #66757b;
  font-size: 11px;
  line-height: 1.35;
}

.experiment-course-heading strong {
  margin-top: 2px;
  color: #263840;
  font-size: 15px;
}

.experiment-course-volumes { display: flex; gap: 4px; }

.experiment-course-volume-option,
.course-sound-preview {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid rgb(41 73 82 / 12%);
  border-radius: 8px;
  color: #34515d;
  background: rgb(247 251 252 / 92%);
  font: 650 12px/1 var(--font-sans, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif);
  cursor: pointer;
}

.experiment-course-volume-option[aria-pressed="true"] {
  border-color: rgb(0 113 227 / 24%);
  color: #006edb;
  background: #e9f4ff;
}

.experiment-course-list {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 6px;
  max-height: 154px;
  overflow: auto;
  padding: 1px 4px 13px 1px;
  border-bottom: 1px solid rgb(41 73 82 / 10%);
}

.experiment-course-option {
  display: flex;
  min-width: 0;
  min-height: 39px;
  align-items: center;
  gap: 7px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #415158;
  background: rgb(241 247 248 / 72%);
  font: 650 12px/1.25 var(--font-sans, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif);
  text-align: left;
}

.experiment-course-option:hover,
.experiment-course-option[data-selected="true"] {
  border-color: rgb(0 113 227 / 23%);
  color: #07588f;
  background: #e9f5ff;
}

.experiment-course-select {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 7px;
  align-self: stretch;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.experiment-course-select > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-start-button,
.course-start-detail {
  flex: 0 0 auto;
  border: 1px solid rgb(0 113 227 / 19%);
  border-radius: 7px;
  color: #006edb;
  background: #f3f9ff;
  box-shadow: 0 1px 1px rgb(22 50 60 / 5%);
  font: 700 11px/1 var(--font-sans, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif);
  cursor: pointer;
}

.course-start-button {
  min-height: 28px;
  padding: 0 8px;
}

.course-start-button:hover,
.course-start-detail:hover {
  border-color: #0071e3;
  color: #fff;
  background: #0071e3;
}

.course-start-detail {
  width: 100%;
  min-height: 40px;
  margin-top: 13px;
  color: #fff;
  background: #0071e3;
  font-size: 13px;
}

.course-start-detail:hover { background: #0077ed; }

.experiment-course-index {
  flex: 0 0 auto;
  color: #7a8b91;
  font-size: 10px;
}

.experiment-course-detail { padding-top: 14px; }
.experiment-course-title-row { justify-content: space-between; gap: 10px; }
.experiment-course-title-row h2 { margin: 0; color: #1d3038; font-size: 19px; line-height: 1.18; letter-spacing: -0.03em; }
.course-sound-preview { min-width: 49px; color: #006edb; background: #edf7ff; }
.course-equation { margin: 8px 0 11px; color: #31515e; font: 650 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; overflow-wrap: anywhere; }
.course-color { gap: 10px; padding: 10px; border-radius: 13px; background: #f5fafb; }
.course-color i { display: block; width: 32px; height: 32px; flex: 0 0 auto; border: 3px solid rgb(255 255 255 / 90%); border-radius: 50%; background: var(--course-color, #edf8ff); box-shadow: 0 3px 9px rgb(22 50 60 / 18%); }
.course-color strong { display: block; margin-top: 2px; color: #243b45; font-size: 14px; line-height: 1.3; }
.course-phenomenon { margin: 11px 1px; color: #45575e; font-size: 13px; line-height: 1.58; }
.course-sound { gap: 9px; padding: 9px 1px; border-top: 1px solid rgb(41 73 82 / 8%); border-bottom: 1px solid rgb(41 73 82 / 8%); }
.course-sound strong { color: #36515c; font-size: 12px; line-height: 1.4; }
.course-steps { display: grid; gap: 8px; margin: 13px 0 9px; padding: 0; list-style: none; }
.course-steps li { display: flex; align-items: flex-start; gap: 9px; color: #33454d; font-size: 13px; line-height: 1.42; }
.course-steps li > span { display: grid; width: 21px; height: 21px; flex: 0 0 21px; place-items: center; border-radius: 50%; color: #fff; background: #0071e3; font-size: 11px; font-weight: 700; }
.course-steps p { margin: 1px 0 0; }
.course-status-note { margin: 10px 0 0; line-height: 1.5; }

.experiment-load-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: rgb(244 250 253 / 64%);
  backdrop-filter: blur(12px);
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.experiment-load-overlay.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 180ms ease;
}

.experiment-load-card {
  display: grid;
  width: min(440px, 100%);
  justify-items: center;
  gap: 11px;
  padding: 34px 38px;
  border: 1px solid rgb(255 255 255 / 92%);
  border-radius: 25px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 24px 72px rgb(24 65 84 / 20%);
  color: #1e3540;
  text-align: center;
}

.experiment-load-kicker,
.experiment-load-card > span:last-child {
  color: #65808c;
  font-size: 12px;
  font-weight: 700;
}

.experiment-load-card i {
  width: 54px;
  height: 54px;
  border: 8px solid rgb(255 255 255 / 94%);
  border-radius: 50%;
  background: var(--experiment-load-color, #0071e3);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--experiment-load-color, #0071e3) 30%, transparent);
}

.experiment-load-card strong { font-size: 24px; letter-spacing: -0.04em; }
.experiment-load-card p { margin: 0; color: #45616d; font: 650 12px/1.55 ui-monospace, "SF Mono", Menlo, monospace; }

@media (max-width: 1100px) {
  .experiment-course-panel { right: var(--edge-right); top: 274px; width: min(365px, 37vw); max-height: calc(100dvh - 350px); }
}

@media (max-width: 700px) {
  .experiment-course-panel { top: auto; right: 8px; bottom: 58px; left: 8px; width: auto; max-height: min(47dvh, 390px); padding: 10px; border-radius: 14px; }
  .experiment-course-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 112px; }
  .experiment-course-option { min-height: 34px; font-size: 10px; }
  .course-start-button { padding: 0 6px; font-size: 9px; }
  .experiment-course-detail { padding-top: 9px; }
  .course-status-note { display: none; }
  .experiment-course-panel.is-collapsed { right: 8px; bottom: 58px; left: auto; width: 54px; transform: none; }
  .experiment-course-panel.is-positioned.is-collapsed { transform: none; }
}

.lesson-advance-button {
  pointer-events: auto;
  width: 100%;
  margin-top: 9px;
  min-height: 34px;
  border: 1px solid rgba(18, 112, 176, 0.26);
  border-radius: 12px;
  background: linear-gradient(135deg, #0a84d8, #2aa7f4);
  box-shadow: 0 7px 16px rgba(10, 132, 216, 0.18);
  color: #fff;
  font: 700 12px/1 -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  cursor: pointer;
}

.lesson-advance-button:hover { filter: brightness(1.06); }
.lesson-advance-button:active { transform: translateY(1px); }
