:root {
  --bg: #0f1115; --card: #171b22; --line: #262c36;
  --txt: #e8ecf1; --mut: #9aa4b2; --acc: #4da3ff; --acc-d: #2b7fd4;
  --ok: #3ecf8e; --err: #ff5d5d;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 0 16px 60px;
}
header { max-width: 900px; margin: 28px auto 16px; }
header h1 { margin: 0 0 6px; font-size: 26px; }
header p { margin: 0; color: var(--mut); font-size: 14px; }
main { max-width: 900px; margin: 0 auto; display: grid; gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px;
}
.hidden { display: none !important; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 14px; }
input[type=text] {
  flex: 1; min-width: 220px; background: #0d0f13; color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; font-size: 14px;
}
select {
  background: #0d0f13; color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 10px; font-size: 14px;
}
button, .btn-link {
  border: 0; border-radius: 8px; padding: 11px 18px; font-size: 14px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary, .btn-link.primary { background: var(--acc); color: #06121f; font-weight: 700; }
button.primary:hover, .btn-link.primary:hover { background: var(--acc-d); }
button.primary:disabled { opacity: .45; cursor: default; }
button.big, .btn-link.big { padding: 13px 26px; font-size: 15px; }
button.ghost { background: transparent; color: var(--mut); border: 1px solid var(--line); padding: 8px 12px; }
button.ghost:hover { color: var(--txt); border-color: var(--acc); }
.msg { margin-top: 10px; font-size: 13px; color: var(--mut); min-height: 18px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

.video-head { display: flex; gap: 14px; margin-bottom: 14px; }
.video-head img { width: 168px; height: 94px; object-fit: cover; border-radius: 8px; background: #000; }
.vtitle { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.vmeta { color: var(--mut); font-size: 13px; }

.heat-wrap { margin: 6px 0 14px; }
.heat-label { font-size: 12px; color: var(--mut); margin-bottom: 6px; }
.heat {
  display: flex; align-items: flex-end; gap: 1px; height: 56px;
  background: #0d0f13; border: 1px solid var(--line); border-radius: 8px; padding: 6px;
}
.heat i { flex: 1; background: #2b6cb0; border-radius: 1px; min-height: 2px; opacity: .75; }
.heat i.pk { background: var(--acc); opacity: 1; }

.cand-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cands { display: grid; gap: 8px; }
.cand {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: #0d0f13; border: 1px solid var(--line); border-radius: 10px;
}
.cand.sel { border-color: var(--acc); }
.cand input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--acc); }
.cand .rank {
  width: 30px; height: 30px; border-radius: 50%; background: #222a35;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.cand .ts { font-family: monospace; font-size: 15px; font-weight: 700; min-width: 64px; }
.cand .score { flex: 1; min-width: 80px; }
.cand .score .bar { height: 6px; background: #222a35; border-radius: 3px; overflow: hidden; }
.cand .score .bar i { display: block; height: 100%; background: var(--acc); }
.cand .score small { color: var(--mut); font-size: 11px; }
.cand .acts { display: flex; gap: 6px; }
.cand .acts button { padding: 7px 10px; font-size: 12px; }

.prog-bar { height: 10px; background: #0d0f13; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.prog-bar div { height: 100%; width: 0; background: var(--acc); transition: width .3s; }
#prog-text { margin-top: 8px; }

.results { display: grid; gap: 12px; margin-top: 14px; }
.res {
  display: flex; gap: 14px; padding: 12px; background: #0d0f13;
  border: 1px solid var(--line); border-radius: 10px; align-items: center; flex-wrap: wrap;
}
.res video { width: 220px; max-width: 100%; border-radius: 8px; background: #000; }
.res .info { flex: 1; min-width: 160px; }
.res .info .t { font-family: monospace; font-weight: 700; }
.res .info .s { color: var(--mut); font-size: 12px; margin-top: 4px; }
.res a.dl {
  background: var(--ok); color: #04120a; font-weight: 700; border-radius: 8px;
  padding: 10px 16px; text-decoration: none; font-size: 13px;
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; width: 720px; max-width: 100%; padding: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }
.modal-video { position: relative; padding-top: 56.25%; background: #000; border-radius: 8px; overflow: hidden; }
.modal-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#modal-note { margin-top: 10px; }
