/* Lora (SIL OFL 1.1, licenses/LORA-OFL.txt), bundled for offline use: headings. */
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(./vendor/fonts/lora-vietnamese-400-normal.woff2) format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(./vendor/fonts/lora-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(./vendor/fonts/lora-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(./vendor/fonts/lora-vietnamese-600-normal.woff2) format("woff2");
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(./vendor/fonts/lora-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(./vendor/fonts/lora-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* be-vietnam-pro-vietnamese-400-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(./vendor/fonts/be-vietnam-pro-vietnamese-400-normal.woff2)
    format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}

/* be-vietnam-pro-latin-ext-400-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(./vendor/fonts/be-vietnam-pro-latin-ext-400-normal.woff2)
    format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* be-vietnam-pro-latin-400-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(./vendor/fonts/be-vietnam-pro-latin-400-normal.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
/* be-vietnam-pro-vietnamese-500-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(./vendor/fonts/be-vietnam-pro-vietnamese-500-normal.woff2)
    format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}

/* be-vietnam-pro-latin-ext-500-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(./vendor/fonts/be-vietnam-pro-latin-ext-500-normal.woff2)
    format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* be-vietnam-pro-latin-500-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(./vendor/fonts/be-vietnam-pro-latin-500-normal.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
/* be-vietnam-pro-vietnamese-600-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(./vendor/fonts/be-vietnam-pro-vietnamese-600-normal.woff2)
    format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}

/* be-vietnam-pro-latin-ext-600-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(./vendor/fonts/be-vietnam-pro-latin-ext-600-normal.woff2)
    format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* be-vietnam-pro-latin-600-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(./vendor/fonts/be-vietnam-pro-latin-600-normal.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
/* be-vietnam-pro-vietnamese-700-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(./vendor/fonts/be-vietnam-pro-vietnamese-700-normal.woff2)
    format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
    U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329,
    U+1EA0-1EF9, U+20AB;
}

/* be-vietnam-pro-latin-ext-700-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(./vendor/fonts/be-vietnam-pro-latin-ext-700-normal.woff2)
    format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* be-vietnam-pro-latin-700-normal */
@font-face {
  font-family: "Be Vietnam Pro";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(./vendor/fonts/be-vietnam-pro-latin-700-normal.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
:root {
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #24343d;
  background: #edf1f3;
  color-scheme: light;
  --border: #d3dde1;
  --muted: #566974;
  --accent: #146958;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}
body.sidebar-closed {
  grid-template-columns: 0 minmax(0, 1fr);
}
body.sidebar-closed #inventory {
  display: none;
}
button,
input,
select {
  font: inherit;
}
button,
select,
input[type="number"] {
  color: inherit;
  background: #fff;
  border: 1px solid #b9c9d0;
  border-radius: 6px;
  padding: 8px 11px;
  min-height: 38px;
}
button,
select,
summary {
  cursor: pointer;
}
button {
  font-weight: 500;
}
button:hover {
  background: #f0f6f4;
  border-color: #628c80;
}
button:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #5a9cda;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.primary:hover {
  background: #105647;
}
select {
  max-width: 100%;
}
input[type="checkbox"],
input[type="range"] {
  accent-color: var(--accent);
}
#inventory {
  background: #fafbfc;
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  height: 100dvh;
  overflow: auto;
}
header {
  margin-bottom: 19px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin: 4px 0;
}
h1 span {
  color: var(--accent);
}
h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 3px 0;
  line-height: 1.3;
}
.version {
  font-size: 12px;
  color: var(--muted);
}
nav {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
nav button {
  flex: 1;
  padding: 7px 4px;
  font-size: 12px;
}
nav .active {
  background: #dfede8;
  color: #155746;
  border-color: #8eb6a9;
}
#cards {
  display: grid;
  gap: 7px;
}
.card {
  width: 100%;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  text-align: left;
  background: #fff;
}
.card svg {
  width: 36px;
  height: 49px;
  flex-shrink: 0;
}
.card svg path:first-child {
  stroke: #486c77;
  fill: #eaf3f5;
}
.card svg path:last-child {
  stroke: #318087;
}
.card strong {
  font-size: 14px;
  font-weight: 600;
  display: block;
}
.card .formula {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.card .hazard {
  font-size: 12px;
  color: #8c4816;
  margin-top: 3px;
}
.card .hazard:empty {
  display: none;
}
.pages {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 11px 0;
}
.pages button {
  font-size: 22px;
  padding: 0 17px;
}
.pages span,
.small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.wide {
  width: 100%;
  font-size: 12px;
  background: #f6f0e7;
  border-color: #d4bca0;
  color: #75491f;
}
.note {
  margin-top: 12px;
}
.file-tools {
  display: flex;
  gap: 7px;
  margin: 12px 0;
}
.file-tools button {
  flex: 1;
  padding: 7px;
  font-size: 12px;
}
#experiment {
  display: block;
  width: 100%;
  margin-top: 5px;
  font-size: 12px;
}
main {
  min-width: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px 18px 10px;
  overflow: auto;
}
main > * {
  flex-shrink: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toolbar,
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.toolbar button {
  font-size: 13px;
}
.controls {
  font-size: 12px;
}
.controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.controls button,
.controls select {
  font-size: 12px;
  padding: 6px 8px;
  min-height: 34px;
}
.controls input[type="range"] {
  width: 80px;
}
.camera-deck {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 86px;
}
#camera-preview {
  position: relative;
  width: 158px;
  height: 89px;
  flex-shrink: 0;
  background: #15242d;
  border-radius: 7px;
  overflow: hidden;
}
#camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scaleX(-1);
}
#camera-preview span {
  position: absolute;
  bottom: 3px;
  left: 6px;
  font-size: 11px;
  color: white;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
#hand-status {
  flex: 1;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #344c59;
}
#hand-status > div {
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid #398371;
  border-radius: 5px;
  min-height: 34px;
}
#hand-b {
  border-left-color: #ad7d31 !important;
}
#workspace {
  position: relative;
  isolation: isolate;
  flex: 1 1 auto;
  min-height: 300px;
  border: 1px solid #b7c7cc;
  border-radius: 9px;
  overflow: hidden;
  background: #7a9095;
}
#three,
#labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#three canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#labels {
  pointer-events: none;
}
.object-label {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  background: #f8fafbea;
  color: #293d47;
  border: 1px solid #aabcc5;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  text-align: center;
  will-change: transform;
}
.object-label b {
  font-weight: 500;
}
.object-label span {
  display: block;
  font-size: 11px;
  color: #526871;
  margin-top: 2px;
}
.object-label.selected {
  border: 1px solid #16715a;
  background: #effaf5f2;
}
.room-caption {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 3px #283d45;
  pointer-events: none;
}
.room-caption span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.9;
}
#empty {
  position: absolute;
  top: 40%;
  width: 100%;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: #f5f9fa;
  text-shadow: 0 1px 4px #233b46;
  pointer-events: none;
}
#empty span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  margin-top: 9px;
}
#inspector {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
}
#inspector strong {
  font-size: 14px;
  color: #155e4d;
  font-weight: 600;
}
#object-species {
  font-size: 12px;
  color: var(--muted);
  max-height: 35px;
  overflow: auto;
}
#message {
  font-size: 13px;
  min-height: 20px;
  max-height: 40px;
  overflow: auto;
  color: #315866;
}
#alert {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 3;
  border-radius: 7px;
  padding: 13px 15px;
  background: #892d32f5;
  border: 1px solid #ffc6b8;
  color: #fff7f0;
  font-size: 14px;
  pointer-events: none;
}
#alert strong {
  display: block;
  margin-bottom: 5px;
  color: #ffe1b5;
}
#settings {
  color: #425963;
  font-size: 12px;
  border-top: 1px solid var(--border);
  padding-top: 4px;
}
summary {
  padding: 5px 0;
  font-size: 13px;
  font-weight: 500;
}
#settings > .controls {
  padding: 9px 0;
}
#performance {
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 8px 0;
}
#performance strong {
  color: #17634f;
}
#camera-resolution {
  color: #4d6571;
  font-variant-numeric: tabular-nums;
}
.camera-options {
  border-top: 1px solid var(--border);
  padding-top: 7px;
}
#hands-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  z-index: 20;
}
.shortcuts {
  color: #566974;
}
.shortcuts summary {
  font-size: 12px;
}
.footer {
  font-size: 12px;
  padding: 5px 0;
}
dialog {
  width: min(650px, 94vw);
  max-height: 90vh;
  overflow: auto;
  background: #f9fbfc;
  color: #24343d;
  border: 1px solid #afc2cb;
  border-radius: 9px;
  padding: 24px;
  font-size: 14px;
  line-height: 1.65;
}
dialog::backdrop {
  background: #10212b99;
}
dialog li {
  margin: 8px 0;
}
#reaction-select {
  width: 100%;
}
#reaction-inputs label {
  display: inline-flex;
  gap: 8px;
  margin: 8px;
}
#reaction-inputs input {
  width: 90px;
}
#reaction-result {
  font-size: 13px;
  white-space: pre-wrap;
}
#titration-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}
.t-readings {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.t-readings strong {
  display: block;
  font-size: 27px;
  font-weight: 600;
  color: #17634f;
  font-variant-numeric: tabular-nums;
}
#titration-panel p {
  font-size: 12px;
  margin: 7px 0;
}
#t-config {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
#titration-panel input[type="number"] {
  width: 70px;
}
#valve-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  background: #fff6d9;
  border: 1px solid #9a7424;
  color: #694c12;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
}
body.titrating #inspector,
body.titrating #message,
body.titrating .interaction-controls {
  display: none;
}
@media (max-height: 820px) {
  main {
    gap: 6px;
    padding-top: 10px;
  }
  header {
    margin-bottom: 12px;
  }
  .camera-deck {
    min-height: 73px;
  }
  #camera-preview {
    width: 132px;
    height: 74px;
  }
  #workspace {
    min-height: 260px;
  }
  #inspector {
    padding: 6px 10px;
  }
}
@media (max-width: 1100px) {
  body {
    grid-template-columns: 232px minmax(0, 1fr);
  }
  main {
    padding-left: 10px;
    padding-right: 10px;
  }
  #inventory {
    padding-left: 10px;
    padding-right: 10px;
  }
  .toolbar {
    gap: 5px;
  }
  .toolbar button {
    padding: 6px 8px;
    font-size: 12px;
  }
}
@media (max-width: 720px) {
  body {
    grid-template-columns: 200px minmax(420px, 1fr);
    overflow: auto;
  }
  .card {
    gap: 6px;
  }
  .card strong {
    font-size: 13px;
  }
  h1 {
    font-size: 23px;
  }
  #workspace {
    min-height: 320px;
  }
}

/* Selection carries the detailed label; other tools remain visually unobstructed. */
.object-label:not(.selected) {
  display: none;
}
.object-label {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* THPT lessons: retain the existing camera/workspace and collapse optional theory. */
.lesson-picker {
  padding: 16px 0;
  border-bottom: 1px solid var(--line, #d5dfe3);
  margin-bottom: 12px;
}
.lesson-picker h2 {
  font-size: 18px;
  margin: 0 0 12px;
}
.lesson-picker label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 10px 0;
}
.lesson-picker select {
  width: 100%;
  min-height: 40px;
  font-size: 13px;
  white-space: normal;
}
#lesson-preview {
  font-size: 13px;
  line-height: 1.6;
  color: #4c626d;
  margin: 10px 0 14px;
}
#lesson-exit {
  margin-top: 8px;
}
#lesson-panel {
  background: #f6faf9;
  border: 1px solid #cadbd5;
  border-radius: 12px;
  padding: 12px 16px;
}
.lesson-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.lesson-summary > div {
  flex: 1;
  min-width: 260px;
}
#lesson-step {
  font-size: 12px;
  font-weight: 600;
  color: #326c5e;
}
#lesson-status {
  font-size: 14px;
  line-height: 1.5;
  margin: 5px 0;
}
#lesson-knowledge {
  margin-top: 10px;
}
#lesson-knowledge summary {
  cursor: pointer;
  font-size: 14px;
  color: #315664;
  font-weight: 600;
}
.lesson-knowledge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.7;
}
.lesson-knowledge-grid h3 {
  font-size: 15px;
  margin: 16px 0 5px;
}
.lesson-knowledge-grid p {
  margin: 0;
}
#lesson-equation {
  white-space: pre-line;
  font-weight: 500;
}
#lesson-steps {
  padding-left: 24px;
}
#lesson-steps li {
  margin-bottom: 8px;
}
#lesson-sources a {
  display: block;
  color: #226b82;
  font-size: 12px;
  margin: 8px 0;
}
body.lesson-active #tabs,
body.lesson-active #buret-tool,
body.lesson-active #risk-mode,
body.lesson-active label:has(#experiment) {
  display: none;
}
body.lesson-active #cards {
  margin-top: 12px;
}
body.lesson-active .object-label {
  display: block !important;
  font-size: 12px;
  max-width: 220px;
  padding: 5px 9px;
  background: #17313dea;
}
body.lesson-active .object-label span {
  font-size: 11px;
}
#lesson-quiz-dialog {
  max-width: 640px;
  width: 90%;
  padding: 28px;
  border: 1px solid #ccd9df;
  border-radius: 16px;
  background: #f8fbfc;
  color: #19333f;
}
#lesson-quiz-dialog h2 {
  font-size: 21px;
  margin: 20px 0;
}
#lesson-answers {
  display: grid;
  gap: 10px;
}
#lesson-answers button {
  text-align: left;
  min-height: 48px;
  font-size: 15px;
  white-space: normal;
}
#lesson-answers .correct {
  border-color: #278b69;
  background: #e3f3eb;
}
#lesson-answer-feedback {
  line-height: 1.7;
  min-height: 3em;
}
.dialog-close {
  float: right;
}
@media (max-width: 800px) {
  .lesson-knowledge-grid {
    grid-template-columns: 1fr;
  }
  .lesson-summary > div {
    min-width: 180px;
  }
}

body.lesson-active .object-label {
  color: #effbf8;
  max-width: 175px;
  white-space: normal;
  line-height: 1.4;
}
body.lesson-active .object-label span {
  color: #c5dee4;
}
.lesson-picker select {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.projection-control {
  font-size: 12px;
  color: #46636d;
  display: flex;
  align-items: center;
  gap: 6px;
}
.projection-control select {
  font-size: 13px;
  min-height: 36px;
}

/* V3.5: reserve real space for the laboratory; utilities stay available below. */
main { gap: 10px; padding: 14px 18px; }
#workspace { flex: 0 0 auto; height: max(420px, 62vh); min-height: 420px; }
body.lesson-active #workspace { height: max(420px, 64vh); }
.toolbar button { min-height: 40px; font-size: 14px; }
.version, .eyebrow { font-size: 13px; }
.camera-deck { min-height: 68px; }
#camera-preview { width: 128px; height: 72px; }
#hand-status { min-width: 0; }
#hand-a, #hand-b { font-size: 13px; white-space: normal; }
#lesson-panel { padding: 12px 16px; }
.lesson-summary { flex-wrap: wrap; gap: 10px; }
.lesson-summary > div { flex: 1 1 320px; min-width: 0; }
.projection-control { flex: 0 1 auto; }
#lesson-status { font-size: 15px; }
#practice-options, #extra-tools, #settings, .shortcuts { border-top: 1px solid #d5e2e5; padding: 8px 0; }
summary { cursor: pointer; font-size: 14px; }
.extra-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }
.extra-grid #cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); width: 100%; gap: 8px; }
.extra-grid #tabs, .extra-grid .pages { display: flex; gap: 8px; }
.extra-grid .small, .extra-grid .note { display: none; }
body.lesson-active #extra-tools #cards { display: none; }
.object-label, body.lesson-active .object-label { font-size: 13px; line-height: 1.35; padding: 6px 9px; max-width: 152px; }
.object-label b { font-size: 13px; max-height: none; }
.object-label span { font-size: 12px; max-height: none; }
#inventory { width: auto; }
@media(max-width: 800px) {
 body { grid-template-columns: 225px minmax(0, 1fr); }
 body.sidebar-closed { grid-template-columns: 0 minmax(0, 1fr); }
 main { padding: 10px; }
 #workspace, body.lesson-active #workspace { height: 480px; min-height: 480px; }
 .camera-deck { gap: 8px; }
 .lesson-summary > div { flex-basis: 100%; }
}

main { grid-column: 2; grid-row: 1; }
#inventory { grid-column: 1; grid-row: 1; }

#learning-panel { border-top:1px solid #d5e2e5;padding:8px 0;font-size:14px; }
#learning-response { display:block;width:100%;max-width:720px;margin:8px 0;font:inherit;padding:10px; }
#learning-panel label { display:block;margin:8px 0; }

/* V3.6: the stock panel reserves its own column, never covers the 3D canvas. */
body { --lesson-width: 240px; --stock-width: 284px; grid-template-columns: var(--lesson-width) minmax(0,1fr) var(--stock-width); }
body.sidebar-closed { --lesson-width: 0px; grid-template-columns: var(--lesson-width) minmax(0,1fr) var(--stock-width); }
body.supplies-closed { --stock-width: 0px; }
#supplies { grid-column:3; grid-row:1; height:100dvh; overflow:auto; min-width:0; padding:16px 12px; border-left:1px solid var(--border); background:#fafbfc; }
body.supplies-closed #supplies { display:none; }
.supply-heading { display:flex; align-items:center; gap:6px; justify-content:space-between; margin-bottom:14px; }
.supply-heading h2 { font-size:17px; }
.supply-heading button { font-size:12px; padding:6px; }
#supplies #cards { grid-template-columns:1fr; }
#supplies .card { touch-action:none; }
#reaction-hints { margin-top:18px; border-top:1px solid var(--border); padding-top:12px; font-size:13px; line-height:1.6; overflow-wrap:anywhere; }
#reaction-hints h3 { margin:5px 0; font-size:15px; }
#reaction-hints article { padding:10px 0; border-bottom:1px solid var(--border); }
#reaction-hints p { margin:5px 0; }
#reaction-hints a { color:#146958; }
.risk-badge { display:inline-block; padding:3px 7px; border-radius:5px; font-weight:600; color:#28493b; background:#e1f2e8; }
.risk-badge[data-level="attention"] { color:#6b4c00; background:#fff3c9; }
.risk-badge[data-level="danger"] { color:#7c3500; background:#ffe6d2; }
.risk-badge[data-level="severe"] { color:#8b1e22; background:#fde2e4; }
#settings-notice { font-size:13px; color:#285448; }
#settings-notice:empty { display:none; }
#pipeline-metrics { margin:8px 0; }
#hint-panel { margin:10px 0; padding:8px; border:1px solid var(--border); border-radius:6px; background:#f1f8f5; }
#hint-panel summary { font-size:13px; font-weight:600; }
#hint-panel #reaction-hints { max-height:34vh; overflow:auto; margin-top:6px; padding:0; border:0; }
@media(max-width:1100px) {
 body { --lesson-width:210px; --stock-width:245px; }
 main { padding:10px; }
}
@media(max-width:800px) {
 body { --lesson-width:0px; --stock-width:215px; }
 #inventory { display:none; }
 body.lesson-menu-open { --lesson-width:210px; --stock-width:0px; }
 body.lesson-menu-open #inventory { display:block; }
 body.lesson-menu-open #supplies { display:none; }
 #supplies { padding:12px 8px; }
 .camera-deck { flex-wrap:wrap; }
 #hand-status { flex-basis:100%; }
 .supply-heading { flex-wrap:wrap; }
}

/* Hand assist toggle, aligned with toolbar buttons. */
.toolbar .assist-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  min-height: 36px;
  border: 1px solid var(--line, #cfd6df);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.toolbar .assist-toggle input { margin: 0; }
