:root {
  --bg: #0f0f14;
  --surface: #17171f;
  --surface-2: #1e1e28;
  --border: #2a2a36;
  --text: #f2f2f5;
  --text-dim: #9a9aa8;
  --accent-1: #7c3aed;
  --accent-2: #ec4899;
  --accent-grad: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  padding: 48px 0 28px;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.25), transparent 60%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 30px;
}

.tagline {
  margin: 10px 0 0;
  color: var(--text-dim);
  font-size: 15px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.input-row {
  display: flex;
  gap: 10px;
}

#url-input {
  flex: 1;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
}

#url-input:focus {
  outline: 2px solid var(--accent-1);
  outline-offset: 1px;
}

button {
  cursor: pointer;
  border: none;
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
}

#fetch-btn {
  padding: 14px 22px;
  background: var(--accent-grad);
  color: white;
  white-space: nowrap;
}

#fetch-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.secondary {
  padding: 12px 18px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

details#advanced {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 14px;
}

details#advanced summary {
  cursor: pointer;
  color: var(--text);
}

.advanced-body {
  margin-top: 10px;
}

.advanced-body textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  resize: vertical;
}

.advanced-body .hint {
  font-size: 12.5px;
  margin: 8px 0 0;
}

.advanced-body code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

.status {
  margin: 16px 0 0;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 10px;
}

.status.error {
  background: rgba(236, 72, 153, 0.12);
  color: #ff9fc8;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.status.loading {
  background: rgba(124, 58, 237, 0.12);
  color: #c4a6ff;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.result-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.result-header img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-2);
}

.author {
  font-weight: 700;
}

.caption {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

/* Toggled by script.js when the (possibly truncated) caption is clicked, so
   long captions aren't permanently cut off with no way to read the rest. */
.caption.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.item img, .item video {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #000;
  display: block;
}

.item a.dl-btn {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: white;
  background: var(--accent-grad);
  text-decoration: none;
}

#download-all {
  margin-top: 18px;
  width: 100%;
}

.about h2 {
  font-size: 16px;
  margin: 0 0 10px;
}

.about p {
  color: var(--text-dim);
  font-size: 14px;
}

.disclaimer {
  font-size: 12.5px !important;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px !important;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 10px 0 40px;
}

@media (max-width: 480px) {
  .input-row { flex-direction: column; }
  #fetch-btn { width: 100%; }
}
