:root {
	--bg: #f5f4f1;
	--panel: #ffffff;
	--ink: #1d1c1a;
	--muted: #6b6862;
	--line: #e3e0da;
	--accent: #2f5bd3;
	--accent-ink: #ffffff;
	--accent-soft: #e8eefc;
	--ok: #1f7a4d;
	--warn: #a15c07;
	--err: #b42318;
	--err-soft: #fdecea;
	--radius: 14px;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #141413;
		--panel: #1e1e1c;
		--ink: #ecebe8;
		--muted: #9c9992;
		--line: #33322f;
		--accent: #7d9cf0;
		--accent-ink: #10131c;
		--accent-soft: #232b40;
		--ok: #5cc28f;
		--warn: #e0a250;
		--err: #f2867a;
		--err-soft: #3a201d;
		color-scheme: dark;
	}
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 64px; }
header {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 18px 0 22px;
}
header a.brand { color: var(--ink); text-decoration: none; font-weight: 650; font-size: 18px; letter-spacing: -0.01em; }
header nav { display: flex; gap: 6px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -0.015em; }
h2 { font-size: 18px; margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack > * + * { margin-top: 16px; }

button, .btn {
	font: inherit; font-weight: 550; cursor: pointer;
	border: 1px solid var(--line); background: var(--panel); color: var(--ink);
	padding: 10px 16px; border-radius: 10px; text-decoration: none;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
}
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.07); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); }
button.danger { color: var(--err); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, .btn:focus-visible, .drop:focus-visible, .slot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.drop {
	display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
	gap: 8px; min-height: 260px; padding: 28px;
	border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel); cursor: pointer;
	transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 44px; height: 44px; color: var(--accent); }
.drop strong { font-size: 18px; }

.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s; }
.bar.indet > i { width: 35%; animation: slide 1.3s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.progress-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); margin-top: 8px; }

.faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.face {
	background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
	display: flex; flex-direction: column; gap: 12px;
}
.face.set { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pair { display: grid; grid-template-columns: 1fr 24px 1fr; align-items: center; gap: 6px; }
.pair svg { width: 22px; height: 22px; color: var(--muted); }
.thumb, .slot { aspect-ratio: 4 / 5; width: 100%; border-radius: 10px; overflow: hidden; background: var(--bg); }
.thumb img, .slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot {
	border: 2px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 4px; color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; padding: 6px; position: relative;
}
.slot:hover { border-color: var(--accent); color: var(--accent); }
.slot.filled { border-style: solid; border-color: var(--accent); padding: 0; }
.slot svg { width: 26px; height: 26px; }
.slot .x {
	position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; min-height: 0; padding: 0;
	border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; border: 0; font-size: 18px; line-height: 1;
}
.slot.busy::after { content: ""; position: absolute; inset: 0; background: rgba(127,127,127,.35); }
.face-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.face-meta b { font-size: 15px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }

.minor-toggle { margin-top: 14px; }
.options { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .grow { flex: 1 1 200px; }

.msg { padding: 12px 14px; border-radius: 10px; font-size: 15px; }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.info { background: var(--accent-soft); color: var(--ink); }

video { width: 100%; border-radius: var(--radius); background: #000; display: block; max-height: 70vh; }

.jobs { list-style: none; margin: 0; padding: 0; }
.jobs li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.jobs li:first-child { border-top: 0; }
.jobs a { color: var(--ink); font-weight: 550; text-decoration: none; word-break: break-word; }
.jobs a:hover { color: var(--accent); }
.status { font-size: 13px; white-space: nowrap; }
.status.done { color: var(--ok); }
.status.error { color: var(--err); }
.status.run { color: var(--warn); }

.login { max-width: 360px; margin: 14vh auto 0; }
.login input {
	width: 100%; font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
	background: var(--bg); color: var(--ink); min-height: 48px;
}
.login input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.hidden { display: none !important; }

@media (max-width: 560px) {
	h1 { font-size: 21px; }
	.panel { padding: 16px; }
	.faces { grid-template-columns: 1fr; }
	.actions button { flex: 1 1 100%; }
}
