:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --text: #1f2933;
  --muted: #62707d;
  --border: #d3d9df;
  --primary: #1d5fd1;
  --primary-text: #fff;
  --ok: #1a7f37;
  --error: #b42318;
  --error-bg: #fdecea;
  --drag: #e8f0fd;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --surface: #1b2128;
    --text: #e6eaee;
    --muted: #9aa7b3;
    --border: #36404a;
    --primary: #6ea2ff;
    --primary-text: #0c1a33;
    --ok: #56d364;
    --error: #ff8f84;
    --error-bg: #3a1c1a;
    --drag: #1d2b44;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}
.container { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.lead, .hint { color: var(--muted); margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.card.disabled { opacity: 0.5; pointer-events: none; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row.center { justify-content: center; }
input[type="text"] { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
button { font: inherit; padding: 9px 16px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-weight: 600; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--primary); text-decoration: underline; padding: 0 4px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.auth-result { color: var(--ok); font-weight: 600; margin: 0; }
.message { margin: 12px 0 0; min-height: 1.6em; }
.message.error { color: var(--error); }
.dropzone { border: 2px dashed var(--border); border-radius: 10px; padding: 28px 16px; text-align: center; transition: background 0.15s; }
.dropzone.dragover { background: var(--drag); border-color: var(--primary); }
.dropzone p { margin: 0 0 8px; }
.dropzone-main { font-weight: 600; }
.dropzone-sub { color: var(--muted); }
.file-list { list-style: none; padding: 0; margin: 16px 0 0; }
.file-item { display: grid; grid-template-columns: 4.5em 120px 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 6px; border-top: 1px solid var(--border); }
.file-item.reorderable { cursor: grab; }
.file-item.dragging { opacity: 0.4; }
.file-item.drop-before { box-shadow: 0 -3px 0 0 var(--primary); }
.file-item.drop-after { box-shadow: 0 3px 0 0 var(--primary); }
.file-part { font-weight: 700; color: var(--primary); white-space: nowrap; }
.file-thumb { width: 120px; aspect-ratio: 16 / 9; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-main { min-width: 0; display: grid; gap: 2px; }
.file-actions { display: flex; gap: 4px; }
.file-action { padding: 4px 10px; }
.part-note { color: var(--muted); font-size: 0.875rem; margin: 0 0 8px; }
@media (max-width: 560px) { .file-item { grid-template-columns: 4em 80px 1fr; } .file-thumb { width: 80px; } .file-actions { grid-column: 1 / -1; } }
.file-name { font-weight: 600; word-break: break-all; }
.file-group { grid-column: 1; justify-self: start; }
.file-meta { color: var(--muted); font-size: 0.875rem; }
.file-status { font-size: 0.875rem; }
.file-status.error { color: var(--error); }
.file-status.done { color: var(--ok); }
.file-remove { padding: 4px 10px; }
progress { width: 100%; height: 8px; }
.actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.deadline { font-weight: 600; margin: 0 0 16px; }
.confirm-result { color: var(--ok); font-weight: 600; margin: 0; }
.groups { display: grid; gap: 16px; }
.group-card { border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.group-card h3 { margin: 0 0 4px; font-size: 1rem; }
.group-uploaded { color: var(--muted); font-size: 0.875rem; margin: 0 0 12px; }
.group-card .dropzone { padding: 16px; }

.hint.notice { font-weight: bold; }
.group-result { font-size: 0.875rem; margin: 0 0 12px; }
.group-result.ok { color: var(--ok, #1a7f37); }
.group-result.error { color: var(--error, #b42318); }
#replace-dialog { max-width: 32rem; border: 1px solid var(--muted); border-radius: 8px; }
