:root {
  color-scheme: light dark;
  --bg: #f7faff;
  --surface: #ffffff;
  --surface-soft: #eef5ff;
  --surface-strong: #e5efff;
  --text: #101827;
  --text-soft: #44546c;
  --text-muted: #67768f;
  --line: #cfe0ff;
  --line-strong: #9fc0ff;
  --blue: #1257e5;
  --blue-deep: #0b3fae;
  --blue-soft: #e4efff;
  --shadow: 0 20px 50px rgba(18, 87, 229, 0.1);
  --max-width: 1160px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071120;
    --surface: #0d1a2e;
    --surface-soft: #112542;
    --surface-strong: #162f56;
    --text: #eef5ff;
    --text-soft: #c7d6ed;
    --text-muted: #91a8c7;
    --line: #1f3f6c;
    --line-strong: #3d6fb8;
    --blue: #7cadff;
    --blue-deep: #b9d4ff;
    --blue-soft: #132d52;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  }
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7faff;
  --surface: #ffffff;
  --surface-soft: #eef5ff;
  --surface-strong: #e5efff;
  --text: #101827;
  --text-soft: #44546c;
  --text-muted: #67768f;
  --line: #cfe0ff;
  --line-strong: #9fc0ff;
  --blue: #1257e5;
  --blue-deep: #0b3fae;
  --blue-soft: #e4efff;
  --shadow: 0 20px 50px rgba(18, 87, 229, 0.1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071120;
  --surface: #0d1a2e;
  --surface-soft: #112542;
  --surface-strong: #162f56;
  --text: #eef5ff;
  --text-soft: #c7d6ed;
  --text-muted: #91a8c7;
  --line: #1f3f6c;
  --line-strong: #3d6fb8;
  --blue: #7cadff;
  --blue-deep: #b9d4ff;
  --blue-soft: #132d52;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, var(--surface-soft) 0, transparent 360px),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
}

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

button {
  font: inherit;
}

code,
pre {
  font-family: var(--font-mono);
}

.topbar,
main,
.footer {
  width: min(calc(100% - 36px), var(--max-width));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
}

.brand,
.main-nav,
.top-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--blue-deep);
  font-size: 1.35rem;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.main-nav {
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  color: var(--text-soft);
  font-size: 0.96rem;
}

.main-nav a:hover,
.main-nav a:focus-visible,
.footer a:hover,
.footer a:focus-visible {
  color: var(--blue-deep);
}

.top-actions {
  gap: 10px;
}

.language-link,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
}

.language-link {
  padding: 0 14px;
}

.theme-toggle {
  min-width: 86px;
  padding: 0 14px;
  cursor: pointer;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
  gap: 40px;
  align-items: start;
  padding: 60px 0 18px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue);
  font-weight: 750;
}

.hero h1 {
  max-width: 13ch;
  margin: 0;
  color: var(--text);
  font-size: clamp(2.55rem, 4.8vw, 4.25rem);
  letter-spacing: 0;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.hero h1 span {
  display: block;
}

.lede {
  max-width: 54ch;
  margin: 22px 0 0;
  color: var(--text-soft);
  font-size: 1.12rem;
}

.command-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin-top: 28px;
}

.command-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(100%, 640px);
  min-width: 0;
  min-height: 62px;
  padding: 15px 16px 15px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.command-line--primary {
  border-color: transparent;
  background: var(--blue);
  color: #fff;
}

.command-line code {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
  font-size: 0.98rem;
}

.command-line span {
  flex: 0 0 auto;
  color: inherit;
  font-weight: 700;
}

.terminal-panel,
.card,
.snippet,
.auth-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.terminal-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 430px;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
}

.terminal-header span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line-strong);
}

.terminal-header strong {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 700;
}

.terminal-panel pre {
  margin: 0;
  overflow-x: auto;
  color: var(--text);
}

.terminal-panel pre {
  flex: 1;
  padding: 22px;
  background: var(--surface-soft);
  font-size: 0.94rem;
}

.terminal-panel code {
  display: block;
}

.section {
  padding-top: 76px;
}

.section-heading {
  max-width: 680px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.1rem);
  letter-spacing: 0;
  line-height: 1.08;
}

.cards,
.snippet-grid,
.auth-grid {
  display: grid;
  gap: 16px;
}

.cards--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.card,
.snippet,
.auth-step {
  min-width: 0;
  padding: 22px;
}

.card h3,
.snippet h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.card p,
.auth-step p {
  margin: 0;
  color: var(--text-soft);
}

.snippet pre {
  margin: 14px 0 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
}

.snippet code {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-section {
  padding-bottom: 72px;
}

.auth-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.auth-step span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 750;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
}

.footer span {
  color: var(--blue-deep);
  font-weight: 750;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: calc(100vw - 40px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.command-line:hover,
.command-line:focus-visible,
.language-link:hover,
.language-link:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .hero,
  .cards--three,
  .cards--four,
  .snippet-grid,
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 42px;
  }

  .terminal-panel {
    justify-self: stretch;
    width: 100%;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .topbar,
  main,
  .footer {
    width: min(calc(100% - 24px), var(--max-width));
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(2rem, 9vw, 2.55rem);
    line-height: 1.04;
  }

  body[data-page-lang="zh-CN"] .hero h1 {
    font-size: clamp(1.9rem, 8.5vw, 2.45rem);
  }

  .command-line {
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
  }

  .command-line code {
    width: 100%;
    word-break: break-all;
  }

  .terminal-panel pre {
    overflow: hidden;
  }

  .terminal-panel code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

}
