/* Polymer Workshop: monomer shelf | workbench | reaction panel, inside the practice shell's stage. */
.pw { position: absolute; inset: 0; display: grid; grid-template-columns: 268px minmax(0, 1fr) 232px; gap: 10px; padding: 10px 12px; }
.pw-k { margin: 0; font-size: 16px; font-weight: var(--tlg-weight-bold); text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps); color: var(--ps-accent); }
html[data-theme="dark"] .pw-k { color: var(--tlg-text-muted); }

/* shelf */
.pw-shelf { position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; padding: 8px 10px; border-radius: var(--tlg-radius-lg);
  border: var(--tlg-border-width) solid var(--tlg-border); background: var(--tlg-surface); }
.pw-group-t { margin: 0 0 2px; font-size: 16px; font-weight: 700; color: var(--tlg-text-muted); }
.pw-bins { display: grid; grid-template-columns: repeat(4, 58px); gap: 4px; }
.pw-bin { position: relative; width: 58px; height: 70px; border-radius: 10px; background: var(--tlg-surface-2); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08); }
.pw-stack { position: absolute; inset: 0; }
.pw-shelf.is-closed .pw-bins { opacity: .45; }
.pw-closed { margin: 4px 0 0; font-size: 16px; font-weight: 700; color: var(--tlg-text-muted); }

/* tokens (shelf + bench); not scoped under .pw so the drag ghost on <body> keeps the look */
.pw-tok { all: unset; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0;
  width: 58px; height: 70px; padding: 4px 2px 2px; border-radius: 10px; background: #fffdf8; border: 2px solid #c9b79c; color: #2a2620;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18); cursor: grab; text-align: center; }
.pw-stack > .pw-tok { position: absolute; left: 0; top: 0; }
.pw-stack > .pw-tok.is-below { transform: translate(3px, 3px); box-shadow: none; }
.pw-stack > .pw-tok.is-under { visibility: hidden; }
.pw-stack > .pw-tok.is-top { z-index: 2; }
.pw-tok:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 2px; }
.pw-tok.is-disabled, .pw-tok.is-static, .pw-tok.is-fixed { cursor: default; }
.pw-tok.is-static { position: absolute; left: 0; top: 0; }
.pw-glyph { width: 52px; height: 39px; flex: none; overflow: visible; pointer-events: none; }
.pw-tok-l { display: block; max-width: 100%; margin-top: 2px; font: 700 16px/1.15 var(--tlg-font, Arial, sans-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.pw-tok-l--long { letter-spacing: -.03em; }
/* sugars and lipid parts: 3 to a shelf row on wider tokens so the full name fits at 16 px */
.pw-tok--wide { width: 78px; padding-left: 0; padding-right: 0; }
.pw-bins--3, .pw-bins--2 { grid-template-columns: repeat(3, 78px); }
.pw-bins--3 .pw-bin, .pw-bins--2 .pw-bin { width: 78px; }
.pw--break .pw-slot:not(.has-tok), .pw--chips .pw-slot:not(.has-tok) { display: none; }
.pw-tok.is-picked { outline: 4px dashed var(--ps-accent); outline-offset: 3px; }

/* bench */
.pw-mid { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.pw-head { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.pw-counter { margin: 0; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--tlg-radius-full); background: #e3f1fb; color: #123a5a; font-size: 16px; font-weight: 700; }
.pw-counter svg { width: 22px; height: 22px; }
.pw-counter.is-tick { animation: pw-tick .35s ease; }
@keyframes pw-tick { 40% { transform: scale(1.12); } }
.pw-clear { margin-left: auto; min-height: 36px; padding: 2px 12px; font-size: 16px; }
.pw-bench { position: relative; flex: none; padding: 100px 10px 14px; border-radius: var(--tlg-radius-lg); border: var(--tlg-border-width) solid #d6c3a3;
  background: linear-gradient(#fbf6ec 0 72%, #ead8b8 72% 100%); }
.pw-slots { display: flex; justify-content: center; gap: 6px; transition: gap .4s ease; }
.pw-slots.is-split { gap: 22px; }
.pw-slot { position: relative; width: 78px; height: 92px; flex: none; border-radius: 12px; border: 2px dashed #c3ad8a; background: rgba(255, 255, 255, .55); display: grid; place-items: center; }
.pw-slot.has-tok { border-color: transparent; background: transparent; }
.pw-slot-n { position: absolute; left: 5px; top: 1px; font-size: 16px; font-weight: 800; color: #9a8564; }
.pw-slot.has-tok .pw-slot-n { display: none; }
.pw-slot .pw-tok { position: static; width: 76px; height: 88px; padding: 5px 0 0; transform: none; visibility: visible; }
.pw-slot .pw-glyph { width: 66px; height: 49.5px; }
.pw-fx { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pw-bond { fill: none; stroke: #8a3b12; stroke-width: 5; stroke-linecap: round; }
.pw-bond--tri { stroke-width: 3; stroke-linejoin: round; }
.pw-fx-t { font: 800 17px/1 Arial, sans-serif; paint-order: stroke; stroke: #fffaf0; stroke-width: 3.5px; }
.pw-fx-oh { fill: #b3261e; }
.pw-fx-h { fill: #334155; }
.pw-product { margin: 0; min-height: 1.3em; font-size: 16px; line-height: 1.3; }
.pw-answer { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-radius: var(--tlg-radius-sm); background: var(--tlg-surface-2); }
.pw-answer-k { font-size: 16px; font-weight: 700; margin-right: 4px; }
.pw-mini { display: inline-flex; flex-direction: column; align-items: center; padding: 2px 3px; border-radius: 8px; background: #fffdf8; border: 1.5px solid #c9b79c; color: #2a2620; }
.pw-mini-g { width: 34px; height: 25.5px; }
.pw-mini small { font-size: 16px; font-weight: 700; line-height: 1.15; }
.pw-mini-bond { width: 10px; height: 4px; border-radius: 2px; background: #8a3b12; }

/* polysaccharide figure */
.pw-bench--poly { padding: 10px; }
.pw-poly { display: grid; place-items: center; height: 220px; }
.pw-poly-svg { width: 100%; height: 100%; }
.pw-poly-cap { margin: 4px 0 0; text-align: center; font-size: 16px; font-weight: 700; color: #5b4a33; }

/* chips */
.pw-choice-k { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.pw-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.pw-choice--el .pw-opts { grid-template-columns: repeat(6, minmax(48px, 1fr)); }
.pw-opt { min-height: 44px; padding: 4px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.15; border-radius: var(--tlg-radius-sm); white-space: normal; }
.pw-choice--el .pw-opt b { font-size: 19px; }
.pw-opt span { font-size: 16px; font-weight: 600; opacity: .85; }
.pw-opt.is-ok { box-shadow: 0 0 0 3px var(--tlg-success, #1b7f3b); }
.pw-opt.is-bad { box-shadow: 0 0 0 3px var(--tlg-danger, #b42318); }
.pw-mark { font-weight: 900; }
.pw-msg { margin: 0; min-height: 1.2em; font-size: 16px; font-weight: 700; color: var(--tlg-danger, #b42318); }
html[data-theme="dark"] .pw-msg { color: #ffb4a8; }

/* panel */
.pw-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding: 2px; }
.pw-rxs { display: grid; gap: 6px; }
.pw-rx { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 12px; border-radius: var(--tlg-radius-md, 10px);
  border: var(--tlg-border-width-strong, 2px) solid var(--tlg-border-strong); background: var(--tlg-surface); color: var(--tlg-text); cursor: pointer; }
.pw-rx svg { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-rx span { display: flex; flex-direction: column; line-height: 1.15; }
.pw-rx b { font-size: 19px; }
.pw-rx small { font-size: 16px; color: var(--tlg-text-muted); }
.pw-rx:hover:not(:disabled) { background: var(--tlg-surface-2); }
.pw-rx:focus-visible { outline: var(--tlg-focus-width) solid var(--tlg-focus); outline-offset: 2px; }
.pw-rx[aria-checked="true"] { background: var(--ps-accent); border-color: var(--ps-accent); color: var(--ps-accent-ink, #fff); }
.pw-rx[aria-checked="true"] small { color: inherit; opacity: .9; }
.pw-rx:disabled { cursor: default; }
.pw-rx.is-ok { box-shadow: 0 0 0 3px var(--tlg-success, #1b7f3b); }
.pw-rx.is-bad { box-shadow: 0 0 0 3px var(--tlg-danger, #b42318); }
.pw-water .pn-key { min-height: 42px; }
.pw-water .pn-input { font-size: 26px; padding: 3px 0; }
.pw-note { margin: 0; font-size: 16px; line-height: 1.35; color: var(--tlg-text-muted); }

/* Briefing worked example */
.pw-example svg { width: 100%; height: auto; max-height: 300px; display: block; border-radius: var(--tlg-radius-lg); background: linear-gradient(#fbf6ec 0 78%, #ead8b8 78% 100%); }
.pw-ex-t { font: 800 16px Arial, sans-serif; fill: #123a5a; }
.pw-ex-btn { fill: #8a3b12; }
.pw-ex-bt { font: 800 15px Arial, sans-serif; fill: #fff; }

/* the bench stays a light picture in dark mode */
html[data-theme="dark"] .pw-bench { border-color: var(--tlg-border); }
html[data-theme="dark"] .pw-bin { background: var(--tlg-surface-3); }
html[data-theme="dark"] .pw-counter { background: #1f3b52; color: #e3f1fb; }

@media (max-width: 1100px) { .pw { grid-template-columns: 250px minmax(0, 1fr) 212px; } .pw-slot { width: 66px; } .pw-slot .pw-tok { width: 64px; } .pw-slot .pw-glyph { width: 58px; height: 43.5px; } .pw-bins { grid-template-columns: repeat(4, 54px); } .pw-bin, .pw-stack > .pw-tok, .pw-tok.is-static { width: 54px; }
  .pw-bins--3, .pw-bins--2 { grid-template-columns: repeat(3, 72px); } .pw-bins--3 .pw-bin, .pw-bins--2 .pw-bin, .pw-stack > .pw-tok--wide, .pw-tok--wide.is-static { width: 72px; }
  .pw-tok-l--long, .pw-slot .pw-tok-l { font-size: 14px; } }   /* narrow desktop only: never below 14 px, full name in the tooltip */
@media (max-width: 900px) {
  .pw { position: static; grid-template-columns: 1fr; }
  .pw-shelf { overflow: visible; }
  .pw-bins { grid-template-columns: repeat(4, 58px); }
  .pw-bin, .pw-stack > .pw-tok, .pw-tok.is-static { width: 58px; }
  .pw-bins--3, .pw-bins--2 { grid-template-columns: repeat(3, 78px); } .pw-bins--3 .pw-bin, .pw-bins--2 .pw-bin, .pw-stack > .pw-tok--wide, .pw-tok--wide.is-static { width: 78px; }
  .pw-slot { width: 78px; } .pw-slot .pw-tok { width: 76px; } .pw-slot .pw-glyph { width: 66px; height: 49.5px; }
  .pw-tok-l--long, .pw-slot .pw-tok-l { font-size: 16px; }
  .pw-group { display: inline-block; }
}
