:root {
  --bg: #0f1115;
  --panel: #161a22;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --accent: #1db5cb;
  --error: #ff6b6b;
  --ok: #4ade80;
  --warn: #fbbf24;
}
@media (prefers-color-scheme: light) {
  :root { --bg:#f7f8fa; --panel:#fff; --text:#15171c; --muted:#5a6172; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body.centered { display: grid; place-items: center; min-height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }
.error { color: var(--error); }
.banner { background: rgba(251,191,36,0.15); border-left: 3px solid var(--warn); padding: .75em 1em; margin: 1em 0; border-radius: 4px; }

header { display: flex; align-items: center; justify-content: space-between; padding: 1em 1.25em; background: var(--panel); border-bottom: 1px solid rgba(255,255,255,0.05); position: sticky; top: 0; z-index: 10; }
header .brand { font-weight: 700; font-size: 1.1em; }
header nav { display: flex; gap: 1.25em; align-items: center; }
header nav a, header nav .link { color: var(--text); font-size: 0.95em; }
.inline { display: inline; }
button.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
button.link:hover { text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 1em 1.25em 4em; }

.search-form { display: flex; gap: .5em; margin: 1em 0 1.5em; }
.search-form input[type=search] { flex: 1; padding: .75em 1em; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); background: var(--panel); color: var(--text); font-size: 1em; }
.search-form button, button[type=submit] { padding: .75em 1.25em; border-radius: 6px; border: none; background: var(--accent); color: white; font-weight: 600; cursor: pointer; }
.search-form button:hover, button[type=submit]:hover { filter: brightness(1.1); }

section { margin: 1.5em 0; }
section h2 { font-size: 1.1em; color: var(--muted); margin: 0 0 .75em; text-transform: uppercase; letter-spacing: 0.05em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1em; }
.card { background: var(--panel); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: rgba(255,255,255,0.05); }
.card .meta { padding: .65em .75em .25em; flex: 1; }
.card .title { font-weight: 600; font-size: .95em; line-height: 1.3; }
.card .sub { color: var(--muted); font-size: .8em; margin-top: .25em; }
.card form { padding: .5em .75em .75em; }
.card button { width: 100%; padding: .55em; font-size: .85em; }

.login { background: var(--panel); padding: 2em; border-radius: 10px; display: grid; gap: .85em; min-width: 280px; }
.login h1 { margin: 0 0 .5em; font-size: 1.25em; text-align: center; }
.login input { padding: .75em 1em; border-radius: 6px; border: 1px solid rgba(255,255,255,0.15); background: var(--bg); color: var(--text); font-size: 1em; }

table.queue { width: 100%; border-collapse: collapse; }
table.queue th, table.queue td { text-align: left; padding: .65em .5em; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; }
table.queue th { color: var(--muted); font-size: .8em; text-transform: uppercase; letter-spacing: 0.05em; }
table.queue .thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
table.queue .title { font-weight: 600; font-size: .95em; }
table.queue .sub { color: var(--muted); font-size: .82em; }
.status { display: inline-block; padding: .2em .6em; border-radius: 99px; font-size: .8em; font-weight: 600; }
.status-queued      { background: rgba(255,255,255,0.08); color: var(--muted); }
.status-downloading { background: rgba(29,181,203,0.18); color: var(--accent); }
.status-done        { background: rgba(74,222,128,0.15); color: var(--ok); }
.status-error       { background: rgba(255,107,107,0.18); color: var(--error); }

@media (max-width: 600px) {
  header { padding: .85em 1em; }
  header nav { gap: .9em; }
  main { padding: .85em 1em 4em; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75em; }
  table.queue thead { display: none; }
  table.queue tr { display: grid; grid-template-columns: 60px 1fr auto; gap: .25em .65em; padding: .65em 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
  table.queue td { border: none; padding: 0; }
  table.queue td:nth-child(1) { grid-row: span 3; }
  table.queue td:nth-child(3) { display: none; }
}
