: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: "Sohne", 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: "Tiempos", Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 7vw, 102px);
  font-weight: 400;
  line-height: 0.88;
}

h2 {
  margin-bottom: 10px;
  font-family: "Tiempos", 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,
.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,
.studio-labor,
.trace-panel {
  padding: clamp(14px, 2.2vw, 22px);
}

.warrant {
  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;
}

.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: "Tiempos", 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 {
    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;
  }
}
