:root { color-scheme: dark; }
* { box-sizing: border-box; margin: 0; }
body {
  background: #101214; color: #dfe5ea;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
  padding: 20px; padding-bottom: 60px;
  max-width: 1200px; margin: 0 auto;
}
a { color: inherit; text-decoration: none; }
.muted { color: #93a0ab; font-size: 14px; }

/* ---- шапка / панель ---- */
.topbar { margin-bottom: 18px; }
.topbar h1 { font-size: 21px; font-weight: 600; }
.topbar a { color: #93a0ab; }
.topbar a:active, .topbar a:hover { color: #dfe5ea; }
.bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

.btn {
  display: inline-block; background: #232a30; color: #dfe5ea; border: 0;
  padding: 9px 15px; border-radius: 9px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: #2f3841; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-accent { background: #2f5a75; }
.btn-accent:hover { background: #38698a; }

.badge-live { font-size: 13px; color: #e8c268 !important; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.flash {
  background: #1b2a1e; border: 1px solid #2e4a33; border-radius: 10px;
  padding: 11px 14px; margin-bottom: 16px; font-size: 14px;
}
.flash a { text-decoration: underline; }
.flash-warn { background: #2f2416; border-color: #5a4423; }

/* ---- сетка библиотеки ---- */
.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.card {
  position: relative; border-radius: 12px; overflow: hidden; background: #191d21;
}
.card img, .card-noimg {
  width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block;
}
.card-noimg { display: flex; align-items: center; justify-content: center; font-size: 46px; }
.card .meta { padding: 10px 12px; font-size: 13px; color: #93a0ab; }
.card .meta b { display: block; color: #dfe5ea; font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta .desc { display: block; color: #b9c2ca; margin: 2px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  position: absolute; top: 10px; left: 10px; font-size: 12px;
  padding: 3px 9px; border-radius: 7px; background: rgba(0,0,0,.65);
}

/* вердикты */
.verdict-ai      { color: #9fd08c; }
.verdict-filmed  { color: #8cb8d0; }
.verdict-hybrid  { color: #d0c08c; }
.verdict-unclear { color: #a8a8a8; }
.verdict-bg-ai      { background: #1d2a1a; }
.verdict-bg-filmed  { background: #1a232a; }
.verdict-bg-hybrid  { background: #2a251a; }
.verdict-bg-unclear { background: #202020; }
.badge-inline { font-size: 13px; padding: 2px 9px; border-radius: 7px; background: #232a30; }

/* ---- поиск и фильтры ---- */
.search {
  margin-left: auto; background: #191d21; border: 1px solid #2f3841;
  border-radius: 9px; color: #dfe5ea; padding: 9px 12px; font-size: 14px;
  width: min(320px, 100%);
}
.search:focus { outline: none; border-color: #2f5a75; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  background: #191d21; border: 1px solid #2f3841; color: #93a0ab;
  border-radius: 20px; padding: 6px 13px; font-size: 13px; cursor: pointer;
}
.chip:hover { color: #dfe5ea; }
.chip.on { background: #2f5a75; border-color: #2f5a75; color: #dfe5ea; }

/* ---- страница карточки ---- */
.card-page { max-width: 760px; }
.card-head { display: flex; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.card-head h1 { font-size: 22px; margin-bottom: 12px; }
.card-cover { width: 220px; border-radius: 12px; object-fit: cover; align-self: flex-start; }
.card-head > div { flex: 1; min-width: 260px; }
.passport-table { border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
.passport-table td { padding: 3px 0; }
.passport-table td:first-child { color: #93a0ab; padding-right: 18px; white-space: nowrap; }
.passport-table a { text-decoration: underline; text-underline-offset: 3px; }

.md-body { font-size: 15px; line-height: 1.65; }
.md-body h2 {
  font-size: 17px; margin: 26px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid #232a30;
}
.md-body p, .md-body ul, .md-body ol { margin-bottom: 12px; }
.md-body ul, .md-body ol { padding-left: 22px; }
.md-body pre {
  position: relative; background: #191d21; border: 1px solid #232a30;
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
  white-space: pre-wrap; word-break: break-word;
  font: 13.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: #c4cdd5;
}
.md-body code { font: 13.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.md-body p code { background: #191d21; padding: 1px 6px; border-radius: 5px; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; border: 0; border-radius: 7px;
  background: #232a30; color: #93a0ab; font-size: 12px; padding: 4px 10px;
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.md-body pre:hover .copy-btn { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }
.copy-btn:hover { color: #dfe5ea; background: #2f3841; }

/* ---- форма нового разбора ---- */
.new-form { max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.new-form .field { display: flex; flex-direction: column; gap: 6px; }
.new-form label { font-size: 14px; color: #93a0ab; }
.new-form input[type=url] {
  background: #191d21; border: 1px solid #2f3841; border-radius: 9px;
  color: #dfe5ea; padding: 11px 13px; font-size: 15px;
}
.new-form input[type=url]:focus { outline: none; border-color: #2f5a75; }

/* ---- страница прогресса ---- */
.run-box { max-width: 560px; background: #191d21; border-radius: 14px; padding: 22px 24px; }
.run-line { font-size: 15px; margin-bottom: 16px; }
.stages { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.stages li { color: #93a0ab; font-size: 15px; }
.stages .st-ico { display: inline-block; width: 22px; }
.stages .st-done { color: #9fd08c; }
.stages .st-run { color: #dfe5ea; }
.stages .st-run .st-ico { animation: spin 1.2s linear infinite; display: inline-block; }
.stages .st-err { color: #d98383; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- вход ---- */
.login-wrap { min-height: 82vh; display: flex; align-items: center; justify-content: center; }
.login-box {
  background: #191d21; padding: 34px 30px; border-radius: 14px;
  display: flex; flex-direction: column; gap: 14px; width: min(92vw, 330px);
}
.login-box h1 { font-size: 20px; text-align: center; }
.login-box input {
  background: #101214; border: 1px solid #2f3841; border-radius: 9px;
  color: #dfe5ea; padding: 11px 13px; font-size: 16px;
}
.login-box input:focus { outline: none; border-color: #2f5a75; }
.login-error { color: #d98383; font-size: 14px; text-align: center; }

/* ---- телефон ---- */
@media (max-width: 600px) {
  body { padding: 12px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .topbar h1 { font-size: 18px; }
  .card-cover { width: 100%; }
}
