/* Ribosome Diner: the kitchen scene (top), the order controls (left) and the codon wheel (right) inside the stage. */
.rd { position: absolute; inset: 0; padding: 8px 12px 10px; display: grid; gap: 8px 12px;
  grid-template-columns: minmax(0, 1fr) var(--rd-wheel, 420px); grid-template-rows: var(--rd-scene-h, 210px) minmax(0, 1fr); }
.rd-scene { grid-column: 1 / -1; position: relative; min-height: 0; border-radius: var(--tlg-radius-lg); overflow: hidden; border: var(--tlg-border-width) solid var(--tlg-border);
  background: #fbf3e4; display: flex; flex-direction: column; }
.rd-scene-svg { width: 100%; flex: 1 1 0; min-height: 0; display: block; }
.rd-capbar { flex: 0 0 26px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: #3b2a1f; color: #fff6e8; }
.rd-cap { margin: 0; flex: 1; min-width: 0; font-size: 16px; font-weight: 700; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-skip { flex: none; height: 22px; padding: 0 10px; border-radius: 999px; border: 1px solid #c9b29a; background: #fff6e8; color: #2a1d14; font: 700 16px/1 var(--tlg-font); cursor: pointer; }
.rd-skip[hidden] { display: none; }
.rd-work { grid-column: 1; grid-row: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.rd-side { grid-column: 2; grid-row: 2; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.rd-wheel { height: 100%; max-width: 100%; aspect-ratio: 1; min-height: 0; flex: 0 1 auto; }
.rd-wheel-svg { width: 100%; height: 100%; display: block; }
.rd-wheel-cap { margin: 0; font-size: 16px; font-weight: 700; color: var(--tlg-text-muted); }
.rd-muted { color: var(--tlg-text-muted); font-weight: 400; }
.rd-tag { display: inline-block; padding: 0 8px; border-radius: 999px; background: #fde2b8; color: #6b3a00; font-weight: 800; font-size: 16px; }
html[data-theme="dark"] .rd-tag { background: #5b3a10; color: #ffe2b0; }
.rd-note { margin: 0; min-height: 0; font-size: 16px; line-height: 1.3; color: var(--tlg-text); }
.rd-note:empty { display: none; }
.rd-note.is-bad { color: #b42318; font-weight: 700; }
html[data-theme="dark"] .rd-note.is-bad { color: #ff8a80; }

/* ── codon wheel ── */
.rd-w-bg { fill: var(--tlg-surface); }
.rd-w-t { font-weight: 800; fill: #1d1d1f; }
.rd-w-aat { font-weight: 800; }
.rd-w-lines circle { stroke: #6b5a4a; stroke-width: 1.5; }
.rd-w-s1 path, .rd-w-s2 path, .rd-w-s3 path, .rd-w-aa path { stroke: #fff; stroke-width: 1; transition: opacity .2s; }
html[data-theme="dark"] .rd-w-s1 path, html[data-theme="dark"] .rd-w-s2 path, html[data-theme="dark"] .rd-w-s3 path, html[data-theme="dark"] .rd-w-aa path { stroke: #1a2230; }
.rd-wheel-svg.is-hl .rd-w-s1:not(.is-on), .rd-wheel-svg.is-hl .rd-w-s2:not(.is-on), .rd-wheel-svg.is-hl .rd-w-s3:not(.is-on), .rd-wheel-svg.is-hl .rd-w-aa:not(.is-on) { opacity: .28; }
.rd-wheel-svg .is-on path { stroke: #1d1d1f; stroke-width: 3; }
.rd-w-arrow { fill: none; stroke: #1d1d1f; stroke-width: 4; stroke-dasharray: 2 7; stroke-linecap: round; }
.rd-w-arrowhead { fill: #1d1d1f; }

/* ── strand rows (base cells) ── */
.rd-row { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rd-row-h { margin: 0; font-size: 16px; line-height: 1.3; }
.rd-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.rd-end { flex: 0 0 22px; text-align: center; font-weight: 800; font-size: 16px; color: var(--tlg-text-muted); }
.rd-cells { flex: 0 1 auto; min-width: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 30px)); gap: 2px; }
.rd-c { display: grid; place-items: center; height: 34px; min-width: 0; padding: 0; border-radius: 5px; border: 1px solid #8a7a6a; background: #f4efe8;
  color: #1d1d1f; font: 800 18px/1 var(--tlg-font-mono, ui-monospace, Menlo, monospace); position: relative; }
button.rd-c { cursor: pointer; }
.rd-b-A { background: #ffd98a; } .rd-b-U { background: #ffb3a7; } .rd-b-T { background: #f3b5d6; } .rd-b-G { background: #a9cdf2; } .rd-b-C { background: #b7e4c0; }
.rd-c--in { background: var(--tlg-surface); border: 2px dashed var(--tlg-border-strong); color: #1d1d1f; }
html[data-theme="dark"] .rd-c--in:not([class*="rd-b-"]) { background: #222c3c; }
.rd-c--in[class*="rd-b-"] { border-style: solid; border-color: #8a7a6a; }
.rd-c.is-cur { outline: 3px solid var(--ps-accent); outline-offset: 1px; z-index: 1; }
.rd-cells:focus-visible { outline: var(--tlg-focus-width, 3px) solid var(--tlg-focus, #2563eb); outline-offset: 3px; border-radius: 6px; }
.rd-c.is-kfocus { outline: 3px solid var(--tlg-focus, #2563eb); outline-offset: 1px; z-index: 1; }
.rd-c.is-ok { box-shadow: inset 0 -4px 0 #2e7d32; }
.rd-c.is-bad { box-shadow: inset 0 0 0 3px #b42318; }
.rd-c.is-bad[data-want]::after { content: attr(data-want); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 16px; color: #b42318; }
html[data-theme="dark"] .rd-c.is-bad[data-want]::after { color: #ff8a80; }
.rd-row--given .rd-c { border-color: #5e7584; }
.rd-row--input.is-apart { margin-top: 6px; }
/* translation: start picker + codon brackets */
.rd-c.is-lead { opacity: .55; }
.rd-c.is-start::before { content: "▶"; position: absolute; top: -13px; left: 50%; transform: translateX(-50%); font-size: 13px; color: var(--ps-accent); }
.rd-c.is-codon-b { border-bottom: 4px solid #7a4b2a; }
.rd-c.is-codon-a { border-bottom: 4px solid #d9a36f; }
.rd-c.is-true { box-shadow: inset 0 0 0 3px #2e7d32; }
.rd-brs { min-height: 32px; }
.rd-brs-empty { margin: 4px 0 0; font-size: 16px; }
.rd-cells--br .rd-br { min-height: 30px; padding: 0; border: 2px solid var(--tlg-border-strong); border-top: 0; border-radius: 0 0 8px 8px; background: transparent;
  color: var(--tlg-text-muted); font: 700 16px/1 var(--tlg-font); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 2px; }
.rd-cells--br .rd-br.is-on { color: var(--tlg-text); border-color: var(--ps-accent); }
.rd-cells--br .rd-br.is-lit { background: color-mix(in srgb, var(--ps-accent) 18%, transparent); }
.rd-tl { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.rd-tl-row .rd-c { margin-top: 8px; }
.rd-chain-empty { margin: 8px 0; font-size: 16px; }

/* chain-builder inside the diner: narrow codon slots, bead cards */
.rd .pcb { gap: 4px; }
.rd .pcb-row { gap: 0; }
.rd .pcb-arrow { flex-basis: 14px; }
.rd .pcb-arrow::before { left: 1px; right: 6px; }
.rd .pcb-arrow::after { border-width: 6px; border-left-width: 7px; top: 7px; }
.rd .pcb-slot { min-height: 70px; padding: 4px; gap: 2px; align-items: center; }
.rd .pcb-slot-label { text-transform: none; font-family: var(--tlg-font-mono, ui-monospace, Menlo, monospace); letter-spacing: .06em; color: var(--tlg-text); }
.rd .pcb-slot-label b { display: none; }
.rd .pcb-slot-empty { min-height: 34px; font-size: 16px; text-align: center; line-height: 1.1; }
.rd .pcb-slot .pcb-chip { padding: 0; border: 0; background: transparent; justify-content: center; }
.rd .pcb-tray { gap: 6px; min-height: 48px; }
.rd .pcb-card { min-height: 44px; padding: 3px 5px; }
.rd .pcb-tray-h { font-size: 16px; }
.rd-chainbox.is-wrap .pcb-row { flex-wrap: wrap; row-gap: 6px; }
.rd-chainbox.is-wrap .pcb-slot { flex: 0 0 76px; }
.rd-bead { display: inline-grid; place-items: center; min-width: 52px; height: 34px; padding: 0 8px; border-radius: 999px; background: var(--rd-c); color: var(--rd-i);
  font: 800 16px/1 var(--tlg-font); border: 1.5px solid rgba(0, 0, 0, .45); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35); }
.rd-bead--stop { border-radius: 8px; letter-spacing: .04em; }
.pcb-ghost .rd-bead { pointer-events: none; }

/* ── the base pad ── */
.rd-tx { display: flex; flex-direction: column; gap: 8px; }
.rd-pad { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.rd-key { width: 64px; height: 54px; border-radius: 12px; border: 2px solid #6b5a4a; color: #1d1d1f; font: 900 26px/1 var(--tlg-font-mono, ui-monospace, Menlo, monospace);
  cursor: pointer; box-shadow: 0 3px 0 #6b5a4a; touch-action: manipulation; }
.rd-key:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #6b5a4a; }
.rd-key--x { background: var(--tlg-surface-2); color: var(--tlg-text); font-size: 22px; }
.rd-key:disabled, .rd-clear:disabled { opacity: .5; cursor: default; }
.rd-pad-tip { margin: 0; font-size: 16px; flex-basis: 100%; }
.rd-go { margin-left: auto; }
.rd-stage1, .rd-stage2 { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.rd-stage1[hidden], .rd-stage2[hidden] { display: none; }
.rd-back { align-self: flex-start; min-height: 36px; padding: 2px 12px; }

/* ── anticodons ── */
.rd-ac { display: flex; flex-direction: column; gap: 6px; }
.rd-ac-list { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.rd-row--ac { flex-direction: row; align-items: center; gap: 6px; }
.rd-row--ac .rd-cells { grid-template-columns: repeat(3, 30px); }
.rd-ac-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #3f9384; color: #fff; font-weight: 800; font-size: 16px; }
.rd-ac-tip { margin: 0; font-size: 16px; }

/* ── mutation ── */
.rd-mut { display: flex; flex-direction: column; gap: 8px; }
.rd-codons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.rd-codon { display: inline-grid; grid-template-columns: repeat(3, 30px); gap: 2px; }
.rd-c--mut { outline: 3px solid #b42318; outline-offset: 1px; }
.rd-star { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 16px; color: #b42318; }
.rd-calls { display: flex; gap: 10px; flex-wrap: wrap; }
.rd-call { min-width: 150px; min-height: 52px; padding: 6px 16px; border-radius: 12px; border: 2px solid var(--tlg-border-strong); background: var(--tlg-surface);
  color: var(--tlg-text); font: 800 18px/1.1 var(--tlg-font); cursor: pointer; }
.rd-call[aria-checked="true"] { border-color: var(--ps-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ps-accent) 35%, transparent); background: color-mix(in srgb, var(--ps-accent) 10%, var(--tlg-surface)); }
.rd-call[aria-checked="true"]::before { content: "● "; color: var(--ps-accent); }
.rd-call.is-right { border-color: #2e7d32; border-style: solid; }
.rd-call.is-right::after { content: " ✓"; color: #2e7d32; }
.rd-call.is-wrong { border-color: #b42318; }
.rd-call.is-wrong::after { content: " ✗"; color: #b42318; }
.rd-mut .rd-muted { margin: 0; font-size: 16px; }

/* ── splicing (AP): the processing station covers the kitchen drawing until Serve it ── */
.rd-proc { position: absolute; inset: 0 0 26px 0; z-index: 2; padding: 10px 14px; background: linear-gradient(#f1ecfb, #e3dcf4); color: #1d1d1f; overflow: hidden; }
.rd-proc[hidden] { display: none; }
.rd-proc .rd-muted { color: #4d4560; }
.rd-proc-h { margin: 0; font-size: 16px; color: #3b2a78; }
.rd-proc .rd-tog { background: #fff; color: #1d1d1f; border-color: #6b5a8a; }
.rd-proc .rd-tog[aria-pressed="true"] { background: #fbe7e2; border-color: var(--ps-accent); }
.rd-sp { display: flex; flex-direction: column; gap: 4px; }
.rd-segs { display: flex; flex-wrap: wrap; gap: 4px; }
.rd-seg { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 3px 6px; border-radius: 8px; border: 2px solid #6b5a4a; cursor: pointer;
  background: #fff3df; color: #1d1d1f; font: 800 16px/1.15 var(--tlg-font-mono, ui-monospace, Menlo, monospace); letter-spacing: .02em; }
.rd-seg small { font: 700 16px/1.1 var(--tlg-font); color: #5d4a3a; }
.rd-seg--intron { background: repeating-linear-gradient(135deg, #e9dcf7 0 8px, #d6c3ef 8px 16px); border-style: dashed; }
.rd-seg.is-cut { opacity: .45; text-decoration: line-through; }
.rd-seg.is-cut small::before { content: "✂ cut · "; }
.rd-seg.is-bad { outline: 3px solid #b42318; outline-offset: 1px; }
.rd-sp-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.rd-tog { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 2px 12px; border-radius: 999px; border: 2px solid var(--tlg-border-strong);
  background: var(--tlg-surface); color: var(--tlg-text); font: 700 16px/1 var(--tlg-font); cursor: pointer; }
.rd-tog[aria-pressed="true"] { border-color: var(--ps-accent); background: color-mix(in srgb, var(--ps-accent) 12%, var(--tlg-surface)); }
.rd-tog[aria-pressed="true"]::after { content: "✓"; color: var(--ps-accent); font-weight: 900; }
.rd-capdot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: #34495e; vertical-align: middle; }
.rd-taildot { display: inline-block; font: 800 16px/1 var(--tlg-font-mono, ui-monospace, monospace); color: #8a6d00; }
.rd--splice .rd-end { flex-basis: 34px; }

/* ── Briefing example + start art ── */
.rd-ex-svg { width: 100%; height: auto; display: block; color: var(--tlg-text); }
.rd-start-art { width: 100%; height: 100%; display: block; }

/* the assignment card would cover the wheel: move it to the foot of the customer column */
@media (min-width: 901px) {
  html.ps-locked:has(.rd) .lga-card { right: auto; left: 12px; }
  html.ps-locked:has(.rd):has(.lga-card) .ps-side { padding-bottom: 84px; }
}
@media (max-width: 1100px) { .rd { --rd-wheel: 360px; } }
@media (max-width: 900px) {
  .rd { position: relative; inset: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .rd-scene { height: 170px; }
  .rd-work, .rd-side { grid-column: 1; grid-row: auto; overflow: visible; }
  .rd-wheel { max-width: 440px; }
}
@media (prefers-reduced-motion: reduce) { .rd-w-s1 path, .rd-w-s2 path, .rd-w-s3 path, .rd-w-aa path { transition: none; } }
