:root {
  --blue: #3370ff;
  --blue-dark: #245bdb;
  --blue-soft: #edf3ff;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --border: #dee0e3;
  --border-2: #e2e5e9;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-soft-2: #fafbfc;
  --card: #ffffff;
  --shadow: 0 10px 28px rgba(31, 35, 41, 0.07);
  --shadow-lg: 0 22px 60px rgba(31, 35, 41, 0.12);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --blue: #5b8dff;
  --blue-dark: #7aa5ff;
  --blue-soft: #17233d;
  --text: #e8eaed;
  --text-2: #b6bcc6;
  --text-3: #858c98;
  --border: #2a303a;
  --border-2: #303744;
  --bg: #0f1115;
  --bg-soft: #141821;
  --bg-soft-2: #171b24;
  --card: #171b24;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
}

.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;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border-2);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}

.header-inner {
  max-width: 1136px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #6f9bff);
  color: #fff;
  box-shadow: 0 8px 18px rgba(51, 112, 255, 0.25);
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-3);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease;
}

.header-nav a:hover,
.theme-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.theme-toggle {
  border: 1px solid var(--border-2);
  background: var(--card);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.hero {
  border-bottom: 1px solid var(--border-2);
  background:
    radial-gradient(circle at 50% -20%, rgba(51, 112, 255, 0.12), transparent 42%),
    var(--bg-soft);
}

.hero-inner {
  max-width: 1136px;
  margin: 0 auto;
  padding: 72px 20px 64px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 26%, transparent);
  border-radius: 999px;
  background: var(--card);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.badge svg {
  width: 15px;
  height: 15px;
}

.hero h1 {
  margin: 20px 0 0;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero-subtitle {
  max-width: 720px;
  margin: 18px auto 0;
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.8;
}

.hero-note {
  margin: 12px auto 0;
  color: var(--text-3);
  font-size: 13px;
}

.hero-actions {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 24px rgba(51, 112, 255, 0.24);
}

.btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.btn-ghost {
  border-color: var(--border-2);
  background: var(--card);
  color: var(--text-2);
}

.btn-ghost:hover {
  border-color: color-mix(in srgb, var(--blue) 38%, transparent);
  color: var(--blue);
}

.stats {
  margin-top: 38px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 82%, transparent);
}

.stat strong {
  display: block;
  font-size: 24px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
}

.catalog-section {
  padding: 64px 20px 84px;
}

.catalog-inner {
  max-width: 1136px;
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 29px);
  letter-spacing: -0.025em;
}

.section-head p {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.filters {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  position: relative;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.filter-chip:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.filter-chip.active {
  border-color: color-mix(in srgb, var(--blue) 58%, transparent);
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 38px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  outline: none;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-wrap input::placeholder {
  color: var(--text-3);
}

.search-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
}

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
}

.search-clear:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.search-clear[hidden] {
  display: none;
}

.search-clear svg {
  position: static;
  transform: none;
  width: 15px;
  height: 15px;
}

.result-count {
  margin: 16px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

.skill-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.skill-card {
  min-width: 0;
  min-height: 238px;
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: 0 1px 0 rgba(31, 35, 41, 0.02);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.skill-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--blue) 48%, transparent);
  box-shadow: var(--shadow);
}

.skill-card-top {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.skill-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: color-mix(in srgb, var(--accent, var(--blue)) 12%, transparent);
  color: var(--accent, var(--blue));
}

.skill-icon svg {
  width: 27px;
  height: 27px;
}

.skill-card-title {
  min-width: 0;
  flex: 1;
}

.skill-card-title h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.skill-card-title p {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.skill-card-desc {
  margin: 18px 0 0;
  flex: 1;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.75;
}

.skill-card-footer {
  margin-top: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.card-cta svg {
  width: 16px;
  height: 16px;
  transition: transform 0.18s ease;
}

.skill-card:hover .card-cta svg {
  transform: translateX(4px);
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--bg-soft-2);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  color: var(--text-3);
}

.empty-state p {
  margin: 14px 0 0;
  color: var(--text-2);
}

.site-footer {
  border-top: 1px solid var(--border-2);
  padding: 28px 20px 36px;
  color: var(--text-3);
  font-size: 13px;
}

.footer-inner {
  max-width: 1136px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Detail page */
.detail-page {
  min-height: 100vh;
}

.detail-shell {
  max-width: 1136px;
  margin: 0 auto;
  padding: 28px 20px 84px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 14px;
}

.back-link:hover {
  color: var(--blue);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.detail-hero {
  margin-top: 24px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent, var(--blue)) 13%, transparent), transparent 42%),
    var(--card);
  box-shadow: var(--shadow);
}

.detail-hero-top {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.detail-hero .skill-icon {
  width: 66px;
  height: 66px;
  border-radius: 18px;
}

.detail-hero .skill-icon svg {
  width: 32px;
  height: 32px;
}

.detail-hero h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.03em;
}

.detail-hero .tagline {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.7;
}

.detail-meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 84%, transparent);
  color: var(--text-2);
  font-size: 13px;
}

.meta-pill svg {
  width: 15px;
  height: 15px;
  color: var(--accent, var(--blue));
}

.detail-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.detail-nav {
  position: sticky;
  top: 88px;
  padding: 16px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--card);
}

.detail-nav strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 14px;
  transition: background 0.16s ease, color 0.16s ease;
}

.detail-nav a:hover,
.detail-nav a.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.detail-nav .nav-num {
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.detail-nav a.active .nav-num {
  color: var(--blue);
}

.detail-content {
  min-width: 0;
}

.detail-section {
  scroll-margin-top: 90px;
  padding-top: 4px;
}

.detail-section + .detail-section {
  margin-top: 42px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.section-title .section-num {
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.section-lead {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.8;
}

.highlight-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.highlight-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--bg-soft-2);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

.highlight-list svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--blue);
}

.example-list {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.example-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.example-card:hover {
  border-color: color-mix(in srgb, var(--blue) 34%, transparent);
  box-shadow: var(--shadow);
}

.example-card h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.example-body {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-soft);
}

.example-text {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--blue);
  transition: background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.copy-btn:hover {
  background: var(--blue-soft);
}

.copy-btn:active {
  transform: scale(0.93);
}

.copy-btn svg {
  width: 17px;
  height: 17px;
}

.copy-btn.copied {
  color: #10b981;
}

.faq-list {
  margin-top: 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.faq-item + .faq-item {
  border-top: 1px solid var(--border-2);
}

.faq-question {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 15px;
  font-weight: 600;
}

.faq-question:hover {
  color: var(--blue);
}

.faq-question svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--text-3);
  transition: transform 0.2s ease;
}

.faq-item.open .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 18px 18px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.8;
}

.faq-item.open .faq-answer {
  display: block;
}

.source-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--bg-soft-2);
}

.source-box h3 {
  margin: 0;
  font-size: 15px;
}

.source-box p {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
}

.file-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-list li {
  padding: 6px 10px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--card);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
}

.related-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.related-card {
  padding: 15px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--card);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.related-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--blue) 40%, transparent);
}

.related-card strong {
  display: block;
  font-size: 14px;
}

.related-card span {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  transform: translate(-50%, 16px);
  padding: 11px 16px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

@media (max-width: 860px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .detail-nav strong {
    width: 100%;
    margin-bottom: 2px;
  }

  .detail-nav a {
    padding: 7px 10px;
  }

  .detail-nav .nav-num {
    display: none;
  }
}

@media (max-width: 760px) {
  .header-inner {
    padding: 12px 16px;
  }

  .header-nav a {
    display: none;
  }

  .hero-inner {
    padding: 54px 16px 46px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

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

  .catalog-section {
    padding: 44px 16px 64px;
  }

  .section-head {
    display: block;
  }

  .skill-grid,
  .related-grid {
    grid-template-columns: 1fr;
  }

  .skill-card {
    min-height: 0;
    padding: 22px;
  }

  .detail-shell {
    padding: 20px 16px 64px;
  }

  .detail-hero {
    padding: 22px;
  }

  .example-body {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-btn {
    width: 100%;
    height: 38px;
  }

  .footer-inner {
    display: block;
  }
}

