/* ========================================
   AI工具站 — 暗黑霓虹赛博风
   配色: 深色背景 + 紫青渐变 + 霓虹高光
   参考: iokle.com 暗紫色系
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f2a;
  --bg-card: #141435;
  --bg-card-hover: #1a1a45;
  --bg-input: #1a1a3a;

  --neon-purple: #8b5cf6;
  --neon-purple-light: #a78bfa;
  --neon-cyan: #06b6d4;
  --neon-cyan-dim: #0891b2;
  --neon-pink: #ec4899;
  --neon-pink-light: #f472b6;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #c4b5fd;

  --gradient-main: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --gradient-glow: linear-gradient(135deg, rgba(139,92,246,0.3), rgba(6,182,212,0.3));
  --gradient-card: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(6,182,212,0.08));

  --border-color: rgba(139,92,246,0.2);
  --border-glow: rgba(139,92,246,0.4);

  --shadow-glow: 0 0 30px rgba(139,92,246,0.15);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.3);

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

  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

a:hover {
  color: var(--neon-purple-light);
  text-shadow: 0 0 8px rgba(139,92,246,0.5);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--neon-purple); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-purple-light); }

/* ============ NAVBAR ============ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary) !important;
  font-weight: 700;
  font-size: 18px;
}

.logo-icon { font-size: 24px; }

.logo-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary) !important;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary) !important;
  background: rgba(139,92,246,0.1);
}

.nav-link.active {
  color: var(--neon-purple-light) !important;
}

.nav-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  background: var(--gradient-main);
  color: white !important;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 20px rgba(139,92,246,0.4);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}

.nav-placeholder { height: 64px; }

/* ============ HERO ============ */
.hero {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 40px 20px;
}

.hero-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(139,92,246,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(6,182,212,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(236,72,153,0.08) 0%, transparent 40%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 800px;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 20px;
}

.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.gradient-text::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-main);
  filter: blur(8px);
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scaleX(0.8); }
  50% { opacity: 1; transform: scaleX(1); }
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--neon-cyan);
  margin-bottom: 12px;
  font-weight: 500;
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.8;
}

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

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
  font-family: var(--font-sans);
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-main);
  color: white !important;
  box-shadow: 0 4px 20px rgba(139,92,246,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139,92,246,0.5);
}

.btn-secondary {
  background: transparent;
  color: var(--neon-cyan) !important;
  border-color: var(--neon-cyan);
}

.btn-secondary:hover {
  background: rgba(6,182,212,0.1);
  box-shadow: 0 0 20px rgba(6,182,212,0.3);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary) !important;
  border-color: var(--border-color);
}

.btn-outline:hover {
  border-color: var(--neon-purple);
  color: var(--neon-purple-light) !important;
}

.btn-generate {
  width: 100%;
  justify-content: center;
  padding: 16px;
  font-size: 18px;
  margin-top: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ============ FEATURES ============ */
.features {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  cursor: pointer;
  transition: all 0.3s;
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--neon-purple);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(139,92,246,0.2);
}

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

.feature-card h3 {
  font-size: 18px;
  margin-bottom: 10px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.feature-tag {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(139,92,246,0.15);
  color: var(--neon-purple-light);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* ============ LEGAL LINKS ============ */
.legal-links-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

.legal-links {
  display: flex;
  justify-content: center;
  gap: 40px;
}

.legal-links a {
  color: var(--text-muted) !important;
  font-size: 13px;
  transition: color 0.2s;
}

.legal-links a:hover {
  color: var(--text-secondary) !important;
}

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border-color);
}

/* ============ TOOL PAGE ============ */
.tool-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

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

.tool-icon { font-size: 32px; }

.tool-header h2 {
  font-size: 28px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.tool-card-hint {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  font-style: italic;
}

.input-area textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-sans);
  resize: vertical;
  transition: border-color 0.2s;
  outline: none;
  line-height: 1.6;
}

.input-area textarea:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 15px rgba(139,92,246,0.2);
}

.input-area textarea::placeholder {
  color: var(--text-muted);
}

/* Options */
.image-options, .music-options {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.option-row select, .option-row input[type="checkbox"] {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.option-row select:focus {
  border-color: var(--neon-purple);
}

.option-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--neon-purple);
}

/* Trial banner */
.trial-banner {
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.trial-used {
  color: var(--neon-pink);
  font-weight: 600;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error toast */
.error-toast {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 14px;
}

/* Result section */
.result-section {
  margin-top: 32px;
}

.result-section h3 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--neon-cyan);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s;
}

.result-card:hover {
  border-color: var(--neon-purple);
  box-shadow: 0 0 20px rgba(139,92,246,0.2);
}

.result-card img {
  width: 100%;
  display: block;
  cursor: pointer;
}

.result-audio {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.result-audio audio {
  width: 100%;
  max-width: 500px;
}

.result-audio audio::-webkit-media-controls-panel {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-download {
  display: block;
  width: 100%;
  padding: 10px;
  background: rgba(139,92,246,0.15);
  border: 1px solid var(--border-color);
  border-top: none;
  color: var(--neon-cyan);
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.btn-download:hover {
  background: rgba(139,92,246,0.25);
  color: var(--neon-purple-light);
}

.result-prompt {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  word-break: break-all;
}

/* ============ AUTH ============ */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 64px);
  padding: 40px 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.auth-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-hint {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

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

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
  font-family: var(--font-sans);
}

.form-group input:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 15px rgba(139,92,246,0.2);
}

.form-error {
  color: #fca5a5;
  font-size: 14px;
  margin-bottom: 12px;
  min-height: 20px;
}

.form-agreement {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.form-agreement input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--neon-purple);
  flex-shrink: 0;
}

.form-agreement a {
  color: var(--neon-cyan) !important;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--neon-purple-light) !important;
  font-weight: 500;
}

/* ============ PROFILE ============ */
.profile-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.profile-header {
  text-align: center;
  margin-bottom: 40px;
}

.profile-avatar {
  font-size: 48px;
  margin-bottom: 12px;
}

.profile-header h2 {
  font-size: 24px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* History */
.history-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  display: flex;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--neon-purple);
  background: var(--bg-card-hover);
}

.history-media {
  width: 120px;
  flex-shrink: 0;
}

.history-media img {
  width: 100%;
  border-radius: var(--radius-sm);
}

.history-media audio {
  width: 120px;
  height: 40px;
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-type {
  font-size: 13px;
  margin-bottom: 4px;
}

.history-prompt {
  font-size: 14px;
  color: var(--text-secondary);
  word-break: break-word;
  line-height: 1.5;
}

.history-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 16px;
}

/* ============ LEGAL PAGES ============ */
.legal-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.legal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-card);
}

.legal-card h2 {
  font-size: 28px;
  margin-bottom: 24px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.legal-content h3 {
  font-size: 16px;
  color: var(--neon-cyan);
  margin-top: 24px;
  margin-bottom: 10px;
}

.legal-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 12px;
}

.legal-content ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-content li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 4px;
}

.legal-date {
  margin-top: 32px;
  font-size: 13px !important;
  color: var(--text-muted) !important;
  font-style: italic;
}

.legal-card > .btn-outline {
  margin-top: 24px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

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

  .tool-card {
    padding: 20px;
  }

  .legal-card {
    padding: 24px;
  }

  .auth-card {
    padding: 24px;
  }

  .history-item {
    flex-direction: column;
  }

  .history-media {
    width: 100%;
  }

  .history-media audio {
    width: 100%;
  }

  .legal-links {
    gap: 20px;
    flex-wrap: wrap;
  }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#app > * {
  animation: fadeInUp 0.5s ease-out;
}

/* ===== HISTORY ===== */
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.history-item:hover {
  border-color: rgba(139,92,246,0.3);
}
.history-media {
  margin-bottom: 10px;
}
.history-media img {
  width: 100%;
  border-radius: 8px;
  cursor: pointer;
}
.history-media audio {
  width: 100%;
  height: 40px;
}
.history-info {
  margin-bottom: 10px;
}
.history-type {
  font-size: 12px;
  color: var(--neon-cyan);
  margin-bottom: 4px;
}
.history-prompt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}
.history-time {
  font-size: 11px;
  color: var(--text-muted);
}
.history-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 10px;
}
.history-actions .btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.history-actions .btn-sm:hover {
  background: rgba(139,92,246,0.1);
  border-color: rgba(139,92,246,0.25);
  color: var(--text-accent);
}
