:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #6a7282;
  --line: #e2e5eb;
  --accent: #2f6df6;
  --accent-soft: #e8efff;
  --accent-text: #ffffff;
  --down: #12805c;
  --up: #b4561a;
  --err: #c43a3a;
  --check: #eceef2;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #1b1f27;
    --text: #e8ebf1;
    --muted: #98a0ae;
    --line: #2c323d;
    --accent: #5b8cff;
    --accent-soft: #1f2a44;
    --accent-text: #0d1220;
    --down: #45c495;
    --up: #e8955a;
    --err: #f07a7a;
    --check: #262b35;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h2 { font-size: 15px; margin: 0 0 12px; }
p { margin: 0; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); font-weight: normal; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.top, main { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  text-decoration: none;
}
.local-badge {
  font-size: 12px;
  color: var(--down);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 10px;
}

/* ドロップ枠 */
.drop {
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
  min-height: 260px;
  border: 2px dashed var(--line);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s, min-height .2s;
}
.drop:hover, .drop:focus-visible, .drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.drop-title { font-size: 20px; font-weight: 700; }
.drop-sub { color: var(--muted); font-size: 13px; }
.drop.compact { min-height: 64px; border-radius: var(--radius); }
.drop.compact .drop-title { font-size: 15px; color: var(--accent); }
.drop.compact .drop-sub { display: none; }

/* 作業エリア */
.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
  margin-top: 20px;
}
.work[hidden] { display: none; }
@media (max-width: 820px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .settings { position: static; }
}

.files-head { display: flex; justify-content: space-between; align-items: baseline; }
.link {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
}
.link:hover { color: var(--err); }
.link:disabled { visibility: hidden; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.item.is-unsupported { opacity: .7; }
.item.is-done { border-color: color-mix(in srgb, var(--down) 40%, var(--line)); }
.thumb {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  /* 透明部分が分かるよう市松模様 */
  background: repeating-conic-gradient(var(--check) 0 25%, var(--surface) 0 50%) 0 0 / 12px 12px;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.meta { flex: 1; min-width: 0; }
.name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { color: var(--muted); font-size: 13px; }
.sub b { color: var(--text); }
.down { color: var(--down); font-weight: 600; }
.up { color: var(--up); font-weight: 600; }
.err { color: var(--err); }
.act { display: flex; align-items: center; gap: 6px; flex: none; }
.remove {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.remove:hover { background: var(--check); color: var(--text); }

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 設定パネル */
.settings {
  position: sticky;
  top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.settings.busy .field { opacity: .5; pointer-events: none; }
.field { margin-bottom: 18px; }
.label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.sub-label { margin-top: 12px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 14px;
  cursor: pointer;
}
.seg button:hover:not(:disabled) { border-color: var(--accent); }
.seg button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.seg button:disabled { opacity: .4; cursor: not-allowed; }

.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inline .seg { display: inline-flex; }
input[type="number"] {
  width: 96px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input[type="color"] { width: 40px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--bg); }
.inline .hint { margin: 0; }
.range { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.range input { flex: 1; accent-color: var(--accent); }
.range output { width: 2.5em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.run { display: grid; gap: 8px; margin-bottom: 10px; }
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-size: 16px; padding: 12px 16px; }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 5px 12px; font-size: 13px; border-color: var(--accent); color: var(--accent); }

/* できること */
.abilities { margin: 36px 0 48px; }
.abilities ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.ability {
  width: 100%;
  height: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.ability:hover:not(:disabled) { border-color: var(--accent); }
.ability:disabled { cursor: default; opacity: .6; }
.ability-label { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ability-detail { color: var(--muted); font-size: 13px; }
.tag {
  font-size: 11px;
  font-weight: 600;
  background: var(--check);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 8px;
}
