:root {
  color-scheme: light;
  --bg: #f9fafb;
  --bg-alt: #f5f5f7;
  --card: #ffffff;
  --text: #141414;
  --text-soft: #1f1f23;
  --muted: #6b7280;
  --border: #e5e7eb;
  --blue: #2563eb;
  --purple: #8b2fff;
  --pink: #f5054f;
  --gradient: linear-gradient(135deg, var(--blue) 0%, var(--purple) 52%, var(--pink) 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: inherit;
}

h1, h2, h3 {
  line-height: 1.2;
  color: var(--text-soft);
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(249, 250, 251, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-soft);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gradient);
  color: white;
  font-size: 0.8rem;
  font-weight: 800;
}

.site-nav {
  display: flex;
  gap: 28px;
  font-size: 0.92rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--text-soft);
}

.lang-switch {
  position: relative;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
}

.lang-toggle:hover {
  border-color: var(--purple);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 6px;
  list-style: none;
  width: 200px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(37, 38, 47, 0.18);
}

.lang-menu[hidden] {
  display: none;
}

.lang-menu li {
  margin: 0;
}

.lang-menu a,
.lang-menu span {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-soft);
}

.lang-menu a:hover {
  background: var(--bg-alt);
}

.lang-menu span {
  color: var(--purple);
  font-weight: 700;
  background: var(--bg-alt);
}

/* Hero */

.hero {
  padding: 72px 0 56px;
  text-align: center;
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.08), transparent 45%),
    radial-gradient(circle at 88% 10%, rgba(245, 5, 79, 0.08), transparent 45%);
}

.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  margin: 0 0 18px;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  color: var(--muted);
  max-width: 580px;
  margin: 0 auto 36px;
  font-size: 1.08rem;
}

.download-box {
  max-width: 820px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  text-align: left;
  box-shadow: 0 24px 60px rgba(37, 38, 47, 0.1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button {
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  opacity: 0.94;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-icon {
  font-size: 1.1rem;
}

/* URL input row */

.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 20px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--bg-alt);
  transition: border-color 0.15s ease;
}

.input-row:focus-within {
  border-color: var(--purple);
  background: var(--card);
}

.input-ig-icon {
  width: 26px;
  height: 26px;
  flex: none;
}

.url-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
  padding: 16px 0;
  font-family: inherit;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.btn-paste,
.btn-clear,
.btn-fetch-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 20px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

.btn-paste,
.btn-clear {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-clear {
  padding: 13px;
}

.btn-paste[hidden],
.btn-clear[hidden],
.btn-fetch-inline[hidden] {
  display: none;
}

.btn-paste:hover:not(:disabled),
.btn-clear:hover:not(:disabled) {
  color: var(--text-soft);
  border-color: var(--purple);
}

.btn-fetch-inline {
  background: var(--gradient);
  color: white;
  box-shadow: 0 8px 18px rgba(139, 47, 255, 0.28);
  letter-spacing: 0.02em;
}

.btn-fetch-inline .btn-icon {
  width: 15px;
  height: 15px;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

.fair-use-notice {
  display: block;
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

.fair-use-link {
  color: var(--purple);
  text-decoration: underline;
}

.status {
  margin-top: 14px;
  min-height: 1.2em;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

/* Result box */

.result-box {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.result-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #16a34a;
  color: white;
  font-size: 0.7rem;
}

.result-thumb-wrap {
  position: relative;
  margin: 0 0 16px;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

.result-thumb {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #000;
}

.result-thumb[hidden] {
  display: none;
}

.thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.thumb-play[hidden] {
  display: none;
}

.thumb-play svg {
  width: 22px;
  height: 22px;
  color: white;
  margin-left: 3px;
}

.thumb-play::before {
  content: '';
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-dl-main,
.btn-dl-audio {
  flex: 1;
  min-width: 180px;
  padding: 16px 20px;
  border-radius: 60px;
  color: white;
  font-size: 0.98rem;
}

.btn-dl-main {
  background: var(--gradient);
  box-shadow: 0 12px 28px rgba(139, 47, 255, 0.28);
}

.btn-dl-audio {
  background: var(--text-soft);
}

/* Per-download progress list */

.downloads-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.download-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.download-item-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.95rem;
  background: var(--gradient);
}

.download-item-body {
  flex: 1;
  min-width: 0;
}

.download-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.download-item-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.download-item-status {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-item-bar {
  margin-top: 6px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.download-item-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient);
  transition: width 0.2s ease;
}

.download-item.is-error .download-item-icon {
  background: #f5054f;
}

.download-item.is-error .download-item-bar-fill {
  background: #f5054f;
}

.download-item.is-done .download-item-bar-fill {
  background: #16a34a;
}

.download-item-close {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0;
}

.download-item-close:hover {
  background: var(--border);
  color: var(--text-soft);
}

/* Error box */

.error-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(245, 5, 79, 0.08);
  border: 1px solid rgba(245, 5, 79, 0.25);
  color: #b91c4a;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

/* Una clase que fija "display" (flex/grid) le gana en especificidad al
   comportamiento nativo de [hidden] (misma especificidad, pero la nuestra
   viene después en la cascada) — sin esto, el recuadro nunca se ocultaba de
   verdad, solo se veía vacío mientras no tuviera texto. */
.error-box[hidden] {
  display: none;
}

.error-box svg {
  flex: none;
}

/* Generic section layout */

.section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.section h2 {
  text-align: center;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  margin: 0 0 44px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* Steps */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 24px 28px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(37, 38, 47, 0.05);
}

.step-illus {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  margin-bottom: 18px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  font-weight: 800;
  margin: 0 auto 16px;
}

.step h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.step p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

/* Features */

.features-section {
  background: var(--bg-alt);
}

.features-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.feature-card {
  flex: 0 1 calc(25% - 15px);
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(37, 38, 47, 0.05);
}

.feature-icon {
  font-size: 1.7rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.feature-card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

/* About */

.about-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.about-section h2 {
  text-align: left;
  font-size: 1.3rem;
  margin: 0 0 14px;
}

.about-section p {
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0 0 14px;
}

@media (max-width: 720px) {
  .about-wrap {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* FAQ */

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 20px;
}

.faq-item summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 700;
  font-size: 0.98rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-soft);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--purple);
  margin-left: 12px;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Responsive */

@media (max-width: 720px) {
  .steps {
    grid-template-columns: 1fr;
  }

  .feature-card {
    flex: 0 1 calc(50% - 10px);
  }

  .site-nav {
    display: none;
  }
}

@media (max-width: 480px) {
  .feature-card {
    flex: 0 1 100%;
  }

  .result-actions {
    flex-direction: column;
  }

  .btn-paste span {
    display: none;
  }

  .download-box {
    padding: 20px;
  }
}
