:root { color-scheme: dark; }
[data-theme="dark"] {
  --bg: #101113; --panel: #18191c; --card: #202125; --border: #303136;
  --text: #f2f2f3; --text2: #92949b;
  --success: #65c995; --warn: #e0b26a; --error: #e47c7c;
  --mark: #3a3320;
}
[data-theme="light"] {
  --bg: #ffffff; --panel: #f4f4f5; --card: #ffffff; --border: #e4e4e7;
  --text: #27272a; --text2: #71717a;
  --success: #15803d; --warn: #b45309; --error: #b91c1c;
  --mark: #fef08a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg); color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip;
}
button { font-family: inherit; }
.mono { font-family: ui-monospace, "IBM Plex Mono", Menlo, Consolas, monospace; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.tiny { font-size: 12px; color: var(--text2); }
.tiny.err { color: var(--error); margin-top: 8px; min-height: 18px; }

/* шапка — как в оригинале */
header.top { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: var(--bg); }
.bar { height: 56px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-right: auto; font-size: 14px; }
.logo-mark { width: 28px; height: 28px; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text2); }
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; font-size: 12px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--card); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.btn.primary:hover { opacity: .9; }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; }
.btn.big { min-height: 44px; padding: 0 28px; font-size: 14px; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; justify-content: center; min-height: 44px; font-size: 14px; }
.runrow { display: flex; justify-content: center; margin: 20px 0 8px; }
.runrow[hidden] { display: none; }

/* hero */
main { flex: 1; }
.hero { text-align: center; padding: 40px 0 24px; }
.hero h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; }

/* секции загрузки */
.sec { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-top: 12px; }
.sec-t { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; }
.sec-hint { margin-left: auto; text-transform: none; letter-spacing: 0; }
.drop { width: 100%; border: 1px dashed var(--border); background: var(--panel); color: var(--text2); border-radius: 10px; padding: 22px 16px; font-size: 13px; cursor: pointer; text-align: center; }
.drop:hover { border-color: var(--text2); color: var(--text); }
.drop-orig { border-style: solid; padding: 18px 16px; }
.drop-plus { display: block; text-align: center; font-size: 28px; font-weight: 400; line-height: 1; color: var(--text2); }
.drop-orig:hover .drop-plus, .drop-more:hover .drop-plus { color: var(--text); }
.drop-more { margin-top: 8px; padding: 10px 16px; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.entry { border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.entry .row { display: flex; gap: 10px; align-items: flex-start; }
.entry .fn { font-size: 13px; font-weight: 600; word-break: break-all; }
.entry .meta { font-size: 11px; color: var(--text2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.entry .ok { color: var(--success); }
.entry .bad { color: var(--error); }
.entry [data-edit-author] { cursor: pointer; border-bottom: 1px dashed var(--text2); }
.entry [data-edit-author]:hover { color: var(--text); border-bottom-color: var(--text); }
.entry.foreign { border-color: var(--error); background: color-mix(in srgb, var(--error) 9%, transparent); }
.entry .author-miss { color: var(--warn); border-bottom-color: var(--warn); }
.icobtn { border: 1px solid var(--border); background: var(--card); color: var(--text2); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-size: 12px; line-height: 1; flex-shrink: 0; }
.icobtn:hover { color: var(--text); }

/* переключатель языка RU | EN */
.langseg { display: inline-flex; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.langseg button { border: 0; background: transparent; color: var(--text2); font-size: 12px; min-height: 32px; padding: 6px 10px; cursor: pointer; }
.langseg button + button { border-left: 1px solid var(--border); }
.langseg button.on { background: var(--text); color: var(--bg); font-weight: 700; }
.langseg button:not(.on):hover { color: var(--text); }

/* статья-отчёт */
.article { padding: 28px 0; margin-top: 20px; }
.article .kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text2); }
.article h2 { font-size: 26px; line-height: 1.25; margin: 8px 0 4px; letter-spacing: -.01em; }
.article h3 { font-size: 17px; margin: 44px 0 8px; scroll-margin-top: 70px; }
.article a { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
#report { padding-bottom: 48px; }
.article p, .article li { font-size: 14px; }
.article p { margin: 8px 0; color: var(--text); }
.article .lede { font-size: 16px; color: var(--text2); }
.article ul, .article ol { margin: 8px 0 8px 20px; }
.article ul.inter { list-style: none; margin-left: 0; padding-left: 0; }
.article ul.inter li { position: relative; padding-left: 22px; }
.article ul.inter li::before { content: "\00B7"; position: absolute; left: 6px; top: 0; color: var(--text2); font-weight: 700; }
.article li { margin: 4px 0; }
.winner { border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 14px 16px; margin: 14px 0; }
.winner-top { display: flex; align-items: center; gap: 10px; }
.winner-top b { font-size: 22px; line-height: 1.25; letter-spacing: -.01em; }
.winner-top .score { font-size: 18px; margin-right: 0; }
.winner-meta { display: block; margin-top: 8px; }
.score { display: inline-block; min-width: 52px; text-align: center; font-weight: 700; border: 1px solid var(--border); border-radius: 8px; padding: 2px 10px; margin-right: 8px; background: var(--card); }
.score.good { background: linear-gradient(135deg, #1e7a4c 0%, #4ed68a 100%); border-color: #65c995; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.score.warn { background: linear-gradient(135deg, #96701c 0%, #eec06a 100%); border-color: #e0b26a; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.score.bad { background: linear-gradient(135deg, #963232 0%, #ef8f8f 100%); border-color: #e47c7c; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.scrollx { overflow-x: auto; margin: 12px 0; border: 1px solid var(--border); border-radius: 10px; }
table.rep { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; background: var(--panel); table-layout: fixed; }
table.rep th, table.rep td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; }
table.rep th.c-idx, table.rep td.c-idx { width: 44px; }
table.rep th.c-file, table.rep td.c-file { width: 34%; }
table.rep th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); font-weight: 600; }
table.rep tr:last-child td { border-bottom: 0; }
table.rep tr.win td { background: rgba(101, 201, 149, .08); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; font-size: 11px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; color: var(--text2); }
.pill.good { color: var(--success); border-color: var(--success); }
.pill.bad { color: var(--error); border-color: var(--error); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
/* таймлайн (раздел 5): одна сплошная полоса на весь фильм, строки без отступов */
.tl-bandwrap { width: 100vw; margin: 8px 0 4px calc(50% - 50vw); padding: 0 5vw; box-sizing: border-box; }
/* пункт 5 целиком закрепляется под шапкой: заголовок, полоса и панель сравнения стоят вместе, высота естественная.
   Важно: sticky перестаёт держаться, если он выше вьюпорта — поэтому ограничиваем
   общую высоту и даём панели внутренний скролл, иначе длинные отрезки выталкивают блок. */
.tl-sticky { position: sticky; top: 56px; z-index: 30; background: var(--bg); padding: 8px 0; max-height: calc(100vh - 56px); display: flex; flex-direction: column; }
.tl-sticky h3, .tl-sticky > p { flex-shrink: 0; }
.tl-sticky .tl-bandwrap { flex-shrink: 0; }
/* высота панели фиксирована — короткие и длинные отрезки не меняют размер блока,
   длинные скроллятся внутри панели и не растягивают sticky за пределы экрана */
.tl-sticky #tl-detail { height: 45vh; min-height: 45vh; max-height: 45vh; overflow-y: auto; }
/* пустое место под пунктом — длинный скролл с закреплённым пунктом 5 */
.tl-pad { height: 120vh; }
.tl-band { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); overflow: hidden; }
.tl-ruler { position: relative; height: 20px; border-bottom: 1px solid var(--border); }
.tl-rows { position: relative; touch-action: pan-y; cursor: crosshair; }
.tl-rows:focus-visible { outline: 1px solid var(--text); outline-offset: -1px; }
.tl-row { position: relative; height: 46px; border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: 0; }
.tl-rowtag { position: absolute; left: 6px; top: 5px; z-index: 2; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--text2); pointer-events: none; text-shadow: 0 1px 3px var(--panel), 0 0 4px var(--panel); }
.tl-rowtag.win { color: var(--success); }
/* полоса рисуется на одном canvas — зелёным только строка победителя */
.tl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.tl-sel { position: absolute; top: 0; bottom: 0; border: 1px solid var(--text); border-radius: 2px; background: color-mix(in srgb, var(--text) 8%, transparent); z-index: 3; pointer-events: none; }
.tl-sel[hidden] { display: none; }
.tl-sel.pinned { border-width: 2px; background: color-mix(in srgb, var(--text) 12%, transparent); }
.tl-pin { color: var(--text2); font-size: 11px; white-space: nowrap; }
.tl-legend-dec { color: var(--success); font-weight: 700; }
.tl-edge { position: absolute; top: 2px; font-size: 10px; color: var(--text2); }
.tl-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text); opacity: .8; z-index: 4; pointer-events: none; }
.tl-cross[hidden] { display: none; }
/* сравнение момента под полосой */
#tl-detail { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: 12px 14px; margin-top: 10px; font-size: 13px; }
.tl-seghead { font-size: 12px; color: var(--text2); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-segrow { margin-top: 10px; }
/* реплика в панели: текст слева, № и время справа в одну строку как в Subtitle Edit;
   на узком экране мета переносится под текст */
.tl-cue { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; margin-top: 6px; flex-wrap: wrap; }
.tl-cue-text { flex: 1 1 220px; min-width: 0; }
.tl-cue-meta { flex: 0 1 auto; white-space: nowrap; margin-left: auto; }
.tl-segorig { margin-top: 2px; }
.tl-detail-hint { padding: 12px 14px; font-size: 13px; color: var(--text2); }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.verdict { border-left: 3px solid var(--success); padding: 4px 0 4px 14px; margin: 12px 0; font-size: 14px; }

/* качество по 6 критериям */
/* качество по 6 критериям: карточки с общими строками (как таблица) —
   subgrid выравнивает каждую строку по самой высокой карточке ряда */
.qgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 12px 0; }
.qcard { border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 12px 14px; font-size: 13px; display: flex; flex-direction: column; }
@supports (grid-template-rows: subgrid) {
  .qcard { display: grid; grid-template-rows: subgrid; grid-row: span 10; }
}
.qcard.win { border-color: var(--success); }
.qcard-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; min-width: 0; }
.qcard-top h4 { font-size: 13px; margin: 0; flex: 1; min-width: 0; overflow-wrap: break-word; }
.qcard-top .score { font-size: 13px; flex-shrink: 0; min-width: 0; padding: 1px 8px; }
.qcard.win .qcard-top h4 { color: var(--success); }
.qcard .qscore { font-size: 13px; margin-bottom: 2px; }
.qcard .qrow { font-size: 12px; color: var(--text); border-top: 1px dashed var(--border); padding-top: 6px; margin-top: 6px; overflow-wrap: break-word; }
.qcard .qrow b { color: var(--text2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
/* подписи-заметки в отчёте — обычным шрифтом, без италика */
.article p.tiny { font-style: normal; }

/* попап «Инфо» */
#info-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
#info-modal[hidden] { display: none; }
.info-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.info-box { position: relative; width: min(640px, 100%); max-height: calc(100vh - 60px); overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.info-head { display: flex; align-items: center; gap: 10px; }
.info-kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text2); }
.info-x { margin-left: auto; }
.info-box h2 { font-size: 22px; margin: 6px 0 4px; letter-spacing: -.01em; }
.info-lede { font-size: 14px; color: var(--text); margin: 8px 0; }
.info-formula { display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 10px 16px; margin: 8px auto 10px; width: fit-content; max-width: 100%; font-size: 15px; text-align: center; }
.info-formula .f-label { white-space: nowrap; }
.info-formula .f-frac { display: inline-flex; flex-direction: column; align-items: stretch; text-align: center; min-width: 170px; }
.info-formula .f-num { padding: 0 14px 5px; border-bottom: 2px solid var(--text); line-height: 1.4; white-space: nowrap; }
.info-formula .f-den { padding-top: 5px; line-height: 1.2; }
.info-box h3 { font-size: 15px; margin: 18px 0 6px; }
.info-box ul.inter { list-style: none; margin: 6px 0; padding-left: 0; }
.info-box ul.inter li { position: relative; padding-left: 22px; font-size: 13.5px; margin: 8px 0; }
.info-box ul.inter li::before { content: "·"; position: absolute; left: 6px; top: 0; color: var(--text2); font-weight: 700; }
.info-box li b { font-weight: 700; }
.info-ex { display: block; margin-top: 4px; color: var(--text2); }
.info-foot { margin-top: 16px; justify-content: flex-end; }

/* оверлей перетаскивания — пунктир на весь экран, фон просто затемнён */
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 100; display: flex; padding: 16px; }
#overlay[hidden] { display: none; }
#overlay .box { flex: 1; width: 100%; min-height: calc(100vh - 32px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed var(--text2); border-radius: 16px; padding: 24px; text-align: center; background: transparent; color: var(--text); }
#overlay .box-t { font-weight: 700; margin-top: 12px; }

@media (max-width: 640px) {
  .hero h1 { white-space: normal; }
  .article { padding: 12px 0; }
}
