/* Compound Pharmacy: the naming counter of a chemical "pharmacy". Scene drawn by art.js (colors from the --cp-* properties below). */
html {
  --cp-wall1: #e4f2ed; --cp-wall2: #c9e3d9; --cp-wall-line: #8fbcae;
  --cp-wood1: #c08a55; --cp-wood2: #7f532b; --cp-wood-hi: #e2b37f;
  --cp-tray1: #f7f3ec; --cp-tray2: #e6ddcf; --cp-tray-line: #8a6b4c;
  --cp-cat1: #f8bd7c; --cp-cat2: #dc7a2e; --cp-cat-line: #8f4612; --cp-cat-ink: #3a1d06;
  --cp-an1: #8ccbee; --cp-an2: #2f80b8; --cp-an-line: #174a6e; --cp-an-ink: #06233a;
  --cp-atom1a: #f2a25a; --cp-atom1b: #b55a16; --cp-atom2a: #7fc2ea; --cp-atom2b: #23699b;
  --cp-jar1: #f6fbf9; --cp-jar2: #c3dcd4; --cp-jar-line: #2c5f55; --cp-lid1: #1d6b5f; --cp-lid2: #6a5a86;
  --cp-paper: #ffffff; --cp-ink: #16302b; --cp-glass1: #eaf7f3; --cp-glass2: #a6d3c6; --cp-glass-line: #2c5f55; --cp-cap: #1d6b5f;
  --cp-metal1: #e3e7ea; --cp-metal2: #66727b;
  --cp-accent: #1d6b5f; --cp-ok: #13704a; --cp-bad: #b3261e;
  --cp-panel-bg1: #f6fbf9; --cp-panel-bg2: #e7f2ee; --cp-panel-ink: #17302b;
}
html[data-theme="dark"] {
  --cp-wall1: #1f2e2b; --cp-wall2: #18241f; --cp-wall-line: #3f5d55;
  --cp-wood1: #6e4a2a; --cp-wood2: #442c16; --cp-wood-hi: #94683f;
  --cp-tray1: #2f2a25; --cp-tray2: #25211d; --cp-tray-line: #b2906c;
  --cp-jar1: #44544f; --cp-jar2: #2a3633; --cp-jar-line: #9fd0c3; --cp-lid1: #3fa592; --cp-lid2: #9a88bc;
  --cp-paper: #f3f5f2; --cp-ink: #16302b; --cp-glass1: #4b6a62; --cp-glass2: #2a3e39; --cp-glass-line: #9fd0c3; --cp-cap: #3fa592;
  --cp-metal1: #9aa5ad; --cp-metal2: #d1d8dd;
  --cp-accent: #6fd1bd; --cp-ok: #4fd08c; --cp-bad: #ff8a80;
  --cp-panel-bg1: #1f2a28; --cp-panel-bg2: #182220; --cp-panel-ink: #e9f3f0;
}

/* ── layout ── */
.cp { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--tlg-text); font-size: 16px; }
.cp input, .cp button { font: inherit; }
.cp-controls { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; padding: 10px 12px;
  background: linear-gradient(var(--cp-panel-bg1), var(--cp-panel-bg2)); color: var(--cp-panel-ink); border: 3px solid var(--cp-accent);
  border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.cp-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.cp-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--cp-accent); }

/* request card */
.cp-card { display: grid; gap: 2px; padding: 8px 12px; border-radius: 10px; background: #fffdf6; color: #1d2a27;
  border: 2px dashed #b59a6e; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
html[data-theme="dark"] .cp-card { background: #2c2820; color: #f4efe3; border-color: #9c845a; }
.cp-card-l { font-size: 16px; font-weight: 600; opacity: .85; }
.cp-card-v { font-size: 24px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.cp-card-v.is-formula { font-size: 28px; letter-spacing: .02em; }
.cp-ref { display: grid; gap: 2px; }
.cp-ref p { margin: 0; font-size: 16px; line-height: 1.3; }
.cp-ref .cp-tip { opacity: .85; font-style: italic; }

/* steps */
.cp-step { display: grid; gap: 4px; }
.cp-step-b { display: grid; gap: 6px; }
.cp-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.cp-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--cp-accent);
  color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .cp-n { color: #0d2420; }
.cp-step.is-done .cp-n { background: var(--cp-ok); }

/* count steppers */
.cp-stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cp-stepper-l { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.cp-stepper-c { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.cp-sb { width: 42px; height: 42px; border-radius: 10px; border: 2px solid var(--cp-accent); background: var(--cp-paper); color: var(--cp-accent);
  font-size: 24px; font-weight: 800; line-height: 1; cursor: pointer; touch-action: manipulation; }
html[data-theme="dark"] .cp-sb { background: #12201d; }
.cp-sb:disabled { opacity: .4; cursor: default; }
.cp-count { display: grid; place-items: center; min-width: 46px; height: 42px; border-radius: 10px; border: 2px solid #8fa9a2;
  background: #fff; color: #10201c; font-size: 22px; font-weight: 800; cursor: default; }
html[data-theme="dark"] .cp-count { background: #101917; color: #f0f6f4; border-color: #5f7d75; }
.cp-stepper.is-unset .cp-count { color: #6b7d78; font-weight: 600; }
.cp-count:focus-visible, .cp-sb:focus-visible, .cp-text:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }

/* text fields */
.cp-text { width: 100%; min-height: 44px; font-size: 18px; padding: 6px 10px; border: 2px solid #8fa9a2; border-radius: 8px; background: #fff; color: #10201c; }
html[data-theme="dark"] .cp-text { background: #101917; color: #f0f6f4; border-color: #5f7d75; }
.cp-text:disabled { opacity: 1; background: #eef3f1; }
html[data-theme="dark"] .cp-text:disabled { background: #1a2523; }
.cp-oxrow { display: flex; align-items: center; gap: 8px; }
.cp-ox { width: 110px; flex: none; }
.cp-unit-l { font-size: 16px; opacity: .85; }

/* scene */
.cp-scene { flex: 0 1 auto; min-height: 0; }
.cp-svg { display: block; width: 100%; height: auto; max-height: 440px; border-radius: 14px; border: 3px solid var(--cp-jar-line);
  box-shadow: 0 3px 8px rgba(0,0,0,.16); font-family: var(--tlg-font, Arial, sans-serif); }
.cp-drawer-t { font-size: 16px; font-weight: 700; fill: #3b2a1a; }
.cp-jar-t { font-size: 17px; font-weight: 800; fill: var(--cp-ink); }
.cp-side-t { font-size: 17px; font-weight: 800; fill: #3b2a1a; letter-spacing: .03em; }
html[data-theme="dark"] .cp-side-t { fill: #f0e3d2; }
.cp-model-t { font-size: 16px; font-style: italic; fill: #6a5038; }
html[data-theme="dark"] .cp-model-t { fill: #d4bea2; }
.cp-tile-t { font-size: 18px; font-weight: 800; fill: var(--cp-cat-ink); }
.cp-side--b .cp-tile-t { fill: var(--cp-an-ink); }
.cp-tile-t.is-long { font-size: 17px; letter-spacing: -.02em; }
.cp-tile-q { font-size: 17px; font-weight: 800; fill: var(--cp-cat-ink); }
.cp-unit.is-pos { fill: #fff6e8; stroke: var(--cp-cat-line); stroke-width: 1.5; }
.cp-unit.is-neg { fill: #eaf6fd; stroke: var(--cp-an-line); stroke-width: 1.5; }
.cp-unit-t { font-size: 16px; font-weight: 900; fill: #1b1b1b; pointer-events: none; }
.cp-unit-x { font-size: 17px; font-weight: 900; fill: var(--cp-cat-ink); }
.cp-side--b .cp-unit-x { fill: var(--cp-an-ink); }
.cp-atom-t { font-size: 21px; font-weight: 900; fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.35); stroke-width: 2.5px; }
.cp-empty-t { font-size: 24px; font-weight: 800; fill: var(--cp-tray-line); }
.cp-scale-t { font-size: 16px; font-weight: 700; fill: var(--cp-ink); }
html[data-theme="dark"] .cp-scale-t { fill: #e9f3f0; }
.cp-pan-t { font-size: 18px; font-weight: 900; fill: var(--cp-ink); }
html[data-theme="dark"] .cp-pan-t { fill: #f3f5f2; }
.cp-beam { transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.cp-scale.is-even .cp-scale-t { fill: var(--cp-ok); }
.cp-sign-t { font-size: 17px; font-weight: 800; fill: var(--cp-ink); }
.cp-sign-t2 { font-size: 16px; fill: var(--cp-ink); }
.cp-label-t { font-size: 19px; font-weight: 800; fill: var(--cp-ink); }
.cp-label-t.is-blank { font-weight: 500; font-style: italic; fill: #7d8a86; }
.cp-stamp circle { stroke-width: 3; fill: #fff; }
.cp-stamp text { font-size: 24px; font-weight: 900; }
.cp-stamp.is-ok circle { stroke: var(--cp-ok); } .cp-stamp.is-ok text { fill: var(--cp-ok); }
.cp-stamp.is-bad circle { stroke: var(--cp-bad); } .cp-stamp.is-bad text { fill: var(--cp-bad); }
html[data-theme="dark"] .cp-stamp circle { fill: #1b1b1b; }

/* reveal: the two sides click together (right) or shake (wrong) */
.cp-side { transition: transform .5s cubic-bezier(.3,1.3,.5,1); }
.cp-svg.is-merged .cp-side--a { transform: translateX(14px); }
.cp-svg.is-merged .cp-side--b { transform: translateX(-14px); }
.cp-svg.is-merged .cp-divider { opacity: 0; transition: opacity .3s; }
.cp-svg.is-returned .cp-tray { animation: cp-shake .45s ease-in-out 1; }
.cp-stamp { transition: opacity .25s; }
.cp-svg.is-merged .cp-stamp, .cp-svg.is-returned .cp-stamp { animation: cp-stamp .4s ease-out 1; transform-box: fill-box; transform-origin: center; }
@keyframes cp-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes cp-stamp { 0% { transform: scale(1.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.cp-svg.is-still .cp-side, .cp-svg.is-still .cp-tray, .cp-svg.is-still .cp-stamp { animation: none; transition: none; }

.cp-readout { margin: 0; font-size: 17px; font-weight: 600; min-height: 1.3em; }
.cp-model { margin: 0; font-size: 16px; opacity: .85; font-style: italic; }
.cp-about { font-size: 16px; }
.cp-about summary { cursor: pointer; font-weight: 700; min-height: 28px; }
.cp-about p { margin: 6px 0 0; }

/* Briefing example */
.cp-ex { border-collapse: collapse; width: 100%; font-size: 17px; }
.cp-ex caption { text-align: left; font-weight: 800; margin-bottom: 6px; }
.cp-ex th, .cp-ex td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--tlg-border, #ccc); }

@media (max-width: 900px) {
  .cp { position: static; grid-template-columns: 1fr; }
  .cp-controls { overflow: visible; }
  .cp-svg { height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .cp *, .cp-beam { transition: none !important; animation: none !important; }
}
