:root {
  --bg-gradient: radial-gradient(circle at top, #fff1f2 0%, #f8fafc 55%, #eef2f6 100%);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-muted: #f1f5f9;
  --surface-hover: #e2e8f0;
  --border: rgba(15, 23, 42, 0.1);
  --shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --accent: #e11d48;
  --accent-bright: #ff0000;
  --accent-soft: rgba(255, 0, 0, 0.1);
  --accent-border: rgba(255, 0, 0, 0.28);
  --ok: #059669;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --ok-border: rgba(16, 185, 129, 0.32);
  --warn: #b45309;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --warn-border: rgba(245, 158, 11, 0.35);
  --footer-bg: rgba(255, 255, 255, 0.72);
}

html.dark {
  --bg-gradient: radial-gradient(circle at top, #1a1d2a 0%, #0d1119 72%);
  --surface: rgba(24, 27, 38, 0.86);
  --surface-muted: rgba(15, 23, 42, 0.85);
  --surface-hover: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.55);
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
  --accent: #ff4d4d;
  --accent-soft: rgba(255, 77, 77, 0.14);
  --accent-border: rgba(255, 77, 77, 0.32);
  --ok: #34d399;
  --warn: #fcd34d;
  --footer-bg: rgba(0, 0, 0, 0.42);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-gradient);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, input, summary { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.container {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

.container-narrow {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
}

.glass {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-radius: 0;
  border-inline: 0;
  border-top: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, #ff0000, #ff4d4d);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 20px -4px rgba(255, 0, 0, 0.35);
}

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

.nav-links {
  display: none;
  align-items: center;
  gap: 1.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-links a {
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--accent); }

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.78rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-pill:hover { background: var(--surface-hover); }

.owner-badge {
  background: var(--ok-soft);
  border-color: var(--ok-border);
  color: var(--ok);
}

/* Main */
.site-main {
  flex: 1 0 auto;
  padding-top: 2.25rem;
  padding-bottom: 4.5rem;
}

.hero {
  text-align: center;
  max-width: 48rem;
  margin-inline: auto;
  margin-bottom: 1.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-bright);
}

.hero h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.hero-gradient {
  background: linear-gradient(90deg, #ff0000, #ff6b6b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 0 auto 1.4rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 42rem;
}

/* Hub Tool Tabs */
.tool-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tool-tab {
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tool-tab:hover,
.tool-tab[aria-current="page"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Stats Strip */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  text-align: left;
  margin-bottom: 1.75rem;
}

@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stat-card {
  padding: 0.85rem;
  border-radius: 0.85rem;
}

.stat-label { font-size: 0.72rem; color: var(--text-subtle); }
.stat-value { font-size: 0.88rem; font-weight: 700; margin-top: 0.15rem; }

/* Downloader Card */
.tool-card {
  max-width: 50rem;
  margin: 0 auto 2rem;
  padding: 1.25rem;
}

@media (min-width: 640px) {
  .tool-card { padding: 1.5rem; }
}

.fetch-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .fetch-form { flex-direction: row; }
}

.input-wrap {
  position: relative;
  flex: 1 1 auto;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
}

.url-input {
  width: 100%;
  padding: 0.95rem 5.4rem 0.95rem 2.75rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s ease;
}

.url-input:focus { border-color: var(--accent); outline: none; }

.paste-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.4rem 0.7rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.paste-btn:hover { background: var(--surface-hover); color: var(--text); }

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 1.65rem;
  border: 0;
  border-radius: 0.85rem;
  background: linear-gradient(90deg, #ff0000, #ff4d4d);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px -6px rgba(255, 0, 0, 0.35);
  flex-shrink: 0;
}

.submit-btn:hover { filter: brightness(0.95); }
.submit-btn:disabled { opacity: 0.65; cursor: wait; }

.helper-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.helper-row code {
  background: var(--surface-muted);
  padding: 0.12rem 0.38rem;
  border-radius: 0.35rem;
  font-size: 0.74rem;
}

.error-box {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.8rem;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.retry-btn {
  padding: 0.4rem 0.75rem;
  border-radius: 0.55rem;
  border: 1px solid var(--warn-border);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.loading-box {
  margin-top: 1.5rem;
  padding-block: 1.75rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.spinner {
  width: 2.2rem;
  height: 2.2rem;
  border: 3px solid var(--accent-border);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  animation: spin 0.75s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

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

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .result-layout { grid-template-columns: 2fr 3fr; }
}

.thumb-wrap {
  position: relative;
  border-radius: 0.85rem;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.duration-badge {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.video-title {
  margin: 0.75rem 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.video-channel {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-subtle);
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}

.formats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

@media (min-width: 640px) {
  .formats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.format-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.72rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

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

.format-left { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; }

.badge-quality {
  padding: 0.15rem 0.42rem;
  border-radius: 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.format-size { font-size: 0.75rem; color: var(--text-subtle); }

.audio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

@media (min-width: 640px) {
  .audio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.audio-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.78rem 0.9rem;
  border-radius: 0.78rem;
  border: 1px solid var(--ok-border);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.audio-btn:hover { filter: brightness(0.95); }

.audio-pill {
  font-size: 0.7rem;
  padding: 0.15rem 0.42rem;
  border-radius: 0.35rem;
  background: rgba(16, 185, 129, 0.16);
}

/* Clearly separated, zero-CLS ad container */
.ad-slot {
  max-width: 50rem;
  margin: 0 auto 2.5rem;
  min-height: 108px;
  padding: 0.75rem;
  border-radius: 0.9rem;
  border: 1px dashed var(--border);
  background: var(--surface);
  text-align: center;
}

.ad-slot-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 0.4rem;
}

/* Content Sections */
.section-block { margin-bottom: 3rem; }

.section-heading {
  text-align: center;
  margin-bottom: 1.75rem;
}

.section-heading h2 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 800;
}

.section-heading p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-subtle);
}

.grid-4 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.info-card { padding: 1.25rem; }
.info-card h3 { margin: 0 0 0.4rem; font-size: 1rem; font-weight: 700; }
.info-card p, .info-card li { margin: 0; font-size: 0.84rem; color: var(--text-muted); }
.info-card ul { margin: 0; padding-left: 1.15rem; display: grid; gap: 0.45rem; }

.step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.7rem;
}

/* FAQ Accordion */
.faq-list {
  max-width: 48rem;
  margin-inline: auto;
  display: grid;
  gap: 0.75rem;
}

.faq-item { padding: 1rem 1.15rem; }

.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-chevron { transition: transform 0.15s ease; color: var(--text-subtle); flex-shrink: 0; }

.faq-item p {
  margin: 0.75rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* Legal Pages */
.prose-legal {
  max-width: 48rem;
  margin-inline: auto;
  padding: 1.75rem;
}

.prose-legal h1 { margin: 0 0 0.5rem; font-size: 1.85rem; }
.prose-legal h2 { margin: 1.6rem 0 0.5rem; font-size: 1.15rem; }
.prose-legal p, .prose-legal li { font-size: 0.92rem; color: var(--text-muted); }
.prose-legal table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.84rem;
}
.prose-legal th, .prose-legal td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  padding-block: 1.75rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .footer-inner { flex-direction: row; align-items: center; }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.footer-links a,
.footer-links button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

.footer-links a:hover,
.footer-links button:hover { color: var(--accent); }

/* Cookie Consent Banner (Equal-weight buttons) */
.cookie-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  padding: 1.05rem 1.15rem;
  max-width: 28rem;
  margin-left: auto;
}

.cookie-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.btn-consent {
  padding: 0.55rem 0.85rem;
  border-radius: 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  text-align: center;
}

.btn-consent-accept {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: #fff;
}

.btn-consent-essential {
  background: var(--surface-muted);
  color: var(--text);
}
