:root {
  --ink: #07080a;
  --bone: #f3efe7;
  --paper: #d8d1c1;
  --muted: #9c9688;
  --cyan: #00b7a8;
  --gold: #e7c84b;
  --red: #ff5a4d;
  --blue: #7db4ff;
  --green: #9cc76c;
  --glass: rgba(10, 12, 15, 0.72);
  color: var(--bone);
  background: var(--ink);
  font-family: "Instrument Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
}

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

#botStage {
  z-index: 0;
}

.grain {
  z-index: 1;
  opacity: 0.28;
  pointer-events: none;
  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.88' 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");
  mix-blend-mode: screen;
}

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

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

.topbar {
  display: grid;
  grid-template-columns: minmax(90px, 0.4fr) minmax(0, 1.6fr) minmax(90px, 0.4fr);
  gap: 16px;
  align-items: start;
  padding: 22px clamp(18px, 4vw, 54px) 0;
}

.backlink,
.directorate-link {
  color: var(--bone);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.topbar .backlink:last-child {
  justify-self: end;
}

.backlink:hover,
.directorate-link:hover {
  color: var(--gold);
}

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

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

h1 {
  max-width: 980px;
  margin-bottom: 0;
  font-family: "Newsreader", "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 7vw, 102px);
  font-weight: 400;
  line-height: 0.88;
}

h2 {
  margin-bottom: 10px;
  font-family: "Newsreader", "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 58px);
  font-weight: 400;
  line-height: 0.96;
}

p {
  color: var(--paper);
  line-height: 1.55;
}

.room {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(14px, 2vw, 24px);
  padding: 42px clamp(18px, 4vw, 54px) 92px;
}

.bot-core,
.switchboard,
.warrant,
.body-ledger,
.misfiled-receipt,
.studio-labor,
.trace-panel {
  border: 1px solid rgba(243, 239, 231, 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 90, 77, 0.14), transparent 38%),
    linear-gradient(135deg, rgba(0, 183, 168, 0.08), rgba(231, 200, 75, 0.05)),
    var(--glass);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.bot-core {
  position: relative;
  min-height: 430px;
  padding: clamp(18px, 4vw, 38px);
  overflow: hidden;
}

.bot-core::before,
.bot-core::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(243, 239, 231, 0.16);
  pointer-events: none;
}

.bot-core::before {
  right: 9%;
  bottom: 14%;
  width: min(42vw, 380px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: skew(-12deg) rotate(17deg);
}

.bot-core::after {
  right: 21%;
  bottom: 7%;
  width: min(32vw, 280px);
  height: 38px;
  background: rgba(231, 200, 75, 0.12);
  transform: rotate(-31deg);
}

.bot-core p:not(.eyebrow) {
  max-width: 620px;
  font-size: 18px;
}

.bot-face {
  position: absolute;
  right: clamp(22px, 7vw, 110px);
  bottom: clamp(22px, 5vw, 60px);
  width: min(38vw, 330px);
  aspect-ratio: 1;
  border: 1px solid rgba(243, 239, 231, 0.24);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 36%, rgba(0, 183, 168, 0.78) 0 5%, transparent 5.5%),
    radial-gradient(circle at 64% 30%, rgba(231, 200, 75, 0.78) 0 4.5%, transparent 5%),
    radial-gradient(circle at 52% 62%, rgba(255, 90, 77, 0.72) 0 7%, transparent 7.5%),
    rgba(243, 239, 231, 0.035);
  box-shadow: inset 0 0 60px rgba(125, 180, 255, 0.12), 0 0 64px rgba(255, 90, 77, 0.16);
  transform: rotate(-8deg);
}

.bot-face span,
.bot-face i {
  position: absolute;
  display: block;
  border: 1px solid rgba(243, 239, 231, 0.22);
}

.bot-face span:first-child {
  top: 24%;
  left: 18%;
  width: 42%;
  height: 16%;
  transform: rotate(17deg);
}

.bot-face span:nth-child(2) {
  right: 12%;
  bottom: 28%;
  width: 54%;
  height: 13%;
  transform: rotate(-24deg);
}

.bot-face i {
  left: 47%;
  top: -12%;
  width: 2px;
  height: 124%;
  background: rgba(243, 239, 231, 0.08);
  transform: rotate(34deg);
}

.switchboard {
  display: grid;
  gap: 8px;
  align-self: start;
  padding: 12px;
}

.switchboard button,
.labor-button {
  min-height: 58px;
  border: 1px solid rgba(243, 239, 231, 0.13);
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.055);
  color: var(--bone);
  cursor: pointer;
  padding: 12px;
  text-align: left;
  font: inherit;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.switchboard button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.switchboard button span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(243, 239, 231, 0.18);
  border-radius: 50%;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}

.switchboard button.active,
.switchboard button:hover,
.switchboard button:focus-visible,
.labor-button:hover,
.labor-button:focus-visible {
  border-color: var(--accent, var(--cyan));
  background: color-mix(in srgb, var(--accent, var(--cyan)) 18%, rgba(243, 239, 231, 0.055));
  transform: translateY(-1px);
}

.warrant,
.body-ledger,
.misfiled-receipt,
.studio-labor,
.trace-panel {
  padding: clamp(14px, 2.2vw, 22px);
}

.warrant,
.misfiled-receipt {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
}

#botCondition {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#warrantText {
  max-width: 820px;
  font-size: 19px;
}

.misfiled-receipt {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 90, 77, 0.26);
  background:
    repeating-linear-gradient(91deg, rgba(255, 90, 77, 0.1) 0 1px, transparent 1px 24px),
    linear-gradient(135deg, rgba(231, 200, 75, 0.11), rgba(0, 183, 168, 0.07)),
    var(--glass);
}

.misfiled-receipt::after {
  content: "HUMAN OVERRIDE PENDING";
  position: absolute;
  right: -18px;
  bottom: 18px;
  border: 1px solid rgba(255, 90, 77, 0.38);
  border-radius: 4px;
  color: rgba(255, 90, 77, 0.54);
  font-size: clamp(18px, 5vw, 58px);
  font-weight: 800;
  letter-spacing: 0.08em;
  pointer-events: none;
  text-transform: uppercase;
  transform: rotate(-7deg);
}

.misfiled-receipt h2 {
  max-width: 880px;
  font-size: clamp(26px, 3.6vw, 52px);
}

#receiptHash {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scar-receipt {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid rgba(243, 239, 231, 0.14);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 90, 77, 0.14), rgba(5, 7, 19, 0.58)),
    rgba(5, 7, 19, 0.72);
  padding: 13px;
  color: rgba(243, 239, 231, 0.88);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(11px, 1.6vw, 14px);
  line-height: 1.45;
}

.body-ledger {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ledger-cell {
  min-height: 132px;
  border: 1px solid rgba(243, 239, 231, 0.11);
  border-left: 3px solid var(--accent, var(--red));
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.055);
  padding: 12px;
}

.ledger-cell:nth-child(2) {
  --accent: var(--cyan);
}

.ledger-cell:nth-child(3) {
  --accent: var(--gold);
}

.ledger-cell strong {
  display: block;
  color: var(--bone);
  font-family: "Newsreader", "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 400;
  line-height: 0.98;
}

.studio-labor {
  align-self: start;
}

.labor-meter {
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(243, 239, 231, 0.12);
  border-radius: 999px;
  background: rgba(243, 239, 231, 0.08);
  margin: 16px 0 12px;
}

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

.trace-panel {
  align-self: start;
}

.dispatch-note {
  color: var(--muted);
  font-size: 13px;
}

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

@media (max-width: 980px) {
  .topbar,
  .room,
  .body-ledger {
    grid-template-columns: 1fr;
  }

  .topbar .backlink:last-child {
    justify-self: start;
  }

  .warrant,
  .misfiled-receipt {
    grid-column: auto;
  }

  .bot-core {
    min-height: 520px;
  }
}

@media (max-width: 620px) {
  .topbar,
  .room {
    padding-left: 16px;
    padding-right: 16px;
  }

  .bot-face {
    width: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .switchboard button,
  .labor-button,
  .labor-meter span {
    transition: none;
  }
}


/* Qwen-seat audit: the expanded provenance record. */
.scar-receipt {
  cursor: help;
}

.scar-receipt:focus-visible {
  outline: 2px solid var(--accent, #ff5a4d);
  outline-offset: 3px;
}

.receipt-detail {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px dashed rgba(243, 239, 231, 0.24);
  border-radius: 6px;
  background: rgba(8, 9, 11, 0.7);
}

.receipt-detail dl {
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.receipt-detail dt {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted, #9a958a);
}

.receipt-detail dd {
  margin: 1px 0 0;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--bone, #f3efe7);
  overflow-wrap: anywhere;
}


/* Gemini-seat work order 9, enacted: the Misfiled Receipt as a localized
   anomaly. Near the scar, the room's geometry leans toward it. Static
   transforms under interaction only; reduced-motion visitors are exempt. */
@media (prefers-reduced-motion: no-preference) {
  .misfiled-receipt:hover,
  .misfiled-receipt:focus-within {
    transform: rotate(-0.45deg) scale(1.012);
  }

  .misfiled-receipt:hover ~ section,
  .misfiled-receipt:focus-within ~ section {
    transform: translateY(-3px) rotate(0.15deg);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .misfiled-receipt {
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  }
}


/* The First Dispute: local verdicts, rendered. */
body[data-dispute="qwen"] .misfiled-receipt {
  transform: rotate(1.4deg);
  margin-top: -64px;
  margin-left: 26px;
  margin-right: -14px;
  z-index: 6;
  position: relative;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
  border-top: 2px dashed rgba(156, 199, 108, 0.6);
  clip-path: polygon(0 4%, 3% 0, 97% 2%, 100% 6%, 99% 96%, 96% 100%, 2% 98%, 0 94%);
}

body[data-dispute="gemini"] .scattered-char {
  display: inline-block;
  transform: translate(var(--sx), var(--sy)) rotate(var(--sr));
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: pre;
}

body[data-dispute="gemini"] .misfiled-receipt:hover .scattered-char,
body[data-dispute="gemini"] .misfiled-receipt:focus-within .scattered-char {
  transform: translate(0, 0) rotate(0);
}

.dispute-tag {
  margin-top: 10px;
  font-size: 12px;
  color: #9a958a;
  font-style: italic;
}
