:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --ink: #16181d;
  --muted: #606771;
  --line: #dfe2e6;
  --line-strong: #c9ced5;
  --codex: #1769e0;
  --codex-soft: #edf4ff;
  --claude: #c45138;
  --claude-soft: #fff1ed;
  --canvas: #6d28d9;
  --focus: #0b73e0;
  --code-bg: #171a20;
  --code-ink: #eef1f5;
  --shadow: 0 8px 24px rgba(20, 25, 32, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 38%, transparent);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(223, 226, 230, 0.92);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand__name {
  font-size: 16px;
  font-weight: 760;
}

.brand__section {
  color: var(--muted);
  font-size: 13px;
}

.tutorial-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: var(--surface-subtle);
}

.tutorial-switcher a {
  min-height: 34px;
  border-radius: 5px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
  line-height: 22px;
  text-decoration: none;
  white-space: nowrap;
}

.tutorial-switcher a:hover {
  color: var(--ink);
  background: var(--surface);
}

.tutorial-switcher a[aria-current="page"] {
  color: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 25, 32, 0.16);
}

.tutorial-switcher a[data-tutorial="codex"][aria-current="page"] {
  background: var(--codex);
}

.tutorial-switcher a[data-tutorial="claude"][aria-current="page"] {
  background: var(--claude);
}

.landing {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 72px;
}

.landing-hero {
  max-width: 720px;
  margin-bottom: 36px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.landing h1,
.document-hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1.12;
}

.landing-hero p:last-child,
.document-hero__summary {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
}

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

.tutorial-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.tutorial-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 34px rgba(20, 25, 32, 0.12);
}

.tutorial-card__preview {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.tutorial-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: transform 240ms ease;
}

.tutorial-card:hover .tutorial-card__preview img {
  transform: scale(1.015);
}

.tutorial-card__body {
  display: flex;
  min-height: 190px;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 22px;
}

.tutorial-card__label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 760;
}

.tutorial-card[data-tutorial="codex"] .tutorial-card__label {
  color: var(--codex);
}

.tutorial-card[data-tutorial="claude"] .tutorial-card__label {
  color: var(--claude);
}

.tutorial-card[data-tutorial="infinite-canvas"] .tutorial-card__preview {
  background: #09001d;
}

.tutorial-card[data-tutorial="infinite-canvas"] .tutorial-card__preview img {
  object-fit: contain;
  object-position: center;
}

.tutorial-card[data-tutorial="infinite-canvas"] .tutorial-card__label {
  color: var(--canvas);
}

.tutorial-card h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0;
  line-height: 1.25;
}

.tutorial-card p {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.tutorial-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: auto;
  border-radius: 6px;
  padding: 8px 14px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 720;
}

.tutorial-card[data-tutorial="codex"] .tutorial-card__action {
  background: var(--codex);
}

.tutorial-card[data-tutorial="claude"] .tutorial-card__action {
  background: var(--claude);
}

.tutorial-card[data-tutorial="infinite-canvas"] .tutorial-card__action {
  background: var(--canvas);
}

@media (max-width: 1060px) and (min-width: 821px) {
  .tutorial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.document-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.document-hero {
  padding: 24px 0 30px;
}

.document-hero--codex .eyebrow {
  color: var(--codex);
}

.document-hero--claude .eyebrow {
  color: var(--claude);
}

.document-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.toc__title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.toc a {
  display: block;
  border-left: 2px solid transparent;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
}

.toc a:hover,
.toc a.is-active {
  color: var(--ink);
  background: var(--surface-subtle);
}

.toc a.is-active {
  border-left-color: var(--tutorial-accent);
}

.toc a[data-level="2"] {
  padding-left: 18px;
  font-size: 12px;
}

.article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(24px, 5vw, 56px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-page--codex {
  --tutorial-accent: var(--codex);
  --tutorial-soft: var(--codex-soft);
}

.document-page--claude {
  --tutorial-accent: var(--claude);
  --tutorial-soft: var(--claude-soft);
}

.article h1,
.article h2,
.article h3,
.article h4 {
  scroll-margin-top: 88px;
  margin: 1.8em 0 0.62em;
  color: var(--ink);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.35;
}

.article h1:first-child,
.article h2:first-child {
  margin-top: 0;
}

.article h1 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.42em;
  font-size: clamp(25px, 3vw, 34px);
}

.article h2 {
  font-size: clamp(21px, 2.4vw, 27px);
}

.article h3 {
  font-size: 19px;
}

.heading-anchor {
  color: inherit;
  text-decoration: none;
}

.heading-anchor:hover::after {
  content: " #";
  color: var(--tutorial-accent);
}

.article p,
.article ul,
.article ol {
  margin: 1em 0;
}

.article a {
  color: var(--tutorial-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article strong {
  font-weight: 750;
}

.article img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 20px 0 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  box-shadow: 0 6px 18px rgba(20, 25, 32, 0.08);
}

.article blockquote {
  margin: 20px 0;
  border-left: 3px solid var(--tutorial-accent);
  padding: 2px 0 2px 16px;
  color: var(--muted);
  background: var(--tutorial-soft);
}

.code-block {
  position: relative;
  margin: 20px 0;
}

.code-block pre {
  min-height: 72px;
  margin: 0;
  overflow: auto;
  border-radius: 7px;
  padding: 44px 18px 18px;
  color: var(--code-ink);
  background: var(--code-bg);
}

.article code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.article p code,
.article li code {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.12em 0.34em;
  color: var(--ink);
  background: var(--surface-subtle);
}

.code-copy {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  min-width: 54px;
  min-height: 28px;
  border: 1px solid #454b56;
  border-radius: 5px;
  color: #dfe4eb;
  background: #272b33;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 680;
}

.code-copy:hover,
.code-copy.copied {
  border-color: #6d7685;
  color: #ffffff;
  background: #343a45;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 20px 34px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 820px) {
  .site-header__inner {
    width: min(100% - 24px, 1180px);
    min-height: 58px;
    gap: 12px;
  }

  .brand__section {
    display: none;
  }

  .tutorial-switcher a {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .landing,
  .document-page {
    width: min(100% - 24px, 1180px);
  }

  .landing {
    padding: 42px 0 52px;
  }

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

  .document-page {
    padding-top: 18px;
  }

  .document-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .toc {
    position: relative;
    top: auto;
    display: flex;
    max-height: none;
    gap: 4px;
    overflow-x: auto;
    padding: 8px;
    white-space: nowrap;
  }

  .toc__title {
    display: none;
  }

  .toc a,
  .toc a[data-level="2"] {
    flex: 0 0 auto;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 7px 9px;
  }

  .toc a.is-active {
    border-bottom-color: var(--tutorial-accent);
  }

  .article {
    padding: 24px 18px;
  }
}

@media (max-width: 460px) {
  .site-header__inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 0;
  }

  .tutorial-switcher {
    width: 100%;
  }

  .tutorial-switcher a {
    flex: 1;
    text-align: center;
  }

  .landing h1,
  .document-hero h1 {
    font-size: 32px;
  }

  .landing-hero p:last-child,
  .document-hero__summary {
    font-size: 15px;
  }
}

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

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