/* Cell Sculptor: a cell-design studio. Scene drawn by art.js (colors from the --cs-* properties below). */
html {
  --cs-wall1: #e4eef0; --cs-wall2: #c9dadf; --cs-bench1: #8a6a4f; --cs-bench2: #6c513b; --cs-bench-edge: #b38d68;
  --cs-med1: #dff4ef; --cs-med2: #a9ddd3; --cs-glass: #5d8f99; --cs-dot: #2f8a76;
  --cs-c0: #fde3d6; --cs-c1: #f5b3a0; --cs-c2: #e3836f; --cs-c3: #b9584c; --cs-rim: #8d2f45;
  --cs-nuc1: #b994d6; --cs-nuc2: #6d4a96; --cs-mv: #8d2f45; --cs-fold: #7a2639;
  --cs-hunger: #6f7378; --cs-text: #13363c; --cs-plate: #f6efe2; --cs-plate-text: #3b2a1d;
  --cs-ink: #1f2a30; --cs-panel1: #fbf7f2; --cs-panel2: #f2e9e1; --cs-panel-line: #7a2e4d;
  --cs-accent: #7a2e4d; --cs-ok: #13704a; --cs-bad: #b3261e; --cs-supply: #2f8a76; --cs-mem: #8d2f45;
}
html[data-theme="dark"] {
  --cs-wall1: #1b2b30; --cs-wall2: #12201f; --cs-bench1: #4a3829; --cs-bench2: #35281d; --cs-bench-edge: #6a523c;
  --cs-med1: #164046; --cs-med2: #0d2c31; --cs-glass: #7fb3bd; --cs-dot: #6fd3bb;
  --cs-c0: #f7cdbd; --cs-c1: #e59a86; --cs-c2: #c86f5d; --cs-c3: #94443b; --cs-rim: #ffb3c2;
  --cs-nuc1: #cdb0e6; --cs-nuc2: #7d5aa8; --cs-mv: #ffb3c2; --cs-fold: #5a1a2a;
  --cs-hunger: #4a4f55; --cs-text: #e4f2f3; --cs-plate: #2c241c; --cs-plate-text: #f1e6d4;
  --cs-ink: #eef2f3; --cs-panel1: #2a2226; --cs-panel2: #221c1f; --cs-panel-line: #c06a8c;
  --cs-accent: #e7a3bf; --cs-ok: #4fd08c; --cs-bad: #ff8a80; --cs-supply: #6fd3bb; --cs-mem: #ff9fb5;
}

/* ── layout ── */
.cs { position: absolute; inset: 0; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--tlg-text); font-size: 16px; }
.cs-controls { display: flex; flex-direction: column; gap: 7px; min-height: 0; overflow: auto; padding: 10px 12px;
  background: linear-gradient(var(--cs-panel1), var(--cs-panel2)); color: var(--cs-ink); border: 3px solid var(--cs-panel-line);
  border-radius: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.cs-right { display: flex; flex-direction: column; gap: 7px; min-width: 0; min-height: 0; }
.cs-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cs-accent); }
.cs-step { display: grid; gap: 5px; }
.cs-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.cs-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--cs-accent);
  color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .cs-n { color: #2a1520; }
.cs-step.is-done .cs-n { background: var(--cs-ok); }
.cs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cs-note { margin: 0; font-size: 16px; line-height: 1.3; color: var(--cs-ink); opacity: .85; }

/* shape cards (radio inputs) */
.cs-shapes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0; padding: 0; border: 0; min-width: 0; }
.cs-shape { position: relative; display: flex; align-items: center; gap: 6px; min-height: 50px; padding: 3px 7px; border: 2px solid #b9a59a;
  border-radius: 10px; background: #fffdfb; cursor: pointer; }
html[data-theme="dark"] .cs-shape { background: #3a3034; border-color: #8f7682; }
.cs input, .cs button { font: inherit; }
.cs-shape input { position: absolute; z-index: 2; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.cs-shape-art { flex: none; width: 46px; height: 40px; display: grid; place-items: center; }
.cs-shape-art svg { max-width: 46px; max-height: 40px; overflow: visible; }
.cs-shape-t { display: grid; line-height: 1.15; }
.cs-shape-t b { font-size: 16px; }
.cs-shape-t small { font-size: 14px; opacity: .85; }
.cs-shape:has(input:checked) { border-color: var(--cs-accent); background: var(--cs-accent); color: #fff; box-shadow: inset 0 0 0 2px #fff; }
html[data-theme="dark"] .cs-shape:has(input:checked) { color: #2a1520; box-shadow: inset 0 0 0 2px #2a1520; }
.cs-shape:has(input:focus-visible) { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.cs-shape:has(input:disabled) { cursor: default; }
.cs-shape:hover:not(:has(input:disabled)) { border-color: var(--cs-accent); }

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

/* number fields */
.cs-num { display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: center; gap: 2px 8px; }
.cs-num-l { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; font-weight: 700; font-size: 16px; line-height: 1.2; }
.cs-num-l > span:first-child { white-space: nowrap; }
.cs-num-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.cs-num input { flex: 1 1 auto; min-width: 0; width: 100%; font: inherit; font-size: 17px; min-height: 42px; padding: 5px 8px; border: 2px solid #9c8a80;
  border-radius: 8px; background: #fff; color: #1f2a30; }
html[data-theme="dark"] .cs-num input { background: #1d1a1c; color: #f2ecee; border-color: #8f7682; }
.cs-num input:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.cs-num input[readonly] { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(122,46,77,.08) 6px 12px), #f3eeea; }
html[data-theme="dark"] .cs-num input[readonly] { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(231,163,191,.1) 6px 12px), #2a2427; }
.cs-num input:disabled { opacity: 1; }
.cs-unit { flex: none; font-weight: 700; min-width: 30px; }
.cs-mark { font-weight: 800; white-space: nowrap; }
.cs-mark.is-ok { color: var(--cs-ok); } .cs-mark.is-bad { color: var(--cs-bad); }
.cs-seal { margin: 0; font-size: 16px; font-weight: 700; color: var(--cs-accent); }

/* run button */
.cs-run { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 12px; font: inherit; font-size: 18px; font-weight: 800;
  color: #fff; background: linear-gradient(#2f8a76, #23695a); border: 2px solid #1b5246; border-radius: 10px; cursor: pointer; box-shadow: 0 3px 0 #164338; }
.cs-run:hover:not(:disabled) { filter: brightness(1.06); }
.cs-run:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #164338; }
.cs-run:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 3px; }
.cs-run:disabled { cursor: default; background: #c9cfcd; border-color: #a9b1ae; color: #3c4643; box-shadow: none; }
html[data-theme="dark"] .cs-run:disabled { background: #3a4240; border-color: #56605d; color: #d6dcda; }
.cs-run.is-done:disabled { background: #e3efe9; color: #1b5246; border-color: #7fb8a6; }
html[data-theme="dark"] .cs-run.is-done:disabled { background: #1f3a33; color: #b9ecd9; border-color: #3f7d6b; }
.cs-run-i { font-size: 16px; }
.cs-run.is-done .cs-run-t { font-size: 16px; }

/* spec strip */
.cs-spec { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-chip { display: flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--tlg-surface, #fff);
  border: 2px solid var(--tlg-border, #ccd); font-size: 16px; line-height: 1.25; }
.cs-chip-k { opacity: .85; }
.cs-chip--need { border-color: var(--cs-supply); }
.cs-chip--budget { border-color: var(--cs-mem); }

/* scene */
.cs-scene { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; }
.cs-svg { display: block; width: 100%; height: 100%; max-height: 100%; }
.cs-wall { fill: url(#cs-g-wall); }
.cs-bench { fill: url(#cs-g-bench); } .cs-bench-edge { fill: var(--cs-bench-edge); }
.cs-chamber { fill: url(#cs-g-medium); }
.cs-glass { fill: none; stroke: var(--cs-glass); stroke-width: 5; }
.cs-glare { stroke: #fff; stroke-opacity: .55; stroke-width: 6; stroke-linecap: round; }
.cs-glare--2 { stroke-opacity: .35; }
.cs-drift circle { fill: var(--cs-dot); opacity: .45; }
.cs-drift { animation: cs-drift 9s ease-in-out infinite alternate; }
@keyframes cs-drift { from { transform: translate(-6px, 3px); } to { transform: translate(6px, -3px); } }
.cs-t { font-family: var(--tlg-font, sans-serif); font-size: 18px; fill: var(--cs-text); }
.cs-t-b { font-weight: 700; }
.cs-model { font-weight: 700; font-size: 17px; }
.cs-scalebar path { fill: none; stroke: var(--cs-text); stroke-width: 3; }
.cs-plate rect { fill: var(--cs-plate); stroke: rgba(0,0,0,.25); stroke-width: 2; }
.cs-t-plate { fill: var(--cs-plate-text); font-weight: 700; }
.cs-lump { fill: var(--cs-c1); fill-opacity: .45; stroke: var(--cs-rim); stroke-width: 3; stroke-dasharray: 9 7; }

/* cells */
.cs-face { stroke: var(--cs-rim); stroke-width: 2.4; stroke-linejoin: round; }
.cs-face--front { fill: url(#cs-g-front); } .cs-face--top { fill: url(#cs-g-top); } .cs-face--side { fill: url(#cs-g-side); }
.cs-ball { fill: url(#cs-g-ball); }
.cs-shine { fill: #fff; opacity: .4; }
.cs-nuc { fill: url(#cs-g-nuc); opacity: .7; }
.cs-nucleolus { fill: var(--cs-nuc2); opacity: .8; }
.cs-mv line { stroke: var(--cs-mv); stroke-width: 2.2; stroke-linecap: round; }
.cs-fold { fill: none; stroke: var(--cs-fold); stroke-width: 2.6; stroke-linecap: round; opacity: .85; }
.cs-hunger { fill: var(--cs-hunger); opacity: 0; transition: opacity 1.4s ease .5s; pointer-events: none; }
.cs-rim { fill: none; stroke: transparent; stroke-width: 6; }
.cs-cell-in.is-pop { animation: cs-pop .35s ease-out; }
@keyframes cs-pop { from { transform: scale(.88); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.cs-cell-in.is-thrive { animation: cs-thrive 1.1s ease-in-out 2; }
.cs-cell-in.is-thrive .cs-rim { stroke: var(--cs-ok); stroke-opacity: .6; }
@keyframes cs-thrive { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.06); } }
.cs-cell-in.is-starve { animation: cs-starve 1.4s ease-in-out forwards; }
@keyframes cs-starve { to { transform: scale(.94); filter: saturate(.35); } }
.cs-cell-in.is-wobble { animation: cs-wobble .6s ease-in-out 2; }
@keyframes cs-wobble { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.cs-nutrient { fill: var(--cs-supply); stroke: #fff; stroke-width: 1.2; }

/* gauges */
.cs-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cs-gauge { padding: 6px 10px 6px; border-radius: 10px; background: var(--tlg-surface, #fff); border: 2px solid var(--tlg-border, #ccd); min-width: 0; }
.cs-g-h { display: flex; justify-content: space-between; gap: 6px; font-size: 16px; }
.cs-g-s { font-weight: 800; white-space: nowrap; }
.cs-gauge.is-ok .cs-g-s { color: var(--cs-ok); } .cs-gauge.is-bad .cs-g-s { color: var(--cs-bad); }
.cs-g-track { position: relative; height: 16px; margin: 4px 0 2px; border-radius: 8px; background: var(--tlg-bg-band, #e8ecee); border: 1px solid var(--tlg-border-strong, #889); overflow: visible; }
.cs-g-fill { display: block; height: 100%; width: 0; border-radius: 8px; transition: width 1.1s ease .2s; }
.cs-g-fill--supply { background: repeating-linear-gradient(45deg, var(--cs-supply) 0 6px, color-mix(in srgb, var(--cs-supply) 75%, #fff) 6px 10px); }
.cs-g-fill--mem { background: repeating-linear-gradient(-45deg, var(--cs-mem) 0 6px, color-mix(in srgb, var(--cs-mem) 75%, #fff) 6px 10px); }
.cs-g-tick { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 3px solid var(--tlg-text, #222); }
.cs-g-tick-l { position: absolute; top: -3px; left: 4px; font-size: 14px; font-weight: 700; line-height: 1; display: none; }
.cs-g-v { display: block; font-size: 16px; line-height: 1.25; }
.cs-gauge.is-flash { animation: cs-flash .5s ease-in-out 3; }
@keyframes cs-flash { 50% { border-color: var(--cs-bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cs-bad) 35%, transparent); } }
.cs-readout { margin: 0; font-size: 16px; line-height: 1.3; min-height: 21px; }
.cs-about { font-size: 16px; }
.cs-about summary { cursor: pointer; font-weight: 700; min-height: 28px; display: inline-block; }
.cs-about p { margin: 6px 0 0; max-height: 160px; overflow: auto; }

/* locked (after Check, or replay) */
.cs.is-locked .cs-shape:not(:has(input:checked)) { opacity: .6; }

/* briefing example */
.cs-ex-svg { display: block; width: 100%; height: auto; }
.cs-ex-arrow { fill: none; stroke: var(--tlg-text, #222); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ps-brief .cs-t { fill: var(--tlg-text, #222); font-size: 20px; }

/* start art */
.cs-turn { fill: #5e4635; } .cs-turn-top { fill: #8a6a4f; stroke: #5e4635; stroke-width: 3; } .cs-turn-post { fill: #4a3628; }
.cs-tool { stroke: #8a6a4f; stroke-width: 8; stroke-linecap: round; } .cs-tool-tip { stroke: #c7ced3; stroke-width: 6; stroke-linecap: round; }

/* narrow: stack, the page scrolls */
@media (max-width: 900px) {
  .cs { position: static; grid-template-columns: 1fr; }
  .cs-right { order: -1; }
  .cs-controls { overflow: visible; }
  .cs-scene { flex: none; }
  .cs-gauges { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .cs *, .cs *::before { animation: none !important; transition: none !important; }
}
