:root {
  --bg: #121417; --card: #1c2027; --fg: #e8eaed; --muted: #9aa3ad;
  --accent: #4f9cf9; --danger: #f06a6a; --ok: #5ec27f; --line: #2a2f38;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--fg); font-size: 18px; }
.top nav { display: flex; gap: 16px; align-items: center; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.foot { padding: 16px; color: var(--muted); text-align: center; font-size: 13px; }
h1 { font-size: 24px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 20px 0 8px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); }
.flash { padding: 10px 14px; border-radius: 8px; background: #2a2f38; }
.flash.error { background: #4a2626; }
.flash.ok { background: #244a31; }
.card { background: var(--card); border-radius: 12px; padding: 20px; }
.card.narrow { max-width: 480px; margin: 24px auto; }
label { display: block; margin: 12px 0; color: var(--muted); }
input[type=text], input[type=email], textarea, .share, input.title {
  width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #0f1114; color: var(--fg); font: inherit; }
input.code { font-size: 26px; letter-spacing: 6px; text-transform: uppercase; text-align: center; }
input[type=file] { margin-top: 6px; color: var(--muted); }
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; border: 0;
  background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.small { padding: 6px 12px; font-size: 14px; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
button.link.danger { color: var(--danger); }
.inline { display: inline; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* загрузки */
.trow { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tmain { flex: 1; min-width: 0; }
.tname { color: var(--fg); font-weight: 600; word-break: break-word; }
.tstate { color: var(--muted); font-size: 14px; margin-top: 2px; }
.bar { height: 6px; background: #0f1114; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .5s; }

/* плитки */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }
.tile { background: var(--card); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.poster { display: block; position: relative; aspect-ratio: 16/9; background: #0f1114; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noposter { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 40px; }
.badge { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 6px;
  background: rgba(0,0,0,.7); font-size: 12px; color: #fff; }
.badge.err { background: var(--danger); }
.tinfo { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
input.title { padding: 6px 8px; font-weight: 600; background: transparent; border-color: transparent; }
input.title:focus { background: #0f1114; border-color: var(--line); }
.meta { font-size: 13px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share { flex: 1; min-width: 120px; padding: 6px 8px; font-size: 12px; color: var(--muted); margin: 0; }
.files { list-style: none; padding: 0; margin: 8px 0 16px; }
.files li { padding: 6px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.files label { margin: 0; color: var(--fg); display: flex; gap: 8px; align-items: baseline; }
.files .fname { flex: 1; }
.files li.picked { color: var(--fg); }

/* плеер */
body.watch .wrap { max-width: 1280px; }
.wtitle { font-size: 20px; }
.player video { width: 100%; max-height: 80vh; background: #000; border-radius: 8px; display: block; }
.controls { display: flex; gap: 16px; align-items: center; margin-top: 8px; min-height: 28px; flex-wrap: wrap; }
.controls label { margin: 0; display: inline-flex; gap: 8px; align-items: center; }
.controls select { padding: 4px 8px; border-radius: 6px; background: #0f1114; color: var(--fg); border: 1px solid var(--line); font: inherit; }
.resume { background: var(--ok); color: #000; padding: 4px 10px; border-radius: 6px; font-size: 14px; }
.waiting { text-align: center; padding: 24px; background: var(--card); border-radius: 12px; }
.waiting img { max-width: 480px; width: 100%; border-radius: 8px; }

@media (max-width: 600px) {
  .wrap { padding: 10px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .top nav { gap: 10px; font-size: 14px; }
}
