/* ═══════════════════════════════════════════════════════
   KwaiSave — Premium Dark Neon Design System
   Typography: Sora (Google Fonts)
   Layout: Optimized Above-the-Fold Tool 
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-2: #f8fafc;
  --surface: rgba(0,0,0,0.04);
  --surface-hover: rgba(0,0,0,0.07);
  --border: rgba(0,0,0,0.08);
  --border-accent: rgba(255,60,172,0.3);

  --accent-1: #FF3CAC;
  --accent-2: #784BA0;
  --accent-3: #2B86C5;
  --gradient: linear-gradient(135deg, #FF3CAC 0%, #784BA0 50%, #2B86C5 100%);
  --gradient-glow: linear-gradient(135deg, rgba(255,60,172,0.15) 0%, rgba(120,75,160,0.15) 50%, rgba(43,134,197,0.15) 100%);

  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #475569;

  --success: #10B981;
  --error: #F43F5E;
  --warning: #F59E0B;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 0 0 1px rgba(0,0,0,0.06), 0 8px 40px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 30px rgba(255,60,172,0.15);
  --shadow-btn: 0 4px 20px rgba(255,60,172,0.3);

  --font: 'Sora', -apple-system, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
  --bg: #060612;
  --bg-2: #0a0a1a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --text: #F1F5F9;
  --text-muted: #64748B;
  --text-soft: #94A3B8;
  --shadow-card: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(255,60,172,0.2), 0 0 60px rgba(120,75,160,0.1);
}

/* ─── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Noise Texture & Orbs ──────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}
body.dark-mode::before {
  opacity: 0.4;
}
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s;
}
body.dark-mode .bg-orb {
  opacity: 0.35;
}
.bg-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,60,172,0.4), transparent 70%);
  top: -200px; left: -200px;
}
.bg-orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(43,134,197,0.35), transparent 70%);
  bottom: -150px; right: -150px;
}

/* ─── Layout ─────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; }
@media (min-width: 640px) { .container { padding: 0 24px; } }

/* ─── Header ─────────────────────────────────────────── */
header {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(6, 6, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
}
header .container { display: flex; justify-content: space-between; align-items: center; }

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-decoration: none;
  color: var(--text);
}
.logo-area svg { width: 28px; height: 28px; }
.logo-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ─── Hero Section ───────────────────────────────────── */
.hero {
  text-align: center;
  padding: 24px 0 16px; /* Greatly reduced padding so tool is visible */
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 60, 172, 0.1);
  border: 1px solid rgba(255, 60, 172, 0.25);
  color: #FF3CAC;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 42px); /* Reduced size */
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 8px;
}
.hero h1 .gradient-word {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 16px; /* Tighter margin */
}

/* ─── Tab Navigation ─────────────────────────────────── */
.tabs-nav {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 16px; /* Reduced from 24px */
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.tab-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--gradient);
  color: white;
  box-shadow: var(--shadow-btn);
}

/* ─── Tool Card ──────────────────────────────────────── */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px; /* Optimized for mobile compactness */
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition);
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
}
.tool-card:focus-within { border-color: var(--border-accent); }
@media (min-width: 640px) { .tool-card { padding: 24px; border-radius: var(--radius-xl); } }

/* ─── Input Area ─────────────────────────────────────── */
.input-wrapper {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
@media (max-width: 640px) { .input-wrapper { flex-direction: column; align-items: stretch; } }

.url-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 14px 16px;
  outline: none;
  width: 100%;
}
.url-input:focus {
  border-color: rgba(255,60,172,0.5);
  background: rgba(255, 60, 172, 0.04);
}

.btn-primary {
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  padding: 14px 24px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: var(--shadow-btn);
  width: 100%;
}
@media (min-width: 640px) { .btn-primary { width: auto; } }

/* ─── Stats Bar (Moved below tool card) ──────────────── */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 16px auto 32px;
  flex-wrap: wrap;
}
.stat-number { font-size: 20px; font-weight: 800; color: var(--accent-1); }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ─── Loading Skeleton ───────────────────────────────── */
#loading-skeleton { display: none; padding: 16px 0; }
.loading-status { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.loading-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border); border-top-color: var(--accent-1);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 3px; background: rgba(255,255,255,0.08); border-radius: 100px; }
.progress-fill { height: 100%; width: 0%; background: var(--gradient); border-radius: 100px; transition: width 0.4s ease; }

/* ─── Error Card ─────────────────────────────────────── */
#error-card { display: none; background: rgba(244, 63, 94, 0.08); border: 1px solid rgba(244, 63, 94, 0.25); border-radius: var(--radius-md); padding: 16px; margin-top: 16px; }
.error-inner { display: flex; gap: 10px; }
.error-title { font-size: 13px; font-weight: 700; color: #F43F5E; }
#error-message { font-size: 13px; color: var(--text-soft); }

/* ─── Success Card (Result) ──────────────────────────── */
#success-card { display: none; margin-top: 16px; background: var(--surface); border: 1px solid rgba(255,60,172,0.2); border-radius: var(--radius-lg); overflow: hidden; }
.video-preview-area { position: relative; background: #000; max-height: 240px; overflow: hidden; }
#preview-player, #preview-thumb { width: 100%; max-height: 240px; object-fit: contain; display: block; }
.preview-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px; background: linear-gradient(transparent, rgba(0,0,0,0.8)); }
.video-meta h3 { font-size: 14px; color: white; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.download-panel { padding: 16px; }
.format-quality-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.selector-group { display: flex; gap: 4px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.selector-group label { font-size: 10px; font-weight: 600; color: var(--text-muted); align-self: center; margin: 0 4px; text-transform: uppercase; }
.quality-btn, .format-btn { background: none; border: none; color: var(--text-muted); font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: 0.2s; }
.quality-btn.active, .format-btn.active { background: var(--gradient); color: white; }

.btn-download-main { width: 100%; background: var(--gradient); color: white; border-radius: var(--radius-md); font-size: 15px; font-weight: 700; padding: 14px; text-decoration: none; display: flex; justify-content: center; margin-bottom: 8px; }
.btn-extra { flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--text-soft); padding: 8px; border-radius: var(--radius-sm); font-size: 13px; text-align: center; cursor: pointer; margin-right: 4px; }
#qr-section { display: none; text-align: center; margin-top: 16px; }
#qrcode canvas { border-radius: 8px; background: white; padding: 8px; }

/* ─── Features Grid ──────────────────────────────────── */
.features-section { padding: 40px 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; }
.feature-icon { font-size: 24px; margin-bottom: 12px; }

/* ─── FAQ ────────────────────────────────────────────── */
.faq-section { padding: 40px 0; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 8px; overflow: hidden; }
.faq-question { width: 100%; background: none; border: none; color: var(--text); padding: 16px; text-align: left; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; }
.faq-answer { display: none; padding: 0 16px 16px; font-size: 13px; color: var(--text-muted); }
.faq-item.open .faq-answer { display: block; }

/* ─── Toast ──────────────────────────────────────────── */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2937; color: white; padding: 12px 24px; border-radius: 100px; opacity: 0; pointer-events: none; transition: 0.3s; z-index: 1000; font-size: 13px;}
.toast.show { opacity: 1; bottom: 30px; }

/* Hide tabs */
.tab-content { display: none; }
#single-tab { display: block; }
#bulk-tab textarea { width: 100%; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: white; resize: vertical; min-height: 100px; margin-bottom: 10px; font-family: var(--font); font-size: 14px;}
.profile-result-card { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; }

/* History */
.history-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
@media (min-width: 640px) { .history-grid { grid-template-columns: repeat(3, 1fr); } }
.history-item img { width: 100%; border-radius: var(--radius-sm); }

/* ─── Steps Section ─────────────────────────────── */
.steps-section {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}
.steps-section h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-intro {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 15px;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition: var(--transition);
}
.step-card:hover {
  border-color: var(--border-accent);
  background: var(--surface-hover);
}
.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.step-screenshot {
  border-radius: var(--radius-md);
  background: var(--bg-2);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-screen-mock {
  text-align: center;
  padding: 20px;
  width: 100%;
}
.step-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.step-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.step-screenshot img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

/* Tool Mock UI */
.tool-mock-ui {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.mock-header {
  background: rgba(255,255,255,0.05);
  padding: 6px 10px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.mock-circle {
  width: 8px; height: 8px; border-radius: 50%;
}
.mock-circle.red { background: #ff5f56; }
.mock-circle.yellow { background: #ffbd2e; }
.mock-circle.green { background: #27c93f; }
.mock-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
}
.mock-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.mock-btn.primary { background: var(--bg-2); }
.mock-btn.download { background: var(--gradient); color: white; border: none; }
.mock-input {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  width: 100%;
  text-align: left;
}
.mock-thumb {
  width: 100%;
  height: 60px;
  background: #000;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
}

/* ─── Article Section ───────────────────────────── */
.article-section {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}
.article-section article {
  max-width: 760px;
  margin: 0 auto;
}
.article-section h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}
.article-section h3 {
  font-size: 17px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--accent-1);
}
.article-section p {
  color: var(--text-soft);
  margin-bottom: 12px;
  line-height: 1.7;
}
.article-section ul {
  padding-left: 20px;
  margin-bottom: 16px;
}
.article-section ul li {
  color: var(--text-soft);
  line-height: 1.8;
  font-size: 14px;
}
