:root {
  --bg: #0e0f11;
  --panel: #16181c;
  --line: #252830;
  --text: #e8e9ec;
  --dim: #8b909c;
  --accent: #7aa2ff;
  --ok: #5fd3a0;
  --bad: #ff7a7a;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f7f8; --panel: #fff; --line: #e1e3e8; --text: #16181c; --dim: #666b78;
    --accent: #2f5bd8; --ok: #1a8f5f; --bad: #c33;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }

h1 { font-size: 20px; margin: 0; font-weight: 600; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.msg { min-height: 20px; margin: 6px 0 0; font-size: 13px; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }

input, button {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
}
input { min-width: 0; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; }
button:hover { border-color: var(--dim); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }

.addbar { margin: 16px 0 4px; }
.addbar input { flex: 1; min-width: 220px; }

.controls { margin: 16px 0; }
.controls input[type=search] { width: 220px; }
.chip {
  padding: 4px 10px; border-radius: 999px; font-size: 13px; background: transparent;
  color: var(--dim);
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { cursor: pointer; border-radius: 10px; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.thumb { position: relative; aspect-ratio: 16/9; background: var(--panel); border-radius: 10px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.watched img { opacity: .45; }
.dur {
  position: absolute; right: 6px; bottom: 8px; background: rgba(0,0,0,.8); color: #fff;
  font-size: 12px; padding: 1px 6px; border-radius: 4px;
}
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.2); }
.bar i { display: block; height: 100%; background: var(--accent); }
.badge {
  position: absolute; left: 6px; top: 6px; background: var(--ok); color: #04130c;
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
}
.card h3 {
  font-size: 14px; font-weight: 600; margin: 8px 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 12px; color: var(--accent); }
.empty { text-align: center; padding: 70px 10px; color: var(--dim); }

/* watch view */
.back { margin-bottom: 12px; }
.playerwrap { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; }
.playerwrap iframe, .playerwrap #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.overlay {
  position: absolute; inset: 0; z-index: 2; background: rgba(10,11,13,.96); color: #e8e9ec;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 20px;
}
.overlay h2 { margin: 0; font-size: 18px; }
.overlay p { margin: 0; color: #9aa0ad; max-width: 480px; }
.watchmeta { margin-top: 14px; }
.watchmeta h2 { margin: 0 0 4px; font-size: 18px; }
.actions { margin-top: 12px; }

/* login */
.login { max-width: 360px; margin: 18vh auto 0; }
.login input { width: 100%; margin: 12px 0; }
