:root {
  --bg: #14181c;
  --panel: #1c2228;
  --panel-2: #242c34;
  --line: #2f3943;
  --text: #e4e9ee;
  --muted: #94a2b0;
  --accent: #40bcf4;
  --good: #00c030;
  --warn: #ff8000;
  --radius: 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7; --panel: #fff; --panel-2: #eef1f4; --line: #d8dee4;
    --text: #1b2228; --muted: #5d6b78; --accent: #0f7fb8; --good: #0a8a2a;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.tag { color: var(--muted); font-size: 13px; }
.top nav { margin-left: auto; display: flex; gap: 8px; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.narrow { max-width: 620px; margin: 40px auto; }
h1 { font-size: 26px; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.lede { color: var(--muted); margin: 0 0 18px; }
.steps { padding-left: 20px; margin: 0 0 20px; }
.steps li { margin: 4px 0; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; margin-top: 18px; }
.error { color: #ff6b6b; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 36px 16px; border: 2px dashed var(--line); border-radius: var(--radius);
  cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--panel-2); }
.drop-main { font-weight: 600; }
.drop-sub { color: var(--muted); font-size: 13px; }

button {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 7px 14px; cursor: pointer; font-weight: 600;
}
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.ghost:hover { border-color: var(--muted); }
button.link { background: none; color: var(--muted); padding: 2px 4px; font-weight: 400; text-decoration: underline; }

.bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin: 16px 0 10px; }
#barFill { height: 100%; width: 0; background: var(--accent); transition: width .5s; }

.stats { margin: 0 0 14px; }
.filters {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px;
}
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.field.grow { flex: 1; min-width: 180px; }
.field select, .field input {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; font-size: 14px; color: var(--text); min-width: 110px;
}
.label { font-size: 12px; color: var(--muted); min-width: 90px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13px;
  user-select: none; background: var(--panel-2);
}
.chip input { margin: 0; accent-color: var(--accent); }
.chip:has(input:checked) { border-color: var(--accent); }
.chip img { width: 20px; height: 20px; border-radius: 4px; }
.chip .n { color: var(--muted); font-size: 11px; }
.services .chip { padding-left: 4px; }
.toggle { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 14px; }
.card {
  display: grid; grid-template-columns: 110px 1fr; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; min-width: 0;
}
.poster img {
  width: 110px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px;
  background: var(--panel-2); display: block;
}
.body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.head h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.head h3 a { color: var(--text); }
.match {
  flex: none; font-size: 12px; font-weight: 700; color: var(--good);
  border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.meta { margin: 0; color: var(--muted); font-size: 13px; }
.scores { display: flex; flex-wrap: wrap; gap: 6px; }
.score {
  font-size: 12px; background: var(--panel-2); border-radius: 5px; padding: 2px 7px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.score b { font-weight: 700; }
.score.sorted { outline: 1px solid var(--accent); }
.wl { font-size: 11px; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; }
.because { margin: 0; font-size: 13px; color: var(--muted); }
.because b { color: var(--text); font-weight: 500; }
.overview {
  margin: 0; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; cursor: pointer;
}
.overview.open { -webkit-line-clamp: unset; }
.where { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 4px; }
.where a { display: inline-flex; }
.where img { width: 28px; height: 28px; border-radius: 6px; }
.where .kind { font-size: 11px; color: var(--muted); margin-right: 2px; }
.where .none { font-size: 12px; color: var(--muted); }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 30px 24px 40px; }

@media (max-width: 560px) {
  main { padding: 14px; }
  .card { grid-template-columns: 80px 1fr; }
  .poster img { width: 80px; }
  .field select { min-width: 0; }
}

.userfield { margin-bottom: 14px; font-size: 13px; }
.userfield input { font-size: 15px; padding: 8px 10px; }
.userfield .opt { color: var(--muted); font-weight: 400; }
.or { color: var(--muted); font-size: 13px; margin: 14px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#sync { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#sync input { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; width: 160px; }
#sync button { padding: 4px 10px; }
