:root {
  color-scheme: dark;
  --black: #050706;
  --ink: #0b0e0c;
  --steel: #252925;
  --steel-light: #3b403a;
  --cream: #d8d3bd;
  --paper: #c9c1a0;
  --paper-ink: #24251f;
  --red: #9c2b25;
  --red-bright: #e04a3f;
  --green: #779176;
  --amber: #ba9f68;
  --line: rgba(218, 214, 192, .19);
  --white-mask: url("svg/white-1.svg");
  --iris-mask: url("svg/iris-round.svg");
  --pupil-mask: url("svg/pupil-round.svg");
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  background: #050706;
  color: var(--cream);
  font-family: "Arial Narrow", "Roboto Condensed", "DIN Condensed", Arial, sans-serif;
  letter-spacing: .08em;
}

button { font: inherit; }

button:focus-visible {
  outline: 2px solid #f0d68c;
  outline-offset: 4px;
}

.facility {
  position: relative;
  min-height: 100vh;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 38px);
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 48% 32%, rgba(78, 86, 72, .13), transparent 34%),
    linear-gradient(100deg, transparent 0 48%, rgba(255,255,255,.012) 48.2% 48.4%, transparent 48.6%),
    #0a0d0b;
  isolation: isolate;
}

.facility-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .24;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.018) 4px),
    radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,.72) 100%);
}

.topbar, .status-rail, .footer-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow, .modal-code, .paper-code {
  margin: 0 0 5px;
  color: #85897b;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .22em;
}

h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 800;
  letter-spacing: .19em;
}

.sound-button {
  min-width: 106px;
  padding: 9px 11px;
  border: 1px solid #494d46;
  background: #161916;
  color: #a9ab9e;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .15em;
  cursor: pointer;
}

.sound-light, .decision-light {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #433a34;
  box-shadow: inset 0 0 2px #000;
}

.sound-button[aria-pressed="true"] .sound-light {
  background: #849879;
  box-shadow: 0 0 8px rgba(153, 192, 132, .65);
}

.status-rail {
  margin: 20px 0 13px;
  border-block: 1px solid var(--line);
  background: rgba(0,0,0,.22);
}

.status-cell {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 12px;
  padding: 10px 13px;
  border-right: 1px solid var(--line);
}

.status-cell:last-child { border: 0; justify-content: flex-end; }
.status-cell--center { justify-content: center; }
.status-cell span { color: #7f8278; font-size: .62rem; font-weight: 700; }
.status-cell strong { font-family: Consolas, monospace; font-size: .92rem; letter-spacing: .08em; }
.status-cell--timer strong { min-width: 4.5ch; color: #ddd5bd; font-size: 1.12rem; }
.status-cell--timer.is-low {
  background: linear-gradient(90deg, transparent, rgba(112, 20, 17, .22));
}
.status-cell--timer.is-low span { color: #c36057; font-weight: 900; }
.status-cell--timer.is-low strong {
  color: #ff5b4e;
  font-size: 1.35rem;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(224, 48, 38, .65);
  animation: timer-pulse 1s steps(2) infinite;
}
.status-cell--timer.is-critical strong {
  color: #ff3025;
  transform: scale(1.08);
  animation-duration: .5s;
}

.machine {
  position: relative;
  padding: clamp(14px, 2vw, 25px);
  border: 1px solid #373b36;
  box-shadow: inset 0 0 0 4px #161916, 0 18px 45px rgba(0,0,0,.45);
  background:
    linear-gradient(115deg, transparent 0 49%, rgba(255,255,255,.025) 49.2% 49.5%, transparent 49.7%),
    #242823;
}

.machine::before {
  content: "";
  position: absolute;
  inset: 7px;
  pointer-events: none;
  border: 1px solid rgba(0,0,0,.7);
}

.machine-label {
  position: absolute;
  top: 5px;
  color: #686d64;
  font: 700 .48rem/1.35 Consolas, monospace;
  letter-spacing: .16em;
}
.machine-label--left { left: 13px; }
.machine-label--right { right: 13px; text-align: right; }

.chamber {
  position: relative;
  height: clamp(230px, 34vw, 390px);
  overflow: hidden;
  border: 10px solid #111411;
  border-inline-width: clamp(10px, 2vw, 22px);
  background: #010202;
  box-shadow: inset 0 0 60px #000, 0 0 0 1px #4b4f48;
  touch-action: none;
  cursor: crosshair;
}

.chamber-depth {
  position: absolute;
  inset: 0;
  opacity: .5;
  background:
    radial-gradient(ellipse at center, rgba(38,43,36,.27) 0, rgba(3,4,3,.18) 32%, #000 77%),
    linear-gradient(90deg, rgba(255,255,255,.015), transparent 17% 83%, rgba(255,255,255,.015));
}

.eyes {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(35px, 8vw, 105px);
  z-index: 3;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .6s ease .2s, transform .6s ease .2s;
}

.chamber.is-open .eyes { opacity: 1; transform: translateY(0); }

.eye {
  position: relative;
  width: clamp(116px, 20vw, 230px);
  aspect-ratio: 2.03 / 1;
  filter: drop-shadow(0 0 5px rgba(213, 197, 165, .08));
}

.eye--right { transform: scaleX(-1); }

.eye-shape {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #c9c7bd;
  -webkit-mask: var(--white-mask) center / contain no-repeat;
  mask: var(--white-mask) center / contain no-repeat;
}

.eye-shape--yellowed {
  background: #b9ac73;
  box-shadow: inset 0 0 18px rgba(111, 66, 23, .24);
}

.eye-shape--yellowed .veins {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: .38;
  background:
    linear-gradient(15deg, transparent 0 22%, #813f39 23% 23.7%, transparent 24.5%) 0 10% / 48% 38% no-repeat,
    linear-gradient(-12deg, transparent 0 28%, #813f39 29% 29.7%, transparent 30.5%) 100% 72% / 52% 42% no-repeat,
    linear-gradient(168deg, transparent 0 37%, #7d3b36 38% 38.6%, transparent 39.5%) 0 90% / 42% 45% no-repeat;
}

.eye-shape--drift-x { animation: whole-eye-drift-x 5.5s ease-in-out infinite; }
.eye-shape--drift-y { animation: whole-eye-drift-y 6.2s ease-in-out infinite; }
.eye-shape--rotate { animation: whole-eye-rotate 7s ease-in-out infinite; }

.gaze {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--iris-size, 45%);
  aspect-ratio: 1;
  transform: translate(calc(-50% + var(--gx, 0px)), calc(-50% + var(--gy, 0px)));
  transition: transform 80ms linear;
  z-index: 2;
}

.iris {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
  background: var(--iris-color, #695140);
  -webkit-mask: var(--iris-mask) center / contain no-repeat;
  mask: var(--iris-mask) center / contain no-repeat;
  transition: background-color .9s ease;
}

.pupil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50%;
  height: 68%;
  transform: translate(-50%, -50%);
  transform-origin: center;
  background: #10110f;
  -webkit-mask: var(--pupil-mask) center / contain no-repeat;
  mask: var(--pupil-mask) center / contain no-repeat;
}

.pupil.is-rotating {
  animation: pupil-quarter-turn 10s linear alternate infinite;
}

.eye-glint {
  position: absolute;
  left: 28%;
  top: 23%;
  width: 11%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,.48);
  filter: blur(.2px);
  pointer-events: none;
}

.lid {
  position: absolute;
  z-index: 4;
  background: #020302;
  pointer-events: none;
}
.lid--top, .lid--bottom { left: -3%; width: 106%; height: 55%; }
.lid--top { top: -5%; transform: translateY(-100%); }
.lid--bottom { bottom: -5%; transform: translateY(100%); }
.lid--left, .lid--right { top: -4%; width: 54%; height: 108%; }
.lid--left { left: -4%; transform: translateX(-100%); }
.lid--right { right: -4%; transform: translateX(100%); }

.eye.blink-vertical .lid--top { animation: lid-top .32s ease-in-out; }
.eye.blink-vertical .lid--bottom { animation: lid-bottom .32s ease-in-out; }
.eye.blink-side .lid--left { animation: lid-left .42s ease-in-out; }
.eye.blink-side .lid--right { animation: lid-right .42s ease-in-out; }
.eye.blink-bottom .lid--bottom { animation: lid-bottom-full .44s ease-in-out; }
.eye.eye-roll .gaze { animation: eye-roll 1.2s ease-in-out; }
.eye.eye-wander .gaze { animation: eye-wander 3.8s ease-in-out infinite; }
.eyes.is-flickering { animation: eye-flicker 1.2s steps(1, end); }

.hidden-eyes {
  position: absolute;
  left: 53%;
  top: 20%;
  z-index: 2;
  display: flex;
  gap: 21px;
  opacity: 0;
  transform: scale(.65);
}

.hidden-eyes.is-visible { animation: hidden-reveal .62s steps(2, end); }

.tiny-eye {
  position: relative;
  display: block;
  width: 23px;
  height: 18px;
  background: #aaa99c;
  -webkit-mask: url("svg/white-small-2.svg") center / contain no-repeat;
  mask: url("svg/white-small-2.svg") center / contain no-repeat;
}
.tiny-eye--right { transform: scaleX(-1); }
.tiny-eye i {
  position: absolute;
  left: 50%; top: 50%;
  width: 7px; height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #090a08;
}

.flash-wash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background: #e9ebdf;
  mix-blend-mode: screen;
}
.flash-wash.is-flashing { animation: flash .22s ease-out; }

.pupil-filter {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  transform: translateY(-106%);
  border: 3px solid rgba(99, 133, 124, .62);
  border-top-width: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(187, 230, 207, .025) 0 2px, transparent 3px 9px),
    linear-gradient(rgba(62, 107, 97, .16), rgba(21, 56, 49, .24));
  box-shadow: 0 8px 18px rgba(0,0,0,.75), inset 0 0 45px rgba(72, 150, 130, .1);
  transition: transform 5s cubic-bezier(.3,.05,.55,1);
}
.pupil-filter::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .26;
  background: repeating-linear-gradient(0deg, transparent 0 4px, rgba(117, 185, 165, .2) 5px);
}
.pupil-filter span {
  position: absolute;
  right: 9px;
  top: 7px;
  color: rgba(158, 205, 190, .5);
  font: 700 .48rem Consolas, monospace;
  letter-spacing: .16em;
}
.pupil-filter.is-lowering,
.pupil-filter.is-down { transform: translateY(0); }
.pupil-filter.is-rising { transform: translateY(-106%); transition-duration: .28s; }

.shutter {
  position: absolute;
  left: 0;
  z-index: 8;
  width: 100%;
  height: 51%;
  background: linear-gradient(#333831, #181b18 55%, #292d28);
  transition: transform .72s cubic-bezier(.66,.05,.25,1);
  box-shadow: 0 0 13px #000;
}
.shutter--top { top: 0; border-bottom: 4px solid #090a09; }
.shutter--bottom { bottom: 0; border-top: 4px solid #41463f; }
.chamber.is-open .shutter--top { transform: translateY(-91%); }
.chamber.is-open .shutter--bottom { transform: translateY(91%); }
.shutter-ribs {
  position: absolute;
  inset: 0;
  opacity: .55;
  background: repeating-linear-gradient(0deg, transparent 0 14px, #0c0e0c 15px 17px, rgba(255,255,255,.06) 18px);
}

.scanline {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: .18;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.32) 4px);
}

.chamber-message {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 10;
  margin: 0;
  transform: translate(-50%, -50%);
  color: #8d9185;
  font: 700 clamp(.65rem, 1.4vw, .85rem) Consolas, monospace;
  letter-spacing: .23em;
  white-space: nowrap;
  transition: opacity .2s;
}
.chamber.is-open .chamber-message { opacity: 0; }

.subject-strip {
  display: flex;
  align-items: baseline;
  padding: 13px 6px 0;
  font: 700 .7rem Consolas, monospace;
  color: #858a7e;
}
.subject-strip strong { margin-left: 10px; color: var(--cream); font-size: 1.1rem; }
.subject-strip__instruction { margin-left: auto; color: #73796f; letter-spacing: .17em; }

.workbench {
  display: grid;
  grid-template-columns: minmax(235px, 1fr) minmax(250px, .85fr) minmax(235px, 1fr);
  align-items: start;
  gap: clamp(15px, 3vw, 38px);
  padding: 26px clamp(2px, 2vw, 18px) 18px;
}

.rules-plate {
  position: relative;
  padding: 17px 20px 14px;
  border: 1px solid #565a50;
  background: #292d27;
  box-shadow: inset 0 0 13px #121411, 4px 7px 14px rgba(0,0,0,.28);
  transform: rotate(.35deg);
}

.rules-plate h2, .exception-paper h2 {
  margin: 0 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid currentColor;
  font-size: .78rem;
  letter-spacing: .19em;
}

.rule-equation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 13px;
  color: #cbc6b2;
  font-size: .64rem;
}
.rule-equation span { color: #777c71; }
.rule-equation b { color: #e07167; }
.rule-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.rule-columns h3 { margin: 0 0 6px; color: #b6ad8f; font-size: .61rem; }
.rule-columns p { margin: 4px 0; color: #85897d; font-size: .53rem; font-weight: 700; letter-spacing: .09em; }
.rules-plate small { display: block; margin-top: 13px; color: #666b62; font-size: .5rem; text-align: center; }
.screw { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #0c0e0c; box-shadow: 0 0 0 1px #555a50; }
.screw--tl { top: 7px; left: 7px; }.screw--tr { top: 7px; right: 7px; }

.controls { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.name-button, .flash-button, .filter-button, .equipment-button, .decision, .start-button {
  position: relative;
  border: 1px solid #555a50;
  background: #252923;
  color: #d6d1bd;
  font-weight: 900;
  letter-spacing: .17em;
  cursor: pointer;
  box-shadow: inset 0 0 0 3px #171a17, 0 4px 0 #090a09;
  transition: transform .08s, filter .15s;
}
.name-button {
  min-height: 44px;
  border-color: #5c5541;
  color: #c1b68f;
}
.name-button kbd { position: absolute; right: 8px; bottom: 6px; color: #6f746b; font: .5rem Consolas, monospace; }
.flash-button, .filter-button { display: flex; align-items: center; justify-content: center; gap: 12px; }
.flash-button { min-height: 58px; }
.flash-icon { color: #d1bc80; font-size: 1.2rem; }
.filter-button { min-height: 48px; border-color: #3f5d56; color: #88aaa0; font-size: .68rem; }
.filter-button::before {
  content: "";
  position: absolute;
  inset: 3px;
  width: var(--filter-progress, 0%);
  max-width: calc(100% - 6px);
  z-index: 0;
  background: rgba(67, 119, 105, .22);
}
.filter-button > * { position: relative; z-index: 1; }
.filter-icon { width: 13px; height: 9px; border: 1px solid #6e9388; background: rgba(77, 131, 116, .22); }
.flash-button kbd, .filter-button kbd, .decision kbd { position: absolute; right: 8px; bottom: 6px; color: #6f746b; font: .5rem Consolas, monospace; }
.decision-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.decision { min-height: 58px; }
.decision--deny { border-color: #6c3733; color: #d4776d; }
.decision--admit { border-color: #3f5e43; color: #93af8e; }
.decision--deny .decision-light { background: #762a26; }
.decision--admit .decision-light { background: #3c653f; }
.equipment-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.equipment-button { min-height: 39px; color: #8a8d81; font-size: .58rem; }
.equipment-button small { display: block; margin-top: 3px; color: #64695f; font-size: .45rem; }
.name-button:hover:not(:disabled), .flash-button:hover:not(:disabled), .filter-button:hover:not(:disabled), .equipment-button:hover:not(:disabled), .decision:hover:not(:disabled), .start-button:hover { filter: brightness(1.25); }
.name-button:active:not(:disabled), .flash-button:active:not(:disabled), .filter-button:active:not(:disabled), .equipment-button:active:not(:disabled), .decision:active:not(:disabled), .start-button:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px #171a17, 0 1px 0 #090a09; }
button:disabled { opacity: .32; cursor: not-allowed; filter: grayscale(.7); }
.control-note { margin: 2px 0 0; color: #5f645c; font-size: .48rem; font-weight: 700; text-align: center; line-height: 1.5; }

.dossier-stack { display: grid; gap: 17px; min-width: 0; }

.roster-paper,
.exception-paper {
  position: relative;
  min-height: 185px;
  padding: 25px 22px 16px;
  color: var(--paper-ink);
  background:
    linear-gradient(93deg, rgba(0,0,0,.05), transparent 12% 80%, rgba(88,67,34,.08)),
    var(--paper);
  box-shadow: 5px 7px 15px rgba(0,0,0,.42);
  transform: rotate(-1.1deg);
}
.roster-paper { transform: rotate(.5deg); background: #b7b49b; }
.exception-paper { transform: rotate(-1.1deg); }
.roster-paper::after, .exception-paper::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .14; background: repeating-linear-gradient(0deg, transparent 0 18px, #665f48 19px); }
.tape { position: absolute; top: -11px; left: 50%; z-index: 2; width: 82px; height: 25px; transform: translateX(-50%) rotate(2deg); background: rgba(182,172,131,.58); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.paper-code { color: #68634f; font-size: .48rem; }
.roster-paper h2, .exception-paper h2 { font-family: "Courier New", monospace; margin: 0 0 10px; padding-bottom: 7px; border-bottom: 1px solid currentColor; font-size: .78rem; letter-spacing: .19em; }
.roster-paper { color: var(--paper-ink); }
.roster-list { position: relative; z-index: 1; display: grid; gap: 3px; }
.roster-row { display: grid; grid-template-columns: 2ch 1fr auto; gap: 8px; align-items: baseline; font: 700 .61rem/1.2 "Courier New", monospace; }
.roster-row i { color: #6e6a56; font-size: .45rem; font-style: normal; }
.roster-row--cleared strong, .roster-row--cleared i { color: #46654c; text-decoration: line-through; }
.roster-row--missed strong, .roster-row--missed i,
.roster-row--deceased strong, .roster-row--deceased i { color: #8d332d; }
.exception-list { position: relative; z-index: 1; display: grid; gap: 5px; font: 700 .66rem/1.25 "Courier New", monospace; letter-spacing: .04em; }
.exception-row { display: grid; grid-template-columns: 3ch 1fr; gap: 13px; }
.exception-row span:first-child { border-bottom: 1px solid rgba(30,30,25,.32); }
.exception-row--name { grid-template-columns: minmax(7ch, .8fr) 1.4fr; gap: 7px; font-size: .52rem; }
.paper-stamp { position: absolute; right: 13px; bottom: 7px; margin: 0; border: 2px solid rgba(112,33,29,.52); color: rgba(112,33,29,.55); font: 900 .67rem Arial, sans-serif; padding: 3px 5px; transform: rotate(-8deg); }

.footer-line { padding-top: 14px; border-top: 1px solid var(--line); color: #555a52; font: 700 .54rem Consolas, monospace; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  visibility: hidden;
  opacity: 0;
  background: rgba(2,3,2,.92);
  transition: opacity .35s, visibility .35s;
}
.modal.is-visible { visibility: visible; opacity: 1; }
.modal-card { width: min(440px, 100%); padding: clamp(28px, 6vw, 52px); border: 1px solid #464b43; background: #111411; box-shadow: 0 0 80px #000, inset 0 0 40px rgba(0,0,0,.4); text-align: center; }
.modal-card h2 { margin: 8px 0 30px; font-size: clamp(1.8rem, 7vw, 3rem); letter-spacing: .2em; }
.intro-readout { width: fit-content; margin: 0 auto 25px; color: #a4a596; font: 700 .8rem/1.8 Consolas, monospace; text-align: left; }
.intro-readout p { margin: 0; }
.intro-command { margin: 0 0 18px; color: #d5cba8; font-size: .82rem; font-weight: 900; letter-spacing: .25em; }
.start-button { width: 100%; min-height: 58px; }
.start-note { margin: 16px 0 0; color: #61665d; font-size: .48rem; }

.end-card { width: min(560px, 100%); }
.end-card h2 { margin-bottom: 24px; font-size: clamp(1.35rem, 6vw, 2.2rem); }
.result-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 22px; margin: 0 auto 24px; padding: 17px; border-block: 1px solid #343832; color: #909488; font: 700 .72rem Consolas, monospace; text-align: left; }
.result-grid strong { color: #d3cfba; text-align: right; }
.missed-evidence {
  margin: -10px 0 23px;
  padding: 12px 14px;
  border: 1px solid rgba(166, 61, 53, .52);
  background: rgba(86, 21, 18, .18);
  color: #d27b72;
  font: 700 .65rem/1.55 Consolas, monospace;
  letter-spacing: .11em;
  text-align: left;
}
.missed-evidence strong { display: block; color: #9eaaa0; font-size: .52rem; letter-spacing: .17em; }
.missed-evidence strong:not(:first-child) { margin-top: 10px; }
.missed-evidence p { margin: 3px 0 0; }
.end-verdict { margin: 0 0 24px; color: #8dab88; font-weight: 900; letter-spacing: .23em; }
.end-modal.is-failure .end-verdict, .end-modal.is-failure h2 { color: #c5574e; }

.shop { margin: 0 0 22px; padding: 14px; border: 1px solid #363a34; background: #0d0f0d; }
.shop-heading { display: flex; justify-content: space-between; margin-bottom: 10px; color: #888d81; font: 700 .6rem Consolas, monospace; }
.shop-heading strong { color: #c8bea0; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-grid button { min-height: 48px; border: 1px solid #43483f; background: #1b1e1a; color: #aaa99b; font: 800 .58rem Arial, sans-serif; letter-spacing: .11em; cursor: pointer; }
.shop-grid button small { display: block; margin-top: 4px; color: #777b70; font: .44rem Consolas, monospace; }
.shop-grid button:disabled { opacity: .35; }
.shop > p { margin: 10px 0 0; color: #666b61; font: .48rem/1.4 Consolas, monospace; }

.subtitle {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 70;
  width: min(680px, calc(100% - 32px));
  min-height: 42px;
  padding: 12px 18px;
  transform: translate(-50%, 14px);
  opacity: 0;
  border: 1px solid rgba(198, 193, 168, .25);
  background: rgba(2, 3, 2, .9);
  color: #ded9c5;
  font: 700 .76rem/1.4 Consolas, monospace;
  letter-spacing: .14em;
  text-align: center;
  pointer-events: none;
  transition: opacity .16s, transform .16s;
}
.subtitle.is-visible { opacity: 1; transform: translate(-50%, 0); }

.pupil.pupil-twitch { animation: pupil-twitch 6.5s steps(1, end) infinite; }
.pupil-filter.is-medicated { background-color: rgba(76, 128, 96, .28); }
.campaign-goal { margin: -6px 0 18px; color: #8c8060; font: 700 .56rem Consolas, monospace; }
.end-modal { overflow-y: auto; align-items: start; }
.end-card { margin: 20px auto; }

.breach {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  visibility: hidden;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  overflow: hidden;
  background: #000;
}
.breach.is-visible { visibility: visible; animation: breach-in 2.6s forwards; }
.breach-eyes { display: flex; gap: clamp(28px, 8vw, 100px); opacity: 0; filter: contrast(1.2) brightness(.8) drop-shadow(0 0 14px rgba(116,21,18,.2)); animation: apparition 2.4s .35s forwards; }
.breach-eyes .eye { width: clamp(130px, 24vw, 260px); }
.breach-smile { width: clamp(180px, 34vw, 370px); height: auto; margin-top: clamp(15px, 4vh, 35px); opacity: 0; filter: brightness(.62) contrast(1.5) drop-shadow(0 0 11px rgba(115, 15, 12, .55)); animation: smile-in 1.7s 1s forwards; }
.breach-copy { margin-top: clamp(25px, 5vh, 50px); opacity: 0; color: #bb342c; text-align: center; animation: copy-in .3s 2.1s forwards; }
.breach-copy p { margin: 0 0 8px; font-size: clamp(1rem, 3vw, 1.6rem); font-weight: 900; letter-spacing: .28em; }
.breach-copy small { color: #74605c; font: 700 .62rem Consolas, monospace; letter-spacing: .15em; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@keyframes lid-top { 0%,100% { transform: translateY(-100%); } 47%,53% { transform: translateY(0); } }
@keyframes lid-bottom { 0%,100% { transform: translateY(100%); } 47%,53% { transform: translateY(0); } }
@keyframes lid-left { 0%,100% { transform: translateX(-100%); } 45%,58% { transform: translateX(0); } }
@keyframes lid-right { 0%,100% { transform: translateX(100%); } 45%,58% { transform: translateX(0); } }
@keyframes lid-bottom-full { 0%,100% { transform: translateY(100%); } 45%,58% { transform: translateY(-2%); } }
@keyframes pupil-quarter-turn {
  from { transform: translate(-50%, -50%) rotate(0deg) scaleX(.78); }
  to { transform: translate(-50%, -50%) rotate(90deg) scaleX(.78); }
}
@keyframes pupil-twitch {
  0%,42%,46%,100% { margin-left: 0; margin-top: 0; }
  43% { margin-left: 7px; margin-top: -2px; }
  44% { margin-left: -5px; margin-top: 3px; }
  45% { margin-left: 3px; margin-top: 0; }
}
@keyframes whole-eye-drift-x { 0%,100% { transform: translateX(-2px); } 50% { transform: translateX(14px); } }
@keyframes whole-eye-drift-y { 0%,100% { transform: translateY(-2px); } 50% { transform: translateY(13px); } }
@keyframes whole-eye-rotate { 0%,100% { transform: rotate(-1deg); } 50% { transform: rotate(9deg); } }
@keyframes iris-drift-slow {
  0%,100% { transform: translate(0, 0); }
  50% { transform: translate(28%, -16%); }
}
@keyframes iris-drift-momentary {
  0%,43%,58%,100% { transform: translate(0, 0); }
  47% { transform: translate(-34%, 20%); }
  52% { transform: translate(24%, -14%); }
}
@keyframes eye-roll { 0%,100% { transform: translate(calc(-50% + var(--gx, 0px)), calc(-50% + var(--gy, 0px))); } 45%,64% { transform: translate(-50%, -86%); } }
@keyframes eye-wander { 0%,100% { transform: translate(-50%, -50%); } 35% { transform: translate(-72%, -40%); } 70% { transform: translate(-29%, -58%); } }
@keyframes eye-flicker {
  0%,9%,17%,29%,44%,100% { opacity: 1; filter: brightness(1); }
  10%,18%,30% { opacity: .16; filter: brightness(.25); }
  45% { opacity: .58; filter: brightness(.7); }
}
@keyframes hidden-reveal { 0% { opacity: 0; } 12%,80% { opacity: .84; } 100% { opacity: 0; } }
@keyframes flash { 0% { opacity: .95; } 22% { opacity: .7; } 100% { opacity: 0; } }
@keyframes timer-pulse { 50% { opacity: .45; } }
@keyframes breach-in { 0% { opacity: 0; } 5% { opacity: 1; } 8% { opacity: .35; } 12%,100% { opacity: 1; } }
@keyframes apparition { 0%,12% { opacity: 0; transform: scale(.96); } 15% { opacity: .8; } 20% { opacity: .2; } 25%,100% { opacity: .94; transform: scale(1); } }
@keyframes smile-in { 0%,26% { opacity: 0; transform: scaleY(.2); } 30% { opacity: .85; } 38% { opacity: .2; } 45%,100% { opacity: .9; transform: scaleY(1); } }
@keyframes copy-in { to { opacity: 1; } }

@media (max-width: 760px) {
  .facility { padding-inline: 12px; }
  .status-cell { flex-direction: column; gap: 3px; padding: 8px; }
  .status-cell--center { align-items: center; }
  .status-cell:last-child { align-items: flex-end; }
  .status-cell span { font-size: .48rem; }
  .chamber { height: clamp(205px, 52vw, 300px); border-inline-width: 8px; }
  .eyes { gap: 7vw; }
  .eye { width: min(36vw, 190px); }
  .workbench { grid-template-columns: 1fr 1fr; gap: 17px 12px; }
  .controls { grid-column: 1 / -1; grid-row: 1; padding: 0; }
  .rules-plate, .dossier-stack, .roster-paper, .exception-paper { min-width: 0; }
  .exception-paper { padding-inline: 15px; }
  .rule-columns { grid-template-columns: 1fr; gap: 6px; }
  .rule-columns div:nth-child(2) { border-top: 1px solid #44483f; padding-top: 7px; }
  .rule-equation { flex-wrap: wrap; gap: 4px 10px; }
}

@media (max-width: 430px) {
  .topbar { align-items: flex-end; }
  .sound-button { min-width: auto; padding: 8px; font-size: .55rem; }
  .machine { padding-inline: 9px; }
  .machine-label { display: none; }
  .subject-strip__instruction { font-size: .55rem; }
  .workbench { padding-top: 18px; }
  .rules-plate { padding-inline: 12px; }
  .rules-plate h2, .exception-paper h2 { font-size: .65rem; }
  .rule-columns p, .exception-list { font-size: .48rem; }
  .exception-paper { min-height: 235px; }
}

@media (max-width: 560px) {
  .workbench { grid-template-columns: 1fr; }
  .controls { grid-column: 1; grid-row: 1; }
  .dossier-stack { grid-column: 1; grid-row: 2; }
  .rules-plate { grid-column: 1; grid-row: 3; }
  .roster-paper, .exception-paper { padding-inline: 20px; }
  .shop-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .shutter { transition-duration: .15s; }
  .pupil.is-rotating { animation-duration: 14s; }
}

.test-autostart .shutter,
.test-autostart .eyes { transition: none; }

.iris.iris-drift--slow { animation: iris-drift-slow 16s ease-in-out infinite; }
.iris.iris-drift--momentary { animation: iris-drift-momentary 9s ease-in-out infinite; }
