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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --border: #242424;
  --border-hover: #383838;
  --text: #ededed;
  --muted: #5a5a5a;
  --muted-light: #888;
  --error: #e05c5c;
}

html {
  font-size: 16px;
}

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

/* ── Nav ─────────────────────────────────── */

nav {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-logo img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  color: var(--muted-light);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

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

/* ── Main ────────────────────────────────── */

main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* ── Hero ────────────────────────────────── */

.hero {
  text-align: center;
  padding: 5rem 0 3.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.75px;
  line-height: 1.2;
}

.hero-sub {
  color: var(--muted-light);
  margin-top: 1rem;
  font-size: 1rem;
  line-height: 1.6;
}

/* ── Search ──────────────────────────────── */

.search-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 2.25rem;
}

input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

input:focus {
  border-color: var(--border-hover);
}

input::placeholder {
  color: var(--muted);
}

#fetch-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

#fetch-btn:hover {
  opacity: 0.85;
}

#fetch-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Status ──────────────────────────────── */

.status {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-light);
}

.status.error {
  color: var(--error);
}

.status.loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--muted);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* ── Result card ─────────────────────────── */

.result {
  margin-top: 1.25rem;
  text-align: left;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  gap: 1rem;
  padding: 1rem;
}

#thumbnail {
  width: 100px;
  height: 134px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--border);
}

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

.video-author {
  font-size: 0.8rem;
  color: var(--muted-light);
  font-weight: 500;
}

.video-title {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.download-buttons {
  margin-top: auto;
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.btn-dl {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
  width: 100%;
}

.btn-dl:hover {
  background: var(--border);
  border-color: var(--border-hover);
  opacity: 1;
}

.btn-dl:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-label {
  font-weight: 500;
}

.btn-sub {
  color: var(--muted-light);
  font-size: 0.75rem;
}

.btn-audio .btn-label {
  color: var(--muted-light);
}

/* ── Features ────────────────────────────── */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 5rem;
}

.feature {
  background: var(--surface);
  padding: 1.75rem;
}

.feature h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature p {
  font-size: 0.875rem;
  color: var(--muted-light);
  line-height: 1.6;
}

/* ── How it works ────────────────────────── */

.how {
  margin-top: 5rem;
  max-width: 520px;
}

.how h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

.how-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.how-steps li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted-light);
  flex-shrink: 0;
  margin-top: 1px;
}

.how-steps strong {
  font-size: 0.9rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.2rem;
}

.how-steps p {
  font-size: 0.875rem;
  color: var(--muted-light);
  line-height: 1.5;
}

/* ── SEO blurb ───────────────────────────── */

.seo-blurb {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
}

.seo-blurb-inner {
  max-width: 900px;
  margin: 0 auto;
}

.seo-blurb p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Footer ──────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--muted-light);
}

/* ── Inner pages ─────────────────────────── */

.page {
  max-width: 600px;
  padding: 4rem 0 5rem;
}

.page h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 2.5rem;
}

.page-date {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -1.75rem;
  margin-bottom: 2rem;
}

.page-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.page-body h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

.page-body p {
  font-size: 0.9rem;
  color: var(--muted-light);
  line-height: 1.7;
}

.page-body a {
  color: var(--text);
  text-underline-offset: 3px;
}

.page-body a:hover {
  opacity: 0.75;
}

/* FAQ */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

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

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.faq-item p {
  margin: 0;
}

/* Contact */

.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
}

.contact-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 40px;
}

.contact-card a {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Blog index ──────────────────────────── */

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.blog-card {
  background: var(--surface);
  padding: 1.5rem;
  text-decoration: none;
  display: block;
  transition: background 0.12s;
}

.blog-card:hover {
  background: #1a1a1a;
}

.blog-date {
  font-size: 0.775rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.4rem;
}

.blog-card h2 {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.blog-card p {
  font-size: 0.85rem;
  color: var(--muted-light);
  line-height: 1.5;
}

/* ── Article ─────────────────────────────── */

.article {
  max-width: 640px;
  padding: 3.5rem 0 5rem;
}

.article-header {
  margin-bottom: 2.5rem;
}

.article-back {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 1.25rem;
  transition: color 0.15s;
}

.article-back::before {
  content: '← ';
}

.article-back:hover {
  color: var(--muted-light);
}

.article-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.article-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.article-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.article-body p {
  font-size: 0.9rem;
  color: var(--muted-light);
  line-height: 1.75;
}

.article-body h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1rem;
}

.article-body h3 {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.article-body li {
  font-size: 0.9rem;
  color: var(--muted-light);
  line-height: 1.6;
}

.article-body a {
  color: var(--text);
  text-underline-offset: 3px;
}

.article-body a:hover {
  opacity: 0.75;
}

.article-body strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Utility ─────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Mobile ──────────────────────────────── */

@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.75rem;
  }

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

  .video-card {
    flex-direction: column;
  }

  #thumbnail {
    width: 100%;
    height: 200px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
