:root {
  --paper: #f6f1e6;
  --paper-2: #fffdf8;
  --ink: #1c1915;
  --ink-soft: #3a342c;
  --line: #e4d9c8;
  --red: #ff5a4e;
  --red-deep: #c4322c;
  --blue: #2a62e8;
  --yellow: #f0b429;
  --green: #3dcc8e;
  --green-deep: #0e7a56;
  --orange: #ef7a1a;
  --sky: #d7ecff;
  --shadow: 0 18px 40px rgba(28, 25, 21, 0.12);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --cjk-sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Droid Sans Fallback", sans-serif;
  --cjk-serif: "Noto Serif SC", "Songti SC", "STSong", "Noto Sans SC", serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 0% -10%, rgba(255, 90, 78, 0.16), transparent 42%),
    radial-gradient(ellipse at 100% 0%, rgba(42, 98, 232, 0.13), transparent 38%),
    radial-gradient(ellipse at 90% 100%, rgba(240, 180, 41, 0.18), transparent 34%);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

html[lang="zh-Hans"] body {
  font-family: var(--cjk-sans);
  line-height: 1.75;
}

h1, h2, h3, p {
  margin: 0;
}

h1, h2, .project-zh {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 0.96;
  text-wrap: balance;
}

html[lang="zh-Hans"] h2,
html[lang="zh-Hans"] .project-zh,
html[lang="zh-Hans"] h3 {
  font-family: var(--cjk-serif);
  letter-spacing: 0;
  line-height: 1.2;
  font-weight: 600;
}

h3 {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1.75rem;
}

html[lang="zh-Hans"] h3 {
  letter-spacing: 0.12em;
}

a {
  color: inherit;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  display: inline-block;
  background: var(--ink);
  color: var(--paper-2);
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

html:not([lang="zh-Hans"]) .lang-zh,
html[lang="zh-Hans"] .lang-en {
  display: none !important;
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.03em;
  min-height: 44px;
}

.brand-name {
  font-size: 1rem;
}

.mark {
  width: 28px;
  height: 28px;
  position: relative;
  flex: none;
}

.mark i {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.mark i:nth-child(1) { background: var(--blue); left: 0; top: 1px; }
.mark i:nth-child(2) { background: var(--yellow); right: 0; top: 6px; }
.mark i:nth-child(3) { background: var(--red); left: 6px; bottom: 0; }

.lang-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, var(--paper-2));
  border: 1px solid var(--line);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
}

html:not([lang="zh-Hans"]) #lang-en,
html[lang="zh-Hans"] #lang-zh {
  background: var(--ink);
  color: var(--paper-2);
}

.hero {
  display: grid;
  gap: 28px;
  padding: 36px 0 18px;
}

.eyebrow {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

html[lang="zh-Hans"] .eyebrow {
  letter-spacing: 0.18em;
}

.hero h1 {
  font-size: clamp(2.5rem, 12vw, 6.4rem);
  margin-bottom: 18px;
}

.lede {
  max-width: 38rem;
  font-size: 1.125rem;
  color: var(--ink);
}

.hero-links {
  margin-top: 18px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  text-underline-offset: 0.18em;
}

.still {
  min-height: 148px;
}

.still-table {
  position: relative;
  height: 168px;
  max-width: 280px;
}

.cube {
  position: absolute;
  display: block;
  border-radius: 18px;
  box-shadow:
    inset 0 8px 0 rgba(255, 255, 255, 0.35),
    inset 0 -10px 0 rgba(0, 0, 0, 0.08),
    0 12px 0 rgba(28, 25, 21, 0.06);
}

.cube i {
  position: absolute;
  top: 22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

.cube i:first-child { left: 18px; }
.cube i:last-child { right: 18px; }

.cube-blue {
  width: 84px;
  height: 84px;
  background: var(--blue);
  left: 18px;
  bottom: 18px;
}

.cube-yellow {
  width: 72px;
  height: 72px;
  background: var(--yellow);
  left: 96px;
  bottom: 46px;
}

.cube-red {
  width: 48px;
  height: 48px;
  background: var(--red);
  left: 168px;
  bottom: 22px;
  border-radius: 12px;
}

.cube-green {
  width: 36px;
  height: 36px;
  background: var(--green);
  left: 206px;
  bottom: 62px;
  border-radius: 10px;
}

.project {
  padding: 28px 0 12px;
}

.project-head h2 {
  font-size: clamp(2.4rem, 8vw, 4.6rem);
}

.project-zh {
  margin-top: 8px;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: var(--ink-soft);
}

.pill {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
}

.project-layout {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 28px;
}

.hook p,
.rest > p,
.rule p,
.buffer,
figcaption,
.tech dd {
  color: var(--ink);
}

.hook p {
  font-size: 1.15rem;
}

.device {
  width: min(100%, 340px);
  margin-inline: auto;
  padding: 12px;
  border-radius: 36px;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 520px;
  padding: 10px;
  border-radius: 26px;
  background: #2a2622;
}

.zone {
  border-radius: 18px;
  padding: 10px;
  outline: 2px solid transparent;
  outline-offset: 0;
}

.zone-build {
  flex: 1.3;
  background: linear-gradient(180deg, #eef6ff 0%, var(--sky) 100%);
  color: var(--ink);
}

.zone-hold {
  background: #f3eadb;
  color: var(--ink);
}

.zone-cards {
  background: #141210;
  color: var(--paper-2);
}

.zone-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

html[lang="zh-Hans"] .zone-label {
  letter-spacing: 0.06em;
}

.zone-label.light {
  color: var(--paper-2);
}

.zone-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.build-scene {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 210px;
  padding: 8px 6px 0;
}

.crew {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.bot {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(180deg, #7ea2ff 0%, var(--blue) 42%, #1d4ed0 100%);
  box-shadow:
    inset 0 7px 0 rgba(255, 255, 255, 0.35),
    inset 0 -7px 0 rgba(0, 0, 0, 0.12);
  animation: bob 2.8s ease-in-out infinite;
}

.bot-late {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  animation-delay: 0.35s;
  background: linear-gradient(180deg, #ffe28a 0%, var(--yellow) 40%, #e09a10 100%);
}

.bot::before,
.bot::after {
  content: "";
  position: absolute;
  top: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.bot::before { left: 10px; }
.bot::after { right: 10px; }

.bot-late::before,
.bot-late::after { top: 13px; }

.bot b {
  position: absolute;
  right: -8px;
  bottom: 6px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--blue);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.4);
}

.bot-late b {
  background: var(--yellow);
}

.tower {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.vox,
.ghost {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.vox-blue { background: var(--blue); }
.vox-yellow { background: var(--yellow); }

.ghost {
  background: transparent;
  border: 2px dashed var(--blue);
}

.slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.slot {
  aspect-ratio: 1;
  border-radius: 10px;
  background: rgba(28, 25, 21, 0.06);
  border: 1px dashed rgba(28, 25, 21, 0.22);
  position: relative;
}

.slot.filled {
  border-style: solid;
  border-color: transparent;
}

.slot.filled::before {
  content: "";
  position: absolute;
  inset: 18%;
  background: currentColor;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45);
}

.slot.tone-red { background: var(--red); }
.slot.tone-blue { background: #1f4fd0; }
.slot.tone-yellow { background: var(--yellow); }

.slot.filled::before {
  background: var(--ink);
}

.slot.tone-blue::before {
  background: var(--paper-2);
}

.slot.shape-square::before { border-radius: 4px; }
.slot.shape-circle::before { border-radius: 50%; }
.slot.shape-triangle::before {
  inset: auto;
  top: 8px;
  left: 0;
  right: 0;
  width: 0;
  height: 0;
  margin-inline: auto;
  background: transparent;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 15px solid var(--ink);
  box-shadow: none;
}

.hand {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.wcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 8px 4px 6px;
  border-radius: 12px;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.4), 0 4px 0 rgba(0, 0, 0, 0.18);
}

.wcard.tone-green { background: var(--green); }
.wcard.tone-blue { background: #1f4fd0; }
.wcard.tone-orange { background: #ffb15a; }
.wcard.tone-red { background: var(--red); }

.wcard i {
  width: 16px;
  height: 16px;
  display: block;
  background: var(--ink);
}

.wcard .shape-square { border-radius: 3px; }
.wcard .shape-circle { border-radius: 50%; }
.wcard .shape-round { border-radius: 6px; }
.wcard .shape-triangle {
  width: 0;
  height: 0;
  background: transparent;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid var(--ink);
}

.wcard.tone-blue i {
  background: var(--paper-2);
}

.wcard b {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1;
}

figcaption {
  margin: 12px auto 0;
  max-width: 38rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.steps {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.step {
  display: flex;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper-2) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
}

.step-index {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
}

.step-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-body {
  display: block;
  color: var(--ink-soft);
}

.step[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--paper-2);
  box-shadow: 0 8px 0 rgba(28, 25, 21, 0.06);
}

#super-builder[data-active="cards"] .zone-cards {
  outline-color: var(--yellow);
}

#super-builder[data-active="hold"] .zone-hold,
#super-builder[data-active="match"] .zone-build,
#super-builder[data-active="match"] .zone-hold,
#super-builder[data-active="wait"] .zone-hold {
  outline-color: var(--ink);
}

#super-builder[data-active="match"] .slot.match {
  transform: translateY(-4px);
  box-shadow: 0 8px 0 rgba(42, 98, 232, 0.25);
}

#super-builder[data-active="match"] .slot:not(.match) {
  opacity: 0.45;
}

#super-builder[data-active="wait"] .slot.match {
  opacity: 0.35;
}

#super-builder[data-active="wait"] .slot.filled:not(.match) {
  box-shadow: 0 0 0 2px var(--ink);
}

.buffer {
  margin-top: 12px;
  color: var(--ink-soft);
}

.outcomes {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.rule {
  padding: 16px;
  border-radius: 18px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.rule h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.rule:first-child h3 { color: var(--green-deep); }
.rule:last-child h3 { color: var(--red-deep); }

.tech {
  margin: 12px 0 0;
  display: grid;
  gap: 0;
}

.tech div {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.tech dt {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

html[lang="zh-Hans"] .tech dt {
  letter-spacing: 0.12em;
}

.tech dd {
  margin: 0;
}

.site-footer {
  padding: 36px 0 48px;
}

.handle {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

html[lang="zh-Hans"] .handle {
  font-family: var(--serif);
}

.site-footer p + p {
  color: var(--ink-soft);
  max-width: 36rem;
}

@media (min-width: 880px) {
  .hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr);
    align-items: center;
    padding-top: 56px;
    padding-bottom: 28px;
  }

  .still-table {
    margin-left: auto;
    height: 240px;
    max-width: none;
  }

  .cube-blue { width: 120px; height: 120px; border-radius: 28px; }
  .cube-yellow { width: 104px; height: 104px; left: 132px; bottom: 70px; border-radius: 26px; }
  .cube-red { left: 250px; bottom: 28px; width: 64px; height: 64px; }
  .cube-green { left: 300px; bottom: 92px; }

  .project-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 380px);
    grid-template-areas:
      "hook device"
      "rest device";
    column-gap: 48px;
    row-gap: 8px;
    align-items: start;
  }

  .hook { grid-area: hook; }
  .device-wrap {
    grid-area: device;
    position: sticky;
    top: 88px;
  }
  .rest { grid-area: rest; }

  .device {
    width: 100%;
  }

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

  figcaption {
    margin-inline: 0;
  }
}

@media (max-width: 879px) {
  .device-wrap { order: 2; }
  .hook { order: 1; }
  .rest { order: 3; }
  .hero { padding-top: 28px; }
  .still-table { margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bot { animation: none; }
  .slot,
  .zone,
  .step { transition: none; }
  #super-builder[data-active="match"] .slot.match { transform: none; }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (forced-colors: active) {
  .device,
  .step,
  .rule,
  .site-header,
  .wcard,
  .zone {
    border: 1px solid CanvasText;
  }
  .bot,
  .cube,
  .vox,
  .mark i {
    forced-color-adjust: auto;
  }
}
