.hero {
  width: 100%;
  padding: 64px 16px 96px;
  padding-top: calc(64px + var(--safe-top));
  background: linear-gradient(135deg, #2a251d 0%, #342d23 50%, #1e1a15 100%);
  text-align: center;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 40px 40px;
}

.hero__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.hero__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.hero__wordmark {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.hero__title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.hero__subtitle {
  font-size: 1rem;
  color: var(--text-muted);
}

.search-form {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.search-form__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-form__input {
  flex: 1 1 200px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  /* 16px prevents iOS Safari from auto-zooming on focus. */
  font-size: 16px;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-form__input::placeholder {
  color: var(--text-muted);
}

.search-form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 179, 46, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, transform 0.05s, border-color 0.15s, box-shadow 0.15s;
}

.btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: #1e1a15;
  box-shadow: 0 4px 14px rgba(242, 179, 46, 0.25);
}

.btn--primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(242, 179, 46, 0.35);
}

.btn--outline {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn--outline:hover {
  background: var(--primary-soft);
}

.form-error {
  margin-top: 12px;
  color: var(--danger);
  font-size: 0.9rem;
}

.loading {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error {
  margin-top: 24px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.error__message {
  color: var(--danger);
  font-size: 0.95rem;
}

.result {
  margin-top: 24px;
}

.result__card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  color: var(--text);
}

.result__video {
  width: 100%;
  max-height: 420px;
  background: #000;
  display: block;
  aspect-ratio: 9 / 16;
  object-fit: contain;
}

.result__body {
  padding: 16px;
}

.result__title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.result__author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.result__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

.result__username {
  font-weight: 600;
  color: var(--text);
}

.result__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.stat {
  background: var(--primary-soft);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.result__buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.download-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

.download-btn:active {
  transform: scale(0.99);
}

.download-btn:hover {
  border-color: var(--accent);
  background: var(--primary-soft);
}

.download-btn__label {
  flex: 1;
}

.download-btn__size {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.download-btn__state {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
}

.download-btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.download-btn.is-done {
  border-color: var(--success);
  background: var(--success-soft);
}

.download-btn.is-done .download-btn__state {
  color: var(--success);
}

.download-btn.is-error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.download-btn.is-error .download-btn__state {
  color: var(--danger);
}

/* Mini inline spinner used inside a busy download button. */
.spinner-sm {
  border-radius: 50%;
  border: 2px solid var(--surface-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.result__actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.result-status {
  margin-top: 12px;
  font-size: 0.9rem;
  min-height: 1.3em;
  color: var(--text-muted);
}

.result-status[data-kind="busy"] {
  color: var(--accent);
}

.result-status[data-kind="done"] {
  color: var(--success);
}

.result-status[data-kind="error"] {
  color: var(--danger);
}

/* ══════════ Content sections (SEO) ══════════ */

.search-form__tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.tab {
  flex: 1;
  min-height: 40px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.search-form__textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* prevent iOS zoom */
  color: var(--text);
  background: var(--surface-2);
  font-family: var(--font);
  line-height: 1.5;
  resize: vertical;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-form__textarea::placeholder {
  color: var(--text-muted);
}

.search-form__textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 179, 46, 0.2);
}

.batch__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.batch__count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.batch-queue {
  margin-top: 24px;
}

.batch-queue__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.batch-queue__progress {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.batch-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.batch-item__thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.batch-item__info {
  flex: 1;
  min-width: 0;
}

.batch-item__title {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-item__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.batch-item__state {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.batch-item[data-state="queued"] .batch-item__state { color: var(--text-muted); }
.batch-item[data-state="resolving"] .batch-item__state { color: var(--accent); }
.batch-item[data-state="downloading"] .batch-item__state { color: var(--accent); }
.batch-item[data-state="done"] .batch-item__state { color: var(--success); }
.batch-item[data-state="error"] .batch-item__state { color: var(--danger); }

.batch-item .spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  color: var(--text);
}

.features,
.how,
.faq {
  margin-top: 40px;
}

.features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s, transform 0.08s;
}

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

.feature__icon {
  display: inline-block;
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.feature__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature__text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.how__steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.how__step {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 0.95rem;
}

.how__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #1e1a15;
  font-weight: 700;
  font-size: 1rem;
}

.faq__item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq__item summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.faq__item summary::after {
  content: "+";
  font-size: 1.4rem;
  color: var(--accent);
  margin-left: 12px;
  transition: transform 0.15s;
}

.faq__item[open] summary::after {
  transform: rotate(45deg);
}

.faq__item p {
  padding: 0 18px 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer__brand {
  color: var(--text);
}

.footer__note {
  max-width: 520px;
  margin: 0 auto;
}

.footer__legal {
  color: var(--text-muted);
}

@media (max-width: 520px) {
  .hero {
    padding: 48px 16px 80px;
    padding-top: calc(48px + var(--safe-top));
  }

  .hero__title {
    font-size: 1.5rem;
  }

  .search-form__row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .result__video {
    max-height: none;
  }
}
