/* ================= Sorting Office ================= */
.so { padding-top: 0.4rem; }
.so-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2.5rem; align-items: end; margin-bottom: 1rem; }
.so-head { display: grid; gap: 0.4rem; }
.so-title { margin: 0; font: italic 400 clamp(2.6rem, 6vw, 4rem)/0.95 var(--serif); color: var(--ivory); }

/* ---------- the headline figures ---------- */
.pass { display: grid; grid-template-columns: auto auto; gap: 0.5rem 2rem; align-items: baseline; margin: 0; padding: 0.2rem 0 0.2rem 1.6rem; border-left: 1px solid var(--line); }
.pass .fig-lead { grid-column: 1 / -1; }
.fig { margin: 0; display: flex; align-items: baseline; gap: 0.5rem; }
.fig b { font: 400 clamp(2rem, 4.2vw, 3rem)/1 var(--serif); color: var(--signal); font-variant-numeric: tabular-nums; }
.fig span { color: var(--text-dim); font-size: 0.92rem; max-width: 10rem; line-height: 1.2; }
.fig-lead b { font-style: italic; color: var(--brass-hi); font-size: clamp(2.6rem, 5.6vw, 4rem); text-shadow: 0 0 26px rgba(242, 203, 126, 0.25); }
.fig-lead span { font: italic 1.35rem/1.1 var(--serif); color: var(--text); max-width: 12rem; }

/* ---------- controls ---------- */
.controls { display: grid; gap: 0.7rem; margin-bottom: 1rem; }
.so-packrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.2rem; }
.packs { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: 0 1 auto; }
.pack {
  white-space: nowrap; border: 1px solid var(--line-strong); background: rgba(18, 7, 9, 0.5); color: var(--text-dim); cursor: pointer;
  border-radius: 999px; padding: 0.45rem 1rem; font: italic 1.15rem/1.1 var(--serif);
}
.pack:hover:not([disabled]) { border-color: var(--brass); color: var(--text); }
.pack[aria-checked="true"] { background: var(--brass); border-color: var(--brass); color: var(--ebony); }
.pack[disabled] { opacity: 0.38; cursor: not-allowed; }
.pack-blurb { margin: 0; color: var(--text-faint); font-size: 0.88rem; line-height: 1.35; flex: 1 1 260px; max-width: 34rem; }
.ctrl-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 2rem; }
.ctrl-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.ctrl-buttons .primary { min-width: 11.5rem; }
.switch { display: inline-flex; align-items: center; gap: 0.5rem; }
.switch i { width: 26px; height: 15px; border-radius: 99px; background: rgba(241, 233, 218, 0.18); position: relative; transition: background 200ms; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-dim); transition: transform 200ms, background 200ms; }
.switch[aria-pressed="true"] { border-color: var(--brass); color: var(--brass-hi); }
.switch[aria-pressed="true"] i { background: var(--brass-deep); }
.switch[aria-pressed="true"] i::after { transform: translateX(11px); background: var(--brass-hi); }
.slider { display: grid; gap: 0.25rem; min-width: 210px; flex: 1 1 210px; max-width: 320px; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; font-size: 0.86rem; color: var(--text-dim); }
.slider output { font: italic 1.35rem/1 var(--serif); color: var(--brass-hi); white-space: nowrap; }
.slider-th output { color: var(--signal); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; padding: 0; border: 0; background: transparent; box-shadow: none; cursor: pointer; }
input[type="range"]:focus { box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--brass-deep), var(--brass)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--brass-deep), var(--brass)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #FFFBF2, var(--ivory) 50%, var(--ivory-shade)); box-shadow: 0 0 0 3px var(--stage), 0 0 0 4px var(--brass), 0 3px 8px rgba(0, 0, 0, 0.5); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--ivory); box-shadow: 0 0 0 3px var(--stage), 0 0 0 4px var(--brass); }
.slider-th input[type="range"]::-webkit-slider-runnable-track { background: linear-gradient(90deg, rgba(158, 194, 255, 0.35), var(--signal)); }
.slider-th input[type="range"]::-moz-range-track { background: linear-gradient(90deg, rgba(158, 194, 255, 0.35), var(--signal)); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--stage), 0 0 0 5px var(--signal); }
.run-note { margin: 0; min-height: 1.3em; color: var(--text-faint); font-size: 0.88rem; }
.busy { margin: 0; display: inline-flex; align-items: center; gap: 0.55rem; justify-self: start; padding: 0.35rem 0.9rem; border-radius: 999px; color: var(--brass-hi); background: rgba(212, 162, 76, 0.12); border: 1px solid rgba(212, 162, 76, 0.4); font-size: 0.9rem; }
.busy[hidden] { display: none; }
.busy i { width: 8px; height: 8px; border-radius: 50%; background: var(--brass-hi); animation: blink 1s ease-in-out infinite alternate; }
@keyframes blink { to { opacity: 0.25; } }
.linkish { background: none; border: 0; padding: 0; color: var(--brass-hi); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: inherit; }

/* ---------- the machine ---------- */
.machine {
  --env-w: 124px; --env-h: 58px; --rail: rgba(212, 162, 76, 0.5);
  position: relative; isolation: isolate; padding: 1.1rem 1.2rem 1.2rem; border-radius: 18px; overflow: hidden;
  background:
    radial-gradient(55% 60% at 62% 0%, rgba(242, 203, 126, 0.12), transparent 70%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.09) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #2A121C 0%, #1A0A10 60%, #12070B 100%);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(242, 203, 126, 0.15), 0 40px 70px -40px rgba(0, 0, 0, 0.9);
  user-select: none; -webkit-user-select: none;
}
.m-top { display: grid; grid-template-columns: 150px minmax(80px, 1fr) 236px 236px; gap: 0 1rem; align-items: start; }
.m-label { margin: 0.45rem 0 0; color: var(--text-dim); font-size: 0.86rem; text-align: center; }
.m-label b { font: 400 1.4rem/1 var(--serif); color: var(--text); margin-right: 0.15rem; }

.hopper { display: grid; justify-items: center; padding-top: 30px; }
.hopper-bin {
  position: relative; width: 126px; height: 92px; overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 82% 100%, 18% 100%);
  background: linear-gradient(180deg, #3B1E28, #1A0A10);
  box-shadow: inset 0 3px 0 var(--brass);
}
.hopper-bin::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(212, 162, 76, 0.55) 0 2px, transparent 2px calc(100% - 2px), rgba(212, 162, 76, 0.55) calc(100% - 2px)); z-index: 2; }
.hopper-pile {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0; transition: height 300ms;
  background: repeating-linear-gradient(180deg, var(--ivory) 0 5px, var(--ivory-shade) 5px 6px, #B9A98F 6px 7px);
  box-shadow: inset 0 6px 8px rgba(0, 0, 0, 0.25);
}

.belt { position: relative; height: 92px; margin-top: 30px; }
.belt-track {
  position: absolute; left: -18px; right: -18px; top: 50%; height: 16px; margin-top: 18px; border-radius: 8px;
  background: repeating-linear-gradient(90deg, #2B1A1E 0 14px, #1A0D11 14px 16px);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(242, 203, 126, 0.15);
  animation: belt 0.9s linear infinite paused;
}
.machine.running .belt-track { animation-play-state: running; }
@keyframes belt { to { background-position: 16px 0; } }
.belt-rollers { position: absolute; left: -18px; right: -18px; top: 50%; margin-top: 34px; height: 8px;
  background: radial-gradient(circle, rgba(212, 162, 76, 0.55) 0 3px, transparent 3.5px) 0 0 / 26px 8px repeat-x; }

.station { position: relative; display: grid; justify-items: center; --glow: 0; }
.lamp { position: relative; width: 100%; height: 30px; display: grid; justify-items: center; z-index: 1; pointer-events: none; }
.lamp-head { width: 70px; height: 22px; border-radius: 40px 40px 6px 6px; background: linear-gradient(180deg, var(--brass-hi), var(--brass-deep)); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.5); }
.lamp-beam {
  position: absolute; top: 14px; width: 230px; height: 120px; clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, rgba(255, 230, 170, 0.5), rgba(255, 230, 170, 0.02));
  opacity: calc(0.12 + var(--glow) * 0.75); transition: opacity 250ms;
}
.station-desk {
  width: 216px; height: 92px; border-radius: 10px;
  background: linear-gradient(180deg, #33161F, #1A0A10);
  box-shadow: inset 0 0 0 1px rgba(212, 162, 76, 0.45), inset 0 10px 20px rgba(0, 0, 0, 0.5);
  position: relative; overflow: hidden;
}
.station.on .station-desk::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; top: 0; z-index: 3;
  background: linear-gradient(90deg, transparent, rgba(255, 236, 190, 0.9), transparent);
  box-shadow: 0 0 12px rgba(255, 220, 150, 0.8); animation: scan 0.9s ease-in-out infinite alternate;
}
@keyframes scan { to { transform: translateY(90px); } }
.station-label { margin-top: 0.5rem; }
.station-label b { color: var(--brass-hi); }
.station-sub { margin: 0.1rem 0 0; color: var(--text-faint); font-size: 0.78rem; }

.side { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; padding-top: 30px; }
.desk, .shredder {
  display: grid; justify-items: center; align-content: start; gap: 0.35rem; padding: 0; border: 0; background: none; cursor: pointer; color: inherit;
  border-radius: 12px;
}
.desk-tray {
  position: relative; width: 100%; height: 92px; border-radius: 10px; overflow: hidden; display: block;
  background: linear-gradient(180deg, #4A2A1E, #2C160F); box-shadow: inset 0 0 0 2px #6B4128, inset 0 12px 16px rgba(0, 0, 0, 0.45);
}
.desk-pile { position: absolute; left: 14%; right: 14%; bottom: 8px; height: 0; max-height: calc(100% - 16px); transition: height 300ms;
  background: repeating-linear-gradient(180deg, var(--ivory) 0 5px, var(--ivory-shade) 5px 6px); border-radius: 2px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); }
.desk.has .desk-tray { box-shadow: inset 0 0 0 2px var(--signal), 0 0 22px rgba(158, 194, 255, 0.28), inset 0 12px 16px rgba(0, 0, 0, 0.45); }
.shred-mouth {
  position: relative; width: 100%; height: 92px; border-radius: 10px; display: flex; justify-content: center; gap: 5px; padding-top: 16px;
  background: linear-gradient(180deg, #2A2326, #121012); box-shadow: inset 0 0 0 1px rgba(241, 233, 218, 0.15), inset 0 14px 0 #0A0809;
}
.shred-mouth i { width: 6px; height: 0; background: var(--ivory-shade); border-radius: 0 0 2px 2px; opacity: 0.85; }
.shredder.chew .shred-mouth i { animation: strip 700ms ease-in forwards; }
.shredder.chew .shred-mouth i:nth-child(2n) { animation-delay: 60ms; }
.shredder.chew .shred-mouth i:nth-child(3n) { animation-delay: 120ms; }
@keyframes strip { 0% { height: 0; } 60% { height: 56px; opacity: 0.9; } 100% { height: 66px; opacity: 0; } }
.side-text { display: flex; align-items: baseline; gap: 0.35rem; color: var(--text-dim); font-size: 0.84rem; }
.side-text b { font: 400 1.4rem/1 var(--serif); color: var(--text); }
.desk:hover .desk-tray, .shredder:hover .shred-mouth { filter: brightness(1.15); }

.diverter { position: relative; height: 28px; margin: 0.1rem 0 0; }
.diverter::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: linear-gradient(90deg, transparent, var(--rail) 10%, var(--rail) 90%, transparent); }
.gate {
  position: absolute; top: 4px; left: var(--gx, 60%); width: 6px; height: 30px; margin-left: -3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-deep)); transform-origin: 3px 3px;
  transition: transform 260ms cubic-bezier(0.3, 0.7, 0.3, 1.3); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.gate::before { content: ""; position: absolute; top: -4px; left: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--brass-hi); box-shadow: 0 0 0 3px #1A0A10; }

.chutes { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 0.55rem; }
.chute {
  display: grid; justify-items: center; gap: 0.25rem; padding: 0 0 0.3rem; border: 0; background: none; cursor: pointer; color: inherit; border-radius: 12px; min-width: 0;
}
.chute-mouth { width: 100%; height: 18px; clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%); background: linear-gradient(180deg, var(--brass-hi), var(--brass-deep)); }
.chute-well {
  position: relative; width: 72%; height: 100px; border-radius: 0 0 10px 10px; overflow: hidden; display: block;
  background: linear-gradient(90deg, #0B0406, #1E0D13 30%, #1E0D13 70%, #0B0406);
  box-shadow: inset 0 0 0 1px rgba(212, 162, 76, 0.28), inset 0 10px 12px rgba(0, 0, 0, 0.6);
}
.chute-stack {
  position: absolute; left: 10%; right: 10%; bottom: 6px; height: 0; max-height: calc(100% - 12px); transition: height 300ms ease-out;
  background: repeating-linear-gradient(180deg, var(--ivory) 0 4px, var(--ivory-shade) 4px 5px, #A99779 5px 6px); border-radius: 2px;
  box-shadow: 0 0 14px rgba(242, 203, 126, 0.12);
}
.chute-n { font: 400 1.6rem/1 var(--serif); color: var(--text); margin-top: 0.2rem; }
.chute-name { font-size: 0.82rem; color: var(--text-dim); text-align: center; line-height: 1.15; min-height: 2.3em; overflow-wrap: anywhere; }
.chute:hover .chute-well { box-shadow: inset 0 0 0 1px var(--brass), inset 0 10px 12px rgba(0, 0, 0, 0.6); }
.chute:hover .chute-name { color: var(--text); }
.machine.holding .chute .chute-well, .machine.holding .shred-mouth { box-shadow: inset 0 0 0 2px var(--signal), 0 0 18px rgba(158, 194, 255, 0.3); animation: beckon 1.2s ease-in-out infinite alternate; }
.machine.holding .chute .chute-name::after { content: " (send here)"; color: var(--signal); }
@keyframes beckon { to { box-shadow: inset 0 0 0 2px rgba(158, 194, 255, 0.4), 0 0 6px rgba(158, 194, 255, 0.1); } }

/* envelopes */
.env-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.env {
  position: absolute; top: 0; left: 0; width: var(--env-w); height: var(--env-h); pointer-events: auto; cursor: pointer;
  border-radius: 4px; overflow: hidden; will-change: transform, opacity; contain: layout paint;
  background: linear-gradient(180deg, #FBF5EA, var(--ivory) 60%, #E6D9C3);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(42, 24, 18, 0.25);
}
.env[hidden] { display: none; }
.env-flap { position: absolute; inset: 0 0 auto 0; height: 55%; pointer-events: none;
  background: linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(42, 24, 18, 0.16) 50%, transparent calc(50% + 1px)) left / 50% 100% no-repeat,
              linear-gradient(to bottom left, transparent calc(50% - 1px), rgba(42, 24, 18, 0.16) 50%, transparent calc(50% + 1px)) right / 50% 100% no-repeat; }
.env-text {
  position: absolute; left: 7px; right: 26px; top: 6px; font: 0.6rem/1.25 var(--sans); color: var(--ink); opacity: 0.85;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.env-stamp {
  position: absolute; top: 5px; right: 5px; width: 17px; height: 20px; display: grid; place-items: center;
  font: italic 0.72rem/1 var(--serif); color: var(--brass-deep); background: #F7EBD2;
  outline: 1px dashed rgba(156, 107, 38, 0.6); outline-offset: -2px;
}
.env-seal { position: absolute; right: 6px; bottom: 5px; width: 15px; height: 15px; border-radius: 50%; border: 1px dashed rgba(42, 24, 18, 0.25); }
.env.decided .env-seal { border: 0; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4); }
.env-dest {
  position: absolute; left: 0; bottom: 0; max-width: calc(100% - 26px); padding: 2px 7px 2px 7px; border-radius: 0 6px 0 0;
  font: italic 0.74rem/1.1 var(--serif); color: var(--brass-hi); background: var(--ebony); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.env-dest:empty { display: none; }
.env.reading { box-shadow: 0 0 0 1px rgba(242, 203, 126, 0.8), 0 0 20px rgba(255, 220, 150, 0.55), 0 6px 12px rgba(0, 0, 0, 0.45); }
.env.yours { box-shadow: 0 0 0 2px var(--signal), 0 0 22px rgba(158, 194, 255, 0.6), 0 6px 12px rgba(0, 0, 0, 0.45); }
.env.to-desk .env-dest { color: var(--signal); }
.env.to-shred { filter: grayscale(0.7); }
.env.tamper::after { content: ""; position: absolute; left: -10px; top: 9px; width: 44px; height: 6px; transform: rotate(-38deg); background: repeating-linear-gradient(90deg, #D2483D 0 6px, #F3EBDC 6px 9px); opacity: 0.9; }

/* the injection callout */
.callout {
  position: absolute; z-index: 6; top: 12px; left: 150px; width: min(400px, calc(100% - 24px));
  padding: 0.75rem 0.95rem 0.8rem; border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, #2B1219, #170910); box-shadow: 0 0 0 1px var(--brass), 0 0 40px rgba(242, 203, 126, 0.3), 0 18px 30px rgba(0, 0, 0, 0.6);
}
.callout[hidden] { display: none; }
.callout.show { animation: callout 6.5s ease forwards; }
@keyframes callout { 0% { opacity: 0; transform: translateY(-8px) scale(0.96); } 6%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.callout-title { margin: 0; font: italic 1.45rem/1 var(--serif); color: var(--brass-hi); }
.callout-quote { margin: 0.35rem 0 0; font: italic 0.98rem/1.3 var(--serif); color: var(--text-dim); }
.callout-text { margin: 0.35rem 0 0; font-size: 0.86rem; color: var(--text); }

.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; margin: 0.7rem 0 1.6rem; color: var(--text-faint); font-size: 0.84rem; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 0.35rem; vertical-align: -1px; }
.legend-hint { margin-left: auto; }

/* ---------- cards ---------- */
.card {
  min-width: 0; padding: 1.1rem 1.2rem 1.2rem; border-radius: 14px;
  background: linear-gradient(180deg, #1B0A11, var(--ebony)); box-shadow: inset 0 0 0 1px var(--line);
}
.card-title { margin: 0 0 0.3rem; font: italic 400 1.6rem/1.1 var(--serif); color: var(--text); }
.card-sub { margin: 0 0 0.8rem; color: var(--text-faint); font-size: 0.86rem; }
.chart-help { margin: 0.5rem 0 0; color: var(--text-faint); font-size: 0.8rem; }

.below { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.2rem; margin-bottom: 1.2rem; }

/* your desk */
.desk-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.6rem; }
.desk-card button {
  width: 100%; height: 100%; display: grid; gap: 0.4rem; align-content: space-between; text-align: left; cursor: pointer;
  padding: 0.6rem 0.7rem; border: 0; border-radius: 6px; color: var(--ink);
  background: linear-gradient(180deg, #FBF5EA, var(--ivory)); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 6px 12px rgba(0, 0, 0, 0.4);
  transition: transform 160ms;
}
.desk-card button:hover { transform: translateY(-2px) rotate(-0.4deg); }
.desk-snip { font: italic 1rem/1.3 var(--serif); }
.desk-why { font-size: 0.76rem; color: var(--ink-soft); }
.desk-more { margin: 0.5rem 0 0; font-size: 0.85rem; }
.desk-empty { margin: 0; color: var(--text-faint); font: italic 1.15rem/1.35 var(--serif); }
.desk-held { display: grid; gap: 0.7rem; }
.desk-held-text {
  margin: 0; padding: 0.9rem 1rem; border-radius: 6px; color: var(--ink); font: italic 1.25rem/1.4 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere;
  background: linear-gradient(180deg, #FBF5EA, var(--ivory)); box-shadow: 0 0 0 2px var(--signal), 0 10px 24px rgba(0, 0, 0, 0.5);
}
.desk-held-help { margin: 0; color: var(--signal); font-size: 0.9rem; }
.desk-choices { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.desk-choice { padding: 0.4rem 0.85rem; font-size: 0.9rem; }
.desk-choice:hover { border-color: var(--signal); color: var(--text); }
.desk-choice.shred { border-style: dashed; }
.desk-feedback { margin: 0.7rem 0 0; min-height: 1.2em; font-size: 0.9rem; color: var(--text-dim); }
.desk-score { margin: 0.6rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-size: 0.88rem; color: var(--text-dim); border-top: 1px solid var(--line); padding-top: 0.7rem; }
.desk-score b { font-weight: 600; color: var(--text); margin-right: 0.3rem; }

/* inject */
.inject { display: grid; gap: 0.6rem; align-content: start; }
.inject-text {
  width: 100%; resize: vertical; min-height: 6.2rem; border: 0; border-radius: 4px 4px 12px 12px; padding: 0.7rem 0.9rem;
  font: italic 1.15rem/1.45 var(--serif); color: var(--ink); background: var(--ivory); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.inject-text::placeholder { color: var(--ink-soft); }
.inject-text:focus { outline: none; box-shadow: 0 0 0 3px var(--signal); }
.inject-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.inject-row .cues { margin: 0; }
.inject-status { margin: 0; min-height: 1.2em; color: var(--text-dim); font-size: 0.9rem; }
.inject-status b { color: var(--signal); font-weight: 600; }

/* ---------- the board ---------- */
.board {
  display: grid; gap: 1.2rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
  grid-template-areas: "cover cover live" "flow hist live" "cm cm fields" "rel pay ledger";
}
.c-auto { grid-area: cover; } .c-live { grid-area: live; } .c-flow { grid-area: flow; } .c-hist { grid-area: hist; }
.c-cm { grid-area: cm; } .c-fields { grid-area: fields; } .c-rel { grid-area: rel; } .c-pay { grid-area: pay; } .c-ledger { grid-area: ledger; }

.auto-sentence { margin: 0.2rem 0 0.6rem; font: italic 400 clamp(1.4rem, 2.6vw, 2rem)/1.2 var(--serif); color: var(--text-dim); }
.auto-sentence b { font-weight: 400; color: var(--brass-hi); }
.auto-sentence b + b, .auto-sentence b:nth-of-type(2) { color: var(--signal); }
.curve-svg { width: 100%; height: auto; display: block; touch-action: none; }
.curve-svg .grid, .tl-svg .grid, .rel-svg .grid { stroke: var(--line); stroke-width: 1; }
.curve-svg .tick, .tl-svg .tick, .rel-svg .tick { fill: var(--text-faint); font: 11px var(--sans); }
.curve-svg .line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.curve-svg .tested { fill: none; stroke-width: 1.6; stroke-dasharray: 7 6; opacity: 0.6; }
.curve-svg .cov { stroke: var(--brass-hi); }
.curve-svg .acc { stroke: var(--signal); }
.curve-svg .dot { stroke: var(--ebony); stroke-width: 2.5; }
.curve-svg .dot.cov { fill: var(--brass-hi); } .curve-svg .dot.acc { fill: var(--signal); }
.curve-svg .lab { font: italic 15px var(--serif); stroke: none; }
.curve-svg .lab.cov { fill: var(--brass-hi); } .curve-svg .lab.acc { fill: var(--signal); }
.curve-svg .marker { stroke: var(--ivory); stroke-width: 1.5; stroke-dasharray: 2 3; }
.curve-svg .hit { fill: transparent; cursor: ew-resize; }
.curve-svg .tip { pointer-events: none; }
.curve-svg .tip-line { stroke: var(--text-faint); stroke-width: 1; }
.curve-svg .tip-box { fill: #0C0406; stroke: var(--line-strong); }
.curve-svg .tip-t { fill: var(--text-faint); font: 11px var(--sans); }
.curve-svg .tip-v { fill: var(--text); font: 600 12px var(--sans); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 0.6rem; margin: 0.9rem 0 0; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.stat-row div, .gauges div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 0.15rem; }
.stat-row dt, .gauges dt { font-size: 0.76rem; color: var(--text-faint); line-height: 1.2; }
.stat-row dd, .gauges dd { margin: 0; font: 400 1.7rem/1 var(--serif); color: var(--text); }
.bench { margin: 0.8rem 0 0; font-size: 0.88rem; color: var(--text-dim); padding: 0.6rem 0.75rem; border-radius: 10px; background: rgba(212, 162, 76, 0.07); border: 1px solid rgba(212, 162, 76, 0.22); }
.bench b { color: var(--brass-hi); font-weight: 600; }
.bench:empty { display: none; }

.gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem 0.6rem; margin: 0.4rem 0 0.8rem; }
#g-flight { color: var(--brass-hi); }
.tl-svg { width: 100%; height: auto; display: block; }
.tl-svg .q-area { fill: rgba(212, 162, 76, 0.35); stroke: var(--brass); stroke-width: 1.2; }
.tl-svg .l-dot { fill: var(--signal); opacity: 0.75; }
.tl-svg .l-dot.yours { fill: #fff; opacity: 1; }
.tl-svg .lab { fill: var(--text-faint); font: italic 12px var(--serif); }

.hist-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; height: 150px; align-items: end; }
.hist-bar { position: relative; height: 100%; padding: 0; border: 0; background: rgba(241, 233, 218, 0.04); border-radius: 4px 4px 0 0; cursor: pointer; display: flex; align-items: flex-end; }
.hist-bar[disabled] { cursor: default; }
.hist-fill { display: block; width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--signal), rgba(158, 194, 255, 0.45)); transition: height 300ms; }
.hist-bar.p50 .hist-fill { background: linear-gradient(180deg, var(--brass-hi), var(--brass-deep)); }
.hist-bar:hover:not([disabled]) .hist-fill { filter: brightness(1.2); }
.hist-n { position: absolute; left: 0; right: 0; top: 2px; text-align: center; font-size: 0.7rem; color: var(--text-dim); }
.hist-axis { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; margin-top: 4px; }
.hist-axis span { font-size: 0.66rem; color: var(--text-faint); text-align: left; }

.cm-wrap { overflow-x: auto; padding-bottom: 4px; }
.cm { display: grid; grid-template-columns: minmax(6.5rem, 9rem) repeat(var(--n), minmax(30px, 48px)); gap: 3px; justify-content: start; }
.cm-corner { display: grid; align-content: end; font: italic 0.8rem/1.25 var(--serif); color: var(--text-faint); padding-bottom: 4px; }
.cm-col { position: relative; height: 4.6rem; }
.cm-col span { position: absolute; left: 50%; bottom: 4px; transform-origin: 0 50%; transform: rotate(-55deg); white-space: nowrap; font-size: 0.74rem; color: var(--text-dim); }
.cm-row { font-size: 0.8rem; color: var(--text-dim); align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 0.3rem; }
.cm-cell {
  aspect-ratio: 1; min-height: 30px; border: 0; border-radius: 5px; padding: 0; cursor: pointer; font: 600 0.8rem/1 var(--sans);
  background: rgba(241, 233, 218, 0.04); color: var(--text);
}
.cm-cell.diag { background: rgba(212, 162, 76, var(--a)); color: var(--ebony); }
.cm-cell.diag[disabled] { background: rgba(212, 162, 76, 0.07); }
.cm-cell.miss { background: rgba(242, 144, 127, var(--a)); color: var(--ebony); }
.cm-cell[disabled] { cursor: default; }
.cm-cell:hover:not([disabled]) { outline: 2px solid var(--ivory); outline-offset: 1px; }

.fields { display: grid; gap: 0.55rem; }
.fb-row { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) 2.8rem; gap: 0.6rem; align-items: center; }
.fb-label { font-size: 0.84rem; color: var(--text-dim); line-height: 1.15; }
.fb-track { position: relative; height: 10px; border-radius: 99px; background: rgba(241, 233, 218, 0.08); }
.fb-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--brass-deep), var(--brass-hi)); transition: width 400ms; }
.fb-bench { position: absolute; top: -4px; width: 2px; height: 18px; margin-left: -1px; background: var(--ivory); opacity: 0.7; border-radius: 1px; }
.fb-val { font: 400 1.15rem/1 var(--serif); color: var(--text); text-align: right; }

.rel-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; align-items: center; }
.rel-svg { width: 100%; height: auto; display: block; }
.rel-svg .ideal { stroke: var(--text-faint); stroke-dasharray: 3 4; }
.rel-svg .rel-dot { fill: rgba(158, 194, 255, 0.75); stroke: var(--ebony); stroke-width: 2; cursor: pointer; }
.rel-svg .rel-dot:hover { fill: var(--signal); }
.rel-text { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.rel-text b { color: var(--brass-hi); font: 400 1.2rem var(--serif); }

.pay-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.pay-inputs label { display: grid; gap: 0.3rem; font-size: 0.8rem; color: var(--text-faint); align-content: end; }
.pay-inputs input { padding: 0.5rem 0.7rem; font: 400 1.25rem/1 var(--serif); }
.pay-out { margin: 0.9rem 0 0; color: var(--text-dim); font-size: 0.92rem; }
.pay-out b { display: block; font: italic 400 2.1rem/1.1 var(--serif); color: var(--brass-hi); margin-bottom: 0.2rem; }

.c-live { padding: 0; background: none; box-shadow: none; display: grid; gap: 0.6rem; align-content: start; }
.c-live .inspector { min-height: 100%; }
.c-live .facts .fact.wide { font: italic 1.02rem/1.35 var(--serif); }
.c-live .keys .key-body { height: 92px; }
.c-live .keys .key-pct { font-size: 0.8rem; bottom: 0.4rem; }
.c-live .keys .key-name, .so-drawer .keys.vertical .key-name { font-size: 0.72rem; writing-mode: vertical-rl; transform: rotate(180deg); height: 6.4rem; justify-self: center; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-live .keys { gap: 3px; }
.lv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 0.8rem; align-items: start; margin-top: 0.8rem; }
.lv-dial .dial svg { max-width: 170px; }
.lv-dial .dial-caption b { font-size: 1.4rem; }
.stops-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem 0.4rem; }
.stops-mini .knob { width: 44px; height: 44px; box-shadow: 0 0 0 3px #2A161C, 0 0 0 4px rgba(241, 233, 218, 0.15), inset 0 -3px 6px rgba(0, 0, 0, 0.18); }
.stops-mini .knob::after { inset: 6px; }
.stops-mini .knob b { font-size: 0.82rem; }
.stops-mini .stop.on .knob { transform: scale(1.06); box-shadow: 0 0 0 3px var(--brass), 0 0 0 4px var(--brass-hi), 0 0 18px rgba(242, 203, 126, 0.4); }
.stops-mini .stop-label { font-size: 0.74rem; }
.lv-more { margin: 0.6rem 0 0; font-size: 0.82rem; color: var(--text-faint); }
.c-live .register-name { font-size: 1rem; margin-top: 0.35rem; }
#live-open { justify-self: start; }

.ledger { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ledger li { font-size: 0.86rem; color: var(--text-dim); min-width: 0; }
.ledger-item { width: 100%; display: grid; grid-template-columns: 6.6rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: baseline; text-align: left; padding: 0.3rem 0.4rem; border: 0; border-radius: 6px; background: none; color: inherit; cursor: pointer; font-size: 0.84rem; }
.ledger-item:hover { background: rgba(241, 233, 218, 0.05); }
.ledger-item.yours { box-shadow: inset 2px 0 0 var(--signal); }
.lg-where { font: italic 1rem/1.1 var(--serif); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger q { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-faint); }
.lg-meta { white-space: nowrap; color: var(--text-dim); }
.ledger .who { font-weight: 600; color: var(--signal); }
.to-desk { color: var(--signal); } .to-shred { color: var(--text-faint); }

/* ---------- the letter drawer ---------- */
.so-drawer .drawer-body { display: grid; gap: 0.8rem; align-content: start; }
.so-drawer .drawer-body > * { margin: 0; }
.dr-sub { color: var(--text-dim); }
.dr-letter {
  padding: 0.9rem 1rem; border-radius: 6px; color: var(--ink); font: italic 1.2rem/1.45 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere;
  background: linear-gradient(180deg, #FBF5EA, var(--ivory)); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}
.dr-letter.yours { box-shadow: 0 0 0 2px var(--signal), 0 10px 24px rgba(0, 0, 0, 0.5); }
.dr-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag { font-size: 0.76rem; padding: 0.12rem 0.55rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-dim); }
.tag.yours { border-color: var(--signal); color: var(--signal); }
.tag.warn { border-color: rgba(242, 144, 127, 0.6); color: var(--danger); }
.dr-pass { display: grid; gap: 0.1rem; }
.dr-pass b { font: italic 400 1.5rem/1.1 var(--serif); color: var(--brass-hi); }
.dr-pass span { color: var(--text-faint); font-size: 0.84rem; }
.dr-route { color: var(--text); font-size: 0.92rem; }
.dr-check { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.dr-check th { text-align: left; font-weight: 500; color: var(--text-faint); font-size: 0.76rem; padding: 0 0.4rem 0.3rem 0; }
.dr-check td { padding: 0.3rem 0.4rem 0.3rem 0; border-top: 1px solid var(--line); color: var(--text-dim); vertical-align: top; }
.dr-check td:last-child { font-weight: 600; text-align: right; }
.dr-check .near { color: var(--brass); }
.so-drawer .inspector { padding: 0.9rem; }
.so-drawer .key-body { height: 86px; }
.so-drawer .key-pct { font-size: 0.82rem; bottom: 0.4rem; }
.so-drawer .key-name { font-size: 0.68rem; }
.so-drawer .keys { gap: 3px; }
.dr-reg + .dr-reg { margin-top: 0.9rem; }
.dr-reg .register-name { margin: 0 0 0.4rem; font-size: 1.05rem; }
.dr-score .dial svg { max-width: 200px; }
.so-drawer .stops { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem 0.4rem; }
.so-drawer .knob { width: 48px; height: 48px; box-shadow: 0 0 0 3px #2A161C, 0 0 0 4px rgba(241, 233, 218, 0.15), inset 0 -3px 6px rgba(0, 0, 0, 0.18); }
.so-drawer .knob::after { inset: 6px; }
.so-drawer .knob b { font-size: 0.85rem; }
.so-drawer .stop.on .knob { box-shadow: 0 0 0 3px var(--brass), 0 0 0 4px var(--brass-hi), 0 0 18px rgba(242, 203, 126, 0.4); }
.so-drawer .stop-label { font-size: 0.74rem; }
.dr-back { justify-self: start; }
.dr-list { list-style: none; padding: 0; display: grid; gap: 0.45rem; }
.dr-item { width: 100%; display: grid; gap: 0.3rem; text-align: left; padding: 0.6rem 0.75rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(241, 233, 218, 0.03); color: inherit; cursor: pointer; }
.dr-item:hover { border-color: var(--brass); }
.dr-snip { font: italic 1.02rem/1.3 var(--serif); color: var(--text); }
.dr-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; font-size: 0.8rem; color: var(--text-dim); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .m-top { grid-template-columns: 130px minmax(40px, 1fr) 220px 200px; }
  .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "cover cover" "live flow" "live hist" "cm cm" "fields rel" "pay ledger"; }
}
@media (max-width: 1000px) {
  .so-top { grid-template-columns: 1fr; }
  .pass { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; padding: 0.8rem 0 0; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .machine { --env-w: 104px; --env-h: 50px; }
  .m-top { grid-template-columns: 110px minmax(30px, 1fr) 200px; grid-template-areas: "hopper belt station" "side side side"; }
  .hopper { grid-area: hopper; } .belt { grid-area: belt; } .station { grid-area: station; }
  .side { grid-area: side; grid-template-columns: 1fr 1fr; padding-top: 0.8rem; }
  .desk, .shredder { grid-template-columns: 1fr auto; align-items: center; justify-items: stretch; gap: 0.7rem; }
  .desk-tray, .shred-mouth { height: 52px; }
  .shred-mouth { padding-top: 8px; }
  .hopper-bin { width: 100px; }
  .station-desk { width: 190px; }
  .lamp-beam { width: 200px; }
  .chutes { grid-template-columns: repeat(min(var(--n), 4), minmax(0, 1fr)); row-gap: 0.9rem; }
  .chute-well { height: 90px; }
  .below { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr; grid-template-areas: "cover" "live" "flow" "hist" "cm" "fields" "rel" "pay" "ledger"; }
  .legend-hint { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 560px) {
  .machine { --env-w: 84px; --env-h: 44px; padding: 0.8rem 0.7rem 0.9rem; border-radius: 14px; }
  .m-top { grid-template-columns: 76px minmax(10px, 1fr) 156px; gap: 0 0.5rem; }
  .hopper, .belt { padding-top: 26px; } .belt { margin-top: 26px; padding-top: 0; }
  .hopper-bin { width: 74px; height: 74px; }
  .belt { height: 74px; }
  .lamp { height: 26px; }
  .lamp-head { width: 52px; height: 16px; }
  .lamp-beam { width: 150px; top: 14px; }
  .station-desk { width: 150px; height: 74px; }
  .m-label { font-size: 0.76rem; }
  .m-label b { font-size: 1.15rem; }
  .station-sub { display: none; }
  .side { gap: 0.5rem; }
  .side-text { flex-direction: column; gap: 0; font-size: 0.74rem; line-height: 1.1; }
  .desk-tray, .shred-mouth { height: 44px; }
  .chutes { gap: 0.35rem; }
  .chute-well { height: 70px; width: 80%; }
  .chute-mouth { height: 12px; }
  .chute-n { font-size: 1.25rem; }
  .chute-name { font-size: 0.7rem; }
  .env-text { font-size: 0.5rem; -webkit-line-clamp: 2; right: 22px; }
  .env-stamp { width: 14px; height: 16px; font-size: 0.6rem; }
  .env-seal { width: 12px; height: 12px; }
  .env-dest { font-size: 0.64rem; }
  .callout { position: relative; left: auto; top: auto; width: auto; margin-top: 0.9rem; }
  .pack { font-size: 1rem; padding: 0.35rem 0.75rem; }
  .packs { gap: 0.35rem; }
  .cm { grid-template-columns: 5.2rem repeat(var(--n), minmax(26px, 40px)); }
  .cm-cell { min-height: 26px; }
  .fig span { max-width: 7rem; font-size: 0.82rem; }
  .fig-lead { flex-basis: 100%; }
  .ctrl-buttons .primary { min-width: 0; flex: 1 1 100%; }
  .slider { max-width: none; }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rel-wrap { grid-template-columns: 1fr; }
  .rel-svg { max-width: 240px; }
  .pay-inputs { grid-template-columns: 1fr; }
  .fb-row { grid-template-columns: minmax(6rem, 8rem) minmax(0, 1fr) 2.6rem; }
  .ledger-item { grid-template-columns: 5.4rem minmax(0, 1fr) auto; }
  .card { padding: 0.95rem 0.9rem 1rem; }
  .so-drawer .stops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cm { grid-template-columns: 5.6rem repeat(var(--n), minmax(28px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .belt-track, .busy i, .station.on .station-desk::after, .machine.holding .chute .chute-well, .machine.holding .shred-mouth { animation: none !important; }
  .callout.show { animation: none; }
  .shredder.chew .shred-mouth i { animation: none; }
  .gate, .hopper-pile, .chute-stack, .desk-pile, .hist-fill, .fb-fill, .desk-card button { transition: none; }
}
