:root {
  --bg: #0f1115;
  --panel: #181b22;
  --text: #e8eaee;
  --muted: #9aa3b2;
  --accent: #1d9bf0;
  --accent-dark: #1a8cd8;
  --error: #f4212e;
  --success: #00ba7c;
  --radius: 12px;
}

* { box-sizing: border-box; }

/* 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, 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;
  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 {
  padding: 0.7rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

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; }

.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;
}

.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;
}

@media (min-width: 600px) {
  h1 { font-size: 1.9rem; }
  .row input { font-size: 1.05rem; }
}
