/* Stomata Control Room: three monitors (morning / midday / evening) with a microscope feed of one stoma each, plus the
 * leaf's water and carbon tanks. Scene drawn by art.js (colors from the --sc-* properties below). */
html {
  --sc-room: #dfe7e2; --sc-bezel1: #3a4a44; --sc-bezel2: #24302c; --sc-active: #ffd23f;
  --sc-dawn1: #f7c9a8; --sc-dawn2: #cfe4f2; --sc-noon1: #5aa9e6; --sc-noon2: #bfe3f7; --sc-dusk1: #6a4c8c; --sc-dusk2: #f2a46b;
  --sc-ground: #4f8a3a; --sc-shimmer: rgba(255,255,255,.75);
  --sc-epi1: #e9f6dc; --sc-epi2: #c4e2a9; --sc-cellwall: #7fae5f; --sc-guard1: #b7e39a; --sc-guard2: #4f9a3f; --sc-guard-line: #2c5f28;
  --sc-pore: #1d2a1f; --sc-chloro: #2f7a3a; --sc-nuc: #6d5a8c;
  --sc-glass1: #f4f8fa; --sc-glass2: #c2ccd2; --sc-glass-line: #55636b;
  --sc-ink: #1f2a24; --sc-panel-bg1: #f7fbf5; --sc-panel-bg2: #e7f1e2; --sc-accent: #2f6b3a; --sc-ok: #13704a; --sc-bad: #b3261e;
  --sc-gauge-bg: #e6eee2; --sc-text-on-bezel: #f2f6f3;
}
html[data-theme="dark"] {
  --sc-room: #1a211e; --sc-bezel1: #2c3834; --sc-bezel2: #161e1b;
  --sc-epi1: #34502d; --sc-epi2: #22381e; --sc-cellwall: #5f8a48; --sc-guard1: #8cc46f; --sc-guard2: #3f7a32; --sc-guard-line: #c7ecb3;
  --sc-pore: #070c08; --sc-chloro: #1e5226; --sc-nuc: #b7a6d8;
  --sc-glass1: #5e6a71; --sc-glass2: #343e44; --sc-glass-line: #b8c4cb;
  --sc-ink: #e9f2ec; --sc-panel-bg1: #1f2a24; --sc-panel-bg2: #18211c; --sc-accent: #8fd18f; --sc-ok: #4fd08c; --sc-bad: #ff8a80;
  --sc-gauge-bg: #2a352f;
}

/* ── layout ── */
.sc { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--tlg-text); font-size: 16px; }
.sc input, .sc button, .sc select { font: inherit; }
.sc-controls { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; padding: 10px 12px;
  background: linear-gradient(var(--sc-panel-bg1), var(--sc-panel-bg2)); color: var(--sc-ink); border: 3px solid var(--sc-accent);
  border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.sc-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.sc-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--sc-accent); }
.sc-step { display: grid; gap: 4px; }
.sc-step-b { display: grid; gap: 6px; }
.sc-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.sc-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--sc-accent);
  color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .sc-n { color: #10200f; }
.sc-step.is-done .sc-n { background: var(--sc-ok); }

/* sliders */
.sc-slider { display: grid; gap: 0; }
.sc-slider-h { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.sc-slider-v { font-weight: 800; color: var(--sc-accent); white-space: nowrap; }
.sc-slider.is-unset .sc-slider-v { font-weight: 600; font-style: italic; color: var(--sc-ink); opacity: .8; }
.sc-slider input { width: 100%; min-height: 28px; margin: 0; accent-color: var(--sc-accent); cursor: pointer; }
.sc-slider.is-unset input { opacity: .55; }
.sc-slider input:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.sc-ticks { display: flex; justify-content: space-between; font-size: 16px; line-height: 1.1; opacity: .8; padding: 0 2px; margin-top: -4px; }

/* drought choice */
.sc-choice { display: grid; gap: 4px; font-weight: 600; line-height: 1.25; }
.sc-choice select { width: 100%; min-height: 44px; font-size: 16px; padding: 6px 8px; border: 2px solid #8aa08f; border-radius: 8px;
  background: #fff; color: #1f2a24; cursor: pointer; }
html[data-theme="dark"] .sc-choice select { background: #141b17; color: #e9f2ec; border-color: #6f8a76; }
.sc-choice select:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.sc-choice select:disabled { opacity: 1; cursor: default; }

/* AP prediction */
.sc-num { display: grid; grid-template-columns: minmax(0, 1fr) 160px; align-items: center; gap: 2px 8px; }
.sc-num-l { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; font-weight: 700; font-size: 16px; line-height: 1.2; }
.sc-num-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.sc-num input { flex: 1 1 auto; min-width: 0; width: 100%; font-size: 17px; min-height: 42px; padding: 5px 8px; border: 2px solid #8aa08f;
  border-radius: 8px; background: #fff; color: #1f2a24; }
html[data-theme="dark"] .sc-num input { background: #141b17; color: #e9f2ec; border-color: #6f8a76; }
.sc-num input:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.sc-num input[readonly] { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(47,107,58,.1) 6px 12px), #eef3ec; }
html[data-theme="dark"] .sc-num input[readonly] { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(143,209,143,.1) 6px 12px), #1d2621; }
.sc-num input:disabled { opacity: 1; }
.sc-unit { flex: none; font-weight: 700; }
.sc-mark { font-weight: 800; white-space: nowrap; }
.sc-mark.is-ok { color: var(--sc-ok); } .sc-mark.is-bad { color: var(--sc-bad); }
.sc-seal { margin: 0; font-size: 16px; font-weight: 700; color: var(--sc-accent); }

/* run button */
.sc-run { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 12px; font-size: 18px; font-weight: 800;
  color: #fff; background: linear-gradient(#3f8a4a, #2a6334); border: 2px solid #1f4d27; border-radius: 10px; cursor: pointer; box-shadow: 0 3px 0 #173a1d; }
.sc-run:hover:not(:disabled) { filter: brightness(1.06); }
.sc-run:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #173a1d; }
.sc-run:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 3px; }
.sc-run:disabled { cursor: default; background: #cfd3cf; border-color: #a9b0aa; color: #39403a; box-shadow: none; }
html[data-theme="dark"] .sc-run:disabled { background: #333b36; border-color: #4f5952; color: #d5ddd7; }
.sc-run.is-done:disabled { background: #e4f1e1; color: #1f4d27; border-color: #9cc49f; }
html[data-theme="dark"] .sc-run.is-done:disabled { background: #22352a; color: #c7ecc9; border-color: #4f7a58; }
.sc-run-i { font-size: 16px; }
.sc-run.is-done .sc-run-t { font-size: 16px; }

/* budget sheet */
.sc-sheet { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 6px; }
.sc-card { padding: 4px 10px; border-radius: 10px; background: var(--tlg-surface, #fff); border: 2px solid var(--tlg-border, #ccd); }
.sc-card h3 { margin: 0; font-size: 16px; color: var(--sc-accent); }
.sc-card p { margin: 0; font-size: 16px; line-height: 1.3; }

/* scene */
.sc-scene { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; }
.sc-svg { display: block; width: 100%; height: 100%; max-height: 100%; }
.sc-room { fill: var(--sc-room); }
.sc-bezel { fill: url(#sc-g-bezel); stroke: rgba(0,0,0,.35); stroke-width: 1.5; }
.sc-active { fill: none; stroke: var(--sc-active); stroke-width: 4; opacity: 0; transition: opacity .2s; }
.sc-mon.is-active .sc-active { opacity: 1; }
.sc-t { font-family: var(--tlg-font, sans-serif); font-size: 18px; fill: var(--sc-text-on-bezel); }
.sc-t-name { font-weight: 800; letter-spacing: .06em; }
.sc-t-ap { font-weight: 800; fill: #ffe27a; }
.sc-t-chip { font-weight: 700; fill: #fff; }
.sc-chip { fill: rgba(10,20,14,.62); }
.sc-t-num { font-weight: 800; fill: #ffe27a; }
.sc-t-model { font-size: 16px; font-weight: 700; opacity: .9; }
.sc-t-tank { font-weight: 800; }
.sc-t-val { font-weight: 800; }
.sc-sun { fill: #fff3b0; stroke: #ffd23f; stroke-width: 3; }
.sc-moon { fill: #eef0f8; }
.sc-stars circle { fill: #fff; opacity: .85; }
.sc-shimmer { fill: none; stroke: var(--sc-shimmer); stroke-width: 2.2; stroke-linecap: round; }
.sc-svg.is-running .sc-mon.is-active .sc-shimmer { animation: sc-shim .6s ease-in-out infinite alternate; }
@keyframes sc-shim { to { transform: translateY(-3px); } }
.sc-ground { fill: var(--sc-ground); }
.sc-thermo-tube { fill: #fff; stroke: #3a3a3a; stroke-width: 1.5; }
.sc-thermo-fill, .sc-thermo-bulb { fill: #d93025; }
.sc-thermo-bulb { stroke: #3a3a3a; stroke-width: 1.5; }
.sc-scope-ring { fill: #10160f; stroke: #8a979e; stroke-width: 3; }
.sc-cross { stroke: #c9d3d8; stroke-width: 2.5; }
.sc-guard { fill: url(#sc-g-guard); stroke: var(--sc-guard-line); stroke-width: 2.2; transition: d .25s; }
.sc-wall { fill: none; stroke: var(--sc-guard-line); stroke-width: 4; opacity: .55; }
.sc-chloro { fill: var(--sc-chloro); opacity: .85; }
.sc-nuc { fill: var(--sc-nuc); opacity: .8; }
.sc-pore { fill: var(--sc-pore); }
.sc-gc.is-unset .sc-guard { fill: #c9d1cb; stroke: #6f7a73; stroke-dasharray: 5 4; }
.sc-gc.is-unset .sc-chloro, .sc-gc.is-unset .sc-nuc { opacity: .3; }
.sc-co2-c { fill: #3a3f44; } .sc-co2-o { fill: #e05a4f; stroke: #7a1f18; stroke-width: 1; }
.sc-h2o { fill: #5aa9e6; stroke: #1f5f94; stroke-width: 1.2; }
.sc-h2o.is-cuticle { fill: #a9d4f2; stroke-dasharray: 2 2; }
.sc-run-flash circle { fill: none; }
.sc-tank-body { fill: url(#sc-g-glass); stroke: var(--sc-glass-line); stroke-width: 2.5; }
.sc-tank-glare { stroke: #fff; stroke-width: 3; opacity: .45; stroke-linecap: round; }
.sc-tick { stroke: var(--sc-text-on-bezel); stroke-width: 3; stroke-dasharray: 5 3; }
.sc-tank-w.is-dry .sc-tank-body { stroke: var(--sc-bad); stroke-width: 4; }
.sc-lamp { opacity: 0; } .sc-lamp.is-ok, .sc-lamp.is-bad { opacity: 1; }
.sc-lamp circle { fill: #5c5f63; stroke: #fff; stroke-width: 2; }
.sc-lamp.is-ok circle { fill: #2fae6a; } .sc-lamp.is-bad circle { fill: #d93025; }
.sc-lamp.is-bad circle { animation: sc-blink .5s steps(2) 6; }
@keyframes sc-blink { 50% { fill: #5c5f63; } }
.sc-lamp-t { font-family: var(--tlg-font, sans-serif); font-size: 14px; font-weight: 900; fill: #fff; }
.sc-stem { fill: none; stroke: #3f7a32; stroke-width: 4; stroke-linecap: round; }
.sc-leaf-blade { fill: url(#sc-g-leaf); stroke: #245e2c; stroke-width: 2; transition: fill .6s; }
.sc-leaf-vein { fill: none; stroke: #d8f2c4; stroke-width: 1.6; opacity: .85; }
.sc-leaf-in { transform-box: view-box; transform-origin: -6px 6px; transition: transform .8s ease-in-out; }
.sc-leaf.is-wilt .sc-leaf-in { transform: rotate(38deg); }
.sc-leaf.is-wilt .sc-leaf-blade { fill: #a8a24a; }
.sc-leaf.is-wilt-soft .sc-leaf-in { animation: sc-sag 1s ease-in-out 1; }
@keyframes sc-sag { 50% { transform: rotate(14deg); } }
.sc-leaf.is-perk .sc-leaf-in { animation: sc-perk .45s ease-in-out 4 alternate; }
@keyframes sc-perk { to { transform: rotate(-10deg); } }

/* gauges */
.sc-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.sc-gauge { display: grid; gap: 2px; }
.sc-g-h { display: flex; align-items: baseline; gap: 8px; font-size: 16px; line-height: 1.25; }
.sc-g-h b { flex: none; }
.sc-g-v { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-g-s { flex: none; font-weight: 800; white-space: nowrap; }
.sc-gauge.is-ok .sc-g-s { color: var(--sc-ok); } .sc-gauge.is-bad .sc-g-s { color: var(--sc-bad); }
.sc-g-row { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.sc-g-row .sc-g-track { flex: 1 1 auto; }
.sc-g-track { position: relative; height: 14px; border-radius: 7px; background: var(--sc-gauge-bg); border: 1px solid var(--tlg-border-strong, #888); }
.sc-g-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 7px; transition: width .7s ease-out; }
.sc-g-fill--carbon { background: linear-gradient(90deg, #2f7a3a, #8fd18f); }
.sc-g-fill--water { background: repeating-linear-gradient(45deg, #2a76b0 0 6px, #63b6e6 6px 12px); }
.sc-g-tick { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--tlg-text); }
.sc-gauge.is-flash .sc-g-track { animation: sc-flash .5s ease-in-out 4 alternate; }
@keyframes sc-flash { to { box-shadow: 0 0 0 3px var(--sc-bad); } }
.sc-readout { margin: 0; font-size: 16px; line-height: 1.3; min-height: 21px; }
.sc-about { font-size: 16px; }
.sc-about summary { cursor: pointer; font-weight: 700; min-height: 26px; }
.sc-about p { margin: 4px 0 0; max-height: 160px; overflow: auto; }

/* worked example (Briefing) */
.sc-ex { border-collapse: collapse; font-size: 17px; width: 100%; max-width: 620px; }
.sc-ex caption { text-align: left; font-weight: 800; padding-bottom: 6px; }
.sc-ex th, .sc-ex td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--tlg-border, #ccd); }
.sc-ex-note { font-size: 17px; margin: 8px 0 0; }

.sc.is-locked .sc-slider input { cursor: default; }

@media (max-width: 900px) {
  .sc { position: static; grid-template-columns: 1fr; }
  .sc-controls { overflow: visible; }
  .sc-sheet { grid-template-columns: 1fr; }
  .sc-scene { min-height: 200px; }
  .sc-ledger { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .sc *, .sc *::before { animation: none !important; transition: none !important; }
}
