:root {
  --ink: #111713;
  --ink-soft: #3b463e;
  --paper: #f3f2ee;
  --paper-deep: #e6e5de;
  --white: #ffffff;
  --signal: #db5947;
  --green: #2c775c;
  --mint: #a9d6c1;
  --blue: #3f6480;
  --line: rgba(17, 23, 19, 0.18);
  --shell: min(1240px, calc(100vw - 48px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

button,
a,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(219, 89, 71, 0.45);
  outline-offset: 3px;
}

.lab-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(243, 242, 238, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.beta-route {
  width: var(--shell);
  margin: 0 auto 88px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 48px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}

.beta-route h2 {
  max-width: 18ch;
  margin: 10px 0;
  font-size: clamp(24px, 2.5vw, 38px);
  line-height: 1.2;
}

.beta-route p {
  margin: 0;
}

.beta-route ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.beta-route li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.beta-route li span {
  margin-right: 16px;
  color: var(--green);
  font-weight: 800;
}

.beta-route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
}

.beta-route-actions a {
  padding: 10px 18px;
  border: 1px solid var(--ink);
  font-weight: 700;
}

.beta-route-actions a:first-child {
  color: var(--white);
  background: var(--ink);
}

@media (max-width: 680px) {
  .beta-route {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 24px 20px;
  }

  .beta-route-actions {
    grid-column: 1;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  font-weight: 760;
  text-transform: uppercase;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--ink);
  border: 1px solid var(--ink);
  font-size: 10px;
  font-weight: 820;
}

.lab-header nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 13px;
  font-weight: 650;
}

.lab-header nav a {
  position: relative;
  padding: 8px 0;
}

.lab-header nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 160ms ease;
}

.lab-header nav a:hover::after,
.lab-header nav .is-current::after {
  transform: scaleX(1);
  transform-origin: left;
}

.home-link {
  min-height: 38px;
  padding: 7px 13px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
}

.lab-intro,
.navigation-lab,
.open-source,
.lab-footer {
  width: var(--shell);
  margin-inline: auto;
}

.lab-intro {
  min-height: 430px;
  padding: 86px 0 70px;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 90px;
  align-items: end;
}

.kicker,
.control-label {
  margin: 0 0 17px;
  font-size: 11px;
  font-weight: 780;
  line-height: 1.4;
  text-transform: uppercase;
}

.lab-intro h1 {
  margin: 0;
  font-size: clamp(56px, 7.2vw, 104px);
  font-weight: 760;
  line-height: 0.98;
  letter-spacing: 0;
}

.intro-copy > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.intro-readout {
  margin-top: 38px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.intro-readout span {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 680;
}

.intro-readout strong {
  color: rgba(17, 23, 19, 0.48);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 500;
}

.navigation-lab {
  padding: 110px 0 126px;
  border-top: 1px solid var(--line);
}

.section-title {
  margin-bottom: 58px;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 64px;
  align-items: end;
}

.section-title h2,
.mujoco-copy h2,
.open-source h2 {
  margin: 0;
  font-size: clamp(42px, 5vw, 72px);
  font-weight: 730;
  line-height: 1.08;
  letter-spacing: 0;
}

.section-title > p {
  margin: 0 0 7px;
  color: var(--ink-soft);
}

.workbench {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 28px 70px rgba(17, 23, 19, 0.1);
}

.control-panel {
  padding: 25px;
  background: #151c17;
  color: var(--white);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.control-group {
  padding: 0 0 25px;
  margin-bottom: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.control-label {
  color: rgba(255, 255, 255, 0.58);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.tool-grid button,
.minor-actions button,
.segmented button,
.run-actions button,
.direction-pad button,
.mujoco-actions button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.tool-grid button {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.tool-grid button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--mint);
  border-color: var(--mint);
  font-weight: 730;
}

.tool-swatch {
  width: 11px;
  height: 11px;
  display: inline-block;
  border: 1px solid currentColor;
}

.wall-swatch {
  background: var(--ink);
}

.erase-swatch {
  background: var(--paper);
}

.start-swatch {
  background: var(--mint);
}

.goal-swatch {
  background: var(--signal);
}

.minor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 8px;
}

.minor-actions button {
  min-height: 36px;
  color: rgba(255, 255, 255, 0.58);
  background: transparent;
  font-size: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
}

.segmented button {
  min-height: 38px;
  color: rgba(255, 255, 255, 0.62);
  background: transparent;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  font-size: 11px;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--mint);
  font-weight: 760;
}

.mode-control {
  grid-template-columns: 1fr 1fr;
}

.algorithm-note {
  min-height: 58px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.54);
  font-size: 11px;
  line-height: 1.7;
}

.run-actions {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 8px;
}

.run-actions button {
  min-height: 46px;
  font-size: 12px;
  font-weight: 740;
}

.secondary-button {
  color: var(--white);
  background: transparent;
}

.primary-button {
  color: var(--ink);
  background: var(--mint);
  border-color: var(--mint) !important;
}

.primary-button:hover,
.engine-button:hover {
  transform: translateY(-2px);
}

.map-panel {
  min-width: 0;
  background: #d7ded7;
}

.task-strip {
  min-height: 76px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.task-strip > div {
  display: flex;
  flex-direction: column;
}

.task-strip span,
.task-strip p,
.metrics span,
.mujoco-telemetry span {
  color: rgba(17, 23, 19, 0.52);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.task-strip strong {
  margin-top: 2px;
  font-size: 12px;
}

.task-strip p {
  margin: 0;
  color: var(--green);
  font-weight: 700;
  text-align: right;
}

#navigation-canvas {
  width: 100%;
  aspect-ratio: 8 / 5;
  display: block;
  background: #d7ded7;
  cursor: crosshair;
  touch-action: none;
}

.manual-drive {
  min-height: 82px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--white);
  background: var(--blue);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.manual-drive[hidden] {
  display: none;
}

.drive-copy {
  display: flex;
  flex-direction: column;
  font-size: 11px;
}

.drive-copy span {
  color: rgba(255, 255, 255, 0.62);
}

.direction-pad {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 5px;
}

.direction-pad button {
  width: 44px;
  height: 44px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  font-size: 20px;
}

.direction-pad button:active {
  background: var(--mint);
  color: var(--ink);
}

.metrics {
  min-height: 82px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: var(--white);
  background: var(--ink);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.metrics > div {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.metrics > div:last-child {
  border-right: 0;
}

.metrics span {
  color: rgba(255, 255, 255, 0.46);
}

.metrics strong {
  margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.comparison {
  margin-top: 78px;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 80px;
}

.comparison h3 {
  max-width: 440px;
  margin: 0;
  font-size: 32px;
  line-height: 1.22;
}

.comparison-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 14px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: rgba(17, 23, 19, 0.5);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 550;
}

td:not(:first-child),
th:not(:first-child) {
  text-align: right;
}

.empty-row td {
  color: rgba(17, 23, 19, 0.48);
  text-align: center;
}

.best-value {
  color: var(--green);
  font-weight: 820;
}

.mujoco-section {
  min-height: 840px;
  display: grid;
  grid-template-columns: minmax(360px, 0.72fr) minmax(560px, 1.28fr);
  color: var(--white);
  background: var(--ink);
}

.mujoco-copy {
  padding: 118px max(48px, calc((100vw - 1240px) / 2)) 88px;
  padding-right: 66px;
}

.mujoco-copy > p:not(.kicker):not(.engine-status) {
  max-width: 520px;
  margin: 28px 0 0;
  color: rgba(255, 255, 255, 0.62);
}

.mujoco-actions {
  margin-top: 42px;
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 7px;
}

.mujoco-actions button {
  min-height: 44px;
  padding: 8px 10px;
  color: var(--white);
  background: transparent;
  font-size: 11px;
}

.mujoco-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.36;
}

.mujoco-actions .engine-button {
  color: var(--ink);
  background: var(--signal);
  border-color: var(--signal);
  font-weight: 760;
}

.engine-status {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.48);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.mujoco-stage {
  position: relative;
  min-width: 0;
  min-height: 840px;
  overflow: hidden;
  background: #d5ddd6;
}

#mujoco-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.mujoco-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  color: var(--ink);
  text-align: center;
  pointer-events: none;
}

.mujoco-placeholder span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.mujoco-placeholder strong {
  margin-top: 6px;
  font-size: 16px;
}

.mujoco-placeholder.is-hidden {
  display: none;
}

.mujoco-telemetry {
  position: absolute;
  right: 22px;
  bottom: 22px;
  left: 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  color: var(--white);
  background: rgba(17, 23, 19, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  backdrop-filter: blur(12px);
}

.mujoco-telemetry > div {
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.mujoco-telemetry > div:last-child {
  border-right: 0;
}

.mujoco-telemetry span {
  color: rgba(255, 255, 255, 0.48);
}

.mujoco-telemetry strong {
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.mujoco-telemetry b {
  font-weight: 760;
}

.open-source {
  padding: 118px 0;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 90px;
}

.source-list {
  border-top: 1px solid var(--line);
}

.source-list a {
  min-height: 80px;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.source-list span,
.source-list em {
  color: rgba(17, 23, 19, 0.48);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-style: normal;
}

.source-list strong {
  font-size: 14px;
}

.lab-footer {
  min-height: 118px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 30px;
  align-items: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.lab-footer::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  left: 0;
  height: 118px;
  background: #090d0a;
}

.lab-footer .brand {
  color: var(--white);
}

.lab-footer p {
  margin: 0;
}

.lab-footer > a:last-child {
  text-align: right;
}

@media (max-width: 1060px) {
  .lab-intro {
    grid-template-columns: 1fr 0.8fr;
    gap: 54px;
  }

  .workbench {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .mujoco-section {
    grid-template-columns: 1fr;
  }

  .mujoco-copy {
    padding-right: max(48px, calc((100vw - 1240px) / 2));
  }

  .mujoco-copy > p:not(.kicker):not(.engine-status) {
    max-width: 680px;
  }

  .mujoco-stage {
    min-height: 680px;
  }
}

@media (max-width: 760px) {
  :root {
    --shell: min(100% - 32px, 1240px);
  }

  .lab-header {
    min-height: 64px;
    padding-inline: 16px;
  }

  .lab-header nav {
    display: none;
  }

  .home-link {
    min-height: 36px;
  }

  .lab-intro {
    min-height: 0;
    padding: 62px 0 54px;
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .lab-intro h1 {
    font-size: 54px;
  }

  .intro-copy > p {
    font-size: 15px;
  }

  .navigation-lab {
    padding: 74px 0 88px;
  }

  .section-title,
  .comparison,
  .open-source {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .section-title {
    margin-bottom: 36px;
  }

  .section-title h2,
  .mujoco-copy h2,
  .open-source h2 {
    font-size: 40px;
  }

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

  .control-panel {
    padding: 20px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  .control-group {
    padding-bottom: 19px;
    margin-bottom: 19px;
  }

  .task-strip {
    min-height: 86px;
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .task-strip p {
    text-align: left;
  }

  #navigation-canvas {
    min-height: 300px;
  }

  .manual-drive {
    min-height: 132px;
    align-items: flex-start;
    flex-direction: column;
  }

  .direction-pad {
    width: 100%;
    grid-template-columns: repeat(4, 1fr);
  }

  .direction-pad button {
    width: 100%;
  }

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

  .metrics > div {
    min-height: 70px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  .metrics > div:nth-child(2n) {
    border-right: 0;
  }

  .metrics > div:last-child {
    grid-column: 1 / -1;
  }

  .comparison {
    margin-top: 62px;
  }

  .mujoco-copy {
    padding: 78px 16px 58px;
  }

  .mujoco-actions {
    grid-template-columns: 1fr 1fr;
  }

  .mujoco-stage {
    min-height: 590px;
  }

  .mujoco-telemetry {
    right: 12px;
    bottom: 12px;
    left: 12px;
    grid-template-columns: repeat(2, 1fr);
  }

  .mujoco-telemetry > div:nth-child(2) {
    border-right: 0;
  }

  .mujoco-telemetry > div:nth-child(-n + 2) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .open-source {
    padding: 82px 0;
  }

  .source-list a {
    grid-template-columns: 30px 1fr;
  }

  .source-list em {
    grid-column: 2;
    padding-bottom: 12px;
  }

  .lab-footer {
    min-height: 180px;
    padding: 34px 0;
    grid-template-columns: 1fr;
    gap: 12px;
    align-content: center;
  }

  .lab-footer::before {
    height: 180px;
  }

  .lab-footer > a:last-child {
    text-align: left;
  }
}

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

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