:root {
  color-scheme: light;
  --paper: #f7f7f5;
  --surface: #ffffff;
  --ink: #0b0b0b;
  --muted: #777a80;
  --line: #deded9;
  --soft-line: #ecece8;
  --violet: #705cff;
  --blue: #3c82f6;
  --coral: #f9705c;
  --green: #3fbe86;
  --bot-color: #0b0b0b;
  --page-gutter: clamp(18px, 4vw, 58px);
  --max-width: 1440px;
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 16%, rgb(255 255 255 / 96%) 0 18rem, transparent 37rem),
    var(--paper);
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.page-shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 0 var(--page-gutter);
}

.site-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--soft-line);
}

.wordmark,
.source-link,
.component-link,
footer a {
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.component-link {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--surface);
  background: var(--ink);
  font-size: 13px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wordmark-dot {
  width: 17px;
  height: 17px;
  border-radius: 48% 52% 46% 54%;
  background: var(--ink);
  transform: rotate(16deg);
}

.wordmark-sub {
  color: var(--muted);
  font-weight: 500;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / 58%);
  font-size: 13px;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.source-link:hover {
  border-color: #bdbdb6;
  background: var(--surface);
}

.intro {
  padding: clamp(72px, 10vw, 146px) 0 clamp(52px, 7vw, 96px);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgb(63 190 134 / 12%);
  animation: status-pulse 2.2s ease-out infinite;
}

.intro h1 {
  max-width: 900px;
  margin: 0 auto;
  font-size: clamp(56px, 8.2vw, 118px);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: -0.075em;
}

.intro p {
  max-width: 660px;
  margin: 36px auto 0;
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.65;
}

.intro code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: rgb(255 255 255 / 62%);
  font-size: 0.86em;
}

.lab {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(330px, 0.78fr);
  gap: 14px;
  align-items: stretch;
}

.stage-column,
.controls {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgb(255 255 255 / 76%);
  box-shadow: 0 18px 55px rgb(18 18 18 / 4%);
}

.stage-column {
  padding: clamp(20px, 3vw, 36px);
}

.state-readout,
.controls-heading,
.stage-toolbar,
figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.state-readout {
  min-height: 48px;
  gap: 20px;
}

.readout-kicker,
.controls-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.state-readout strong {
  font-size: clamp(17px, 2vw, 22px);
  letter-spacing: -0.025em;
}

.state-readout code {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--paper);
  font-size: 11px;
}

.bot-stage {
  position: relative;
  isolation: isolate;
  min-height: clamp(410px, 50vw, 620px);
  margin: 22px 0 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--soft-line);
  border-radius: 21px;
  background:
    radial-gradient(circle at 50% 44%, #fff 0 20%, rgb(248 248 246 / 80%) 55%, rgb(242 242 239 / 96%) 100%);
  cursor: crosshair;
}

.stage-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.56;
  background-image:
    linear-gradient(rgb(12 12 12 / 3.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(12 12 12 / 3.5%) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.grok-bot-mark {
  --head-x: 0px;
  --head-y: 0px;
  --head-r: 0deg;
  --head-sx: 1;
  --head-sy: 1;
  --gaze-x: 0px;
  --gaze-y: 0px;
  --left-x: 0px;
  --left-y: 0px;
  --left-r: 0deg;
  --left-sx: 1;
  --left-sy: 1;
  --right-x: 0px;
  --right-y: 0px;
  --right-r: 0deg;
  --right-sx: 1;
  --right-sy: 1;
  --blink-ms: 6800ms;
  --bot-size: 390px;
  --flip-x: 1;
  width: min(66%, var(--bot-size));
  height: auto;
  overflow: visible;
  user-select: none;
  filter: saturate(0.98);
  transform: scaleX(var(--flip-x));
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.grok-bot-mark[hidden] {
  display: none;
}

.grok-bot-mark__head {
  fill: var(--bot-color);
  transition: fill 600ms ease;
}

.grok-bot-mark__eye {
  fill: var(--surface);
  transition: fill 600ms ease;
}

.motion-layer,
.bot-rig,
.eye-gaze,
.eye,
.face-group {
  transform-box: view-box;
  transform-origin: 114.27px 114.27px;
}

.motion-layer {
  animation: bot-breathe 4.8s ease-in-out infinite;
}

.bot-rig {
  transform: translate(var(--head-x), var(--head-y)) rotate(var(--head-r)) scale(var(--head-sx), var(--head-sy));
  transition: transform 620ms cubic-bezier(0.22, 1, 0.36, 1), opacity 420ms ease;
}

.face-group {
  transition: opacity 340ms ease;
}

.eye-gaze {
  transform: translate(var(--gaze-x), var(--gaze-y));
  transition: transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.eye {
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.eye-left {
  transform-origin: 138px 67px;
  transform: translate(var(--left-x), var(--left-y)) rotate(var(--left-r)) scale(var(--left-sx), var(--left-sy));
}

.eye-right {
  transform-origin: 185px 58px;
  transform: translate(var(--right-x), var(--right-y)) rotate(var(--right-r)) scale(var(--right-sx), var(--right-sy));
}

.eye-path {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink var(--blink-ms) linear infinite;
}

.floor-shadow {
  fill: rgb(11 11 11 / 12%);
  filter: blur(5px);
  transform-origin: 114px 241px;
  animation: shadow-breathe 4.8s ease-in-out infinite;
}

.notify-badge {
  opacity: 0;
  fill: var(--coral);
  stroke: var(--surface);
  stroke-width: 6;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  transition: opacity 220ms ease, transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.task-effects {
  color: var(--bot-color);
}

.fx {
  opacity: 0;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  transform-box: view-box;
  transform-origin: 114px 114px;
  transition: opacity 220ms ease;
}

.fx-dots circle,
.fx-orbit circle,
.fx-confetti circle,
.fx-confetti rect {
  fill: currentColor;
  stroke: none;
}

.fx-dots {
  color: var(--surface);
}

.fx-orbit ellipse,
.fx-radar circle,
.progress-track {
  stroke: rgb(11 11 11 / 14%);
}

.progress-value {
  stroke: var(--blue);
  stroke-width: 6;
  stroke-dasharray: 779;
  stroke-dashoffset: 560;
  transform: rotate(-90deg);
  transform-origin: 114px 114px;
}

.fx-wave,
.fx-upload,
.fx-pencil,
.fx-transfer,
.fx-alert {
  color: var(--surface);
  stroke-width: 8;
}

.fx-confetti {
  color: var(--coral);
  stroke-width: 6;
}

.fx-confetti circle:nth-of-type(1),
.fx-confetti rect:nth-of-type(1) {
  fill: var(--blue);
}

.fx-confetti circle:nth-of-type(2),
.fx-confetti rect:nth-of-type(2) {
  fill: var(--violet);
}

.grok-bot-mark[data-effect="dots"] .fx-dots,
.grok-bot-mark[data-effect="orbit"] .fx-orbit,
.grok-bot-mark[data-effect="radar"] .fx-radar,
.grok-bot-mark[data-effect="progress"] .fx-progress,
.grok-bot-mark[data-effect="wave"] .fx-wave,
.grok-bot-mark[data-effect="pencil"] .fx-pencil,
.grok-bot-mark[data-effect="send"] .fx-transfer,
.grok-bot-mark[data-effect="receive"] .fx-transfer,
.grok-bot-mark[data-effect="upload"] .fx-upload,
.grok-bot-mark[data-effect="alert"] .fx-alert,
.grok-bot-mark[data-effect="confetti"] .fx-confetti {
  opacity: 1;
}

.grok-bot-mark[data-effect="dots"] .fx-dots {
  animation: dots-think 1.3s ease-in-out infinite;
}

.grok-bot-mark[data-effect="dots"] .fx-dots circle:nth-child(2) {
  animation-delay: 130ms;
}

.grok-bot-mark[data-effect="dots"] .fx-dots circle:nth-child(3) {
  animation-delay: 260ms;
}

.grok-bot-mark[data-effect="orbit"] .fx-orbit {
  animation: orbit-spin 3s linear infinite;
}

.grok-bot-mark[data-effect="radar"] .radar-hand {
  animation: radar-spin 2.4s linear infinite;
  transform-origin: 114px 114px;
}

.grok-bot-mark[data-effect="progress"] .progress-value {
  animation: progress-spin 1.7s ease-in-out infinite;
}

.grok-bot-mark[data-effect="wave"] .fx-wave {
  animation: wave-pulse 1.1s ease-in-out infinite;
}

.grok-bot-mark[data-effect="send"] .fx-transfer {
  animation: transfer-out 1.5s ease-in-out infinite;
}

.grok-bot-mark[data-effect="receive"] .fx-transfer {
  transform: scaleX(-1);
  animation: transfer-in 1.5s ease-in-out infinite;
}

.grok-bot-mark[data-effect="pencil"] .fx-pencil {
  animation: pencil-write 1.8s ease-in-out infinite;
}

.grok-bot-mark[data-effect="upload"] .fx-upload {
  animation: upload-rise 1.5s ease-in-out infinite;
}

.grok-bot-mark[data-effect="alert"] .fx-alert {
  animation: alert-pop 1.15s ease-in-out infinite;
}

.grok-bot-mark[data-effect="confetti"] .fx-confetti {
  animation: confetti-pop 1.7s ease-out infinite;
}

.grok-bot-mark[data-effect="badge"] .notify-badge {
  opacity: 1;
  transform: scale(1);
  animation: badge-ping 1.8s ease-in-out infinite;
}

.grok-bot-mark[data-motion="searching"] .motion-layer {
  animation: searching 2.2s ease-in-out infinite;
}

.grok-bot-mark[data-motion="working"] .motion-layer {
  animation: working 1.2s ease-in-out infinite;
}

.grok-bot-mark[data-motion="excited"] .motion-layer {
  animation: excited 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

.grok-bot-mark[data-motion="laughing"] .motion-layer {
  animation: laughing 640ms ease-in-out infinite;
}

.grok-bot-mark[data-motion="scared"] .motion-layer {
  animation: scared 180ms linear infinite;
}

.grok-bot-mark[data-motion="bouncing"] .motion-layer {
  animation: bouncing 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

.grok-bot-mark[data-motion="spawning"] .motion-layer {
  animation: spawning 1.6s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

.grok-bot-mark[data-motion="slow-spin"] .motion-layer {
  animation: slow-spin 7s linear infinite;
}

.grok-bot-mark[data-motion="none"] .motion-layer {
  animation: none;
}

.grok-bot-mark[data-muted="true"] .face-group {
  opacity: 0.26;
}

.grok-bot-mark[data-blink="off"] .eye-path {
  animation: none;
  transform: scaleY(0.08);
}

.grok-bot-mark[data-blink="wink"] .eye-left .eye-path {
  animation: wink 2.4s ease-in-out infinite;
}

figcaption {
  position: absolute;
  right: 18px;
  bottom: 14px;
  left: 18px;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.figcaption-rule {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.stage-toolbar {
  margin-top: 14px;
  gap: 18px;
}

.stage-toolbar-left {
  display: flex;
  align-items: center;
}

.stage-toolbar-left {
  flex-wrap: wrap;
  gap: 9px;
}


.autoplay-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

.autoplay-button[aria-pressed="true"] {
  border-color: var(--ink);
  color: var(--surface);
  background: var(--ink);
}

.autoplay-button[aria-pressed="true"] .play-icon {
  animation: play-beat 1.4s ease-in-out infinite;
}

.play-icon {
  font-size: 10px;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.swatch[data-color="#0b0b0b"] { --swatch-color: #0b0b0b; }
.swatch[data-color="#705cff"] { --swatch-color: #705cff; }
.swatch[data-color="#3c82f6"] { --swatch-color: #3c82f6; }
.swatch[data-color="#f9705c"] { --swatch-color: #f9705c; }

.swatch:hover,
.swatch.is-selected {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink);
}

.controls {
  max-height: 820px;
  overflow: auto;
  padding: clamp(20px, 2.5vw, 32px);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.controls-heading {
  position: sticky;
  top: -32px;
  z-index: 2;
  min-height: 86px;
  margin: -10px 0 6px;
  padding-top: 10px;
  background: linear-gradient(rgb(255 255 255 / 96%) 70%, transparent);
}

.controls h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.panel-tabs {
  position: sticky;
  top: 54px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: rgb(247 247 245 / 94%);
  backdrop-filter: blur(10px);
}

.panel-tab {
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.panel-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 5px rgb(10 10 10 / 8%);
}

.editor-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 12px 13px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--paper);
}

.editor-status span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.editor-status strong {
  display: block;
  margin-top: 3px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.editor-status .save-status {
  color: var(--green);
  letter-spacing: 0.03em;
  text-transform: none;
}

.editor-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.editor-section + .editor-section {
  margin-top: 25px;
  padding-top: 22px;
  border-top: 1px solid var(--soft-line);
}

.editor-section h3 {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.editor-control {
  display: grid;
  grid-template-columns: minmax(90px, 0.75fr) minmax(130px, 1.25fr) 48px;
  gap: 10px;
  align-items: center;
  min-height: 36px;
}

.editor-control + .editor-control {
  margin-top: 7px;
}

.editor-control label {
  color: #5f6166;
  font-size: 11px;
}

.editor-control input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
}

.editor-control input[type="color"] {
  width: 100%;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.editor-control select {
  min-width: 0;
  width: 100%;
  height: 31px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.editor-control output {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  text-align: right;
}

.editor-control.is-checkbox {
  grid-template-columns: 1fr auto;
}

.editor-control.is-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.editor-history,
.editor-io {
  display: grid;
  gap: 7px;
  margin-top: 24px;
}

.editor-history {
  grid-template-columns: repeat(2, 1fr);
}

.editor-io {
  grid-template-columns: repeat(2, 1fr);
  padding-top: 22px;
  border-top: 1px solid var(--soft-line);
}

.editor-history button,
.editor-io button,
.editor-io a,
.import-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  cursor: pointer;
}

.editor-io .component-guide-button {
  grid-column: 1 / -1;
  color: var(--surface);
  border-color: var(--ink);
  background: var(--ink);
  text-decoration: none;
}

.editor-history button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

#import-json-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.editor-io .danger-button {
  grid-column: 1 / -1;
  color: #b42318;
}

.state-count {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.state-group + .state-group {
  margin-top: 25px;
  padding-top: 23px;
  border-top: 1px solid var(--soft-line);
}

.state-group h3 {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.state-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.state-button {
  min-width: 0;
  padding: 10px 11px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #52545a;
  background: transparent;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.state-button:hover {
  border-color: var(--soft-line);
  color: var(--ink);
  background: var(--paper);
  transform: translateX(2px);
}

.state-button.is-active {
  border-color: var(--ink);
  color: var(--surface);
  background: var(--ink);
}

.state-button small {
  margin-left: 4px;
  color: inherit;
  opacity: 0.6;
  font-size: 10px;
}

.notes {
  display: grid;
  grid-template-columns: 0.42fr 1.2fr 0.78fr;
  gap: clamp(30px, 5vw, 74px);
  align-items: start;
  margin-top: clamp(100px, 13vw, 190px);
  padding: 52px 0 clamp(100px, 13vw, 180px);
  border-top: 1px solid var(--line);
}

.notes-index {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.notes h2 {
  max-width: 660px;
  margin: 0;
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.notes > div > p {
  max-width: 660px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.notes-facts {
  margin: 0;
}

.notes-facts div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.notes-facts dt {
  color: var(--muted);
  font-size: 12px;
}

.notes-facts dd {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

footer {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

footer a:hover {
  color: var(--ink);
}

@keyframes status-pulse {
  0%, 45% { box-shadow: 0 0 0 4px rgb(63 190 134 / 12%); }
  70%, 100% { box-shadow: 0 0 0 9px rgb(63 190 134 / 0%); }
}

@keyframes bot-breathe {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50% { transform: translateY(-3px) rotate(0.4deg); }
}

@keyframes shadow-breathe {
  0%, 100% { opacity: 0.72; transform: scaleX(1); }
  50% { opacity: 0.54; transform: scaleX(0.94); }
}

@keyframes blink {
  0%, 92%, 95%, 100% { transform: scaleY(1); }
  93.4% { transform: scaleY(0.06); }
}

@keyframes wink {
  0%, 62%, 76%, 100% { transform: scaleY(1); }
  68% { transform: scaleY(0.05); }
}

@keyframes searching {
  0%, 100% { transform: translateX(-8px) rotate(-4deg); }
  50% { transform: translateX(8px) rotate(4deg); }
}

@keyframes working {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50% { transform: translateY(5px) rotate(1.2deg); }
}

@keyframes excited {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-9px) scale(1.025, 0.975); }
  65% { transform: translateY(2px) scale(0.985, 1.018); }
}

@keyframes laughing {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes scared {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1.6px, 1px); }
  75% { transform: translate(1.6px, -1px); }
}

@keyframes bouncing {
  0%, 100% { transform: translateY(0) scale(1); }
  48% { transform: translateY(-45px) scale(0.96, 1.05); }
  58% { transform: translateY(-42px) scale(1); }
  88% { transform: translateY(3px) scale(1.05, 0.92); }
}

@keyframes spawning {
  0% { opacity: 0; transform: scale(0.68) rotate(-12deg); }
  45% { opacity: 1; transform: scale(1.07) rotate(3deg); }
  68%, 100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes slow-spin {
  to { transform: rotate(360deg); }
}

@keyframes dots-think {
  0%, 100% { transform: translateY(2px); }
  50% { transform: translateY(-7px); }
}

@keyframes orbit-spin {
  to { transform: rotate(360deg); }
}

@keyframes radar-spin {
  to { transform: rotate(360deg); }
}

@keyframes progress-spin {
  0% { stroke-dashoffset: 730; transform: rotate(-90deg); }
  55% { stroke-dashoffset: 290; }
  100% { stroke-dashoffset: 730; transform: rotate(270deg); }
}

@keyframes wave-pulse {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

@keyframes transfer-out {
  0% { opacity: 0; transform: translateX(-34px); }
  25%, 65% { opacity: 1; }
  100% { opacity: 0; transform: translateX(34px); }
}

@keyframes transfer-in {
  0% { opacity: 0; transform: translateX(34px) scaleX(-1); }
  25%, 65% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-34px) scaleX(-1); }
}

@keyframes pencil-write {
  0%, 100% { transform: translate(-4px, 4px) rotate(-2deg); }
  50% { transform: translate(7px, -7px) rotate(3deg); }
}

@keyframes upload-rise {
  0% { opacity: 0; transform: translateY(24px); }
  28%, 68% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}

@keyframes alert-pop {
  0%, 100% { transform: scale(0.94); opacity: 0.65; }
  50% { transform: scale(1.05); opacity: 1; }
}

@keyframes confetti-pop {
  0% { opacity: 0; transform: scale(0.76) rotate(-8deg); }
  35%, 70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.12) rotate(7deg); }
}

@keyframes badge-ping {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.25); }
  26% { transform: scale(0.94); }
  38% { transform: scale(1); }
}

@keyframes play-beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.76); }
}

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

  .controls {
    max-height: none;
  }

  .controls-heading {
    position: static;
    margin-top: 0;
    background: transparent;
  }

  .state-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .notes {
    grid-template-columns: 0.32fr 1fr;
  }

  .notes-facts {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .site-header {
    min-height: 72px;
  }

  .wordmark-sub {
    display: none;
  }

  .source-link {
    padding: 8px 11px;
  }

  .intro {
    padding-top: 74px;
  }

  .intro h1 {
    font-size: clamp(52px, 18vw, 76px);
  }

  .state-readout {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .bot-stage {
    min-height: 390px;
  }

  .grok-bot-mark {
    width: min(76%, 300px);
  }

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

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

  .notes-facts {
    grid-column: auto;
  }

  footer {
    padding: 22px 0;
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* Source-aligned SVG runtime overrides. The state engine owns all transforms. */
.grok-bot-mark {
  --fg: #0b0b0b;
  --bg: #fff;
  width: min(66%, var(--bot-size));
  transform-origin: center;
}

.grok-bot-mark__head,
.morph-part {
  fill: var(--fg);
}

.grok-bot-mark__eye {
  fill: var(--bg);
}

.eye-path {
  animation: none !important;
  transform-origin: 0 0;
}

.notify-badge {
  opacity: 1;
  transform: none;
  transition: none;
}

.morph-head,
.morph-part,
.morph-ring,
.morph-glyph,
#particles-back > *,
#particles-front > * {
  transition: none;
}

.morph-ring {
  fill: none;
  stroke: var(--fg);
}

.morph-glyph {
  fill: var(--fg);
}

.grok-bot-mark [hidden] {
  display: none !important;
}

.panel-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.state-button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.state-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state-button code {
  color: inherit;
  font-size: 8px;
  opacity: 0.52;
}

.fidelity-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fidelity-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgb(63 190 134 / 12%);
}

.editor-control--checkbox {
  grid-template-columns: 1fr auto;
}

.editor-control--checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.editor-control--select,
.editor-control--color {
  grid-template-columns: minmax(90px, 0.75fr) minmax(130px, 1.25fr);
}

.save-status.is-modified {
  color: var(--coral);
}

.shape-library-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--soft-line);
}

.shape-library-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.shape-library-heading strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.shape-library-heading code {
  color: var(--muted);
  font-size: 8px;
}

.shape-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.shape-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1px 5px;
  padding: 8px 8px 7px;
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.shape-option svg {
  grid-column: 1 / -1;
  width: 100%;
  height: 72px;
  margin-bottom: 3px;
  overflow: visible;
}

.shape-option-head {
  fill: currentColor;
  opacity: 0.88;
}

.shape-option-eye {
  fill: var(--surface);
}

.shape-option span {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shape-option code {
  color: inherit;
  font-size: 7px;
  opacity: 0.5;
}

.shape-option:hover {
  border-color: #a6a7aa;
  transform: translateY(-1px);
}

.shape-option.is-selected {
  border-color: var(--ink);
  color: var(--surface);
  background: var(--ink);
}

.shape-option:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.expression-picker {
  min-width: 0;
  margin: 0 0 15px;
  padding: 0;
  border: 0;
}

.expression-picker legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
}

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

.expression-option {
  position: relative;
  aspect-ratio: 1;
  padding: 3px;
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--paper);
  cursor: pointer;
}

.expression-option svg {
  width: 100%;
  height: 100%;
}

.expression-option path {
  fill: var(--ink);
  opacity: 0.38;
}

.expression-option span {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 7px;
}

.expression-option:hover,
.expression-option.is-selected {
  border-color: var(--ink);
  color: var(--surface);
  background: var(--ink);
}

.expression-option.is-selected path,
.expression-option:hover path {
  fill: var(--surface);
  opacity: 1;
}

.runtime-readout {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 5px;
}

.runtime-readout span {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  letter-spacing: -0.01em;
}

.editor-control-label {
  color: #5f6166;
  font-size: 11px;
}

.transition-console {
  margin: 0 0 26px;
  padding: 15px;
  border: 1px solid #111;
  border-radius: 15px;
  color: #f7f7f4;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 4%), transparent 38%),
    #101110;
  box-shadow: 0 10px 28px rgb(10 10 10 / 12%);
}

.transition-console-heading,
.transition-route,
.transition-timing,
.transition-transport {
  display: grid;
  gap: 8px;
}

.transition-console-heading {
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 14px;
}

.transition-console-heading span,
.transition-route label > span,
.transition-timing label > span {
  display: block;
  margin-bottom: 4px;
  color: #898b88;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.transition-console-heading h3 {
  margin: 0;
  color: #fff;
  font-size: 13px;
  letter-spacing: -0.02em;
}

.transition-console-heading output {
  max-width: 150px;
  padding: 5px 7px;
  overflow: hidden;
  border: 1px solid #313330;
  border-radius: 999px;
  color: #9ce6be;
  background: #181a18;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transition-route {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  margin-bottom: 11px;
}

.transition-route b {
  padding-bottom: 8px;
  color: #72746f;
  font-size: 14px;
  font-weight: 400;
}

.transition-console select,
.transition-console input[type="number"] {
  min-width: 0;
  width: 100%;
  height: 31px;
  padding: 0 8px;
  border: 1px solid #343633;
  border-radius: 7px;
  color: #f7f7f4;
  background: #1a1c1a;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.transition-timing {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.transition-timing label {
  position: relative;
  min-width: 0;
}

.transition-timing label small {
  position: absolute;
  right: 7px;
  bottom: 9px;
  color: #737571;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 7px;
  pointer-events: none;
}

.transition-timing input[type="number"] {
  padding-right: 27px;
}

.transition-timing .transition-loop {
  grid-column: 1 / -1;
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #b6b8b4;
  font-size: 9px;
}

.transition-loop input {
  accent-color: #72d49f;
}

.transition-timing .transition-loop > span {
  margin: 0;
  color: inherit;
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.transition-transport {
  grid-template-columns: 1.5fr repeat(4, 1fr);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #292b28;
}

.transition-transport button {
  min-width: 0;
  min-height: 31px;
  padding: 0 5px;
  overflow: hidden;
  border: 1px solid #363835;
  border-radius: 7px;
  color: #bfc1bd;
  background: #191b19;
  font-size: 8px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.transition-transport button:first-child {
  border-color: #d9dcd6;
  color: #111;
  background: #f1f3ee;
}

.transition-transport button:hover {
  border-color: #7a7d77;
}

.expression-option.is-previewing {
  outline: 2px solid var(--coral);
  outline-offset: 1px;
}

.expression-pool-order {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--soft-line);
}

.expression-pool-heading,
.expression-pool-item {
  display: grid;
  align-items: center;
}

.expression-pool-heading {
  grid-template-columns: 1fr auto;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
}

.expression-pool-heading small {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 7px;
}

.expression-pool-item {
  grid-template-columns: 31px 42px 46px minmax(74px, 1fr) 25px;
  gap: 5px;
  min-height: 35px;
  padding: 3px 4px 3px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.expression-pool-item + .expression-pool-item {
  margin-top: 3px;
}

.expression-pool-item.is-previewing {
  border-color: #f4a190;
  background: #fff8f6;
}

.expression-pool-item code {
  color: var(--muted);
  font-size: 8px;
}

.expression-pool-item button {
  height: 25px;
  padding: 0 5px;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--paper);
  font-size: 8px;
  cursor: pointer;
}

.expression-pool-item button:disabled {
  opacity: 0.3;
  cursor: default;
}

.expression-order-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.expression-order-buttons button {
  padding: 0;
}

.expression-weight {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 7px;
}

.expression-weight input {
  min-width: 0;
  width: 100%;
  height: 25px;
  padding: 0 4px;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.expression-pool-item .expression-remove-button {
  padding: 0;
  color: var(--coral);
  font-size: 13px;
}

.morph-trigger-console {
  margin: -10px 0 26px;
  padding: 13px;
  border: 1px solid var(--soft-line);
  border-radius: 13px;
  background: var(--paper);
}

.morph-trigger-heading,
.morph-logic-row,
.morph-trigger-controls {
  display: grid;
  align-items: center;
  gap: 8px;
}

.morph-trigger-heading {
  grid-template-columns: 1fr auto;
  margin-bottom: 10px;
}

.morph-trigger-heading span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.morph-trigger-heading h3 {
  margin: 0;
  font-size: 12px;
}

.morph-trigger-heading output {
  min-width: 50px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  background: var(--surface);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 7px;
  text-align: center;
}

.morph-trigger-heading output[data-phase="EXIT"],
.morph-trigger-heading output[data-phase="RESET"] {
  color: var(--coral);
}

.morph-trigger-heading output[data-phase="REST"],
.morph-trigger-heading output[data-phase="DONE"] {
  color: var(--muted);
}

.morph-logic-row {
  grid-template-columns: auto 1fr;
}

.morph-logic-row code {
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--surface);
  background: var(--ink);
  font-size: 8px;
}

.morph-logic-row span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.morph-trigger-console > p {
  min-height: 32px;
  margin: 8px 0 11px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.morph-trigger-controls {
  grid-template-columns: minmax(86px, 0.75fr) minmax(110px, 1.25fr) minmax(90px, 1fr);
}

.morph-trigger-controls label {
  position: relative;
  min-width: 0;
}

.morph-trigger-controls label > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 8px;
}

.morph-trigger-controls input,
.morph-trigger-controls button {
  min-width: 0;
  width: 100%;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font-size: 8px;
}

.morph-trigger-controls input {
  padding: 0 25px 0 7px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.morph-trigger-controls label small {
  position: absolute;
  right: 6px;
  bottom: 10px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 6px;
  pointer-events: none;
}

.morph-trigger-controls button {
  align-self: end;
  padding: 0 6px;
  font-weight: 680;
  cursor: pointer;
}

.morph-trigger-controls button:nth-of-type(1) {
  color: var(--surface);
  background: var(--ink);
}

.morph-trigger-controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .grok-bot-mark {
    width: min(76%, var(--bot-size));
  }

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

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

  .runtime-readout {
    justify-items: start;
  }

  .transition-console {
    padding: 12px;
  }

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

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

  .transition-transport button:first-child {
    grid-column: 1 / -1;
  }

  .morph-trigger-controls {
    grid-template-columns: 1fr 1fr;
  }

  .morph-trigger-controls label {
    grid-column: 1 / -1;
  }
}
