/* Nucleotide Builder: the work order + parts bins and the Nucleotide Workshop bench inside the practice shell's stage. */
.nb { position: absolute; inset: 0; display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 12px; padding: 8px 12px; }
.nb-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding: 2px; }

/* the work order */
.nb-ticket { padding: 6px 12px 8px; border-radius: var(--tlg-radius-lg, 14px); border: 2px dashed #8fbcae; background: #f3fbf7; color: #15302a; }
.nb-ticket-k { margin: 0; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps, .08em); color: #1f6b5c; }
.nb-ticket-h { margin: 0 0 2px; font-size: 19px; line-height: 1.25; }
.nb-given { margin: 2px 0 0; font-size: 16px; line-height: 1.35; }
html[data-theme="dark"] .nb-ticket { background: #16302a; color: #e3f4ee; border-color: #3f7a6a; }
html[data-theme="dark"] .nb-ticket-k { color: #7fd0bd; }

/* the bins and rows */
.nb-ctl { display: flex; flex-direction: column; gap: 6px; }
.nb-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.nb-field legend { padding: 0; margin: 0 0 4px; font-size: 16px; font-weight: 800; color: var(--tlg-text, #172c38); }
.nb-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.nb-part, .nb-tilebtn, .nb-dir, .nb-step {
  font: inherit; color: var(--tlg-text, #172c38); cursor: pointer; border-radius: 12px; background: var(--tlg-surface, #fff);
  border: 2px solid var(--tlg-border, #a5b6c1); box-shadow: 0 2px 0 rgba(0, 0, 0, .08); touch-action: none; user-select: none; -webkit-user-select: none;
}
.nb-step { touch-action: manipulation; }
.nb-part { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; min-height: 58px; padding: 4px 10px 4px 4px; font-size: 16px; font-weight: 700; text-align: left; }
.nb-ico { width: 56px; height: 48px; flex: none; }
.nb-part-t { line-height: 1.15; }
.nb-tilebtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; min-width: 64px; min-height: 52px; }
.nb-tilebtn--named { flex: 1 1 0; min-width: 0; padding: 4px 2px; }
.nb-tile { display: grid; place-items: center; width: 44px; height: 40px; border-radius: 8px; font-size: 24px; font-weight: 900; color: #fff; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .22), inset 0 3px 0 rgba(255, 255, 255, .2); }
.nb-tile--A { background: #2e8b57; } .nb-tile--T { background: #c2412d; } .nb-tile--G { background: #e0a72a; color: #2b1d00; } .nb-tile--C { background: #2f6fb5; }
.nb-tile-name { font-size: 16px; font-weight: 600; line-height: 1.1; }
.nb--pair .nb-choices { display: grid; grid-template-columns: repeat(4, 1fr); }
.nb-dir { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; min-height: 76px; }
.nb-dir-t { font-size: 24px; font-weight: 900; letter-spacing: .02em; }
.nb-dir-s { font-size: 16px; color: var(--tlg-text-muted, #4b5d68); }
.nb-part[aria-pressed="true"], .nb-tilebtn[aria-pressed="true"], .nb-dir[aria-pressed="true"] { border-color: #1f6b5c; background: #e3f4ee; box-shadow: 0 0 0 3px #1f6b5c inset; }
.nb-part[aria-pressed="true"]::after, .nb-tilebtn[aria-pressed="true"]::after, .nb-dir[aria-pressed="true"]::after {
  content: '✓'; position: absolute; top: -9px; right: -9px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 16px; font-weight: 900; line-height: 1; color: #ffffff; background: #1f6b5c; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.nb-part, .nb-tilebtn, .nb-dir { position: relative; }
.nb-part:hover:not(:disabled), .nb-tilebtn:hover:not(:disabled), .nb-dir:hover:not(:disabled), .nb-step:hover:not(:disabled) { border-color: #1f6b5c; }
.nb :focus-visible { outline: 3px solid #b16a08; outline-offset: 2px; }
.nb button:disabled, .nb input:disabled { cursor: default; }
.nb.is-locked .nb-part:not([aria-pressed="true"]), .nb.is-locked .nb-tilebtn:not([aria-pressed="true"]), .nb.is-locked .nb-dir:not([aria-pressed="true"]) { opacity: .6; }
html[data-theme="dark"] .nb-part[aria-pressed="true"], html[data-theme="dark"] .nb-tilebtn[aria-pressed="true"], html[data-theme="dark"] .nb-dir[aria-pressed="true"] { background: #15372f; border-color: #7fd0bd; box-shadow: 0 0 0 3px #7fd0bd inset; }
html[data-theme="dark"] .nb-part[aria-pressed="true"]::after, html[data-theme="dark"] .nb-tilebtn[aria-pressed="true"]::after, html[data-theme="dark"] .nb-dir[aria-pressed="true"]::after { color: #0d2620; background: #7fd0bd; }

/* the hydrogen-bond counter */
.nb-stepper { display: flex; align-items: center; gap: 8px; }
.nb-step { width: 52px; height: 52px; font-size: 28px; font-weight: 800; line-height: 1; }
.nb-num { width: 96px; height: 52px; font: inherit; font-size: 26px; font-weight: 800; text-align: center; border-radius: 10px; border: 2px solid var(--tlg-border, #a5b6c1); background: var(--tlg-surface, #fff); color: var(--tlg-text, #172c38); }
.nb-unit { font-size: 18px; font-weight: 700; }
.nb-num::-webkit-outer-spin-button, .nb-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.nb-num { -moz-appearance: textfield; appearance: textfield; }

.nb-msg { margin: 0; min-height: 1.2em; font-size: 16px; font-weight: 700; color: var(--tlg-danger, #b42318); }
html[data-theme="dark"] .nb-msg { color: #ffb4a8; }
.nb-about { font-size: 16px; line-height: 1.4; }
.nb-about summary { cursor: pointer; font-weight: 700; }
.nb-about p { margin: 4px 0 0; }

/* drag ghost */
html .nb-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: .92; transform: scale(1.06) rotate(-2deg); box-shadow: 0 10px 22px rgba(0, 0, 0, .3); margin: 0; }

/* the workbench */
.nb-view { position: relative; min-width: 0; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.nb-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; }
.nb-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.nb-wall { fill: url(#nb-g-wall); }
.nb-peg { fill: url(#nb-p-peg); }
html[data-theme="dark"] .nb-wall { fill: url(#nb-g-wall-d); }
html[data-theme="dark"] .nb-peg { fill: url(#nb-p-peg-d); }
html[data-theme="dark"] .nb-glow { opacity: .5; }

.nb-t { font-family: var(--tlg-font-body, system-ui, sans-serif); fill: #1d2b2f; }
.nb-sign { font-size: 26px; font-weight: 800; fill: #f6e7b8; letter-spacing: .02em; }
.nb-t-jar, .nb-t-poster { font-size: 17px; font-weight: 700; fill: #2b2418; }
.nb-t-tile { font-weight: 900; font-size: 30px; }
.nb-t-mat { font-size: 17px; font-weight: 700; fill: #e6f4ec; }
.nb-t-atom { font-size: 13px; font-weight: 800; fill: #ffffff; }
.nb-t-prime { font-size: 15px; font-weight: 800; fill: #5b4a2a; }
.nb-t-group { font-size: 19px; font-weight: 800; fill: #fff6dc; paint-order: stroke; stroke: #3a2e14; stroke-width: 4px; }
.nb-oh { fill: #ffd1c9; stroke: #8f2219; }
.nb-t-p { font-size: 26px; font-weight: 900; fill: #4a2208; }
.nb-t-pmini { font-size: 13px; font-weight: 900; fill: #4a2208; }
.nb-t-amino { font-size: 17px; font-weight: 800; fill: #1f3d12; }
.nb-t-socket { font-size: 18px; font-weight: 800; fill: #e3f6ee; }
.nb-t-name, .nb-t-label { font-size: 19px; font-weight: 800; fill: #ffffff; paint-order: stroke; stroke: #17483b; stroke-width: 4px; }
.nb-t-small { font-size: 17px; font-weight: 700; fill: #e6f4ec; }
.nb-t-end { font-size: 20px; font-weight: 900; fill: #1d2b2f; }
.nb-t-x { font-size: 30px; font-weight: 900; fill: #ffb4a8; paint-order: stroke; stroke: #5c120b; stroke-width: 3px; }
.nb-t-ex { font-size: 20px; font-weight: 800; fill: #ffffff; paint-order: stroke; stroke: #17483b; stroke-width: 4px; }
.nb-end rect { fill: #fffaf0; stroke: #1f4f46; stroke-width: 2.5; }
.nb-end.is-empty rect { fill: rgba(255, 255, 255, .2); stroke: #e3f6ee; stroke-dasharray: 5 4; }
.nb-end.is-empty text { fill: #ffffff; }
.nb-end.is-set rect { fill: #fff3c4; stroke: #94680c; }
.nb-socket-r { fill: rgba(255, 255, 255, .08); stroke: #d7f0e6; stroke-width: 3; stroke-dasharray: 8 6; }
.nb-socket { cursor: pointer; }
html.nb-dragging .nb-socket-r { stroke: #ffe27a; }
.nb-socket.is-over .nb-socket-r { fill: rgba(255, 226, 122, .35); stroke: #ffe27a; stroke-dasharray: none; }
.nb-bond { stroke: #3d2f1a; stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nb-backbone { stroke: #3d2f1a; stroke-width: 6; }
.nb-stem { stroke: #3d2f1a; stroke-width: 4; }
.nb-hbond { stroke: #c9f6ff; stroke-width: 4; stroke-dasharray: 5 4; stroke-linecap: round; }
.nb-jig { fill: rgba(0, 0, 0, .12); stroke: #9fd6c2; stroke-width: 2; stroke-dasharray: 3 6; }
.nb-bad-ring { fill: none; stroke: #ff6b5a; stroke-width: 5; stroke-dasharray: 10 6; }

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

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

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