:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #e2e5ea;
  --accent: #2f7d4f;
  --text: #222;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Klee One", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.appbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
}
.appbar h1 { font-size: 18px; margin: 0; }
.appbar .ver { font-size: 12px; opacity: .8; }

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
  align-items: start;
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.group { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: none; }
.group h2 { font-size: 14px; margin: 0 0 8px; color: var(--accent); }
.panel label {
  display: block;
  font-size: 13px;
  margin: 8px 0;
}
.panel select, .panel input[type=text], .panel textarea {
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}
.panel input[type=range] { width: 100%; }
.panel input[type=color] { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; }
.hint { font-size: 11px; color: #888; margin: 6px 0 0; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 10px 0 2px;
  cursor: pointer;
}
.checkbox-label input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.opval { font-size: 12px; color: var(--accent); font-weight: 600; }

.op-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.op-item { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.op-head { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.op-label { flex: 1; }
.op-del {
  width: 20px; height: 20px; line-height: 1;
  border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer;
}
.op-item input[type=range] { width: 100%; margin-top: 4px; }
.btn.small { padding: 6px 8px; font-size: 13px; }

.line-images { display: flex; flex-direction: column; gap: 6px; }
.li-item {
  display: grid;
  grid-template-columns: 1fr 28px auto 24px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.li-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.li-thumb { width: 28px; height: 28px; }
.li-thumb img { width: 28px; height: 28px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; }
.li-item input[type=file] { width: 100%; font-size: 10px; }
.li-del {
  width: 22px; height: 22px;
  border: 1px solid var(--line);
  background: #fff; border-radius: 4px; cursor: pointer;
  line-height: 1;
}

.actions { display: flex; flex-direction: column; gap: 8px; }
.btn {
  padding: 10px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn:hover { opacity: .9; }

.preview { min-width: 0; }
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.pager button { width: auto; }
.pager button:disabled { opacity: .4; cursor: default; }
.canvas-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  text-align: center;
}
#sheet {
  max-width: 100%;
  height: auto;
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
}

/* ===== クレジット フッター ===== */
.credits {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 6px 20px;
  font-size: 11px;
  color: #777;
}
.credits summary {
  cursor: pointer;
  padding: 4px 0;
  font-size: 11px;
  color: #999;
  user-select: none;
}
.credits summary:hover { color: var(--accent); }
.credits-body {
  padding: 8px 0 4px;
  line-height: 1.7;
}
.credits-body p { margin: 0 0 6px; }
.credits-body a { color: var(--accent); }


/* ===== 公開用デザイン試作 ===== */
:root {
  --bg: #f6f8f5;
  --panel: #ffffff;
  --line: #dde6df;
  --accent: #2f7d4f;
  --accent-soft: #edf6f0;
  --text: #263229;
  --muted: #6f7b72;
}

body {
  background: var(--bg);
  color: var(--text);
}

.appbar {
  padding: 16px 24px;
  background: #ffffff;
  color: var(--text);
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.appbar h1 {
  font-size: 22px;
  color: var(--accent);
  letter-spacing: .02em;
}

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

.layout {
  grid-template-columns: 330px 1fr;
  gap: 20px;
  padding: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}

.group {
  padding: 14px 6px;
  border-bottom: 1px solid var(--line);
}

.group h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin-bottom: 10px;
}

.step {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 24px;
}

.subtle-heading {
  color: var(--muted) !important;
  font-size: 13px !important;
}

.panel select,
.panel input[type=text],
.panel textarea {
  background: #fff;
  border: 1px solid #cfdad2;
  border-radius: 8px;
  padding: 8px 10px;
}

.panel textarea:focus,
.panel select:focus,
.panel input[type=text]:focus {
  outline: 2px solid rgba(47,125,79,.18);
  border-color: var(--accent);
}

.hint {
  color: #7b877f;
  line-height: 1.55;
}

.checkbox-label {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 12px;
  z-index: 2;
}

.btn.primary {
  font-size: 16px;
  font-weight: 700;
  padding: 13px 12px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(47,125,79,.18);
}

.preview {
  min-width: 0;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.preview-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.pager {
  justify-content: flex-end;
  margin-bottom: 10px;
}

.canvas-wrap {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 16px;
  background: #eef2ef;
}

#sheet {
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 3px 12px rgba(0,0,0,.12);
}

.credits {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 20px;
}

@media (max-width: 800px) {
  .appbar {
    padding: 14px 16px;
  }
  .layout {
    padding: 12px;
    gap: 12px;
  }
  .panel {
    position: static;
    max-height: none;
  }
  .pager {
    justify-content: center;
  }
}


/* ===== スマホ最適化 ===== */
.mobile-collapsible > summary {
  cursor: pointer;
  list-style: none;
}
.mobile-collapsible > summary::-webkit-details-marker {
  display: none;
}
.mobile-collapsible > summary::after {
  content: "＋";
  float: right;
  font-weight: 700;
}
.mobile-collapsible[open] > summary::after {
  content: "－";
}

@media (min-width: 801px) {
  .mobile-collapsible {
    display: block;
  }
  .mobile-collapsible > summary {
    cursor: default;
  }
  .mobile-collapsible > summary::after {
    display: none;
  }
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr !important;
  }

  .panel {
    width: 100%;
  }

  .mobile-collapsible {
    border-bottom: 1px solid var(--line);
    padding: 12px 6px;
  }

  .mobile-collapsible:not([open]) > *:not(summary) {
    display: none;
  }

  .actions {
    position: sticky !important;
    bottom: 8px !important;
    z-index: 20 !important;
    background: rgba(255,255,255,.96) !important;
    padding: 10px 0 4px !important;
    backdrop-filter: blur(6px);
  }

  .btn.primary {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
  }

  .pager button {
    min-width: 96px;
    min-height: 44px;
    font-size: 15px;
  }

  .pager {
    gap: 10px;
  }

  .canvas-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ===== AdSense 上部広告 ===== */
.ad-area {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}
.ad-area-top {
  max-width: 1200px;
  margin: 10px auto 4px;
  padding: 0 16px;
  min-height: 1px;
}
@media (max-width: 800px) {
  .ad-area-top {
    margin: 8px auto 2px;
    padding: 0 10px;
  }
}
@media print {
  .ad-area {
    display: none !important;
  }
}


/* ===== 広告位置の最適化 ===== */
.ad-separated {
  margin-top: 14px;
  margin-bottom: 22px;
}

@media (max-width: 800px) {
  .ad-separated {
    margin-top: 10px;
    margin-bottom: 18px;
  }
}

/* 広告の直後に操作要素が詰まらないようにする */
.ad-separated + .layout {
  margin-top: 0;
}

/* 印刷時は引き続き広告非表示 */
@media print {
  .ad-separated {
    display: none !important;
  }
}


/* ===== 広告を中央配置 ===== */
.ad-area-top {
  width: 100%;
  max-width: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 24px !important;
  padding-right: 24px !important;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

.ad-area-top .adsbygoogle {
  width: 100% !important;
  max-width: 1200px;
  margin-left: auto !important;
  margin-right: auto !important;
}

@media (max-width: 800px) {
  .ad-area-top {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .ad-area-top .adsbygoogle {
    max-width: 100%;
  }
}
