:root {
  --page: #eef4ff;
  --ink: #25272d;
  --muted: #5c6069;
  --blue: #6b96f3;
  --blue-deep: #4f7ee6;
  --ring: rgba(37, 39, 45, 0.13);
  --card: #ffffff;
  --shadow: 0 26px 60px rgba(61, 88, 145, 0.18);
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.labs-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 74px;
  padding: 16px clamp(20px, 3vw, 42px);
  background: linear-gradient(180deg, rgba(238, 244, 255, 0.95), rgba(238, 244, 255, 0.68));
  backdrop-filter: blur(18px);
}

.brand,
.nav-links a {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: #fff;
  border-radius: 9px 9px 13px 13px;
  background: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.brand strong {
  font-size: clamp(20px, 2vw, 27px);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(22px, 3.5vw, 48px);
  font-size: clamp(17px, 1.45vw, 22px);
  font-weight: 750;
}

.sound-toggle {
  min-width: 104px;
  height: 42px;
  border: 1px solid var(--ring);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.sound-toggle[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
}

.hero-lab {
  position: relative;
  min-height: 100vh;
  padding-top: 82px;
  overflow: hidden;
}

.hero-copy {
  position: relative;
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 8px 20px 0;
  text-align: center;
  pointer-events: none;
}

.eyebrow {
  margin: 0;
  color: rgba(37, 39, 45, 0.72);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.24em;
  margin: 0;
  font-size: clamp(72px, 10.2vw, 168px);
  line-height: 0.86;
  letter-spacing: -0.045em;
}

.hero-copy h1 span:first-child {
  color: #111;
  text-shadow: 0 0 14px rgba(17, 17, 17, 0.28);
}

.hero-copy h1 span:last-child {
  color: #8a6c16;
  text-shadow: 0 0 12px rgba(138, 108, 22, 0.25);
}

.shape {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  background: var(--blue);
  pointer-events: none;
}

.shape-one {
  top: -30%;
  right: -8%;
  width: min(76vw, 930px);
  aspect-ratio: 1;
}

.shape-two {
  left: -17%;
  bottom: -30%;
  width: min(58vw, 760px);
  aspect-ratio: 1;
}

.arcade-carousel {
  position: relative;
  z-index: 2;
  min-height: 680px;
  margin-top: clamp(64px, 8vw, 120px);
}

.carousel-stage {
  position: relative;
  height: 650px;
  user-select: none;
  touch-action: pan-y;
}

.project-card {
  --tx: 0px;
  --ty: 0px;
  --rot: 0deg;
  --scale: 1;
  --opacity: 1;
  --z: 1;
  position: absolute;
  top: 0;
  left: 50%;
  z-index: var(--z);
  display: grid;
  grid-template-rows: auto 1fr;
  width: 370px;
  height: 560px;
  padding: 24px;
  border: 0;
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
  opacity: var(--opacity);
  transform: translateX(calc(-50% + var(--tx))) translateY(var(--ty)) rotate(var(--rot)) scale(var(--scale));
  transform-origin: 50% 120%;
  transition:
    transform 620ms cubic-bezier(0.2, 0.9, 0.16, 1),
    opacity 360ms ease,
    filter 360ms ease;
}

.project-card[aria-hidden="true"] {
  pointer-events: none;
}

.project-card.is-active {
  box-shadow: 0 34px 80px rgba(38, 69, 135, 0.18);
  cursor: pointer;
}

.project-visual {
  position: relative;
  min-height: 322px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 24% 24%, color-mix(in srgb, var(--accent) 52%, #fff), transparent 32%),
    radial-gradient(circle at 75% 62%, color-mix(in srgb, var(--accent-2) 50%, #fff), transparent 31%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 24%, #fff), #f8fbff 72%);
  overflow: hidden;
}

.project-visual::before {
  content: "";
  position: absolute;
  inset: -28%;
  background:
    repeating-linear-gradient(72deg, rgba(255, 255, 255, 0.12) 0 16px, transparent 16px 34px),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.65), transparent 46%);
  filter: blur(11px);
  transform: rotate(-8deg);
}

.visual-title {
  position: absolute;
  left: 18%;
  right: 11%;
  top: 44%;
  z-index: 1;
  color: #101217;
  font-size: 46px;
  font-weight: 520;
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.chip {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 37px;
  padding: 7px 13px;
  border: 1px solid rgba(37, 39, 45, 0.1);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 9px 20px rgba(45, 63, 105, 0.08);
  backdrop-filter: blur(12px);
  color: #20232a;
  font-size: 12px;
  font-weight: 750;
}

.chip::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 78%, #fff);
}

.chip-one {
  left: 13%;
  top: 21%;
}

.chip-two {
  right: 11%;
  top: 13%;
  transform: rotate(4deg);
}

.chip-three {
  left: 10%;
  bottom: 25%;
}

.chip-four {
  right: 9%;
  bottom: 15%;
  transform: rotate(-3deg);
}

.project-copy {
  display: grid;
  align-content: start;
  gap: 12px;
  padding-top: 26px;
}

.project-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-copy h2 {
  margin: 0;
  font-size: 31px;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.project-copy p {
  margin: 0;
  color: rgba(37, 39, 45, 0.68);
  font-size: 15px;
  line-height: 1.45;
}

.project-link {
  align-self: end;
  color: rgba(37, 39, 45, 0.74);
  font-size: 14px;
  font-weight: 760;
  text-decoration: none;
}

.carousel-controls {
  position: relative;
  z-index: 6;
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: -4px;
}

.circle-button {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid rgba(78, 124, 225, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.circle-button span {
  font-size: 42px;
  line-height: 0.7;
}

.circle-button.is-primary {
  border-color: var(--blue-deep);
  background: rgba(255, 255, 255, 0.48);
}

.project-detail {
  --detail-bg: #f7fbf1;
  --detail-panel: rgba(255, 255, 255, 0.78);
  --detail-panel-strong: #ffffff;
  --detail-ink: #24262d;
  --detail-muted: rgba(36, 38, 45, 0.66);
  --detail-line: rgba(36, 38, 45, 0.12);
  --detail-accent: #9fca53;
  --detail-accent-2: #f1ca55;
  position: relative;
  z-index: 4;
  padding: clamp(58px, 8vw, 108px) 20px clamp(28px, 5vw, 70px);
  scroll-margin-top: 82px;
  background:
    linear-gradient(180deg, rgba(238, 244, 255, 0), var(--detail-bg) 16%),
    linear-gradient(135deg, color-mix(in srgb, var(--detail-accent) 17%, transparent), transparent 42%),
    linear-gradient(235deg, color-mix(in srgb, var(--detail-accent-2) 16%, transparent), transparent 46%);
  color: var(--detail-ink);
}

.project-detail[data-theme="zhiwa"] {
  --detail-bg: #edfff7;
  --detail-panel: rgba(255, 255, 255, 0.8);
  --detail-panel-strong: #fbfffd;
  --detail-accent: #0eb698;
  --detail-accent-2: #8fe6c0;
  --detail-line: rgba(14, 182, 152, 0.2);
}

.project-detail[data-theme="learning"] {
  --detail-bg: #fff5f9;
  --detail-panel: rgba(255, 255, 255, 0.78);
  --detail-accent: #e9799b;
  --detail-accent-2: #7cb7ec;
  --detail-line: rgba(233, 121, 155, 0.18);
}

.project-detail[data-theme="matrix"] {
  --detail-bg: #17191f;
  --detail-panel: rgba(255, 255, 255, 0.08);
  --detail-panel-strong: rgba(255, 255, 255, 0.13);
  --detail-ink: #f7f7f1;
  --detail-muted: rgba(247, 247, 241, 0.68);
  --detail-line: rgba(255, 255, 255, 0.16);
  --detail-accent: #ff4f86;
  --detail-accent-2: #40d6c6;
}

.project-detail[data-theme="fde"] {
  --detail-bg: #eff8ff;
  --detail-panel: rgba(255, 255, 255, 0.78);
  --detail-panel-strong: #fbfeff;
  --detail-accent: #238bd8;
  --detail-accent-2: #20c284;
  --detail-line: rgba(35, 139, 216, 0.18);
}

.project-detail[data-theme="harness"] {
  --detail-bg: #f4efe7;
  --detail-panel: rgba(255, 251, 244, 0.8);
  --detail-panel-strong: #fffaf1;
  --detail-accent: #8d6ef2;
  --detail-accent-2: #1f2329;
  --detail-line: rgba(31, 35, 41, 0.14);
}

.detail-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.detail-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 470px);
  gap: 26px;
  align-items: end;
  margin-bottom: 22px;
}

.detail-kicker {
  margin: 0 0 10px;
  color: var(--detail-muted);
  font-size: 12px;
  font-weight: 880;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-toolbar h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 5.2vw, 74px);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.detail-switches {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.detail-switch {
  min-height: 38px;
  border: 1px solid var(--detail-line);
  border-radius: 999px;
  background: var(--detail-panel);
  color: var(--detail-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 13px;
}

.detail-switch.is-active {
  border-color: color-mix(in srgb, var(--detail-accent) 70%, var(--detail-line));
  background: color-mix(in srgb, var(--detail-accent) 22%, var(--detail-panel-strong));
  color: var(--detail-ink);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.detail-aside,
.detail-flow,
.detail-block {
  border: 1px solid var(--detail-line);
  border-radius: 8px;
  background: var(--detail-panel);
  backdrop-filter: blur(18px);
}

.detail-aside {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 18px;
  padding: 22px;
}

.detail-code {
  color: color-mix(in srgb, var(--detail-accent) 75%, var(--detail-ink));
  font-size: 12px;
  font-weight: 880;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-intro {
  margin: 0;
  color: var(--detail-ink);
  font-size: 18px;
  font-weight: 620;
  line-height: 1.58;
}

.detail-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-proof span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--detail-line);
  border-radius: 999px;
  background: var(--detail-panel-strong);
  color: var(--detail-muted);
  font-size: 12px;
  font-weight: 760;
  padding: 6px 10px;
}

.detail-actions {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.detail-actions[hidden] {
  display: none;
}

.detail-launch {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  border: 1px solid color-mix(in srgb, var(--detail-accent) 76%, var(--detail-line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--detail-accent) 82%, #fff), color-mix(in srgb, var(--detail-accent-2) 58%, #fff)),
    var(--detail-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
  padding: 15px 17px;
  box-shadow: 0 18px 44px color-mix(in srgb, var(--detail-accent) 28%, transparent);
}

.detail-launch strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 16px;
}

.detail-launch:hover {
  transform: translateY(-1px);
}

.detail-actions small {
  color: var(--detail-muted);
  font-size: 12px;
  font-weight: 760;
}

.detail-main {
  display: grid;
  gap: 16px;
}

.detail-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--detail-line);
}

.detail-flow span {
  position: relative;
  display: grid;
  min-height: 92px;
  align-content: end;
  gap: 10px;
  background: var(--detail-panel-strong);
  color: var(--detail-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  padding: 15px;
}

.detail-flow span::before {
  content: attr(data-step);
  color: color-mix(in srgb, var(--detail-accent) 78%, var(--detail-muted));
  font-size: 12px;
  font-weight: 880;
}

.detail-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.detail-block {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 286px;
  padding: 22px;
}

.detail-block span {
  color: color-mix(in srgb, var(--detail-accent) 82%, var(--detail-ink));
  font-size: 18px;
  font-weight: 900;
}

.detail-block h3 {
  margin: 0;
  font-size: 23px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.detail-block p {
  margin: 0;
  color: var(--detail-muted);
  font-size: 15px;
  line-height: 1.68;
}

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

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .brand {
    min-width: 0;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .hero-lab {
    padding-top: 128px;
  }

  .hero-copy h1 {
    font-size: clamp(58px, 15vw, 104px);
  }

  .arcade-carousel {
    min-height: 590px;
    margin-top: 52px;
  }

  .carousel-stage {
    height: 562px;
  }

  .project-card {
    width: min(330px, 82vw);
    height: 500px;
    padding: 18px;
  }

  .project-visual {
    min-height: 272px;
  }

  .visual-title {
    font-size: 38px;
  }

  .project-copy h2 {
    font-size: 27px;
  }

  .detail-toolbar,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-switches {
    justify-content: flex-start;
  }

  .detail-aside {
    position: static;
  }

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

  .detail-sections {
    grid-template-columns: 1fr;
  }

  .detail-block {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 14px 16px;
  }

  .brand strong {
    font-size: 20px;
  }

  .sound-toggle {
    min-width: 88px;
  }

  .shape-one {
    top: 4%;
    right: -70%;
    width: 136vw;
  }

  .shape-two {
    left: -72%;
    bottom: -12%;
    width: 130vw;
  }

  .carousel-controls {
    margin-top: 0;
  }

  .project-detail {
    padding-left: 14px;
    padding-right: 14px;
  }

  .detail-toolbar h2 {
    font-size: clamp(32px, 11vw, 48px);
  }

  .detail-intro {
    font-size: 16px;
  }

  .detail-switch {
    flex: 1 1 calc(50% - 8px);
    padding-left: 10px;
    padding-right: 10px;
  }

  .detail-flow {
    grid-template-columns: 1fr;
  }

  .detail-flow span {
    min-height: 76px;
  }

  .chip {
    font-size: 10px;
    min-height: 31px;
    padding: 6px 9px;
  }
}

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

  .project-card,
  .circle-button {
    transition: none;
  }
}
