/* Signal Encoder: the work order and the controls on the left, the signal desk (monitor + desk) on the right, inside
 * the practice shell's stage. */
.sge { position: absolute; inset: 0; display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 12px; padding: 8px 12px; }
.sge-panel { display: flex; flex-direction: column; gap: 9px; min-height: 0; overflow-y: auto; padding: 2px; }

/* work order */
.sge-file { padding: 8px 14px 10px; border-radius: var(--tlg-radius-lg, 14px); border: 2px solid #b79a62; background: #fff8e6; color: #2b1d0e; box-shadow: inset 0 0 0 4px #fffcf2; }
.sge-file-k { margin: 0 0 4px; font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--tlg-tracking-caps, .08em); color: #1f6f5c; }
.sge-file-g { margin: 4px 0 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
html[data-theme="dark"] .sge-file { background: #2a2416; color: #f6ead6; border-color: #7a6232; box-shadow: inset 0 0 0 4px #332b1c; }
html[data-theme="dark"] .sge-file-k { color: #7dffb0; }

/* bit rack */
.sge-rack { border-radius: 14px; padding: 8px 10px 10px; background: linear-gradient(#2b333b, #171c21); border: 2px solid #0b0e11; box-shadow: inset 0 1px 0 #4a545e; color: #e6f3ec; }
.sge-rack-k { margin: 0 0 6px; font-size: 16px; font-weight: 800; color: #7dffb0; letter-spacing: .04em; }
.sge-rack-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sge-rocker { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.sge-rocker legend { padding: 0; margin: 0 auto 2px; font-size: 16px; font-weight: 800; color: #e6f3ec; }
.sge-volt { text-align: center; font: 700 16px ui-monospace, Menlo, Consolas, monospace; color: #ffe27a; }
.sge-bit { min-height: 46px; font: 900 24px ui-monospace, Menlo, Consolas, monospace; cursor: pointer; border-radius: 9px; color: #b8c6cf; background: linear-gradient(#3a444e, #262d34); border: 2px solid #0b0e11; box-shadow: 0 2px 0 #000; touch-action: manipulation; }
.sge-bit:hover:not(:disabled) { color: #ffffff; border-color: #7dffb0; }
.sge-bit[aria-pressed="true"] { color: #062417; background: linear-gradient(#b8ffd6, #38e08a); border-color: #ffffff; box-shadow: 0 0 12px #38e08a99, inset 0 -3px 0 #0d6b3a; }

/* choice cards */
.sge-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.sge-field legend { padding: 0; margin: 0 0 6px; font-size: 16px; font-weight: 800; color: var(--tlg-text, #172c38); }
.sge-cards { display: grid; gap: 7px; }
.sge-cards--2 { grid-template-columns: 1fr 1fr; }
.sge-card { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 6px 12px; font: inherit; font-size: 17px; font-weight: 800; line-height: 1.25; text-align: left; cursor: pointer;
  border-radius: 12px; 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, .1); touch-action: manipulation; }
.sge-cards--reasons .sge-card { font-weight: 700; min-height: 54px; }
.sge-cards--bits .sge-card { justify-content: center; font: 900 24px ui-monospace, Menlo, Consolas, monospace; }
.sge-card svg { flex: none; width: 44px; height: 22px; }
.sge-card:hover:not(:disabled) { border-color: #1f6f5c; }
.sge-card[aria-pressed="true"] { border-color: #1f6f5c; border-width: 3px; background: #e3f6ee; box-shadow: inset 0 0 0 2px #b8ecd4; }
html[data-theme="dark"] .sge-card[aria-pressed="true"] { background: #173a30; box-shadow: inset 0 0 0 2px #2a6b55; }
html[data-theme="dark"] .sge-card:hover:not(:disabled) { border-color: #7dffb0; }

.sge-price { display: flex; align-items: center; gap: 8px; }
.sge-num { width: 160px; height: 52px; font: inherit; font-size: 26px; 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; -moz-appearance: textfield; appearance: textfield; }
.sge-num::-webkit-outer-spin-button, .sge-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sge-num:focus { border-color: #1f6f5c; }
.sge-unit { font-size: 24px; font-weight: 800; }

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

/* the desk */
.sge-view { position: relative; min-width: 0; min-height: 0; display: flex; align-items: flex-start; justify-content: center; }
.sge-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; }
.sge-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.sge-t { font-family: var(--tlg-font-body, system-ui, sans-serif); fill: #dff7ea; }
.sge-t-plaque { font-size: 22px; font-weight: 800; fill: #f6e7b8; letter-spacing: .08em; }
.sge-t-head { font-size: 22px; font-weight: 800; fill: #7dffb0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.sge-t-dim { font-size: 18px; font-weight: 700; fill: #9fd8bd; }
.sge-t-axis { font-size: 19px; font-weight: 700; fill: #9fd8bd; }
.sge-t-q { font-size: 26px; font-weight: 900; fill: #6f9a86; }
.sge-t-bit { font-size: 26px; font-weight: 900; fill: #ffffff; font-family: ui-monospace, Menlo, Consolas, monospace; }
.sge-t-big { font-size: 72px; font-weight: 900; fill: #7dffb0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.sge-t-flip { font-size: 28px; font-weight: 900; fill: #ff8f7a; }
.sge-t-lane { font-size: 20px; font-weight: 900; letter-spacing: .04em; }
.sge-t-lane--a { fill: #ffb27a; } .sge-t-lane--d { fill: #8fe0ff; }
.sge-t-st { font-size: 22px; font-weight: 900; fill: #10202c; }
.sge-t-plug { font-size: 19px; font-weight: 900; fill: #dff7ea; }
.sge-t-res { font-size: 18px; font-weight: 700; fill: #ffffff; }
.sge-t-notek { font-size: 17px; font-weight: 800; fill: #ffffff; letter-spacing: .06em; }
.sge-t-note { font-size: 24px; font-weight: 800; fill: #1b2a4a; font-family: 'Segoe Print', 'Bradley Hand', var(--tlg-font-body, system-ui), sans-serif; }
.sge-t-note.is-empty { font-size: 19px; fill: #7a6a52; font-style: italic; }
.sge-t-cbk { font-size: 17px; font-weight: 900; fill: #6b4a1f; letter-spacing: .08em; }
.sge-t-cb { font-size: 18px; font-weight: 700; fill: #2b1d0e; }
.sge-t-cb.is-on { font-weight: 900; }
.sge-mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

.sge-axis { stroke: #7dffb0; stroke-width: 1.5; opacity: .45; fill: none; }
.sge-thr { stroke: #ffc44d; stroke-width: 3; stroke-dasharray: 12 8; fill: none; }
.sge-wave { stroke: #7dffb0; stroke-width: 5; fill: none; stroke-linejoin: round; filter: url(#sge-f-glow); }
.sge-run { stroke: #ffffff; stroke-width: 7; fill: none; stroke-linejoin: round; stroke-dasharray: 60 3000; animation: sge-run 1.8s ease-in-out .1s 2 both; }
.sge-unset { stroke: #6f9a86; stroke-width: 3; stroke-dasharray: 6 8; fill: none; }
.sge-trace { stroke: #7dffb0; stroke-width: 3; fill: none; opacity: .9; }
.sge-dot { fill: #ffffff; stroke: #0d6b3a; stroke-width: 3; }
.sge-noise { stroke: #ff8fb1; stroke-width: 4; fill: none; stroke-dasharray: 8 6; }
.sge-sort { stroke-width: 5; fill: none; stroke-dasharray: 4 6; }
.sge-sort.is-hi { stroke: #8fe0ff; } .sge-sort.is-lo { stroke: #ffb27a; }
.sge-box { fill: #0b2621; stroke: #7dffb0; stroke-width: 2; }
.sge-copy rect { fill: #0b2621; stroke: #7dffb0; stroke-width: 3; }
.sge-line { fill: none; stroke-width: 4; stroke-linejoin: round; }
.sge-line--a { stroke: #ffb27a; } .sge-line--d { stroke: #8fe0ff; }
.sge-zap { stroke: #ff8fb1; stroke-width: 2.5; stroke-dasharray: 3 5; fill: none; }
.sge-station rect { fill: #dff7ea; stroke: #0b2621; stroke-width: 2; }
.sge-tower path { stroke: #c9d2da; stroke-width: 4; fill: none; stroke-linecap: round; }
.sge-tower circle { fill: #ff6b4a; }
.sge-plug rect { fill: #0b2621; stroke: #6f9a86; stroke-width: 2.5; }
.sge-plug.is-on rect { stroke: #ffe27a; stroke-width: 5; fill: #12362e; }
.sge-plugwave { fill: none; stroke: #dff7ea; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }

.sge-pill rect { fill: rgba(5, 24, 20, .92); stroke: #7dffb0; stroke-width: 1.5; }
.sge-pill text { font-family: var(--tlg-font-body, system-ui, sans-serif); font-size: 18px; font-weight: 800; fill: #ffffff; }
.sge-pill--thr rect { fill: #3a2c05; stroke: #ffc44d; } .sge-pill--thr text { fill: #ffe27a; }
.sge-pill--noise rect { fill: #3a0f1e; stroke: #ff8fb1; } .sge-pill--noise text { fill: #ffd0de; }
.sge-pill--noise.is-spike rect { stroke-width: 4; fill: #6b1230; }
.sge-pill--a rect { fill: #3a1f0a; stroke: #ffb27a; } .sge-pill--d rect { fill: #08293a; stroke: #8fe0ff; }
.sge-pill--far rect { fill: #10202c; stroke: #9fd8bd; stroke-dasharray: 4 4; }
.sge-pill--ok rect { fill: #0f4a2c; stroke: #7dffb0; stroke-width: 2.5; }
.sge-pill--bad rect { fill: #5a1410; stroke: #ff8f7a; stroke-width: 2.5; }

/* reveal (after Check, practice only) */
.sge-reveal, .sge-hop { animation: sge-in .5s ease-out both; }
.sge-blink { animation: sge-blink 1.4s ease-in-out infinite alternate; }
.sge-steam { animation: sge-steam 2.6s ease-in-out infinite; }
@keyframes sge-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sge-run { from { stroke-dashoffset: 60; } to { stroke-dashoffset: -900; } }
@keyframes sge-blink { from { opacity: .45; } to { opacity: 1; } }
@keyframes sge-steam { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: .6; } 100% { opacity: 0; transform: translateY(-12px); } }

.sge-badge { position: absolute; left: 2%; right: 2%; top: 1.2%; 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 #1d6b40; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); animation: sge-pop .25s ease-out; }
.sge-badge.is-bad { border-color: #b42318; }
@keyframes sge-pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

.sge-example-svg { display: block; width: 100%; height: auto; max-height: 460px; border-radius: 10px; }
.sge-start-svg { display: block; width: 100%; height: 100%; }

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