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

/* =====================
   THEME VARIABLES
   ===================== */
:root {
  --pink: #7c3aed;
  --cyan: #a78bfa;
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --text: #f1f1f1;
  --text-secondary: #aaa;
  --muted: #666;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

[data-theme="light"] {
  --bg: #f5f3ff;
  --surface: #ffffff;
  --surface2: #ede9fe;
  --border: #ddd6fe;
  --text: #0f0c1d;
  --text-secondary: #6c6685;
  --muted: #9d97b4;
  --shadow: 0 4px 24px rgba(109, 40, 217, 0.1);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

/* =====================
   HEADER
   ===================== */
header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.logo {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #fe2c55 0%, #cc2366 30%, #1877f2 65%, #111 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo span {
  /* gradient inherited */
}

/* Theme Toggle */
.theme-toggle {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--pink);
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto 0.75rem;
  line-height: 1.5;
}

/* Download Counter */
.counter-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.counter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse-dot 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

#downloadCounter {
  font-weight: 700;
  color: var(--pink);
}

/* =====================
   MAIN
   ===================== */
main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* =====================
   PLATFORM BADGES
   ===================== */
.platforms {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.platform {
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
  cursor: default;
}

.platform.active {
  border-color: var(--pink);
  color: var(--pink);
  background: var(--surface);
}

.platform.detected {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--surface);
  animation: badge-glow 0.5s ease;
}

@keyframes badge-glow {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.platform.soon {
  opacity: 1;
  background: transparent;
  border-style: dashed;
  border-color: #c4b5fd;
  color: #a78bfa;
}

.badge {
  background: #ede9fe;
  color: #7c3aed;
  font-size: 0.62rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =====================
   HERO / FORM
   ===================== */
.hero {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* Privacy badge */
.privacy-badge {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

#urlInput {
  flex: 1;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0.8rem 1.25rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  min-width: 0;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, #c4b5fd, #7c3aed, #a78bfa) border-box;
  transition: background 0.2s;
}

#urlInput:focus {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, #7c3aed, #4f46e5, #a78bfa) border-box;
}

#urlInput::placeholder {
  color: var(--muted);
}

.btn-paste {
  background: var(--surface2);
  color: var(--pink);
  border: 1.5px solid var(--pink);
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-paste:hover {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
}

#submitBtn {
  background: var(--pink);
  color: #fff;
  border: 2px solid var(--pink);
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#submitBtn:hover:not(:disabled) {
  background: #fff;
  color: var(--pink);
  border-color: var(--pink);
}

#submitBtn:active:not(:disabled) {
  transform: translateY(0);
}

#submitBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}


/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Error */
.error {
  margin-top: 1rem;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: #dc2626;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

/* Result */
.result {
  margin-top: 1.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  animation: slide-in 0.3s ease;
  position: relative;
}

.btn-close-result {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  z-index: 1;
}

.btn-close-result:hover {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-inner {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.thumbnail-wrapper {
  position: relative;
  width: 90px;
  height: 115px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.result-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.play-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #111;
  padding-left: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.result-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
  cursor: pointer;
  border: none;
  text-align: center;
}

.btn-download:hover {
  opacity: 0.85;
}

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

.btn-mp3 {
  background: #1db954;
  color: #fff;
  border: none !important;
}

.btn-download:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}


/* =====================
   FEATURES
   ===================== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.feature-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-item:hover {
  border-color: var(--pink);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 1.4rem;
  margin-bottom: 0.15rem;
}

.feature-item h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.feature-item p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* =====================
   HOW IT WORKS
   ===================== */
.how-it-works {
  margin-bottom: 2rem;
}

.how-it-works h2 {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.faq h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: var(--pink);
  text-transform: none;
  letter-spacing: -0.02em;
}

.faq-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.steps {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.step {
  flex: 1;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.step p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* =====================
   SHARE SECTION
   ===================== */
.share-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 2rem;
}

.share-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  font-weight: 600;
}

.share-buttons {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.share-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  background: var(--surface2);
  color: var(--text);
}

.share-whatsapp {
  background: #25d366;
  color: #fff;
  border-color: #25d366;
}
.share-whatsapp:hover {
  background: #fff;
  color: #25d366;
  border-color: #25d366;
}

.share-twitter {
  background: #000000;
  color: #fff;
  border-color: #000000;
}
.share-twitter:hover {
  background: #fff;
  color: #000000;
  border-color: #000000;
}

.share-facebook {
  background: #1877f2;
  color: #fff;
  border-color: #1877f2;
}
.share-facebook:hover {
  background: #fff;
  color: #1877f2;
  border-color: #1877f2;
}

.share-instagram {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  color: #fff;
  border-color: #dc2743;
}
.share-instagram:hover {
  background: #fff;
  color: #dc2743;
  border-color: #dc2743;
}

.share-copy {
  background: var(--surface2);
  color: var(--pink);
  border-color: var(--pink);
}

.share-copy:hover {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
}

/* =====================
   FAQ
   ===================== */
.faq {
  margin-bottom: 2rem;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:first-of-type {
  border-top: 1px solid var(--border);
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  padding: 1rem 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: color 0.2s;
}

.faq-question:hover {
  color: var(--pink);
}

.faq-icon {
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.25s, color 0.25s;
}

.faq-question[aria-expanded="true"] .faq-icon {
  transform: rotate(45deg);
  color: var(--pink);
}

.faq-answer {
  display: none;
  padding-bottom: 1rem;
}

.faq-answer.open {
  display: block;
  animation: fade-down 0.2s ease;
}

@keyframes fade-down {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.faq-answer p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* =====================
   UTILITY
   ===================== */
.hidden {
  display: none !important;
}

/* =====================
   FOOTER
   ===================== */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 1px solid var(--border);
}

.footer-sub {
  color: var(--muted);
  font-size: 0.75rem;
  opacity: 0.6;
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 600px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .input-group {
    flex-direction: column;
  }

  .btn-paste,
  #submitBtn {
    width: 100%;
    justify-content: center;
  }

  .steps {
    flex-direction: column;
  }

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

/* Result: thumbnail upar, info neeche */
  .result-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .thumbnail-wrapper {
    width: 100%;
    height: 200px;
  }
}
