:root {
  --bg: #0f1115;
  --panel: #181b22;
  --text: #e8eaee;
  --muted: #9aa3b2;
  --accent: #1d9bf0;
  --accent-dark: #1a8cd8;
  --error: #f4212e;
  --success: #00ba7c;
  --radius: 12px;
}

* { box-sizing: border-box; }

/* Form controls ship with UA default fonts (serif-ish in WebKit); make them
   use the page stack. */
button, input, select, textarea { font: inherit; }

/* The `hidden` attribute loses to author display rules (e.g. label), so
   re-assert it globally or UI state set via el.hidden lies to the user. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

header { text-align: center; margin-bottom: 1.5rem; }

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }

.tagline { color: var(--muted); margin: 0; font-size: 0.95rem; }

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.row input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 44px;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid #2a2f3a;
  border-radius: var(--radius);
}

.row input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  min-height: 44px;
  padding: 0.7rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

/* Narrow screens: the paste box and Download button stack, full width. */
@media (max-width: 480px) {
  .row input,
  .row button {
    flex: 1 1 100%;
    width: 100%;
  }
}

button:hover:not(:disabled) { background: var(--accent-dark); }

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
}

.status {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid #2a2f3a;
}

.status[data-kind="error"] {
  border-color: var(--error);
  color: #ffb3b8;
}

.status[data-kind="success"] {
  border-color: var(--success);
  color: #7de8c3;
}

.status[data-kind="loading"] {
  color: var(--muted);
}

.result { margin-top: 1.25rem; }

.back-link { color: var(--accent); }

.thumb {
  width: 100%;
  border-radius: var(--radius);
  background: var(--panel);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.75rem 0 0;
  overflow-wrap: anywhere;
}

.pick {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.9rem 0 0.4rem;
}

.quality-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

/* Multi-video posts render one .video-group per video; a single-video post
   puts its .quality-list straight into #quality-list with no heading. */
.quality-groups { display: grid; gap: 1rem; }

.video-group-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.quality-btn {
  width: 100%;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid #2a2f3a;
  padding: 0.8rem 1rem;
}

.quality-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: #1d212b;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  margin: 0.9rem 0 0.3rem;
}

progress {
  width: 100%;
  height: 0.6rem;
  accent-color: var(--accent);
}

footer {
  margin-top: 2.5rem;
  text-align: center;
}

footer p {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.6rem;
}

/* 44px minimum tap targets; the inline-flex + padding keeps the small
   0.8rem label visually centred without stretching the link row at 360px. */
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-links a:hover { color: var(--text); }

/* Prose on the About / Privacy / Terms pages. */
.prose h2 {
  font-size: 1.05rem;
  margin: 1.4rem 0 0.35rem;
}

.prose p,
.prose li {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0.4rem 0;
}

.prose ul {
  padding-left: 1.25rem;
  margin: 0.4rem 0;
}

.prose li { margin: 0.3rem 0; }

.prose strong { color: var(--text); }

@media (min-width: 600px) {
  h1 { font-size: 1.9rem; }
  .row input { font-size: 1.05rem; }
}
