/* Molar Mass Market: the work order, atom cart and price entry beside the market stall, inside the practice shell's stage. */
.mm { position: absolute; inset: 0; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; padding: 8px 12px; }
.mm-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding: 2px; }

/* the work order */
.mm-ticket { padding: 6px 12px 8px; border-radius: var(--tlg-radius-lg, 14px); border: 2px dashed #9fbca9; background: #f4faf5; color: #15302a; }
.mm-ticket-k { margin: 0; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps, .08em); color: #1f4d3a; }
.mm-ticket-f { margin: 0; font-size: 36px; font-weight: 800; line-height: 1.15; letter-spacing: .01em; }
.mm-ticket-f sub { font-size: 24px; line-height: 0; }
.mm-tags-k { margin: 2px 0 4px; font-size: 16px; font-weight: 700; }
.mm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mm-tags-note { margin: 6px 0 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.mm-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: #fffaf0; border: 1.5px solid #c9b991; font-size: 18px; font-weight: 800; color: #2b2418; }
html[data-theme="dark"] .mm-ticket { background: #16302a; color: #e3f4ee; border-color: #3f7a6a; }
html[data-theme="dark"] .mm-ticket-k { color: #8fd8b6; }
html[data-theme="dark"] .mm-tag { background: #2a2418; border-color: #7a6a44; color: #f6ecd2; }

/* element dots (symbol inside: color is never the only signal) */
.mm-dot { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 15px; font-weight: 900; line-height: 1;
  box-shadow: inset -3px -4px 0 rgba(0, 0, 0, .18), inset 3px 3px 0 rgba(255, 255, 255, .35); border: 1.5px solid rgba(0, 0, 0, .35); }
.mm-dot--H { background: #f4f6f8; color: #1d2b33; } .mm-dot--C { background: #5b616b; color: #fff; } .mm-dot--N { background: #4a7fe0; color: #fff; }
.mm-dot--O { background: #e8564a; color: #fff; } .mm-dot--Na { background: #9a6bd3; color: #fff; } .mm-dot--Mg { background: #4fae69; color: #fff; }
.mm-dot--Al { background: #c7d0d8; color: #1d2b33; } .mm-dot--S { background: #f5d84a; color: #2b2200; } .mm-dot--Cl { background: #86da6f; color: #11300a; }
.mm-dot--K { background: #cc8ae6; color: #2a0c3a; } .mm-dot--Ca { background: #f2a35c; color: #2b1600; } .mm-dot--P { background: #f49a78; color: #2b1105; }

/* the cart */
.mm-cart, .mm-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.mm-cart legend, .mm-field legend { padding: 0; margin: 0 0 4px; font-size: 16px; font-weight: 800; color: var(--tlg-text, #172c38); }
.mm-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 44px 40px 44px; align-items: center; gap: 6px; padding: 3px 6px; margin-bottom: 4px; border-radius: 12px; border: 2px solid transparent; background: var(--tlg-surface-2, rgba(0, 0, 0, .03)); }
.mm-row-name { font-size: 16px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-step { width: 44px; height: 44px; font: inherit; font-size: 26px; font-weight: 800; line-height: 1; cursor: pointer; border-radius: 10px; color: var(--tlg-text, #172c38);
  background: var(--tlg-surface, #fff); border: 2px solid var(--tlg-border, #a5b6c1); box-shadow: 0 2px 0 rgba(0, 0, 0, .08); touch-action: manipulation; }
.mm-step:hover:not(:disabled) { border-color: #1f4d3a; }
.mm-step:disabled { opacity: .45; cursor: default; }
.mm-count { text-align: center; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.mm-row.is-ok { border-color: #2e8b57; } .mm-row.is-ok .mm-row-name { color: #1d6b40; font-weight: 800; }
.mm-row.is-bad { border-color: #b42318; border-style: dashed; } .mm-row.is-bad .mm-row-name { color: #b42318; font-weight: 800; }
html[data-theme="dark"] .mm-row.is-ok .mm-row-name { color: #8fe0ad; }
html[data-theme="dark"] .mm-row.is-bad .mm-row-name { color: #ffb4a8; }
.mm-cart-note { margin: 0; font-size: 16px; color: var(--tlg-text-muted, #4b5d68); }

/* the price */
.mm-price { display: flex; align-items: center; gap: 8px; }
.mm-num { width: 170px; height: 54px; font: inherit; font-size: 28px; font-weight: 800; text-align: right; padding: 0 12px; border-radius: 10px;
  border: 2px solid var(--tlg-border, #a5b6c1); background: var(--tlg-surface, #fff); color: var(--tlg-text, #172c38); font-variant-numeric: tabular-nums; }
.mm-num::-webkit-outer-spin-button, .mm-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mm-num { -moz-appearance: textfield; appearance: textfield; }
.mm-num:focus { border-color: #1f4d3a; }
.mm-unit { font-size: 22px; font-weight: 800; }

.mm :focus-visible { outline: 3px solid #b16a08; outline-offset: 2px; }
.mm button:disabled, .mm input:disabled { cursor: default; }
.mm-msg { margin: 0; min-height: 1.2em; font-size: 16px; font-weight: 700; color: var(--tlg-danger, #b42318); }
html[data-theme="dark"] .mm-msg { color: #ffb4a8; }
.mm-about { font-size: 16px; line-height: 1.4; }
.mm-about summary { cursor: pointer; font-weight: 700; }
.mm-about p { margin: 4px 0 0; }

/* the stall */
.mm-view { position: relative; min-width: 0; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.mm-scene { position: relative; width: 100%; aspect-ratio: 720 / 620; border-radius: var(--tlg-radius-lg, 14px); overflow: hidden; border: var(--tlg-border-width, 1px) solid var(--tlg-border, #a5b6c1); user-select: none; -webkit-user-select: none; }
.mm-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mm-wall { fill: url(#mm-g-wall); }
.mm-tile { fill: url(#mm-p-tile); }
html[data-theme="dark"] .mm-wall { fill: url(#mm-g-wall-d); }
html[data-theme="dark"] .mm-tile { fill: url(#mm-p-tile-d); }
.mm-jar { cursor: pointer; }
.mm-jar:hover .mm-jar-hit { fill: rgba(255, 226, 122, .18); }
.mm.is-locked .mm-jar { cursor: default; }
.mm.is-locked .mm-jar:hover .mm-jar-hit { fill: transparent; }
[data-pan] { cursor: pointer; }

.mm-t { font-family: var(--tlg-font-body, system-ui, sans-serif); fill: #1d2b2f; }
.mm-sign { font-size: 28px; font-weight: 800; fill: #f6e7b8; letter-spacing: .02em; }
.mm-chalk-k { font-size: 18px; font-weight: 700; fill: #e9efe6; letter-spacing: .04em; }
.mm-chalk-f { font-weight: 800; fill: #ffffff; }
.mm-chalk-n { font-size: 18px; font-weight: 600; fill: #cfe0d4; font-style: italic; }
.mm-chalk-c { font-size: 20px; font-weight: 800; fill: #ffe68a; }
.mm-chalk-x { font-size: 18px; font-weight: 800; fill: #ffe68a; }
.mm-chalk-mark { fill: none; stroke: #ffe68a; stroke-width: 3.5; stroke-linecap: round; }
.mm-t-jar { font-size: 24px; font-weight: 900; fill: #1d2b2f; }
.mm-t-price { font-size: 18px; font-weight: 800; fill: #7a2d12; }
.mm-t-unit { font-size: 17px; font-weight: 700; fill: #5a3a1a; }
.mm-t-strip { font-size: 17px; font-weight: 700; fill: #2b2418; }
.mm-t-sym { font-weight: 900; pointer-events: none; }
.mm-t-mat { font-size: 17px; font-weight: 700; fill: #fff3dc; paint-order: stroke; stroke: #5a3a1a; stroke-width: 3px; }
.mm-t-plate { font-size: 17px; font-weight: 800; fill: #2c3640; }
.mm-t-hint { font-size: 18px; font-weight: 700; fill: #5a4a30; font-style: italic; }
html[data-theme="dark"] .mm-t-hint { fill: #e9dcc0; }
.mm-lcd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; font-weight: 700; fill: #4c6b58; }
.mm-lcd.is-on { fill: #7dff9e; }
.mm-reg { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; font-weight: 800; fill: #173f1a; }
.mm-t-regk { font-size: 17px; font-weight: 800; fill: #ffffff; }
.mm-rc { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; font-weight: 700; fill: #2b2418; white-space: pre; }
.mm-rc.is-total { font-weight: 900; fill: #1f4d3a; }
.mm-rc.is-ok { font-weight: 900; fill: #1d6b40; }
.mm-rc.is-bad { font-weight: 900; fill: #b42318; }
.mm-rc-big { font-size: 22px; }
.mm-ring-add { fill: none; stroke: #ffd23f; stroke-width: 3; stroke-dasharray: 4 3; }
.mm-x { stroke: #b42318; stroke-width: 3.5; stroke-linecap: round; }

/* reveal badge (over the awning) */
.mm-badge { position: absolute; left: 2%; right: 2%; top: 1.5%; padding: 7px 12px; border-radius: 10px; font-size: 17px; font-weight: 700; line-height: 1.3; pointer-events: none;
  background: rgba(255, 255, 255, .97); color: #10202c; border: 3px solid #1f4d3a; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); animation: mm-pop .25s ease-out; }
.mm-badge.is-bad { border-color: #b42318; }
.mm-badge.is-count { border-color: #2f6fb5; }
@keyframes mm-pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* briefing + start */
.mm-example-svg { display: block; width: 100%; height: auto; max-height: 460px; }
.mm-start-svg { display: block; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) { .mm-badge { animation: none; } }
@media (max-width: 1100px) { .mm { grid-template-columns: 310px minmax(0, 1fr); } }
@media (max-width: 900px) {
  .mm { position: static; grid-template-columns: 1fr; }
  .mm-panel { overflow: visible; }
  .mm-view { display: block; order: -1; }
  .mm-scene { width: 100% !important; }
}
