/* ============================================================
   harness.css — 全ツール共通の見た目
   ツールごとに書き換えない。共通の変更はここだけ。
   ============================================================ */

:root {
  --bg: #ffffff;
  --fg: #1a1d21;
  --muted: #6b7280;
  --line: #e3e6ea;
  --panel: #f7f8fa;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --fg: #e8eaed;
    --muted: #9aa3ad;
    --line: #2b3036;
    --panel: #1c2025;
    --accent: #4f86f7;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans",
               "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 72px;
}

/* ---------- ヘッダ ---------- */

.site-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 26px;
}

.site-head .home {
  font-weight: 600;
  text-decoration: none;
  color: var(--fg);
  font-size: 14px;
}

.site-head .crumb { color: var(--muted); font-size: 13px; }

h1 { font-size: 24px; line-height: 1.35; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 34px 0 10px; }

.lede { color: var(--muted); margin: 0 0 6px; }

/* ブラウザ内処理の明示。全ツールに必ず出す（差別化点なので消さない） */
.privacy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  margin: 10px 0 26px;
}

.privacy::before { content: "🔒"; font-size: 12px; }

/* ---------- ドロップ領域 ---------- */

.drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.drop:hover { border-color: var(--accent); }

.drop strong { display: block; font-size: 16px; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: 13px; }

body.dragging .drop { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }

body.dragging::after {
  content: "ドロップして読み込み";
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  pointer-events: none;
  z-index: 50;
}

/* ---------- 編集画面 ---------- */

.editor { display: none; }
.editor.on { display: block; }

.stage {
  display: grid;
  grid-template-columns: 1fr 268px;
  gap: 22px;
  align-items: start;
}

@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; }
}

.viewport {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    conic-gradient(#0000 25%, rgba(128,128,128,.16) 0 50%, #0000 0 75%, rgba(128,128,128,.16) 0)
    0 0 / 18px 18px;
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 10px;
}

.viewport canvas {
  max-width: 100%;
  max-height: 66vh;
  display: block;
  image-rendering: auto;
}

.viewport canvas.pickable { cursor: crosshair; }

/* ---------- コントロール ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.ctl { margin-bottom: 16px; }
.ctl:last-of-type { margin-bottom: 20px; }

.ctl label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.ctl label .val {
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ctl input[type=range] { width: 100%; accent-color: var(--accent); }

.ctl select,
.ctl input[type=number] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
}

.ctl .row { display: flex; align-items: center; gap: 9px; }

.ctl input[type=color] {
  width: 42px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: none;
  cursor: pointer;
}

.ctl.check label { justify-content: flex-start; cursor: pointer; }
.ctl.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.06); }

.btn.sub {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
  font-weight: 500;
  margin-top: 8px;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 押している間だけ元画像を表示 */
.compare { margin-top: 8px; }

/* ---------- ツール一覧 ---------- */

.tool-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }

@media (min-width: 640px) {
  .tool-list { grid-template-columns: 1fr 1fr; }
}

.tool-list a {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  transition: border-color .12s;
}

.tool-list a:hover { border-color: var(--accent); }
.tool-list b { display: block; font-size: 15px; margin-bottom: 3px; }
.tool-list span { font-size: 13px; color: var(--muted); }

.site-foot {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   一括処理（2026-08-12 追加）
   1枚のときは帯も出力形式も出ない。2枚以上で自動的に出る。
   ============================================================ */

/* display を指定した要素にも hidden 属性を効かせる。
   これが無いと .film / .btn / .batch-row の hidden が無視される。 */
[hidden] { display: none !important; }

.btn + .btn { margin-top: 8px; }

.panel.locked { opacity: .55; pointer-events: none; }
.panel.locked .btn { cursor: not-allowed; }

/* ---------- ファイルの帯 ---------- */

.film {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 10px;
  margin-bottom: 14px;
  scrollbar-width: thin;
}

.film-item {
  position: relative;
  flex: none;
  width: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 5px 5px 4px;
  cursor: pointer;
  transition: border-color .12s;
}

.film-item:hover { border-color: var(--accent); }

.film-item.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.film-item img {
  display: block;
  width: 100%;
  height: 54px;
  object-fit: contain;
  background:
    conic-gradient(#0000 25%, rgba(128,128,128,.16) 0 50%, #0000 0 75%, rgba(128,128,128,.16) 0)
    0 0 / 10px 10px;
  border-radius: 4px;
}

.film-item .nm {
  display: block;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 帯は横スクロールするので、× は必ずタイルの内側に置く（外に出すと切れる） */
.film-item .rm {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}

.film-item:hover .rm, .film-item.sel .rm { opacity: 1; }
.film-item .rm:hover { color: var(--fg); border-color: var(--accent); }

/* 保存済 / 失敗の目印 */
.film-item.done::after,
.film-item.error::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--panel);
}

.film-item.done::after  { background: #22a06b; }
.film-item.error::after { background: #d1453b; }
.film-item.error .nm    { color: #d1453b; }

/* ---------- 一括処理の帯 ---------- */

.batch {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 14px;
}

.batch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.batch-row + .batch-row { margin-top: 9px; }
.batch-row .hint { margin: 0; }

.batch .mini {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.batch .mini:hover { border-color: var(--accent); }

.mini-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.mini-chk input { accent-color: var(--accent); width: 15px; height: 15px; }

.dirinfo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}

.dirinfo b {
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.dot.on { background: #22a06b; }

.batch-row.status { min-height: 24px; }

.count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.prog {
  font-size: 12.5px;
  color: var(--muted);
  flex: 1;
  min-width: 120px;
  font-variant-numeric: tabular-nums;
}

.prog.ok   { color: #22a06b; }
.prog.warn { color: #b26a00; }
.prog.err  { color: #d1453b; }

@media (prefers-color-scheme: dark) {
  .prog.warn { color: #e0a13a; }
  .prog.err  { color: #f0796d; }
  .prog.ok   { color: #4cc38a; }
}

.bar {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 10px;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .15s linear;
}
