/* circuit.css — the circuit editor's sheet (gymEditor.js; owner's pick "A" of three live
 * mockups, 2026-10-24).
 *
 * It sits in the plates / My Gym frame (gymplates.css: .gp-veil, .gp-sheet, .gp-wbar,
 * .gp-card, .gp-pq, .gp-chip, .gp-box) and borrows the cardio panel's step arrows and
 * small buttons (cardio.css: .cp-dstep, .cp-sbtn). Everything new is `ce-`. Colours are
 * the skin's palette tokens with their values as fallbacks, like the sheets it sits beside.
 */

[class*="ce-"], [class*="ce-"]::before, [class*="ce-"]::after { box-sizing: border-box; }

.ce-sheet .gp-card { padding: 12px 10px 16px; }
.ce-sheet .gp-chip.on { color: var(--tol-cream, #f8f3e4); background: var(--tol-umber, #3a2c23); border-color: var(--tol-umber, #3a2c23); }
.ce-saved { opacity: 0; transition: opacity .25s; }
.ce-saved.on { opacity: 1; }
.ce-back { font-size: 20px; }

/* ---------- the list page ---------- */
.ce-step.cp-dstep { width: 100%; height: 48px; background: var(--tol-warm-tan, #e3d5b8); }
.ce-step .cp-dmid { flex: 1; min-width: 0; }
.ce-step .cp-dmid b { font-size: 14px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-menu { margin-top: 6px; background: #fffaf0; border: 2px solid var(--tol-umber, #3a2c23); box-shadow: 2px 2px 0 rgba(58, 44, 35, .25); }
.ce-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; font: inherit; font-size: 12.5px; font-weight: 800;
  color: var(--tol-umber, #3a2c23); text-align: left; background: none; border: 0; border-bottom: 1px solid rgba(58, 44, 35, .15); cursor: pointer; }
.ce-menu button:last-child { border-bottom: 0; }
.ce-menu button.on { background: #f0e2c6; }
.ce-menu i { flex: 0 0 34px; font-style: normal; font-weight: 900; color: var(--tol-wood-dark, #8a5a35); }
.ce-menu small { margin-left: auto; font-size: 11px; color: #a99a88; }

.ce-rows { display: flex; flex-direction: column; gap: 7px; }
.ce-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 2px; cursor: pointer; background: #fffaf0;
  border: 2px solid var(--tol-umber, #3a2c23); border-radius: 4px; box-shadow: 2px 2px 0 rgba(58, 44, 35, .22);
  -webkit-user-select: none; user-select: none; }
.ce-row:active { background: #fbf3e2; }
.ce-row.lift { position: relative; z-index: 3; background: #fff; transform: scale(1.02);
  box-shadow: 0 0 0 2px var(--tol-terracotta, #c96f4a), 4px 6px 0 rgba(58, 44, 35, .3); }
.ce-row.ce-lib { padding-left: 8px; }
.ce-flash { animation: ceFlash 1.4s ease-out; }
@keyframes ceFlash { 0%, 30% { background: #d8ecc9; } }
.ce-grip { flex: 0 0 26px; align-self: stretch; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #a99a88;
  cursor: grab; touch-action: none; }
.ce-n { flex: 0 0 14px; font-size: 11px; font-weight: 900; color: #a99a88; text-align: right; }
.ce-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ce-tx b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-tx span { font-size: 10.5px; font-weight: 700; color: #7a6a5c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-chev { flex: 0 0 auto; font-size: 18px; font-weight: 900; color: #a99a88; }
.ce-addbtn { width: 100%; height: 40px; margin-top: 10px; }

/* the equipment picture: My Gym's glyphs, shrunk into a tile */
.ce-pic { flex: 0 0 38px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: #efe4d2; border: 2px solid rgba(58, 44, 35, .35); border-radius: 4px; }
.ce-pic > * { flex: 0 0 auto; }
.ce-pic > .gp-glyph { transform: scale(.5); }
.ce-pic > .gp-db { transform: scale(.72); }
.ce-pic.none::before { content: '—'; font-size: 14px; color: #a99a88; }

/* ---------- the movement page ---------- */
.ce-name { width: 100%; padding: 8px; font-size: 16px; }
.ce-hist { margin-top: 5px; font-size: 10.5px; font-weight: 700; color: #7a6a5c; }

/* the trash can in the plaque: hold a full second — it fills red — then "Are you sure?" */
.ce-trash { position: relative; overflow: hidden; width: 32px; height: 32px; padding: 0; color: var(--tol-umber, #3a2c23); cursor: pointer;
  background: #d9a76b; border: 3px solid var(--tol-umber, #3a2c23); border-radius: 4px; box-shadow: inset 0 -3px 0 #b07a4a;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ce-trash::after { content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 0; background: rgba(192, 68, 46, .7); }
.ce-trash.holding::after { height: 100%; transition: height 1s linear; }
.ce-trash svg { position: relative; z-index: 1; display: block; margin: auto; pointer-events: none; }

/* sets, then MIN – MAX */
.ce-reprow { display: flex; align-items: flex-end; gap: 6px; margin-bottom: 8px; }
.ce-stepw { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ce-stepw small { font-size: 9px; font-weight: 900; letter-spacing: 1.2px; color: #a99a88; }
.ce-dash { padding-bottom: 10px; font-weight: 900; color: #a99a88; }
.ce-num { display: flex; align-items: stretch; height: 40px; overflow: hidden; background: #fff;
  border: 2px solid var(--tol-umber, #3a2c23); border-radius: 4px; }
.ce-num button { width: 36px; padding: 0; font: inherit; font-size: 18px; font-weight: 900; color: var(--tol-umber, #3a2c23);
  background: #e8c48f; border: 0; cursor: pointer; }
.ce-num button:active { background: #d9a76b; }
.ce-num button:disabled { color: rgba(58, 44, 35, .3); cursor: default; }
.ce-num b { min-width: 40px; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.ce-note { margin: -2px 0 6px; font-size: 10.5px; font-weight: 700; color: #a8402b; }
.ce-reads { font-size: 10.5px; font-weight: 800; color: #7a6a5c; }

/* the wooden ON/OFF switch (P2) */
.ce-swrow { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.ce-swrow.ce-gap { margin-top: 14px; }
.ce-swlbl { font-size: 11.5px; font-weight: 800; line-height: 1.3; }
.ce-switch { position: relative; flex: 0 0 58px; width: 58px; height: 28px; padding: 0; cursor: pointer; background: var(--tol-warm-tan, #e3d5b8);
  border: 2px solid var(--tol-umber, #3a2c23); border-radius: 4px; box-shadow: inset 0 -3px 0 rgba(138, 90, 53, .35); }
.ce-switch i { position: absolute; top: 2px; left: 2px; width: 24px; height: 20px; background: #fffaf0;
  border: 2px solid var(--tol-umber, #3a2c23); border-radius: 3px; transition: left .15s; }
.ce-switch b { position: absolute; top: 5px; font-size: 9px; font-weight: 900; letter-spacing: .5px; }
.ce-swoff { right: 6px; color: #7a6a5c; }
.ce-swon { left: 6px; color: #fff; opacity: 0; }
.ce-switch.on { background: #4f8f53; box-shadow: inset 0 -3px 0 #3a6b3e; }
.ce-switch.on i { left: 28px; }
.ce-switch.on .ce-swon { opacity: 1; }
.ce-switch.on .ce-swoff { opacity: 0; }

.ce-mtiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ce-mtile { height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 2px;
  font: inherit; color: var(--tol-umber, #3a2c23); cursor: pointer; background: var(--tol-warm-tan, #e3d5b8);
  border: 2px solid var(--tol-umber, #3a2c23); box-shadow: inset 0 -3px 0 rgba(138, 90, 53, .35); }
.ce-mtile big { display: flex; align-items: center; justify-content: center; gap: 2px; height: 18px; font-size: 16px; font-weight: 900; line-height: 1; }
.ce-mtile small { font-size: 8.5px; font-weight: 900; letter-spacing: .5px; }
.ce-mtile.on { color: var(--tol-terracotta, #c96f4a); background: var(--tol-cream, #f8f3e4); border-color: var(--tol-terracotta, #c96f4a);
  box-shadow: 0 0 0 2px var(--tol-umber, #3a2c23); }
.ce-dbi { display: inline-flex; align-items: center; margin: -8px -9px; transform: scale(.55); }

.ce-eq { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; font: inherit; color: var(--tol-umber, #3a2c23);
  text-align: left; cursor: pointer; background: #fffaf0; border: 2px solid var(--tol-umber, #3a2c23); border-radius: 4px; }
.ce-eq b { flex: 1; font-size: 13px; }
.ce-eq em { font-style: normal; font-size: 16px; color: #7a6a5c; }
.ce-eqlist { margin-top: 6px; overflow: hidden; background: #fffaf0; border: 2px solid var(--tol-umber, #3a2c23); border-radius: 4px; }
.ce-eqlist button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 5px 8px; font: inherit; font-size: 12.5px; font-weight: 800;
  color: var(--tol-umber, #3a2c23); text-align: left; cursor: pointer; background: none; border: 0; border-bottom: 1px solid rgba(58, 44, 35, .12); }
.ce-eqlist button:last-child { border-bottom: 0; }
.ce-eqlist button.on { background: #f0e2c6; }

/* folds: Muscles, Tips, Video — each opens on press */
.ce-fold { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 8px; padding: 9px 8px; font: inherit; font-size: 11px;
  font-weight: 900; letter-spacing: 1.2px; color: #7a6a5c; text-align: left; cursor: pointer;
  background: rgba(227, 213, 184, .45); border: 2px solid rgba(138, 90, 53, .28); }
.ce-swrow + .ce-fold { margin-top: 14px; }
.ce-fold span { flex: 1; min-width: 0; font-size: 12px; letter-spacing: 0; color: var(--tol-umber, #3a2c23);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-foldbody { padding: 8px; background: rgba(255, 250, 240, .6); border: 2px solid rgba(138, 90, 53, .28); border-top: 0; }
.ce-ta { display: block; width: 100%; min-height: 70px; padding: 7px; font: inherit; font-size: 12px; font-weight: 700;
  color: var(--tol-umber, #3a2c23); resize: vertical; background: #fff; border: 2px solid rgba(138, 90, 53, .28); border-top: 0; border-radius: 0; }
.ce-ta:focus { outline: none; border-color: var(--tol-terracotta, #c96f4a); }
.ce-vrow { display: flex; align-items: center; gap: 8px; padding: 8px; background: #fffaf0; border: 2px solid rgba(138, 90, 53, .28); border-top: 0; }
.ce-vrow .gp-box { flex: 1; min-width: 0; }
.ce-vlink { flex: 1; min-width: 0; font-size: 11.5px; font-weight: 800; color: var(--tol-wood-dark, #8a5a35);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
span.ce-vlink { color: #a99a88; }
.ce-vic { flex: 0 0 34px; height: 32px; padding: 0; font: inherit; font-size: 15px; font-weight: 900; color: var(--tol-umber, #3a2c23); cursor: pointer;
  background: #e8c48f; border: 2px solid var(--tol-umber, #3a2c23); border-radius: 4px; box-shadow: inset 0 -3px 0 #b07a4a; }
.ce-vic.ok { color: #fff; background: #4f8f53; box-shadow: inset 0 -3px 0 #3a6b3e; }

/* muscles (M2): the body on top, the 16 groups under it */
.ce-mlist { margin-top: 10px; background: #fffaf0; border: 2px solid var(--tol-umber, #3a2c23); }
.ce-mg { border-bottom: 1px solid rgba(58, 44, 35, .15); }
.ce-mg:last-child { border-bottom: 0; }
.ce-mgh { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 8px; font-size: 12.5px; font-weight: 800; }
.ce-mgh span { flex: 1; }
.ce-mgh small { font-size: 10px; color: #a99a88; }
.ce-mbox { flex: 0 0 22px; width: 22px; height: 22px; padding: 0; font: inherit; font-size: 12px; font-weight: 900; line-height: 1; color: #fff; cursor: pointer;
  background: #fff; border: 2px solid var(--tol-umber, #3a2c23); border-radius: 3px; }
.ce-mbox.on { background: #c75a32; }
.ce-mbox.part { background: linear-gradient(135deg, #c75a32 50%, #fff 50%); }
.ce-mexp { width: 32px; height: 28px; padding: 0; font: inherit; font-size: 14px; font-weight: 900; color: #7a6a5c; cursor: pointer; background: none; border: 0; }
.ce-msubs { padding: 0 8px 8px 38px; }
.ce-ms { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.ce-ms .ce-mbox { flex-basis: 20px; width: 20px; height: 20px; }
.ce-ms em { font-style: normal; font-size: 9.5px; color: #a99a88; }

/* the body diagram (bodyMap.js) — here and on the workout screen */
.bm-pair { display: flex; gap: 6px; justify-content: center; align-items: flex-end; }
.bm-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bm-fig figcaption { font-size: 8.5px; font-weight: 900; letter-spacing: 1.4px; color: #a99a88; }
.bm-canvas { display: block; image-rendering: pixelated; }
.bm-canvas.tap { cursor: pointer; }
.bm-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; font-size: 9.5px; font-weight: 800; color: #7a6a5c; }
.bm-legend i { display: inline-block; width: 11px; height: 11px; margin-right: 4px; vertical-align: -2px; border: 1.5px solid #3a2c23; }

/* "Are you sure?" / "Save changes?" — over the sheet */
.ce-ays { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(20, 28, 14, .5); }
.ce-aysbox { width: min(100%, 380px); padding: 14px; color: var(--tol-umber, #3a2c23); background: #f6eee4; border: 3px solid var(--tol-umber, #3a2c23);
  border-radius: 8px; box-shadow: 4px 4px 0 rgba(10, 6, 4, .5); font-size: 12px; font-weight: 700; line-height: 1.5; }
.ce-aysbox b { display: block; font-size: 14px; }
.ce-aysbox p { margin: 4px 0 0; }
.ce-acts { display: flex; gap: 8px; margin-top: 10px; }
.ce-acts .gp-pq { flex: 1; height: 36px; }

/* the Save bar — nothing saves without it */
.ce-savebar { position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 8px; margin: 16px -10px -16px; padding: 10px;
  font-size: 11.5px; font-weight: 800; color: #7a6a5c; background: #efe4d2; border-top: 3px solid var(--tol-umber, #3a2c23); border-radius: 0 0 11px 11px; }
.ce-savebar.dirty { color: var(--tol-umber, #3a2c23); background: #f3d9b4; }
.ce-savebar span { flex: 1; }
.ce-savebar .gp-pq { height: 36px; padding: 0 14px; }

/* ---------- the add page ---------- */
.ce-search { width: 100%; height: 40px; font-size: 14px; }
.ce-new { width: 100%; height: 40px; margin-top: 8px; }
.ce-new.dim { opacity: .55; }

/* ---------- the workout screen's "muscles worked" card (gymSession.js, pick S2) ---------- */
.gs-muscles { margin-top: 10px; padding: 10px; background: rgba(255, 253, 243, .95); border: 2px solid var(--ink, #37503b); border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 22, 12, .35); }
.gs-mushead { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--muted, #8b8a72); }
.gs-musnames { margin-top: 6px; font-size: 11px; font-weight: 700; text-align: center; color: var(--ink, #37503b); }
