:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --ink: #171717;
  --muted: #66645f;
  --blue: #165dff;
  --coral: #ff5b45;
  --lime: #cbff4a;
  --rule: rgba(23, 23, 23, 0.76);
  --soft-rule: rgba(23, 23, 23, 0.28);
  --page-pad: clamp(1.25rem, 3.6vw, 4rem);
  --ease: cubic-bezier(0.22, 0.78, 0.2, 1);
  font-family: Inter, "Arial Narrow", "PingFang SC", "Microsoft YaHei",
    "Noto Sans CJK SC", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  transition: background-color 400ms ease;
}

body[data-mood="coral"] {
  --blue: #ff5b45;
  --coral: #165dff;
  --lime: #fff36a;
}

body[data-mood="lime"] {
  --blue: #171717;
  --coral: #ff5b45;
  --lime: #99ff52;
  --paper: #efffda;
}

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

button {
  color: inherit;
  font: inherit;
}

svg {
  display: block;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  translate: 0 -200%;
  border: 2px solid var(--ink);
  background: var(--lime);
  font-weight: 800;
}

.skip-link:focus {
  translate: 0;
}

.cursor-spark {
  position: fixed;
  z-index: 90;
  width: 11px;
  height: 11px;
  pointer-events: none;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  opacity: 0;
  translate: -50% -50%;
  transition:
    width 180ms ease,
    height 180ms ease,
    opacity 180ms ease,
    background-color 400ms ease;
}

@media (pointer: fine) {
  body:hover .cursor-spark {
    opacity: 1;
  }

  body:has(a:hover, button:hover) .cursor-spark {
    width: 22px;
    height: 22px;
    background: transparent;
  }
}

.site-shell {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  border-bottom: 2px solid var(--ink);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: 950;
  letter-spacing: -0.055em;
}

.wordmark-dot {
  width: 0.75rem;
  height: 0.75rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
  transition: transform 250ms var(--ease);
}

.wordmark:hover .wordmark-dot {
  transform: translateX(0.45rem) scale(1.25);
}

.site-nav {
  display: flex;
  align-self: stretch;
  gap: clamp(1.5rem, 4vw, 4rem);
}

.site-nav a {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 2.5rem;
  font-size: clamp(0.9rem, 1.2vw, 1.06rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: 1.25rem;
  left: 0;
  height: 3px;
  scale: 0 1;
  background: var(--blue);
  content: "";
  transform-origin: right;
  transition: scale 240ms var(--ease);
}

.site-nav a:is(:hover, :focus-visible, .is-active)::after {
  scale: 1 1;
  transform-origin: left;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(28rem, 0.96fr);
  align-items: center;
  min-height: clamp(36rem, calc(100svh - 5rem), 38rem);
  padding: clamp(2.75rem, 4vh, 3.5rem) 0;
  border-bottom: 2px solid var(--ink);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero h1 {
  max-width: 9ch;
  margin: 0;
  font-size: clamp(4.3rem, 7.4vw, 7.5rem);
  font-weight: 950;
  letter-spacing: -0.085em;
  line-height: 0.96;
}

.hero h1 span {
  display: block;
}

.hero h1 .coral {
  display: inline;
  color: var(--coral);
}

.hero-copy > p {
  max-width: 34rem;
  margin: clamp(2.2rem, 5vh, 3.5rem) 0 0;
  font-size: clamp(1rem, 1.55vw, 1.35rem);
  font-weight: 540;
  letter-spacing: 0.02em;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: clamp(1.6rem, 3vw, 3rem);
  margin-top: clamp(2.1rem, 4.5vh, 3.3rem);
}

.button,
.lab-option {
  border: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  box-shadow: 7px 7px 0 var(--ink);
  cursor: pointer;
  transition:
    translate 190ms var(--ease),
    box-shadow 190ms var(--ease),
    background-color 280ms ease;
}

.button:hover,
.button:focus-visible,
.lab-option:hover,
.lab-option:focus-visible {
  translate: 3px 3px;
  box-shadow: 4px 4px 0 var(--ink);
}

.button-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: clamp(12.5rem, 17vw, 15.5rem);
  min-height: 4.9rem;
  padding: 0 1.7rem;
  background: var(--blue);
  color: #fff;
  font-size: 1.12rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.button-primary svg {
  width: 1.6rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mood-button {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 3rem;
  padding: 0.45rem 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 750;
}

.mood-button svg {
  width: 2.5rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: translate 220ms var(--ease);
}

.mood-button:hover svg {
  translate: 0.35rem 0;
}

.orbit-stage {
  position: relative;
  justify-self: end;
  width: min(100%, 39rem);
  aspect-ratio: 1;
  touch-action: none;
  user-select: none;
}

.orbit-lines {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.orbit,
.orbit-cut,
.core-tether {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.orbit-a,
.orbit-c {
  stroke-dasharray: 7 7;
}

.orbit-b {
  stroke-width: 2.5;
}

.orbit-node {
  fill: var(--ink);
}

.core-tether {
  stroke-dasharray: 5 7;
}

.orbit-shape,
.drag-core {
  position: absolute;
  display: block;
  border: 2px solid var(--ink);
}

.drag-core {
  top: 50%;
  left: 50%;
  width: clamp(4.5rem, 8vw, 6.25rem);
  aspect-ratio: 1;
  padding: 0;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 4px 4px 0 rgba(23, 23, 23, 0.95);
  cursor: grab;
  z-index: 3;
}

.drag-core:active {
  cursor: grabbing;
  box-shadow: 1px 1px 0 var(--ink);
}

.drag-core::after {
  position: absolute;
  inset: -14px;
  border: 1px dashed transparent;
  border-radius: inherit;
  content: "";
  transition: border-color 180ms ease;
}

.drag-core:hover::after,
.drag-core:focus-visible::after {
  border-color: var(--ink);
}

.coral-square {
  top: 70%;
  left: 20%;
  width: clamp(2.3rem, 4vw, 3.5rem);
  aspect-ratio: 1;
  rotate: -9deg;
  background: var(--coral);
  animation: square-float 4.8s ease-in-out infinite;
}

.lime-dot {
  top: 15%;
  right: 5%;
  width: clamp(2rem, 4vw, 3.1rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--lime);
  animation: dot-orbit 7s ease-in-out infinite alternate;
}

.orbit-hint {
  position: absolute;
  right: clamp(0rem, 4vw, 4rem);
  bottom: 2.2rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  font-size: 0.93rem;
  font-weight: 720;
}

.orbit-hint span {
  font-size: 1.45rem;
}

.hero-index {
  position: absolute;
  right: 0;
  bottom: 1.2rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.tracks-section,
.lab-section {
  padding: clamp(2.5rem, 3vw, 3.25rem) 0;
  border-bottom: 2px solid var(--ink);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(2rem, 4vw, 4rem);
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  font-weight: 950;
  letter-spacing: -0.065em;
  line-height: 1;
}

.section-heading > span {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.tracks-list {
  border-top: 1px solid var(--soft-rule);
}

.track {
  --track-color: var(--blue);
  display: grid;
  grid-template-columns: clamp(5rem, 10vw, 9rem) clamp(7rem, 11vw, 10rem) minmax(12rem, 1fr) minmax(14rem, 0.75fr);
  align-items: center;
  gap: clamp(1rem, 2vw, 2.2rem);
  min-height: clamp(6rem, 7vw, 7rem);
  border-bottom: 1px dashed var(--soft-rule);
  outline: none;
}

.track-code {
  --track-color: var(--coral);
}

.track-life {
  --track-color: var(--lime);
}

.track-number {
  font-size: clamp(3.5rem, 7vw, 6.8rem);
  font-weight: 950;
  letter-spacing: -0.08em;
  line-height: 0.8;
  transition: color 220ms ease;
}

.track h3 {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0;
  font-size: clamp(1.3rem, 2.2vw, 2.1rem);
  font-weight: 900;
}

.track h3 span {
  width: 1.05rem;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--track-color);
}

.track-path {
  width: 100%;
  height: clamp(4rem, 7vw, 5.4rem);
  overflow: visible;
}

.track-path path,
.track-path circle,
.track-path rect {
  fill: none;
  stroke: var(--track-color);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  transition: stroke-width 220ms ease;
}

.track p {
  max-width: 19rem;
  margin: 0;
  font-size: clamp(0.98rem, 1.45vw, 1.25rem);
  font-weight: 650;
  line-height: 1.6;
}

.track:is(:hover, :focus-visible) .track-number {
  color: var(--track-color);
}

.track:is(:hover, :focus-visible) .track-path :is(path, circle, rect) {
  stroke-width: 6;
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 0.28fr) minmax(0, 0.72fr);
  align-items: stretch;
  gap: clamp(2.5rem, 6vw, 7rem);
}

.lab-controls {
  display: grid;
  align-content: center;
  gap: 1.15rem;
}

.lab-option {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  width: 100%;
  min-height: 4.6rem;
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-size: 1.03rem;
  font-weight: 800;
  letter-spacing: 0.035em;
}

.lab-option.is-selected {
  background: var(--blue);
  color: #fff;
}

.lab-option svg {
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.letter-icon {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  flex: 0 0 auto;
  font-family: Georgia, serif;
  font-size: 1.8rem;
}

.motion-icon circle {
  stroke-dasharray: 3 5;
}

.lab-canvas {
  position: relative;
  min-height: clamp(18rem, 23vw, 22rem);
  overflow: hidden;
  border-left: 1px solid var(--soft-rule);
}

.canvas-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 320ms ease,
    transform 520ms var(--ease);
  transform: translateY(1.2rem);
}

.canvas-state.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.line-state svg {
  width: 100%;
  overflow: visible;
}

.canvas-line {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.line-two {
  stroke-dasharray: 7 9;
}

.line-three {
  stroke: var(--blue);
  stroke-width: 3;
}

.words-state p {
  margin: 0;
  font-size: clamp(3.2rem, 7vw, 7rem);
  font-weight: 950;
  letter-spacing: -0.08em;
  line-height: 0.95;
}

.typing-caret {
  position: absolute;
  right: 18%;
  bottom: 25%;
  width: 0.3rem;
  height: 4rem;
  background: var(--coral);
  animation: blink 800ms step-end infinite;
}

.motion-state {
  overflow: hidden;
}

.motion-orbit {
  position: absolute;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.motion-orbit span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.3rem;
  aspect-ratio: 1;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  transform: translate(-50%, -50%) translateX(var(--radius));
}

.orbit-large {
  width: min(75%, 29rem);
  aspect-ratio: 1;
  animation: spin 9s linear infinite;
}

.orbit-large span {
  --radius: clamp(8rem, 18vw, 14.5rem);
}

.orbit-small {
  width: min(44%, 17rem);
  aspect-ratio: 1;
  border-style: dashed;
  animation: spin-reverse 5s linear infinite;
}

.orbit-small span {
  --radius: clamp(4.5rem, 10vw, 8.5rem);
  background: var(--coral);
}

.motion-core {
  width: 5rem;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 6px 6px 0 var(--ink);
}

.canvas-square,
.canvas-lime {
  position: absolute;
  z-index: 4;
  display: block;
  border: 2px solid var(--ink);
  pointer-events: none;
}

.canvas-square {
  top: 6%;
  left: 37%;
  width: 2.5rem;
  aspect-ratio: 1;
  rotate: -28deg;
  background: var(--coral);
}

.canvas-lime {
  right: 5%;
  bottom: 18%;
  width: 3.2rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--lime);
}

.lab-result {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  font-weight: 700;
}

.lab-result span {
  font-size: 2rem;
}

.site-footer {
  padding: clamp(2.75rem, 4vw, 4rem) 0 2.25rem;
}

.footer-message {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin: 0;
  font-size: clamp(4rem, 8.7vw, 8.8rem);
  font-weight: 950;
  letter-spacing: -0.085em;
  line-height: 0.95;
}

.footer-message span {
  color: var(--blue);
  text-align: right;
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(3rem, 6vw, 5rem);
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.footer-meta p {
  margin: 0;
}

.footer-meta a:hover {
  color: var(--blue);
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 5px;
}

@keyframes square-float {
  50% {
    translate: 0 -0.8rem;
    rotate: 10deg;
  }
}

@keyframes dot-orbit {
  to {
    translate: -1.5rem 2rem;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

@keyframes spin-reverse {
  to {
    rotate: -360deg;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-copy {
    padding-right: 6vw;
  }

  .hero h1 {
    max-width: 8.5ch;
    font-size: clamp(4rem, 11vw, 7rem);
  }

  .orbit-stage {
    width: min(86vw, 37rem);
    margin: -2rem -3vw 0 auto;
  }

  .orbit-hint {
    position: static;
    justify-self: center;
    margin: -2rem 0 3.5rem;
  }

  .track {
    grid-template-columns: clamp(4.5rem, 10vw, 7rem) clamp(7rem, 15vw, 9rem) 1fr;
  }

  .track-path {
    grid-column: 2 / 4;
  }

  .track p {
    grid-column: 3;
    grid-row: 1;
  }

  .lab-layout {
    grid-template-columns: 1fr;
  }

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

  .lab-canvas {
    border-top: 1px solid var(--soft-rule);
    border-left: 0;
  }

  .footer-message {
    flex-direction: column;
  }

  .footer-message span {
    text-align: left;
  }
}

@media (max-width: 650px) {
  .site-header {
    min-height: 5.2rem;
  }

  .wordmark {
    gap: 0.5rem;
    font-size: 1.08rem;
  }

  .wordmark-dot {
    width: 0.55rem;
    height: 0.55rem;
  }

  .site-nav {
    gap: 1rem;
  }

  .site-nav a {
    min-width: auto;
    font-size: 0.78rem;
  }

  .site-nav a::after {
    bottom: 0.8rem;
  }

  .hero {
    padding-top: 3.5rem;
  }

  .hero-copy {
    padding-right: 0;
  }

  .hero h1 {
    font-size: clamp(3.15rem, 16.5vw, 4.7rem);
    line-height: 1;
  }

  .hero-copy > p {
    max-width: 26rem;
    font-size: 0.98rem;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button-primary {
    width: 100%;
  }

  .mood-button {
    align-self: flex-start;
  }

  .orbit-stage {
    width: 100%;
    margin: -0.75rem 0 -2.5rem;
  }

  .hero-index {
    bottom: 0.8rem;
  }

  .section-heading h2 {
    max-width: 7ch;
  }

  .track {
    grid-template-columns: 4rem 1fr;
    gap: 1rem;
    padding: 2rem 0;
  }

  .track-number {
    grid-row: 1 / 3;
    align-self: start;
    font-size: 3.8rem;
  }

  .track h3 {
    grid-column: 2;
  }

  .track p {
    grid-column: 2;
    grid-row: 2;
  }

  .track-path {
    grid-column: 1 / 3;
    grid-row: 3;
  }

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

  .lab-canvas {
    min-height: 24rem;
  }

  .words-state p {
    font-size: clamp(2.8rem, 15vw, 4.5rem);
  }

  .footer-message {
    font-size: clamp(3.4rem, 16vw, 5.8rem);
  }
}

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

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