/* Phase Change Thermostat: a thermostat bay (sealed vessel on a heater / chiller plate, thermometer, heating-curve
   monitor, molecule view). Scene by art.js; colors from the --pct-* properties below (light and dark). */
html {
  --pct-wall1: #eef4f6; --pct-wall2: #dbe6ea; --pct-grout: #c6d4da; --pct-bench1: #5d6b75; --pct-bench2: #3f4a52; --pct-line: #1f3440;
  --pct-glass: rgba(225, 242, 250, .5); --pct-glass-edge: rgba(150, 190, 210, .8); --pct-water1: #7cc4ea; --pct-water2: #2f7fb5; --pct-water-line: #1e6a9a;
  --pct-ice1: #f4fbff; --pct-ice2: #cdeaf8; --pct-ice3: #9fd0ea; --pct-ice-line: #5f9fc0; --pct-steam: #ffffff; --pct-steam-line: #9aa9b4; --pct-bubble: #e8f6ff;
  --pct-plate1: #8a959d; --pct-plate2: #4f5a62; --pct-coil-off: #6b767e; --pct-hot: #e2532b; --pct-cold: #2f8fd0; --pct-tube: #ffffff; --pct-merc: #d63a2a;
  --pct-tag: #ffffff; --pct-label: #1f3440; --pct-accent: #1d6b84;
  --pct-case: #2b3640; --pct-screen1: #0f2533; --pct-screen2: #0a1a24; --pct-scr-ink: #cfe9f5; --pct-scr-grid: rgba(150, 200, 225, .18); --pct-scr-curve: #7fd3ff; --pct-scr-dot: #ffd23f; --pct-ok: #4fd08c;
  --pct-ink: #15262f; --pct-panel-bg1: #f5fafc; --pct-panel-bg2: #e6f0f4; --pct-okc: #13704a; --pct-bad: #b3261e; --pct-chip: #ffffff; --pct-chip-on: #d4ecf4;
  --pct-mol-bg: #0f2533; --pct-mol-ice: #e3f5ff; --pct-mol-liq: #4aa8e0; --pct-mol-vap: #d6dee4; --pct-mol-line: #5c8aa3;
}
html[data-theme="dark"] {
  --pct-wall1: #18232a; --pct-wall2: #121b21; --pct-grout: #24323b; --pct-bench1: #36414a; --pct-bench2: #232b31; --pct-line: #050b0f;
  --pct-glass: rgba(120, 170, 195, .22); --pct-glass-edge: rgba(120, 170, 195, .5); --pct-water1: #4f9cc7; --pct-water2: #1f5f8c; --pct-water-line: #7cc4ea;
  --pct-ice1: #d9eef8; --pct-ice2: #a9d2e8; --pct-ice3: #7db4d2; --pct-ice-line: #9fd0ea; --pct-steam: #c9d6de; --pct-steam-line: #8fa1ad; --pct-bubble: #cfeaff;
  --pct-plate1: #59636b; --pct-plate2: #30383e; --pct-coil-off: #4a545b; --pct-hot: #ff7a52; --pct-cold: #5cb8f0; --pct-tube: #e8eef1; --pct-merc: #e2533f;
  --pct-tag: #e8eef1; --pct-label: #dbe9ef; --pct-accent: #7fd0ea;
  --pct-case: #0b1115; --pct-screen1: #08161f; --pct-screen2: #050f15;
  --pct-ink: #e3eef3; --pct-panel-bg1: #1c272e; --pct-panel-bg2: #151e24; --pct-okc: #4fd08c; --pct-bad: #ff8a80; --pct-chip: #142027; --pct-chip-on: #1f4452;
  --pct-mol-bg: #071219;
}
.pct { position: absolute; inset: 0; display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 12px; padding: 10px; color: var(--tlg-text); font-size: 16px; }
.pct input, .pct button { font: inherit; }
.pct-controls { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; padding: 8px 12px;
  background: linear-gradient(var(--pct-panel-bg1), var(--pct-panel-bg2)); color: var(--pct-ink); border: 3px solid var(--pct-accent); border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.pct-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; overflow: auto; }
.pct-order { display: grid; gap: 2px; padding: 6px 10px; border-radius: 10px; background: var(--pct-tag); color: #15262f; border: 2px dashed var(--pct-accent);
  box-shadow: 0 2px 0 rgba(0,0,0,.08); }
html[data-theme="dark"] .pct-order { background: #e8eef1; }
.pct-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #1d6b84; }
.pct-order-l { margin: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 6px; line-height: 1.3; }
.pct-order-l span { font-weight: 700; opacity: .8; }
.pct-step { display: grid; gap: 4px; }
.pct-step-b { display: grid; gap: 6px; }
.pct-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.pct-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--pct-accent); color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .pct-n { color: #08161f; }
.pct-step.is-done .pct-n { background: var(--pct-okc); }
.pct-mark { margin-left: auto; font-weight: 800; white-space: nowrap; }
.pct-mark.is-ok, .pct-fmark.is-ok { color: var(--pct-okc); }
.pct-mark.is-bad, .pct-fmark.is-bad { color: var(--pct-bad); }
.pct-fmark { font-weight: 800; }

/* thermostat dial */
.pct-dial { display: grid; gap: 4px; }
.pct-dial-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pct-dial-v { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--pct-accent); }
.pct-dial.is-heat .pct-dial-v { color: var(--pct-hot); }
.pct-dial.is-cool .pct-dial-v { color: var(--pct-cold); }
html:not([data-theme="dark"]) .pct-dial.is-heat .pct-dial-v { color: #b8381a; }
html:not([data-theme="dark"]) .pct-dial.is-cool .pct-dial-v { color: #1f6fa8; }
.pct-dial.is-unset .pct-dial-v { font-size: 18px; font-style: italic; font-weight: 600; color: var(--pct-ink); opacity: .8; }
.pct-dial-dir { font-weight: 700; }
.pct-dial-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.pct-step-btn { min-height: 44px; border-radius: 10px; border: 2px solid var(--pct-accent); background: var(--pct-chip); color: var(--pct-ink); font-size: 18px; cursor: pointer; }
.pct-step-btn:disabled { opacity: .45; cursor: default; }
.pct-step-btn:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.pct-track { position: relative; height: 44px; border-radius: 22px; border: 2px solid var(--pct-line);
  background: linear-gradient(90deg, #2f8fd0 0, #9fd0ea calc(var(--pct-zero, 50%) - 1px), #6b767e calc(var(--pct-zero, 50%) - 1px), #6b767e calc(var(--pct-zero, 50%) + 1px), #f3b49b calc(var(--pct-zero, 50%) + 1px), #e2532b 100%); }
.pct-track::before { content: ''; position: absolute; left: 6px; top: 50%; width: calc(var(--pct-zero, 50%) - 10px); border-top: 3px dashed rgba(255,255,255,.85); }
.pct-track input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.pct-track input::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.pct-track input::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 40px; margin-top: 0; border-radius: 10px; border: 3px solid var(--pct-line); background: radial-gradient(circle at 40% 35%, #ffffff, #c9d4da); box-shadow: 0 2px 4px rgba(0,0,0,.35); }
.pct-track input::-moz-range-thumb { width: 26px; height: 36px; border-radius: 10px; border: 3px solid var(--pct-line); background: #eef2f4; }
.pct-dial.is-unset .pct-track input::-webkit-slider-thumb { opacity: .55; }
.pct-track input:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 3px; border-radius: 22px; }

.pct-num { display: grid; gap: 2px; }
.pct-num-l { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; font-weight: 700; line-height: 1.2; }
.pct-num--bare .pct-num-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pct-num-row { display: flex; align-items: center; gap: 6px; }
.pct-num input { flex: 1 1 auto; min-width: 0; font-size: 17px; min-height: 42px; padding: 3px 8px; border: 2px solid #8aa2ae; border-radius: 8px; background: #fff; color: #15262f; }
html[data-theme="dark"] .pct-num input { background: #0e171c; color: #e3eef3; border-color: #5f7c8a; }
.pct-num input:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.pct-unit { flex: none; min-width: 26px; font-weight: 700; }
.pct-row { display: grid; gap: 8px; }
.pct-row--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pct-row > * { min-width: 0; }

.pct-chips { display: grid; gap: 5px; }
.pct-chips--phase { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pct-chips--why { grid-template-columns: 1fr; }
.pct-chip { position: relative; display: flex; align-items: center; min-height: 42px; min-width: 0; padding: 4px 20px 4px 8px; border: 2px solid #9db3be; border-radius: 10px;
  background: var(--pct-chip); color: var(--pct-ink); font-size: 16px; line-height: 1.15; text-align: left; cursor: pointer; }
html[data-theme="dark"] .pct-chip { border-color: #4f6a77; }
.pct-chip:hover:not(:disabled) { border-color: var(--pct-accent); }
.pct-chip:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.pct-chip.is-on { border-color: var(--pct-accent); background: var(--pct-chip-on); font-weight: 700; box-shadow: inset 0 0 0 1px var(--pct-accent); }
.pct-chip-m { position: absolute; right: 6px; bottom: 4px; font-weight: 800; }
.pct-chip.is-key { border-color: var(--pct-okc); box-shadow: inset 0 0 0 2px var(--pct-okc); }
.pct-chip.is-key .pct-chip-m { color: var(--pct-okc); }
.pct-chip.is-wrong { border-color: var(--pct-bad); border-style: dashed; }
.pct-chip.is-wrong .pct-chip-m { color: var(--pct-bad); }
.pct-chip:disabled { cursor: default; opacity: 1; }

/* the bay */
.pct-scene { flex: none; border-radius: 12px; overflow: hidden; border: 2px solid var(--pct-line); }
.pct-svg { display: block; width: 100%; height: auto; }
.pct-lbl, .pct-read, .pct-scr { font-family: var(--tlg-font); font-size: 17px; font-weight: 700; fill: var(--pct-label); }
.pct-lbl--sm { font-size: 16px; }
.pct-read { fill: #15262f; font-size: 18px; }
.pct-mode { font-size: 16px; }
.pct-scr { fill: var(--pct-scr-ink); font-size: 17px; font-weight: 600; }
.pct-scr--title { font-weight: 800; letter-spacing: .03em; }
.pct-scr--note { font-size: 16px; fill: #9fd8f2; }
.pct-scr--ok { fill: var(--pct-ok); font-weight: 800; }
.pct-bubble { animation: pct-rise 1.6s linear infinite; }
@keyframes pct-rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(calc(-1 * var(--pct-rise, 60px))); opacity: .2; } }
.pct-wisp { animation: pct-wisp 2.6s ease-in-out infinite alternate; }
.pct-wisp--1 { animation-delay: -.7s; } .pct-wisp--2 { animation-delay: -1.4s; } .pct-wisp--3 { animation-delay: -2s; }
@keyframes pct-wisp { from { transform: translateY(8px); } to { transform: translateY(-12px); } }
.pct-arrows--in { animation: pct-up 1s ease-in-out infinite alternate; }
.pct-arrows--out { animation: pct-up 1s ease-in-out infinite alternate-reverse; }
@keyframes pct-up { from { transform: translateY(0); } to { transform: translateY(-4px); } }

.pct-below { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 204px; gap: 10px; align-items: start; }
.pct-why { padding: 5px 10px 7px; border-radius: 12px; background: var(--pct-panel-bg1); color: var(--pct-ink); border: 2px solid var(--pct-accent); }
.pct-mol { margin: 0; display: grid; gap: 2px; justify-items: center; }
.pct-mol-c { width: 200px; height: 124px; border-radius: 10px; border: 2px solid var(--pct-line); display: block; }
.pct-mol figcaption { font-size: 16px; font-weight: 700; }
.pct-segs { flex: none; padding: 6px 10px; border-radius: 12px; background: var(--pct-panel-bg2); color: var(--pct-ink); }
.pct-segs-h { align-self: center; font-weight: 800; }
.pct-segs-l { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.pct-seg { display: flex; align-items: center; gap: 6px; padding: 1px 7px; border-radius: 8px; border: 2px solid #9db3be; background: var(--pct-chip); opacity: .45; transition: opacity .25s, box-shadow .25s; }
.pct-seg.is-lit { opacity: 1; }
.pct-seg.is-now { box-shadow: 0 0 0 3px var(--tlg-focus, #1a73e8); }
.pct-seg--latent { border-style: dashed; }
.pct-seg-k { font-size: 16px; font-weight: 800; color: var(--pct-accent); white-space: nowrap; }
.pct-seg--sum { opacity: 1; border-color: var(--pct-accent); font-weight: 700; }
.pct-about { flex: none; margin-top: auto; padding: 4px 10px; border: 1px solid var(--tlg-border); border-radius: 8px; }
.pct-about summary { cursor: pointer; min-height: 32px; font-weight: 700; display: flex; align-items: center; }
.pct-about p { margin: 4px 0; }
.pct-ex { border-collapse: collapse; font-size: 16px; }
.pct-ex caption { text-align: left; font-weight: 700; margin-bottom: 4px; }
.pct-ex th, .pct-ex td { padding: 3px 8px; border-bottom: 1px solid var(--tlg-border); text-align: left; }
@media (max-width: 900px) {
  .pct { position: static; grid-template-columns: 1fr; }
  .pct-controls, .pct-right { overflow: visible; }
}
@media (max-width: 560px) {
  .pct-below { grid-template-columns: 1fr; }
  .pct-chips--phase { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .pct *, .pct *::before { animation: none !important; transition: none !important; } }
