:root {
  --bg: #F3F5FA;
  --bg-alt: #E9EDF7;
  --card: #FFFFFF;
  --border: #DCE2F0;
  --ink: #12141A;
  --ink-dim: #5B6272;
  --ink-faint: #8991A6;

  --coral: #FF6B4A;
  --coral-dim: #FFE3DA;
  --navy: #1B1F3B;

  --live: var(--navy);
  --live-soft: #E7E8F3;

  --tiktok: #EE1D52;
  --tiktok-2: #17D6D1;
  --instagram: #C1367B;
  --facebook: #1877F2;
  --youtube: #E62117;
  --twitter: #14171A;
  --pinterest: #E60023;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(18,20,26,0.04), 0 12px 28px -14px rgba(18,20,26,0.18);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--navy);
}

p { color: var(--ink-dim); line-height: 1.55; }

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

.accent { color: var(--coral); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 245, 250, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  font-size: 0.9rem;
}

.logo-text { color: var(--navy); }

nav { display: flex; gap: 24px; }
nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-dim);
  transition: color 0.15s ease;
}
nav a:hover, nav a:focus-visible { color: var(--navy); }

/* ---------- Hero ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.hero {
  text-align: center;
  padding: 18px 0 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--coral-dim);
  color: #B8431F;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.hero h1 {
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  line-height: 1.04;
  font-weight: 700;
}

.rotator {
  display: inline-grid;
  vertical-align: bottom;
  overflow: hidden;
  height: 1.15em;
  color: var(--coral);
}

.rotator-item {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(0.6em);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.rotator-item.is-active {
  opacity: 1;
  transform: translateY(0);
}

.subtitle {
  max-width: 480px;
  margin: 6px auto 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.search-container {
  max-width: 640px;
  margin: 14px auto 0;
  display: flex;
  gap: 8px;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.input-wrapper:focus-within {
  border-color: var(--live);
  box-shadow: 0 0 0 4px var(--live-soft);
}

.input-icon { font-size: 1rem; opacity: 0.6; }

#video-url {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  color: var(--ink);
  min-width: 0;
}

#video-url::placeholder { color: var(--ink-faint); font-family: 'Inter', sans-serif; }

.platform-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--live-soft);
  color: var(--live);
}

.clear-btn {
  border: none;
  background: var(--bg-alt);
  color: var(--ink-dim);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.btn-main {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 0 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-main:hover { background: #262B4F; }
.btn-main:active { transform: scale(0.97); }
.btn-arrow { transition: transform 0.15s ease; }
.btn-main:hover .btn-arrow { transform: translateX(3px); }

/* Platform-aware live accent on the input wrapper */
.input-wrapper[data-platform="tiktok"] { --live: var(--tiktok); --live-soft: #FDE6EC; }
.input-wrapper[data-platform="instagram"] { --live: var(--instagram); --live-soft: #FBE7F0; }
.input-wrapper[data-platform="facebook"] { --live: var(--facebook); --live-soft: #E6F0FE; }
.input-wrapper[data-platform="youtube"] { --live: var(--youtube); --live-soft: #FCE7E6; }
.input-wrapper[data-platform="twitter"] { --live: var(--twitter); --live-soft: #EAEAEC; }
.input-wrapper[data-platform="pinterest"] { --live: var(--pinterest); --live-soft: #FCE1E6; }

.loading {
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  max-width: 640px;
  margin: 14px auto 0;
  background: #FDECEA;
  color: #A22A20;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 0.9rem;
  text-align: left;
}

.result-card {
  max-width: 480px;
  margin: 12px auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 12px;
  text-align: left;
}

.result-card img {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  margin-bottom: 10px;
  max-height: 180px;
  object-fit: cover;
}

.result-card h3 {
  font-size: 0.96rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}

.result-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-dl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  color: #fff;
}

.btn-dl.mp4 { background: var(--navy); }
.btn-dl.mp3 { background: var(--coral); }
.btn-dl.alt { background: var(--ink-dim); }

.hidden { display: none !important; }

/* Platform chips row */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ink-dim);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
}

.chip i {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.chip[data-chip="tiktok"] i { background: var(--tiktok); }
.chip[data-chip="instagram"] i { background: var(--instagram); }
.chip[data-chip="facebook"] i { background: var(--facebook); }
.chip[data-chip="youtube"] i { background: var(--youtube); }
.chip[data-chip="twitter"] i { background: var(--twitter); }
.chip[data-chip="pinterest"] i { background: var(--pinterest); }

/* ---------- Stats ---------- */
.stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 10px 0;
  margin: 0;
}

.stat { text-align: center; }
.stat strong {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  color: var(--navy);
}
.stat span { font-size: 0.72rem; color: var(--ink-faint); }
.stat-divider { width: 1px; height: 24px; background: var(--border); }

/* ---------- Section shared ---------- */
section h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  text-align: center;
}

.section-sub {
  text-align: center;
  max-width: 480px;
  margin: 8px auto 0;
}

/* ---------- Platforms grid ---------- */
.platforms { padding: 24px 0 12px; }

.platforms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.platform-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.platform-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-bottom: 9px;
}

.platform-card[data-platform="tiktok"] .platform-dot { background: var(--tiktok); }
.platform-card[data-platform="instagram"] .platform-dot { background: var(--instagram); }
.platform-card[data-platform="facebook"] .platform-dot { background: var(--facebook); }
.platform-card[data-platform="youtube"] .platform-dot { background: var(--youtube); }
.platform-card[data-platform="twitter"] .platform-dot { background: var(--twitter); }
.platform-card[data-platform="pinterest"] .platform-dot { background: var(--pinterest); }

.platform-card h3 { font-size: 1.02rem; margin-bottom: 6px; }
.platform-card p { font-size: 0.87rem; margin: 0; }

/* ---------- Features ---------- */
.features { padding: 28px 0 12px; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  box-shadow: var(--shadow-card);
}

.feature-icon { font-size: 1.5rem; margin-bottom: 8px; }
.feature-card h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature-card p { font-size: 0.88rem; margin: 0; }

/* ---------- How to ---------- */
.how-to { padding: 28px 0 12px; }

.steps {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
}

.step { flex: 1; text-align: center; }

.step-number {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  margin: 0 auto 14px;
}

.step-content h3 { font-size: 1rem; margin-bottom: 6px; }
.step-content p { font-size: 0.87rem; }

.step-line {
  height: 1.5px;
  background: var(--border);
  flex: 0 0 40px;
  margin-top: 19px;
}

/* ---------- FAQ ---------- */
.faq { padding: 28px 0 40px; }

.faq-list {
  max-width: 640px;
  margin: 16px auto 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 16px 18px;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.faq-q span { color: var(--ink-faint); transition: transform 0.2s ease; }
.faq-q.open span { transform: rotate(45deg); }

.faq-a {
  max-height: 0;
  overflow: hidden;
  padding: 0 18px;
  font-size: 0.88rem;
  color: var(--ink-dim);
  transition: max-height 0.3s ease, padding 0.25s ease;
}

.faq-a.open { max-height: 300px; padding: 0 18px 16px; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
}

.footer-content { max-width: 1080px; margin: 0 auto; }
.footer-content .logo { justify-content: center; margin-bottom: 10px; }
.footer-content p { font-size: 0.85rem; margin: 4px 0; }
.footer-note { color: var(--ink-faint); font-size: 0.78rem; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .platforms-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .steps { flex-direction: column; align-items: stretch; }
  .step-line { display: none; }
  .search-container { flex-direction: column; }
  .btn-main { justify-content: center; padding: 15px; }
  .platform-tag { display: none; }
}

@media (max-width: 480px) {
  .platforms-grid { grid-template-columns: 1fr; }
  .nav-container nav { display: none; }
}

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}
