:root {
  --bg: #0b0c0e;
  --panel: #15171b;
  --line: #262a31;
  --text: #e6e8ec;
  --dim: #8b929e;
  --accent: #6ea8fe;
  --good: #4ade80;
  --ok: #fbbf24;
  --bad: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

/* ── Верхня панель ───────────────────────────────────────────────────────── */

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { font-weight: 600; letter-spacing: .02em; }
.who { color: var(--dim); }
.who b { color: var(--text); font-weight: 500; }
.spacer { flex: 1; }

.stats {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.stats dt {
  color: var(--dim);
  font-size: 12px;
  text-transform: lowercase;
}
.stats dd {
  margin: 0 0 0 4px;
  font-weight: 500;
}
.stats dt + dd { margin-left: -8px; }

.good { color: var(--good); }
.ok   { color: var(--ok); }
.bad  { color: var(--bad); }

.note {
  margin: 0;
  padding: 8px 16px;
  background: #1d2330;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
}

/* ── Сцена ───────────────────────────────────────────────────────────────── */

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  display: flex;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ── Керування ───────────────────────────────────────────────────────────── */

.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  opacity: 0;
  transition: opacity .2s;
}
.stage:hover .controls,
.stage:focus-within .controls { opacity: 1; }

.btn {
  flex: none;
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  background: rgba(255, 255, 255, .1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, .18); }

.time {
  flex: none;
  min-width: 54px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Смуга позиції: під повзунком видно, скільки вже завантажено наперед. */
.track {
  position: relative;
  flex: 1;
  height: 34px;
  display: flex;
  align-items: center;
}
.loaded {
  position: absolute;
  left: 0;
  height: 4px;
  width: 0;
  background: rgba(110, 168, 254, .35);
  border-radius: 2px;
  pointer-events: none;
}
.track input[type=range] { position: relative; width: 100%; }

input[type=range] {
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, .18);
  border-radius: 2px;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: 13px; height: 13px;
  background: var(--accent);
  border-radius: 50%;
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px;
  background: var(--accent);
  border: 0;
  border-radius: 50%;
}
.vol { flex: none; width: 90px; }

/* ── Модалки ─────────────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .75);
  z-index: 10;
}
.modal[hidden] { display: none; }

.modal-box {
  width: min(680px, 100%);
  max-height: 80vh;
  overflow: auto;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.modal-box h2 { margin: 0 0 4px; font-size: 18px; }
.hint { margin: 0 0 16px; color: var(--dim); }

.items { display: flex; flex-direction: column; gap: 6px; }

.item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 11px 14px;
  background: #1b1e24;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.item:hover { background: #222732; border-color: var(--accent); }
.item-title { font-weight: 500; }
.item-meta { color: var(--dim); font-size: 12px; }

@media (max-width: 640px) {
  .stats dt { display: none; }
  .vol { display: none; }
  .controls { opacity: 1; }
}
