/* ===== CSS Variables ===== */
:root {
  --color-primary: #2E86AB;
  --color-primary-light: #4A9BC7;
  --color-bg: #0B1120;
  --color-bg-card: #111827;
  --color-text: #E2E8F0;
  --color-text-muted: #94A3B8;
  --color-accent-red: #E53E3E;
  --color-border: rgba(46, 134, 171, 0.15);

  --font-cn: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-en: 'Inter', var(--font-cn);

  --radius-sm: 8px;
  --radius-md: 12px;

  --transition-fast: 200ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 400ms ease-out;

  --nav-height: 64px;
  --max-width: 1200px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-en);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.7;
  overflow-x: hidden;
}

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

img {
  max-width: 100%;
  display: block;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: rgba(11, 17, 32, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-normal);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.nav-brand img {
  height: 36px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
}

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

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary-light);
  transition: width var(--transition-normal);
}

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

.nav-links a:hover::after {
  width: 100%;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all var(--transition-normal);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 24px;
  transform: translateY(-100%);
  opacity: 0;
  transition: all var(--transition-normal);
  z-index: 999;
}

.mobile-menu.active {
  transform: translateY(0);
  opacity: 1;
}

.mobile-menu a {
  display: block;
  padding: 12px 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  transition: color var(--transition-fast);
}

.mobile-menu a:last-child {
  border-bottom: none;
}

.mobile-menu a:hover {
  color: var(--color-primary-light);
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(160deg, #0B1120 0%, #0f1a2e 40%, #0d1628 100%);
}

.hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
  max-width: 720px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--color-text);
}

.hero-title .accent {
  color: var(--color-primary-light);
}

.hero-subtitle {
  font-size: clamp(14px, 2.5vw, 18px);
  color: var(--color-text-muted);
  margin-bottom: 40px;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-family: var(--font-en);
}

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

.btn-primary:hover {
  background: #256d8c;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid rgba(74, 155, 199, 0.4);
}

.btn-secondary:hover {
  border-color: var(--color-primary-light);
  background: rgba(74, 155, 199, 0.08);
}

/* ===== Section Common ===== */
.section {
  padding: 100px 24px;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.section-desc {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 16px;
  margin-bottom: 56px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.title-accent {
  color: var(--color-primary-light);
}

/* ===== Products Section ===== */
.products {
  background: linear-gradient(180deg, var(--color-bg) 0%, #0e1629 100%);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.product-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary-light), transparent);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(46, 134, 171, 0.12);
  border-color: rgba(74, 155, 199, 0.3);
}

.product-card:hover::before {
  opacity: 1;
}

.product-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(46, 134, 171, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 24px;
}

.product-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.product-desc {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 20px;
  flex: 1;
}

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

.product-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-family: var(--font-en);
  background: var(--color-primary);
  color: #fff;
}

.product-btn:hover {
  background: #256d8c;
}

.product-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tag-new {
  background: rgba(229, 62, 62, 0.15);
  color: var(--color-accent-red);
}

.tag-free {
  background: rgba(46, 134, 171, 0.15);
  color: var(--color-primary-light);
}

/* ===== About Section ===== */
.about {
  background: var(--color-bg);
}

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}

.about-text h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--color-text);
}

.about-text p {
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 16px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: rgba(74, 155, 199, 0.3);
  transform: translateY(-2px);
}

.stat-number {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-primary-light);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ===== Footer ===== */
.footer {
  background: #070d1a;
  border-top: 1px solid var(--color-border);
  padding: 40px 24px;
  text-align: center;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-company {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}

.footer-info {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 2;
}

.footer-info a {
  color: var(--color-primary-light);
  transition: color var(--transition-fast);
}

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

.footer-divider {
  width: 40px;
  height: 1px;
  background: var(--color-border);
  margin: 16px auto;
}

.footer-copy {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.5);
}

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Tool Panel Overlay ===== */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.panel-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== Tool Panel (Slide-in from right) ===== */
.tool-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: #0e1629;
  border-left: 1px solid var(--color-border);
  z-index: 2001;
  transform: translateX(100%);
  transition: transform 350ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tool-panel.active {
  transform: translateX(0);
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.panel-header-info {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.panel-icon {
  font-size: 28px;
  line-height: 1;
  margin-top: 2px;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.panel-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.panel-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition-fast);
  flex-shrink: 0;
  margin-left: 12px;
}

.panel-close:hover {
  color: var(--color-text);
}

/* Panel Body */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 32px;
}

.panel-section {
  margin-bottom: 28px;
}

.panel-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.form-required {
  color: var(--color-accent-red);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--color-text);
  font-family: var(--font-en);
  transition: border-color var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%2394A3B8' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-select option {
  background: var(--color-bg-card);
  color: var(--color-text);
}

.form-error {
  border-color: var(--color-accent-red) !important;
}

/* Generate Button */
.panel-generate-btn {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  font-size: 15px;
}

.panel-generate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-loading {
  display: inline-flex;
  align-items: center;
}

/* Result Section */
.panel-result-section {
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
}

.panel-result-content {
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
}

/* Result types */
.result-text {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-markdown {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.8;
}

.result-markdown h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--color-primary-light);
}

.result-markdown h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 14px 0 6px;
  color: var(--color-text);
}

.result-markdown h5 {
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 4px;
  color: var(--color-text);
}

.result-markdown ul {
  padding-left: 20px;
  margin: 8px 0;
}

.result-markdown li {
  margin-bottom: 4px;
}

.result-markdown strong {
  color: var(--color-primary-light);
}

.result-video-wrap {
  text-align: center;
}

.result-video {
  width: 100%;
  border-radius: var(--radius-sm);
  max-height: 300px;
}

.result-image-wrap {
  text-align: center;
}

.result-image {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

.result-note {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.result-error {
  text-align: center;
  padding: 20px;
}

.result-error-icon {
  font-size: 28px;
  margin-bottom: 8px;
  color: #f59e0b;
}

.result-error p {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* Result actions */
.panel-result-actions {
  display: flex;
  gap: 12px;
}

.panel-action-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .mobile-menu {
    display: block;
  }

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

  .about-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .about-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-card {
    padding: 20px 16px;
    text-align: center;
  }

  .stat-number {
    font-size: 24px;
  }

  .stat-label {
    font-size: 12px;
  }

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

  .hero-actions .btn {
    width: 200px;
  }

  .section {
    padding: 72px 20px;
  }

  /* Tool panel: full width on mobile */
  .tool-panel {
    width: 100vw;
  }

  .panel-header {
    padding: 20px 20px 16px;
  }

  .panel-body {
    padding: 20px 20px 28px;
  }
}

@media (max-width: 480px) {
  .about-stats {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 56px 16px;
  }

  .product-card {
    padding: 24px 20px;
  }

  .panel-result-actions {
    flex-direction: column;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tool-panel {
    width: 420px;
  }
}
