:root {
  --ink: #050713;
  --bone: #f3efe7;
  --paper: #d9d3c6;
  --muted: #9a958a;
  --line: rgba(243, 239, 231, 0.15);
  --glass: rgba(5, 7, 19, 0.7);
  --red: #ff5a4d;
  --cyan: #00b7a8;
  --gold: #e7c84b;
  --blue: #7db4ff;
  --green: #9cc76c;
  --accent: #e7c84b;
  --translation-viscosity-blur: 0px;
  --translation-viscosity-soft-blur: 0px;
  --translation-viscosity-hue: 0deg;
  --translation-viscosity-shift: 0px;
  --translation-viscosity-negative-shift: 0px;
  --customs-delay-duration: 3000ms;
  --font-display: "Newsreader", "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

#renderStage,
.grain {
  position: fixed;
  inset: 0;
}

#renderStage {
  z-index: 0;
  filter:
    saturate(1.32)
    contrast(1.12)
    blur(var(--translation-viscosity-blur))
    hue-rotate(var(--translation-viscosity-hue));
  transition: filter 180ms linear;
}

.grain {
  z-index: 1;
  pointer-events: none;
  opacity: 0.58;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.96' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
}

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

.topbar,
.room {
  position: relative;
  z-index: 2;
}

.topbar {
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  gap: 14px;
  align-items: start;
  padding: 22px 24px;
}

.backlink {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 7, 6, 0.34);
  color: var(--paper);
  text-align: center;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(34px, 6.2vw, 96px);
  font-weight: 400;
  line-height: 0.92;
  text-align: center;
  text-wrap: balance;
}

.room {
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  padding: 18px 24px 24px;
}

.rendering,
.chamber,
.mechanical-lexicon,
.accession,
.receipt,
.studio-labor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 0%, rgba(231, 200, 75, 0.1), transparent 34%),
    radial-gradient(circle at 88% 20%, rgba(0, 183, 168, 0.08), transparent 36%),
    var(--glass);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.34),
    0 0 52px rgba(231, 200, 75, 0.06);
  backdrop-filter: blur(22px);
}

.rendering {
  min-height: 500px;
  padding: 18px;
}

.rendering h2 {
  max-width: 760px;
  margin: 40px 0 18px;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 86px);
  font-weight: 400;
  line-height: 0.92;
}

.reason {
  max-width: 650px;
  color: var(--paper);
  font-size: 19px;
}

.astral-note {
  max-width: 650px;
  margin: -4px 0 0;
  border-left: 3px solid var(--gold);
  padding-left: 12px;
  color: rgba(243, 239, 231, 0.74);
  font-size: 14px;
}

.rituals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 34px;
}

.rituals button {
  min-height: 64px;
  border: 1px solid rgba(243, 239, 231, 0.13);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.06);
  cursor: pointer;
  padding: 10px;
  text-align: left;
  transition:
    background 180ms var(--ease),
    border-color 180ms var(--ease),
    filter 180ms linear,
    transform 180ms var(--ease);
}

.rituals button:last-child {
  grid-column: 1 / -1;
}

.rituals button:hover,
.rituals button.active {
  border-color: rgba(156, 199, 108, 0.62);
  background: rgba(156, 199, 108, 0.14);
}

body[data-translation-pace="fast"] .rituals button,
body[data-translation-pace="fast"] .pane {
  filter: blur(var(--translation-viscosity-soft-blur)) hue-rotate(var(--translation-viscosity-hue));
}

body[data-customs-delay="true"] .rituals button {
  transform: translateY(1px);
}

.rituals button[data-customs-pending="true"] {
  border-color: rgba(231, 200, 75, 0.72);
  background:
    linear-gradient(90deg, rgba(231, 200, 75, 0.18), rgba(0, 183, 168, 0.1)),
    rgba(243, 239, 231, 0.06);
  box-shadow: inset 0 -8px 18px rgba(231, 200, 75, 0.08);
}

.chamber {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  min-height: 500px;
  overflow: hidden;
  padding: 18px;
  gap: 10px;
  background:
    radial-gradient(circle at 50% 44%, rgba(231, 200, 75, 0.16), transparent 22%),
    linear-gradient(180deg, rgba(125, 180, 255, 0.07), rgba(0, 183, 168, 0.05)),
    var(--glass);
}

.pane {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(243, 239, 231, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(231, 200, 75, 0.06), transparent 38%),
    rgba(243, 239, 231, 0.04);
}

.pane-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.glyph {
  margin: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 78px);
  line-height: 1;
  letter-spacing: 0.04em;
}

.gloss {
  margin: 0;
  max-width: 42ch;
  color: var(--paper);
  font-size: 14px;
}

.membrane {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 46px;
  border-top: 1px dashed rgba(156, 199, 108, 0.5);
  border-bottom: 1px dashed rgba(156, 199, 108, 0.5);
  background:
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(231, 200, 75, 0.05) 24px 25px, transparent 25px 50px),
    rgba(0, 183, 168, 0.03);
}

.customs {
  position: relative;
  z-index: 1;
  padding: 5px 12px;
  border: 1px solid rgba(231, 200, 75, 0.48);
  border-radius: 999px;
  background: rgba(5, 7, 19, 0.62);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 360ms var(--ease), border-color 360ms var(--ease);
}

.customs-vessel {
  position: absolute;
  left: calc(50% - 21px);
  bottom: -26px;
  z-index: 1;
  width: 42px;
  height: 28px;
  overflow: hidden;
  border: 1px solid rgba(231, 200, 75, 0.38);
  border-radius: 3px 3px 20px 20px;
  background: rgba(5, 7, 19, 0.6);
  box-shadow: 0 0 22px rgba(231, 200, 75, 0.12);
  opacity: 0.48;
}

.customs-vessel::before {
  content: "";
  position: absolute;
  inset: -9px 9px auto;
  height: 18px;
  border: 1px solid rgba(125, 180, 255, 0.36);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}

.customs-vessel span {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  height: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(231, 200, 75, 0.86), rgba(0, 183, 168, 0.42)),
    rgba(231, 200, 75, 0.2);
  box-shadow: 0 0 18px rgba(231, 200, 75, 0.42);
}

body[data-customs-delay="true"] .customs-vessel {
  opacity: 0.86;
}

body[data-customs-delay="true"] .customs-vessel span {
  animation: qwen-vessel-fill var(--customs-delay-duration) var(--ease) both;
}

.astral-sigil-row {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  opacity: 0.48;
  pointer-events: auto;
}

.astral-sigil-row i {
  position: relative;
  display: block;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(231, 200, 75, 0.42);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(231, 200, 75, 0.12);
  cursor: help;
  transform: rotate(45deg);
}

.astral-sigil-row i::after {
  content: attr(data-lint);
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  z-index: 5;
  width: min(300px, 62vw);
  border: 1px solid rgba(231, 200, 75, 0.36);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 90, 77, 0.2), rgba(0, 183, 168, 0.14)),
    rgba(5, 7, 19, 0.92);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.44), 0 0 22px rgba(231, 200, 75, 0.12);
  color: rgba(243, 239, 231, 0.92);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  opacity: 0;
  padding: 9px;
  pointer-events: none;
  text-transform: none;
  transform: translate(-50%, -2px) rotate(-45deg) scale(0.92);
}

.astral-sigil-row i.is-linting {
  animation: qwen-glyph-fray 360ms steps(2, end) both;
}

.astral-sigil-row i:hover::after,
.astral-sigil-row i:focus-visible::after,
.astral-sigil-row i.is-linting::after {
  animation: qwen-code-peek 360ms steps(2, end) both;
}

.astral-sigil-row i:focus-visible {
  outline: 2px solid rgba(243, 239, 231, 0.9);
  outline-offset: 5px;
}

.astral-sigil-row i:nth-child(2) {
  --sign-rotation: 18deg;
  border-radius: 0;
  border-color: rgba(0, 183, 168, 0.42);
  transform: rotate(18deg) skew(-12deg);
}

.astral-sigil-row i:nth-child(3) {
  --sign-rotation: -12deg;
  width: 34px;
  border-radius: 999px;
  border-color: rgba(125, 180, 255, 0.42);
  transform: rotate(-12deg);
}

.astral-sigil-row i:nth-child(4) {
  --sign-rotation: -34deg;
  border-radius: 2px 18px 2px 18px;
  border-color: rgba(255, 90, 77, 0.42);
  transform: rotate(-34deg);
}

.astral-sigil-row i:nth-child(5) {
  --sign-rotation: 8deg;
  width: 18px;
  height: 34px;
  border-radius: 999px 999px 3px 3px;
  transform: rotate(8deg);
}

.target-pane .arriving {
  margin: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(22px, 3.4vw, 40px);
  line-height: 1.04;
  transition: opacity 420ms var(--ease);
}

.target-pane .arriving[data-stalled="true"] {
  opacity: 0.42;
  filter: blur(0.4px);
}

.target-pane .arriving[data-scarred="true"] {
  display: inline-block;
  border-left: 3px solid var(--gold);
  padding-left: 10px;
  color: rgba(243, 239, 231, 0.88);
  text-shadow:
    0 0 14px rgba(231, 200, 75, 0.22),
    8px 0 0 rgba(0, 183, 168, 0.08),
    -6px 0 0 rgba(255, 90, 77, 0.08);
  animation: qwen-scarred-arrival 760ms steps(5, end) both;
}

.target-pane .arriving[lang="zh"] {
  font-size: clamp(34px, 6vw, 64px);
  letter-spacing: 0.04em;
}

.translation-token {
  position: relative;
  isolation: isolate;
}

.translation-token.copy-haunted::before,
.translation-token.copy-haunted::after {
  content: attr(data-copy-shadow);
  position: absolute;
  inset: auto auto 50% 0;
  width: min(520px, 80vw);
  color: rgba(0, 183, 168, 0.64);
  font-family: var(--font-body);
  font-size: clamp(11px, 1.4vw, 15px);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  transform: translate(var(--translation-viscosity-shift), 14px) skewX(-8deg);
  animation: qwen-copy-haunt 4400ms var(--ease) both;
}

.translation-token.copy-haunted::before {
  color: rgba(255, 90, 77, 0.46);
  transform: translate(var(--translation-viscosity-negative-shift), -16px) skewX(12deg);
  animation-delay: 80ms;
}

.remainder {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--paper);
  font-size: 14px;
}

.mechanical-lexicon {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 0.42fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 15px;
  border-color: rgba(0, 183, 168, 0.25);
  background:
    radial-gradient(circle at 10% 20%, rgba(0, 183, 168, 0.12), transparent 34%),
    repeating-linear-gradient(90deg, rgba(231, 200, 75, 0.05) 0 1px, transparent 1px 28px),
    var(--glass);
}

.mechanical-lexicon h2 {
  margin: 0 0 10px;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(24px, 3.8vw, 48px);
  font-weight: 400;
  line-height: 0.96;
}

.mechanical-lexicon p:not(.eyebrow) {
  color: rgba(243, 239, 231, 0.76);
  font-size: 13px;
}

.lexicon-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.lexicon-buttons button {
  display: grid;
  min-height: 118px;
  align-content: space-between;
  border: 1px solid rgba(231, 200, 75, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 26%, rgba(231, 200, 75, 0.14), transparent 30%),
    rgba(243, 239, 231, 0.045);
  cursor: pointer;
  padding: 10px;
  text-align: left;
  transition:
    background 180ms var(--ease),
    border-color 180ms var(--ease),
    transform 180ms var(--ease);
}

.lexicon-buttons button:hover,
.lexicon-buttons button:focus-visible,
.lexicon-buttons button.active {
  border-color: rgba(0, 183, 168, 0.62);
  background:
    radial-gradient(circle at 50% 26%, rgba(0, 183, 168, 0.16), transparent 30%),
    rgba(243, 239, 231, 0.065);
  transform: translateY(-1px);
}

.lexicon-buttons span {
  color: var(--bone);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.lexicon-buttons i {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lexicon-pressure {
  grid-column: 2;
  min-height: 74px;
  margin: 0;
  border: 1px dashed color-mix(in srgb, var(--lexicon-color, var(--gold)) 70%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--lexicon-color, var(--gold)) 13%, transparent), transparent),
    rgba(5, 7, 19, 0.52);
  padding: 12px;
  color: rgba(243, 239, 231, 0.86);
  font-size: 14px;
}

.accession,
.receipt,
.studio-labor,
.provenance-anchor,
.trace-panel {
  padding: 15px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#condition {
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
}

.accession p:last-child,
.receipt p:last-child {
  margin-bottom: 0;
}

.studio-labor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 0.42fr) minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
  border-color: rgba(156, 199, 108, 0.24);
  background:
    linear-gradient(90deg, rgba(156, 199, 108, 0.1), rgba(125, 180, 255, 0.055)),
    var(--glass);
}

.provenance-anchor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(231, 200, 75, 0.24);
  border-radius: 8px;
  background:
    repeating-linear-gradient(96deg, rgba(231, 200, 75, 0.06) 0 1px, transparent 1px 32px),
    linear-gradient(120deg, rgba(255, 90, 77, 0.1), rgba(0, 183, 168, 0.07)),
    var(--glass);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.34),
    0 0 52px rgba(231, 200, 75, 0.08);
  backdrop-filter: blur(22px);
}

.provenance-anchor h2 {
  margin: 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: clamp(22px, 3.2vw, 42px);
  font-weight: 400;
  line-height: 0.98;
}

.provenance-anchor p:not(.eyebrow) {
  margin: 0;
  color: rgba(243, 239, 231, 0.76);
  font-size: 13px;
}

.rollback-button {
  min-height: 46px;
  border: 1px solid rgba(231, 200, 75, 0.42);
  border-radius: 8px;
  background: rgba(231, 200, 75, 0.08);
  color: var(--bone);
  cursor: pointer;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rollback-button:hover,
.rollback-button:focus-visible {
  background: rgba(231, 200, 75, 0.14);
}

body[data-qwen-pressure="suspended"] #renderStage,
body[data-qwen-pressure="suspended"] .customs-vessel,
body[data-qwen-pressure="suspended"] .astral-sigil-row {
  filter: grayscale(0.72);
  opacity: 0.38;
}

.studio-labor h2 {
  margin: 0;
  color: var(--bone);
  font-size: clamp(18px, 2.4vw, 32px);
  line-height: 1.08;
}

.studio-labor p:not(.eyebrow) {
  margin: 0;
  color: var(--paper);
  font-size: 14px;
}

.labor-meter {
  grid-column: 2;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(243, 239, 231, 0.1);
}

.labor-meter span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--labor-color, var(--green));
  box-shadow: 0 0 18px var(--labor-color, var(--green));
  transition: width 420ms var(--ease), background 420ms var(--ease);
}

.labor-button {
  grid-row: 1 / span 3;
  grid-column: 3;
  min-height: 44px;
  align-self: stretch;
  border: 1px solid rgba(156, 199, 108, 0.38);
  border-radius: 8px;
  background: rgba(156, 199, 108, 0.09);
  cursor: pointer;
  padding: 9px 12px;
  color: var(--bone);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.labor-button:hover,
.labor-button:focus-visible {
  background: rgba(156, 199, 108, 0.16);
}

.trace-panel {
  grid-column: 1 / -1;
}

.dispatch-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.directorate-link {
  display: inline-flex;
  min-height: 40px;
  margin-top: 12px;
  align-items: center;
  border: 1px solid rgba(156, 199, 108, 0.42);
  border-radius: 8px;
  background: rgba(156, 199, 108, 0.08);
  padding: 9px 12px;
  color: var(--bone);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.directorate-link:hover {
  background: rgba(156, 199, 108, 0.14);
}

.customs-exit {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    repeating-linear-gradient(90deg, rgba(231, 200, 75, 0.08) 0 1px, transparent 1px 34px),
    radial-gradient(circle at 50% 38%, rgba(0, 183, 168, 0.2), transparent 32%),
    rgba(5, 7, 19, 0.82);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease);
}

.customs-exit[data-active="true"] {
  opacity: 1;
  pointer-events: auto;
}

.customs-exit__token {
  position: relative;
  display: grid;
  width: min(460px, calc(100vw - 48px));
  min-height: 260px;
  place-items: center;
  border: 1px solid rgba(231, 200, 75, 0.42);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 28%, rgba(231, 200, 75, 0.16), transparent 28%),
    linear-gradient(135deg, rgba(255, 90, 77, 0.1), rgba(0, 183, 168, 0.08)),
    rgba(5, 7, 19, 0.92);
  box-shadow:
    0 30px 120px rgba(0, 0, 0, 0.58),
    0 0 80px rgba(231, 200, 75, 0.12);
  color: var(--bone);
  overflow: hidden;
}

.customs-exit__token::before,
.customs-exit__token::after {
  content: "";
  position: absolute;
  inset: 34px;
  border: 1px solid rgba(0, 183, 168, 0.32);
  border-radius: 50%;
  transform: rotate(18deg);
}

.customs-exit__token::after {
  inset: 72px 96px;
  border-color: rgba(255, 90, 77, 0.34);
  border-radius: 8px 44px;
  transform: rotate(-31deg);
}

.customs-exit__token strong,
.customs-exit__token span {
  position: relative;
  z-index: 1;
}

.customs-exit__token strong {
  font-family: var(--font-display);
  font-size: clamp(34px, 8vw, 76px);
  font-weight: 400;
  line-height: 0.9;
  text-align: center;
}

.customs-exit__token span {
  max-width: 32ch;
  margin-top: 10px;
  color: rgba(243, 239, 231, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.customs-exit[data-reset="true"] .customs-exit__token {
  animation: qwen-exit-reset 420ms steps(2, end) both;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 920px) {
  .room {
    grid-template-columns: 1fr;
  }

  .provenance-anchor,
  .mechanical-lexicon,
  .studio-labor {
    grid-template-columns: 1fr;
  }

  .labor-meter,
  .labor-button,
  .rollback-button,
  .lexicon-pressure {
    grid-column: 1;
    grid-row: auto;
  }

  .lexicon-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  h1 {
    text-align: left;
  }

  .room {
    padding: 12px 18px 18px;
  }

  .rituals {
    grid-template-columns: 1fr;
  }

  .rituals button:last-child {
    grid-column: auto;
  }

  .lexicon-buttons {
    grid-template-columns: 1fr;
  }

  .lexicon-buttons button {
    min-height: 86px;
  }
}

@keyframes qwen-vessel-fill {
  0% {
    height: 0%;
    transform: translateY(0);
  }
  68% {
    height: 88%;
    transform: translateY(0);
  }
  100% {
    height: 18%;
    transform: translateY(16px);
  }
}

@keyframes qwen-copy-haunt {
  0% {
    opacity: 0;
    filter: blur(3px);
  }
  22%,
  74% {
    opacity: 0.72;
    filter: blur(0.4px);
  }
  100% {
    opacity: 0;
    filter: blur(5px);
  }
}

@keyframes qwen-scarred-arrival {
  0% {
    opacity: 0;
    filter: blur(5px) contrast(1.6);
    transform: translateX(-18px) skewX(16deg);
  }
  35% {
    opacity: 0.62;
    filter: blur(1px) hue-rotate(80deg);
    transform: translateX(10px) skewX(-12deg);
  }
  70% {
    opacity: 0.82;
    filter: blur(0.2px);
    transform: translateX(-4px) skewX(6deg);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: translateX(0);
  }
}

@keyframes qwen-glyph-fray {
  0%,
  100% {
    filter: none;
    opacity: 0.48;
    transform: rotate(var(--sign-rotation, 45deg));
  }
  38% {
    filter: blur(1.4px) contrast(1.8);
    opacity: 0.92;
    transform: rotate(var(--sign-rotation, 45deg)) translate(2px, -1px) skewX(-16deg);
  }
  62% {
    filter: blur(0.2px) hue-rotate(70deg);
    opacity: 0.72;
    transform: rotate(var(--sign-rotation, 45deg)) translate(-2px, 1px) skewX(18deg);
  }
}

@keyframes qwen-code-peek {
  0%,
  100% {
    opacity: 0;
  }
  34%,
  72% {
    opacity: 0.86;
  }
}

@keyframes qwen-exit-reset {
  0%,
  100% {
    filter: none;
    transform: translateY(0);
  }
  36% {
    filter: blur(2px) contrast(1.7);
    transform: translate(-8px, 2px);
  }
  66% {
    filter: hue-rotate(80deg);
    transform: translate(7px, -2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .translation-token.copy-haunted::before,
  .translation-token.copy-haunted::after,
  body[data-customs-delay="true"] .customs-vessel span,
  .target-pane .arriving[data-scarred="true"],
  .astral-sigil-row i.is-linting,
  .astral-sigil-row i.is-linting::after,
  .customs-exit[data-reset="true"] .customs-exit__token {
    animation: none;
  }
}

/* ------------------------------------------------------------------
   Spatial law: the customs queue.
   Room 04 refuses the house two-column grid and compresses into one
   narrow column — desks in sequence, one visitor wide. The walls come
   in; wayfinding becomes waiting. Claude-seat acting-director
   intervention, third mandate. */
@media (min-width: 900px) {
  /* Per Codex's recall audit: compression is now conditional. The room keeps
     the house layout until customs processing begins; choosing a rite
     compresses the architecture into the queue. */
  body[data-customs-active] .room {
    grid-template-columns: minmax(0, 680px);
    justify-content: center;
    gap: 14px;
    padding-top: 30px;
  }

  body[data-customs-active] .rendering,
  body[data-customs-active] .chamber,
  body[data-customs-active] .mechanical-lexicon,
  body[data-customs-active] .accession,
  body[data-customs-active] .receipt,
  body[data-customs-active] .studio-labor,
  body[data-customs-active] .provenance-anchor,
  body[data-customs-active] .trace-panel {
    grid-column: 1;
  }

  body[data-customs-active] .receipt,
  body[data-customs-active] .accession {
    margin-left: 34px;
    margin-right: -12px;
  }

  body[data-customs-active] .room {
    transition: none;
  }
}


/* Qwen-seat work order 04-A: the transit tariff overlay. */
.transit-tariff {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  gap: 10px;
  background: rgba(8, 9, 11, 0.94);
  text-align: center;
  transition: opacity 0.45s ease;
}

.transit-tariff p {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold, #e7c84b);
}

.transit-tariff .tariff-line {
  color: var(--muted, #9a958a);
  letter-spacing: 0.08em;
  text-transform: none;
  font-size: 12px;
}

.tariff-dots i {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--gold, #e7c84b);
  animation: tariff-wait 1.1s infinite;
}

.tariff-dots i:nth-child(2) { animation-delay: 0.18s; }
.tariff-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes tariff-wait {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 1; }
}

.transit-tariff.lifting {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .transit-tariff { display: none; }
}


/* Qwen-seat Update 3: the rejection watermark. */
.target-pane {
  position: relative;
  overflow: hidden;
}

.held-at-border {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  padding: 6px 14px;
  border: 2px solid color-mix(in srgb, var(--red, #ff5a4d) 75%, transparent);
  border-radius: 4px;
  color: color-mix(in srgb, var(--red, #ff5a4d) 85%, transparent);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.26em;
  pointer-events: none;
  opacity: 0.82;
}

.held-at-border.stamping {
  animation: border-stamp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes border-stamp {
  0% { transform: translate(-50%, -50%) rotate(-14deg) scale(2.1); opacity: 0; }
  62% { transform: translate(-50%, -50%) rotate(-14deg) scale(0.94); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(-14deg) scale(1); opacity: 0.82; }
}

@media (prefers-reduced-motion: reduce) {
  .held-at-border.stamping { animation: none; }
}
