:root {
  --bg: #0e1014; --card: #171a21; --line: #262b36; --text: #e7e9ee; --muted: #8b93a7;
  --accent: #4f8cff; --red: #ff4d5e; --green: #2ecc71;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, Segoe UI, sans-serif; }
button, select, input { font: inherit; color: inherit; }
h2 { margin: 0; font-size: 16px; }

.top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { color: var(--red); font-weight: 700; text-decoration: none; font-size: 16px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

.grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; padding: 16px 20px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; padding: 16px; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.video-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; }
.video-wrap video, .player video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.placeholder[hidden] { display: none; }
.badge { position: absolute; top: 10px; left: 10px; background: var(--red); color: #fff; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.badge[hidden] { display: none; }

.sources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 520px) { .sources { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.space { justify-content: space-between; }
.row label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; flex: 1; min-width: 160px; }
.row label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.top label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
select, input.title { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; }
.top select { width: auto; }

button { background: #222735; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:hover:not(:disabled) { border-color: #3a4152; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.src.active { border-color: var(--accent); background: #1a2846; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; padding: 10px 22px; }
button.danger { background: #3a1a20; border-color: #5a2630; }
button.ghost { background: transparent; }
button[hidden] { display: none; }
.actions { gap: 8px; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }

.pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.pill.on { color: var(--green); border-color: #1f5a3a; background: #0f2a1d; }
.pill.off { color: var(--muted); }

.links { display: flex; flex-direction: column; gap: 6px; }
.link { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.link .lbl { color: var(--muted); font-size: 12px; }
.link code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.link .copy { padding: 4px 10px; font-size: 12px; }
.link .note { grid-column: 2 / -1; color: var(--muted); font-size: 11px; }
@media (max-width: 520px) { .link { grid-template-columns: minmax(0, 1fr) auto; } .link .lbl { grid-column: 1 / -1; } .link .note { grid-column: 1 / -1; } }
details summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
details .links { margin-top: 8px; }

body.watch { display: flex; flex-direction: column; height: 100vh; }
.player { position: relative; flex: 1; min-height: 0; background: #000; }
