:root {
  --bg: #f5f6f8; --card: #ffffff; --text: #15171c; --muted: #6b7280; --line: #e4e6eb;
  --accent: #e5a00d; --accent-text: #111; --chip: #eef0f3;
  --ok: #16a34a; --low: #d97706; --dead: #dc2626; --bad: #9ca3af;
  --warn-bg: #fff7e6; --warn-text: #8a5a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b21; --text: #e8eaee; --muted: #9aa1ad; --line: #272b33;
    --chip: #22262e; --warn-bg: #2a2214; --warn-text: #f0c36a;
    --ok: #22c55e; --low: #f59e0b; --dead: #ef4444; --bad: #6b7280;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }

/* вход */
#login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.logo { width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 16px; background: var(--accent);
  color: var(--accent-text); display: grid; place-items: center; font-size: 28px; }
h1 { font-size: 22px; margin: 0 0 8px; }
input[type=password], .search input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); outline: none; font-size: 16px; }
input:focus { border-color: var(--accent); }
.btn { padding: 12px 16px; border-radius: 12px; border: 0; background: var(--chip); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .5; cursor: default; }
.error { color: var(--dead); margin: 0; font-size: 14px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.search { flex: 1; min-width: 0; }
.search input { padding: 10px 14px; }
.icon-btn { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--chip);
  font-size: 22px; line-height: 1; cursor: pointer; }
#view { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }

/* общие блоки */
.hint { color: var(--muted); font-size: 14px; margin: 8px 4px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 4px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; background: var(--chip); border: 0; cursor: pointer; font-size: 15px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.film { display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: left;
  width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.film .count { flex: none; color: var(--muted); font-size: 14px; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 16px; text-align: center; color: var(--muted); white-space: pre-line; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: 100%; max-width: 260px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }

/* результаты */
.film-head h2 { font-size: 19px; margin: 4px 4px 2px; }
.film-head p { margin: 0 4px 12px; color: var(--muted); font-size: 14px; }
.rel { border-radius: 14px; border: 1px solid var(--line); background: var(--card); overflow: hidden; }
.rel.bad, .rel.dead { opacity: .72; }
.rel-main { display: grid; grid-template-columns: 28px 1fr; gap: 10px; width: 100%; padding: 12px 14px;
  border: 0; background: none; text-align: left; cursor: pointer; }
.num { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  color: #fff; background: var(--bad); }
.ok .num { background: var(--ok); } .low .num { background: var(--low); } .dead .num { background: var(--dead); }
.q { font-weight: 700; }
.meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.voices { font-size: 14px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--chip); color: var(--muted); }
.warn { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; }
.details { padding: 0 14px 14px 52px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.details .full { color: var(--muted); word-break: break-word; }
.details code { font-size: 12px; word-break: break-all; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions a.btn { text-decoration: none; display: inline-block; }
.legend { color: var(--muted); font-size: 13px; margin: 16px 4px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
