@font-face {
  font-family: "Alibaba PuHuiTi 3";
  src: url("./assets/fonts/AlibabaPuHuiTi-3-45-Light.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Alibaba PuHuiTi 3";
  src: url("./assets/fonts/AlibabaPuHuiTi-3-65-Medium.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 600;
}

@font-face {
  font-family: "Alibaba PuHuiTi 3";
  src: url("./assets/fonts/AlibabaPuHuiTi-3-65-Medium.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

@font-face {
  font-family: "Alibaba PuHuiTi 3";
  src: url("./assets/fonts/AlibabaPuHuiTi-3-65-Medium.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 800;
}

@font-face {
  font-family: "Alibaba PuHuiTi 3";
  src: url("./assets/fonts/AlibabaPuHuiTi-3-65-Medium.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 900;
}

:root {
  --font-sans: "Alibaba PuHuiTi 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --color-primary: #475569;
  --color-on-primary: #ffffff;
  --color-secondary: #64748b;
  --color-accent: #2563eb;
  --color-background: #f8fafc;
  --color-foreground: #1e293b;
  --color-muted: #eaeff3;
  --color-border: #e2e8f0;
  --color-surface: #ffffff;
  --color-soft: #f1f5f9;
  --color-success: #15803d;
  --color-ascend-red: rgb(192, 0, 0);
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --page-gutter: clamp(16px, 3vw, 48px);
  --content-width: min(80vw, 1520px);
  --workspace-height: clamp(1020px, calc(150dvh - 330px), 1350px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--color-foreground);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(248, 250, 252, 0) 360px),
    var(--color-background);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
}

.text-ascend {
  color: var(--color-ascend-red);
}

.title-line {
  display: block;
}

button,
input {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px var(--page-gutter);
  border-bottom: 1px solid rgba(226, 232, 240, 0.88);
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--color-foreground);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 50%;
  background: #fff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand strong,
h1,
h2,
h3,
.command-title strong {
  font-family: var(--font-sans);
}

.brand small {
  display: block;
  color: var(--color-secondary);
  font-size: 13px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.top-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

main {
  width: var(--content-width);
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(360px, 0.97fr);
  gap: 40px;
  align-items: center;
  min-height: calc(100dvh - 72px);
  padding: 72px 0 48px;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(36px, 6vw, 74px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  margin: 24px 0 0;
  color: #334155;
  font-size: 19px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button,
.icon-button,
.small-copy {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  font-weight: 700;
  text-decoration: none;
}

.button svg,
.icon-button svg,
.search-box svg,
.card-actions svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button.primary {
  color: var(--color-on-primary);
  background: var(--color-accent);
}

.button.secondary {
  color: var(--color-foreground);
  border-color: var(--color-border);
  background: var(--color-surface);
}

.button:hover,
.icon-button:hover,
.small-copy:hover {
  transform: translateY(-1px);
}

.terminal-panel {
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #0f172a;
  box-shadow: var(--shadow-soft);
}

.terminal-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.terminal-title span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #94a3b8;
}

.terminal-title span:first-child {
  background: #ef4444;
}

.terminal-title span:nth-child(2) {
  background: #eab308;
}

.terminal-title span:nth-child(3) {
  background: #22c55e;
}

.terminal-title strong {
  margin-left: auto;
  color: #cbd5e1;
  font-size: 13px;
}

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

.terminal-panel pre {
  margin: 0;
  padding: 24px;
  color: #dbeafe;
  white-space: pre-wrap;
  word-break: break-word;
}

.guide-section,
.search-shell,
.selection-panel,
.bundle-section {
  padding: 44px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 26px;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--color-secondary);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

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

.guide-card {
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.guide-step {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--color-primary);
  font-weight: 800;
}

.guide-card h3 {
  margin: 14px 0 8px;
  font-size: 17px;
}

.guide-card p {
  margin: 0;
  color: var(--color-secondary);
}

.search-box {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.search-box svg {
  flex: 0 0 auto;
  color: var(--color-secondary);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--color-foreground);
  background: transparent;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment-button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-primary);
  background: var(--color-surface);
  cursor: pointer;
}

.segment-button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: 1020px;
  height: var(--workspace-height);
  max-height: 1350px;
}

.skill-list-panel,
.skill-detail,
.command-card,
.bundle-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.skill-list-panel {
  position: sticky;
  top: 88px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-secondary);
  font-size: 13px;
}

.list-select-all {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-primary);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.list-select-all:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.skill-list {
  height: calc(100% - 51px);
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.skill-card {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  padding: 14px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.skill-card:hover,
.skill-card.active {
  background: #eef6ff;
}

.skill-card input {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  accent-color: var(--color-accent);
}

.skill-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.skill-card p {
  display: -webkit-box;
  margin: 6px 0 9px;
  overflow: hidden;
  color: var(--color-secondary);
  font-size: 13px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #dbe3ed;
  border-radius: 999px;
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
}

.tag.category-base {
  color: #1d4ed8;
  background: #eff6ff;
}

.tag.category-inference {
  color: #047857;
  background: #ecfdf5;
}

.tag.category-training {
  color: #7c3aed;
  background: #f5f3ff;
}

.tag.category-profiling {
  color: #b45309;
  background: #fffbeb;
}

.tag.category-ops {
  color: #9f1239;
  background: #fff1f2;
}

.tag.category-agent-tools {
  color: #0f766e;
  background: #f0fdfa;
}

.tag.category-ai-for-science {
  color: #6d28d9;
  background: #faf5ff;
}

.tag.category-bundle {
  color: #4338ca;
  background: #eef2ff;
}

.tag.category-external {
  color: #475569;
  background: #f1f5f9;
}

.skill-detail {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.detail-header {
  padding: 24px;
  border-bottom: 1px solid var(--color-border);
}

.detail-header h2 {
  margin: 10px 0 8px;
  font-size: 28px;
}

.detail-header p {
  margin: 0;
  color: #334155;
}

.detail-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.detail-action-break {
  flex-basis: 100%;
  height: 0;
}

.detail-body {
  display: block;
  padding: 24px;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.markdown-body {
  min-width: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 24px 0 10px;
  line-height: 1.25;
}

.markdown-body h1 {
  font-size: 24px;
}

.markdown-body h2 {
  font-size: 20px;
}

.markdown-body h3 {
  font-size: 17px;
}

.markdown-body p,
.markdown-body li {
  color: #334155;
}

.markdown-body blockquote {
  margin: 14px 0;
  padding: 12px 16px;
  border-left: 4px solid #94a3b8;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #f8fafc;
}

.markdown-body blockquote p {
  margin: 8px 0;
  color: #475569;
}

.markdown-body blockquote p:first-child {
  margin-top: 0;
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-body hr {
  margin: 22px 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

.markdown-body pre,
.command-card pre {
  overflow: auto;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #d8e1eb;
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

.math-block {
  margin: 16px 0 18px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid #d8e1eb;
  border-radius: var(--radius);
  background: #f8fafc;
  color: #0f172a;
}

.markdown-body mjx-container {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.skill-list,
.detail-body,
.table-scroll {
  scrollbar-color: #94a3b8 #e2e8f0;
  scrollbar-width: thin;
}

.skill-list::-webkit-scrollbar,
.detail-body::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.skill-list::-webkit-scrollbar-track,
.detail-body::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}

.skill-list::-webkit-scrollbar-thumb,
.detail-body::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb {
  min-height: 64px;
  border: 3px solid #e2e8f0;
  border-radius: 999px;
  background: #94a3b8;
}

.skill-list::-webkit-scrollbar-thumb:hover,
.detail-body::-webkit-scrollbar-thumb:hover,
.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.markdown-body table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 14px;
}

.markdown-body th,
.markdown-body td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

.markdown-body tr:last-child td {
  border-bottom: 0;
}

.markdown-body th {
  color: #0f172a;
  background: #f1f5f9;
  font-weight: 700;
}

.markdown-body td {
  color: #334155;
  background: #ffffff;
}

.icon-button {
  width: 44px;
  padding: 0;
  color: var(--color-primary);
  border-color: var(--color-border);
  background: var(--color-surface);
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.command-card {
  padding: 16px;
}

.command-card.wide {
  grid-column: 1 / -1;
}

.command-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.small-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-color: var(--color-border);
  color: var(--color-primary);
  background: var(--color-surface);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.bundle-callout {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: #eff6ff;
}

.bundle-callout > strong {
  display: block;
  margin-bottom: 10px;
  color: #1e3a8a;
  font-size: 14px;
}

.bundle-callout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(37, 99, 235, 0.14);
  color: #1e293b;
  font-size: 14px;
}

.bundle-callout-row:first-of-type {
  border-top: 0;
}

.bundle-callout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.external-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #f59e0b;
  border-left: 5px solid #d97706;
  border-radius: var(--radius);
  color: #78350f;
  background: #fffbeb;
}

.external-notice strong {
  font-weight: 800;
}

.external-notice a {
  color: #92400e;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.bundle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.bundle-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.bundle-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.bundle-card p {
  margin: 0 0 12px;
  color: var(--color-secondary);
}

.bundle-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.bundle-card .card-actions {
  margin-top: auto;
  padding-top: 14px;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  color: #14532d;
  background: #f0fdf4;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 980px) {
  .site-header {
    position: static;
  }

  .hero,
  .workspace,
  .detail-body,
  .toolbar,
  .guide-grid,
  .command-grid,
  .bundle-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 44px;
  }

  .skill-list-panel {
    position: static;
    height: auto;
  }

  .skill-list {
    max-height: 520px;
    height: auto;
  }

  .workspace {
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .skill-detail {
    height: min(760px, 80dvh);
  }
}

@media (max-width: 640px) {
  main {
    width: calc(100% - 24px);
  }

  .site-header {
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
  }

  .top-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 14px;
  }

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

  .brand small {
    display: none;
  }

  .hero h1 {
    font-size: 36px;
  }

  .hero p {
    font-size: 17px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .terminal-panel pre,
  .detail-header,
  .detail-body {
    padding: 16px;
  }
}
