:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #5b6370;
  --line: #d8dce3;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --ok: #15803d;
  --bad: #b91c1c;
  --bar: #e5e9f0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --card: #181c22;
    --text: #e7eaf0;
    --muted: #9aa3b2;
    --line: #2c333d;
    --accent: #5b8cff;
    --accent-text: #0b1020;
    --ok: #4ade80;
    --bad: #f87171;
    --bar: #242a33;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216;
  --card: #181c22;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --line: #2c333d;
  --accent: #5b8cff;
  --accent-text: #0b1020;
  --ok: #4ade80;
  --bad: #f87171;
  --bar: #242a33;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.top { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
button {
  font: inherit;
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  min-height: 44px;
}
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.small { min-height: 32px; padding: 4px 10px; font-size: 0.85rem; }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, .drop:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

#login { max-width: 420px; margin: 40px auto; }
#login form button { width: 100%; }
.error { color: var(--bad); font-size: 0.9rem; min-height: 1.2em; margin: 8px 0 0; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 12px; }
code { font-size: 0.9em; background: var(--bg); padding: 1px 4px; border-radius: 4px; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.tabs button { background: transparent; color: var(--text); border: 1px solid var(--line); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.grid .wide { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .grid { grid-template-columns: 2fr 1fr; }
  #movie-fields { grid-template-columns: 2fr 1fr; }
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 140px;
  padding: 20px;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: 14px;
  cursor: pointer;
  margin: 8px 0 0;
  color: var(--muted);
}
.drop.over { border-color: var(--accent); color: var(--text); }
.drop-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.drop-sub { font-size: 0.85rem; }

.summary { font-weight: 600; margin-bottom: 8px; }
.queue { list-style: none; margin: 0; padding: 0; }
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.name { overflow-wrap: anywhere; font-weight: 600; }
.status { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.status.done { color: var(--ok); }
.status.fail { color: var(--bad); }
.bar { height: 8px; background: var(--bar); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s linear; }
.item-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.item-actions { display: flex; gap: 6px; }
