/* ==================== Base ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #070605;
  --bg-surface: rgba(10, 9, 7, 0.55);
  --bg-elevated: rgba(16, 14, 11, 0.6);
  --bg-card: rgba(14, 12, 9, 0.5);
  --text: #f5f0e8;
  --text-muted: rgba(245, 240, 232, 0.6);
  --text-dim: rgba(245, 240, 232, 0.35);
  --accent: #d98532;
  --accent-light: #e8a45c;
  --accent-glow: rgba(217, 133, 50, 0.15);
  --accent-glow-strong: rgba(217, 133, 50, 0.3);
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --border: rgba(217, 133, 50, 0.15);
  --border-hover: rgba(217, 133, 50, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --serif: 'Noto Serif SC', 'Songti SC', Georgia, serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ==================== Particle Background ==================== */
#particle-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #f0c080;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(217, 133, 50, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-light);
}

::selection {
  background: rgba(217, 133, 50, 0.3);
  color: #fff;
}

/* ==================== Navigation ==================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  backdrop-filter: none;
  border-bottom: 1px solid transparent;
  transition: all 0.4s ease;
}

.nav.scrolled {
  background: rgba(7, 6, 5, 0.65);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 1.4rem;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

.btn-nav {
  padding: 6px 16px !important;
  font-size: 0.8rem !important;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hover);
  color: var(--accent-light) !important;
  transition: all 0.2s;
}

.btn-nav:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* ==================== Hero ==================== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 80px 24px 60px;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.3s forwards;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.5s forwards;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-light), #e8c080, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 36px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.7s forwards;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 56px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.9s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.25s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #c07528;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(217, 133, 50, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-hover);
}

.btn-secondary:hover {
  background: var(--accent-glow);
  color: var(--text);
  border-color: var(--accent);
}

.hero-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  opacity: 0;
  animation: fadeUp 0.8s ease 1.1s forwards;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  opacity: 0;
  animation: fadeUp 0.8s ease 1.4s forwards;
}

.scroll-arrow {
  display: block;
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg);
  animation: scrollBounce 2s ease infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.4; }
  50% { transform: rotate(45deg) translateY(6px); opacity: 0.8; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== Sections ==================== */
.section {
  padding: 96px 0;
  position: relative;
}

.section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  backdrop-filter: blur(6px);
  z-index: -1;
}

.section-alt::before {
  background: var(--bg-elevated);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 48px;
}

/* ==================== Features ==================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 48px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.3s;
  backdrop-filter: blur(3px);
}

.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==================== Steps ==================== */
.steps {
  display: flex;
  gap: 32px;
  margin-bottom: 48px;
}

.step {
  flex: 1;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-number {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.step-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==================== Code Block ==================== */
.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(217, 133, 50, 0.05);
}

.code-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.code-tab:hover {
  color: var(--text);
}

.code-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.code-content {
  display: none;
  position: relative;
  padding: 20px 24px;
}

.code-content.active {
  display: block;
}

.code-content pre {
  overflow-x: auto;
}

.code-content code {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  background: none;
  padding: 0;
  color: var(--text);
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  background: rgba(217, 133, 50, 0.08);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--accent-glow);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

/* ==================== Docs ==================== */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.docs-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.docs-group-title {
  font-size: 1.1rem;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.endpoint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(3px);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.method {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
}

.method.get {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.method.post {
  background: rgba(217, 133, 50, 0.15);
  color: var(--accent-light);
}

.endpoint-header code {
  font-size: 0.9rem;
  background: none;
  padding: 0;
}

.endpoint > p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.endpoint-example {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
}

.endpoint-example code {
  font-size: 0.8rem;
  line-height: 1.6;
  background: none;
  padding: 0;
  color: var(--text);
}

/* ==================== Info Box ==================== */
.info-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(3px);
}

.info-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.info-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.info-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-box li {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.info-box li::before {
  content: '>';
  color: var(--accent);
  margin-right: 8px;
  font-family: var(--mono);
}

/* ==================== Error Table ==================== */
.error-table {
  width: 100%;
  border-collapse: collapse;
}

.error-table th,
.error-table td {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.error-table th {
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.error-table td {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.error-table tr:last-child td {
  border-bottom: none;
}

/* ==================== Models ==================== */
.models-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 48px;
}

.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s;
  backdrop-filter: blur(3px);
}

.model-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.model-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.badge-pro {
  background: rgba(217, 133, 50, 0.15);
  color: var(--accent-light);
}

.badge-omni {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.badge-flash {
  background: rgba(245, 158, 11, 0.15);
  color: var(--orange);
}

.badge-tts {
  background: rgba(244, 114, 182, 0.15);
  color: #f472b6;
}

.model-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  font-family: var(--mono);
}

.model-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==================== Footer ==================== */
.footer {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  backdrop-filter: blur(6px);
  z-index: -1;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.footer-brand {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.4rem;
  }

  .nav-links a:not(.btn-nav) {
    display: none;
  }

  .features-grid,
  .models-grid {
    grid-template-columns: 1fr;
  }

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

  .steps {
    flex-direction: column;
    gap: 20px;
  }

  .hero-stats {
    gap: 24px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .stat-value {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 16px;
  }

  .stat-divider {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-kicker,
  .hero h1,
  .hero-desc,
  .hero-actions,
  .hero-stats,
  .scroll-hint {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .scroll-arrow {
    animation: none;
  }
}
