:root {
  color-scheme: dark;
  --bg: #0a0d11;
  --surface: rgba(22, 28, 36, 0.85);
  --surface-hover: rgba(30, 38, 48, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f4f8;
  --muted: #8a9baa;
  --accent: #7c6aff;
  --accent-glow: rgba(124, 106, 255, 0.3);
  --gradient: linear-gradient(135deg, #7c6aff, #00c6ff);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, "SF Pro Display", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10, 13, 17, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.brand-icon { font-size: 24px; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.nav-links { display: flex; gap: 24px; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }

/* ─── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  padding: 160px 0 100px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(124, 106, 255, 0.15), transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(0, 198, 255, 0.08), transparent 40%);
}
.hero h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  margin-top: 12px; font-size: 18px; color: var(--muted);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 32px; border: 0; border-radius: var(--radius-sm);
  background: var(--gradient); color: white;
  font-size: 15px; font-weight: 700; cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 32px -8px var(--accent-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 40px -8px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Sections ───────────────────────────────────────────────────────────── */

.section { padding: 80px 0; }
.section-alt { background: rgba(255,255,255,0.02); }
.section-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.section-sub { color: var(--muted); margin-bottom: 32px; }

/* ─── Style Categories ───────────────────────────────────────────────────── */

.style-categories {
  display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}
.cat-btn {
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); padding: 8px 16px; border-radius: 20px;
  font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.cat-btn:hover { border-color: var(--accent); color: var(--text); }
.cat-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ─── Style Grid ─────────────────────────────────────────────────────────── */

.style-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.style-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 14px; text-align: center; cursor: pointer;
  background: var(--surface); transition: all 0.2s;
}
.style-card:hover { background: var(--surface-hover); border-color: rgba(124,106,255,0.3); }
.style-card.selected { border-color: var(--accent); background: rgba(124,106,255,0.08); box-shadow: 0 0 0 2px var(--accent-glow); }
.style-icon { font-size: 32px; margin-bottom: 8px; }
.style-name { font-size: 14px; font-weight: 600; }
.style-desc { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ─── Create Panel ───────────────────────────────────────────────────────── */

.create-panel {
  display: grid; grid-template-columns: 1fr 300px; gap: 24px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 24px;
}
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  min-height: 300px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.2s; overflow: hidden;
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); }
.upload-placeholder { text-align: center; color: var(--muted); }
.upload-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.upload-hint { font-size: 12px; margin-top: 6px; }
.preview-img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; }

.create-controls {
  display: flex; flex-direction: column; gap: 16px; justify-content: center;
}
.selected-style {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3); font-size: 14px;
}
.btn-generate { width: 100%; }

.status { font-size: 13px; padding: 8px 12px; border-radius: 8px; }
.status.ok { background: rgba(0,200,100,0.1); color: #5efa9a; }
.status.err { background: rgba(255,80,80,0.1); color: #ff6b6b; }

/* ─── Result Panel ───────────────────────────────────────────────────────── */

.result-panel {
  margin-top: 32px; padding: 24px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-align: center;
}
.result-panel h3 { margin-bottom: 20px; }
.result-images {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  flex-wrap: wrap;
}
.result-col { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.result-col img { max-width: 300px; max-height: 300px; border-radius: var(--radius-sm); object-fit: contain; }
.result-label { font-size: 12px; color: var(--muted); }
.result-arrow { font-size: 24px; color: var(--muted); }
.result-panel .btn-primary { margin-top: 20px; }

/* ─── Pricing Grid ───────────────────────────────────────────────────────── */

.pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.price-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; background: var(--surface);
  position: relative; transition: all 0.2s;
}
.price-card:hover { border-color: rgba(124,106,255,0.3); }
.price-card.featured { border-color: var(--accent); background: rgba(124,106,255,0.06); }
.price-tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--gradient); color: white; font-size: 11px; font-weight: 700;
  padding: 3px 12px; border-radius: 10px;
}
.price-name { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.price-amount { font-size: 32px; font-weight: 800; }
.price-credits { font-size: 13px; color: var(--muted); margin-top: 4px; }
.price-unit { font-size: 12px; color: var(--accent); margin-top: 4px; }
.btn-buy {
  margin-top: 16px; width: 100%; padding: 10px;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: transparent; color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-buy:hover { background: var(--accent); color: white; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */

.footer {
  padding: 40px 0; text-align: center;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 13px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .create-panel { grid-template-columns: 1fr; }
  .style-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .result-images { flex-direction: column; }
  .result-arrow { transform: rotate(90deg); }
  .nav-links { display: none; }
}
