:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --ok: #16a34a;
  --error: #dc2626;
  --note-bg: #fffbeb;
  --note-text: #92400e;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2 { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.error { color: var(--error); }

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--error); }
.btn.danger:hover { border-color: var(--error); }
.btn.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }

input[type="password"], input[type="search"], input.link {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  padding: 20px;
}

/* вхід */
.login-page { display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 12px; text-align: center; }
.login-card input { text-align: center; font-size: 20px; letter-spacing: 4px; padding: 12px; }
.login-card .btn { padding: 12px; font-size: 16px; }
.login-card p { margin: 0; }

/* основна сторінка */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; }
.page { max-width: 920px; margin: 24px auto; padding: 0 16px; display: grid; gap: 20px; }

.drop {
  display: grid; gap: 6px; place-items: center; text-align: center;
  border: 2px dashed #cbd5e1; border-radius: var(--radius);
  padding: 36px 16px; cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.drop-title { font-weight: 600; font-size: 16px; }
.drop-hint { color: var(--muted); font-size: 14px; }

.rules { margin: 14px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.section-head input { width: 260px; }

.list { display: grid; }
.item { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
#queue .item:first-child { margin-top: 14px; }
.item-body { flex: 1; min-width: 0; display: grid; gap: 6px; align-content: start; }
.item-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.item-status { font-size: 13px; }

.thumb {
  width: 64px; height: 64px; flex: none; border-radius: 10px; object-fit: cover;
  background: #f1f5f9; border: 1px solid var(--line);
}
.video-thumb, .placeholder { display: grid; place-items: center; color: var(--muted); font-size: 20px; }

.link-row { display: flex; gap: 8px; }
.link-row .link { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.bar { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.bar.busy .bar-fill { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.note {
  font-size: 13px; background: var(--note-bg); color: var(--note-text);
  border-radius: 8px; padding: 6px 10px;
}
.item.failed .thumb { border-color: #fecaca; }

.actions { margin-top: 12px; display: flex; justify-content: flex-end; }

@media (max-width: 600px) {
  .link-row { flex-wrap: wrap; }
  .link-row .link { flex-basis: 100%; }
  .section-head { flex-direction: column; align-items: stretch; }
  .section-head input { width: 100%; }
}
