/* セブン写真分割プリント – モバイルファースト、外部リソースなし */
:root {
  --green: #008348;
  --green-dark: #00663a;
  --orange: #f39800;
  --ink: #222;
  --mut: #666;
  --line: #ddd;
  --bg: #f6f6f4;
  --card: #fff;
  --danger: #b00020;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
header {
  background: var(--green);
  color: #fff;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
}
header h1 { margin: 0; font-size: 20px; }
header .sub { margin: 4px 0 0; font-size: 12px; opacity: .9; }
main { max-width: 640px; margin: 0 auto; padding: 12px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { margin: 0 0 10px; font-size: 16px; }
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 13px; color: var(--mut); margin-bottom: 4px; }
select, input[type="number"], input[type="text"], input[type="password"] {
  font-size: 16px; /* iOS の自動ズーム防止 */
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
input[type="color"] { width: 52px; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; margin-top: 10px; }
.row.wrap { flex-wrap: wrap; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
label.mini { font-size: 13px; color: var(--mut); display: flex; align-items: center; gap: 6px; margin-top: 8px; }
label.mini input { width: 64px; }
.filebtn {
  display: block;
  text-align: center;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  border-radius: 10px;
  cursor: pointer;
}
.filebtn:active { background: var(--green-dark); }
button {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
button.primary {
  display: block;
  width: 100%;
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  padding: 14px;
  border-radius: 10px;
}
button.secondary { background: #eef4f1; }
button.ghost { padding: 6px 10px; font-size: 13px; color: var(--mut); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; padding: 10px 4px; font-size: 14px; }
.seg button.on { background: var(--green); color: #fff; font-weight: 600; }
.presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.presets button { padding: 10px 0; font-size: 15px; }
.presets button.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.thumbs .th { position: relative; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; background: #eee; }
.thumbs .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .th button {
  position: absolute; top: 0; right: 0; width: 20px; height: 20px;
  padding: 0; border: 0; border-radius: 0 0 0 6px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; line-height: 1;
}
.summary { font-size: 14px; margin: 0 0 10px; white-space: pre-line; }
.preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview figure { margin: 0; }
.preview canvas { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.preview figcaption { font-size: 12px; color: var(--mut); text-align: center; margin-top: 2px; }
.status { font-size: 14px; min-height: 1.4em; margin: 12px 0 0; white-space: pre-line; }
.status.err { color: var(--danger); font-weight: 600; }
.results { margin-top: 10px; }
.result {
  border: 2px solid var(--green);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  text-align: center;
}
.result .pid { font-size: 34px; font-weight: 800; letter-spacing: .12em; }
.result .meta { font-size: 13px; color: var(--mut); }
.history .hitem { border-bottom: 1px solid var(--line); padding: 8px 0; }
.history .hitem:last-child { border-bottom: 0; }
.history .hpid { font-size: 20px; font-weight: 700; letter-spacing: .08em; }
.history .hmeta { font-size: 12px; color: var(--mut); }
.note, .foot { font-size: 12px; color: var(--mut); }
.empty { font-size: 13px; color: var(--mut); }

/* QRコード画像（結果・履歴共通） */
.qrimg {
  display: block;
  width: 180px;
  height: 180px;
  margin-top: 10px;
  background: #fff;
  padding: 8px;
  border-radius: 8px;
}
.hqr {
  margin-top: 6px;
  font-size: 0.85rem;
  padding: 6px 12px;
}
