/* ═══════════════════════════════════════════════════════════
   ドット絵変換メーカー — style.css（配色は紫 #6d28d9）
   ═══════════════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f3ff;
  color: #1c1917;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
header {
  background: #6d28d9;
  color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.header-inner {
  max-width: 960px; margin: 0 auto; padding: 0 1rem;
  height: 52px; display: flex; align-items: center;
}
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; }

/* ── Main ── */
main { max-width: 960px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }

.hero { text-align: center; margin-bottom: 1.3rem; }
.hero-icon { font-size: 2.6rem; line-height: 1; margin-bottom: .4rem; }
.hero h1 { font-size: 1.75rem; font-weight: 800; color: #6d28d9; line-height: 1.3; margin-bottom: .5rem; }
.description { font-size: .95rem; color: #57534e; max-width: 640px; margin: 0 auto .8rem; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.badge {
  font-size: .75rem; font-weight: 600; padding: .22rem .7rem; border-radius: 999px;
  background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd;
}

.card {
  background: #fff; border-radius: 14px; padding: 1.4rem;
  border: 1.5px solid #ddd6fe; margin-bottom: 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card h2 { font-size: 1.15rem; font-weight: 700; color: #6d28d9; margin-bottom: .9rem; }
code { font-family: Consolas, 'Courier New', monospace; font-size: .86em; background: #f5f3ff; padding: .1em .35em; border-radius: 4px; }

/* ── Drop zone ── */
.drop {
  display: block; text-align: center; padding: 1.6rem 1rem; border-radius: 12px; cursor: pointer;
  border: 2px dashed #c4b5fd; background: #faf8ff; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: #6d28d9; background: #f3efff; }
.drop.has-img { border-style: solid; }
.drop input { display: none; }
.drop-icon { font-size: 2rem; line-height: 1; margin-bottom: .3rem; }
.drop-text { font-size: .9rem; color: #57534e; }
.drop-text strong { color: #6d28d9; }
.drop-info { font-size: .8rem; color: #6d28d9; font-weight: 700; margin-top: .4rem; min-height: 1.2em; }

/* ── Work grid ── */
.work-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 1.2rem; align-items: start; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem .8rem; margin-bottom: .9rem; }
.opt { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; font-weight: 700; color: #292524; }
.opt select, .adj input {
  width: 100%; font-family: inherit; font-size: .9rem; padding: .45rem .55rem;
  border: 1.5px solid #e7e5e4; border-radius: 8px; background: #fafaf9; color: #1c1917;
}
.opt select:focus { outline: none; border-color: #6d28d9; background: #fff; }
.opt select:disabled { color: #a8a29e; background: #f5f5f4; }
.opt.inline { flex-direction: row; align-items: center; gap: .4rem; }
.opt.inline select { width: auto; padding: .3rem .45rem; }

.field { margin-bottom: 1rem; }
.field-label { display: block; font-size: .82rem; font-weight: 700; color: #292524; margin-bottom: .35rem; }
.field-hint { font-size: .76rem; color: #78716c; margin-top: .5rem; }
.field textarea {
  width: 100%; padding: .55rem .7rem; font-size: .85rem; font-family: Consolas, 'Courier New', monospace;
  border: 1.5px solid #e7e5e4; border-radius: 8px; background: #fafaf9; color: #1c1917; resize: vertical;
}
.field textarea:focus { outline: none; border-color: #6d28d9; background: #fff; }

.adj { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.adj-row { display: grid; grid-template-columns: 6.6em 1fr 2.6em auto; align-items: center; gap: .5rem; font-size: .82rem; font-weight: 700; color: #292524; position: relative; }
.adj-row input { padding: 0; border: none; background: none; accent-color: #6d28d9; }
.adj-row b { font-weight: 600; color: #78716c; text-align: right; font-size: .78rem; }
.adj-lock { display: none; font-style: normal; font-size: .8rem; }
.locked .adj-lock { display: inline; }
.adj-row.locked input { opacity: .55; }
.adj-row.locked span { color: #78716c; }

.check-row { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; font-size: .85rem; }
.check-row label { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #6d28d9; }

/* ── Output ── */
.out-card { position: sticky; top: 64px; }
.out-info { font-size: .8rem; color: #6d28d9; font-weight: 700; margin-bottom: .5rem; }
.out-frame {
  overflow: auto; max-height: 560px; border-radius: 10px; border: 1px solid #e7e5e4; padding: 8px;
  /* 透明部分が分かるように市松模様 */
  background-color: #f5f5f4;
  background-image: linear-gradient(45deg, #e7e5e4 25%, transparent 25%, transparent 75%, #e7e5e4 75%),
                    linear-gradient(45deg, #e7e5e4 25%, transparent 25%, transparent 75%, #e7e5e4 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.out-frame canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; touch-action: none; }
.out-empty { font-size: .9rem; color: #a8a29e; text-align: center; padding: 2.4rem 1rem; border: 2px dashed #e7e5e4; border-radius: 10px; }

.pen-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .7rem 0 .4rem; font-size: .8rem; }
.pen-label { font-weight: 700; color: #292524; margin-right: .2rem; }
.pen-bar.locked .pen-label { color: #78716c; }
.mini-btn { font-size: .74rem; padding: .28rem .6rem; border: 1px solid #d6d3d1; border-radius: 6px; background: #fff; cursor: pointer; font-family: inherit; color: #44403c; white-space: nowrap; }
.mini-btn:hover { border-color: #6d28d9; color: #6d28d9; }
.mini-btn.on { border-color: #6d28d9; background: #ede9fe; color: #4c1d95; }
.mini-btn:disabled { color: #a8a29e; cursor: not-allowed; border-color: #e7e5e4; }

.swatches { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: .6rem; }
.swatch {
  width: 64px; height: 30px; border-radius: 6px; border: 2px solid rgba(0,0,0,.12); cursor: pointer;
  font-family: Consolas, 'Courier New', monospace; font-size: .66rem; letter-spacing: -.02em; padding: 0;
}
.swatch.on { border-color: #6d28d9; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6d28d9; }

/* ── Buttons ── */
.btn-primary {
  width: 100%; padding: .85rem; font-size: 1.05rem; font-weight: 700; font-family: inherit;
  background: #6d28d9; color: #fff; border: none; border-radius: 10px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: #5b21b6; }
.btn-primary:active { transform: scale(.98); }
.btn-secondary {
  padding: .6rem 1rem; font-size: .88rem; font-weight: 600; font-family: inherit;
  background: #fff; color: #6d28d9; border: 1.5px solid #6d28d9; border-radius: 8px; cursor: pointer;
}
.btn-secondary:hover { background: #f5f3ff; }
.btn-dark {
  padding: .6rem 1rem; font-size: .88rem; font-weight: 600; font-family: inherit;
  background: #1c1917; color: #fff; border: none; border-radius: 8px; cursor: pointer;
}
.btn-dark:hover { background: #292524; }
.btn-x { background: #000; }
.btn-x:hover { background: #333; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.sample-row { align-items: center; }
.sample-label { font-size: .86rem; color: #57534e; font-weight: 700; }
.sample-row #btn-reset { margin-left: auto; }
.sample-hint { margin-top: .5rem; color: #6d28d9; }
.btn-row > * { flex: 1 1 auto; text-align: center; }

/* ── Lock modal ── */
.overlay { position: fixed; inset: 0; background: rgba(28,25,23,.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 300; }
.overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: 14px; padding: 1.4rem; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal h2 { font-size: 1.1rem; color: #6d28d9; margin-bottom: .8rem; }
.locked-body p { font-size: .9rem; line-height: 1.75; color: #334155; margin-bottom: .7rem; }
.locked-body ul { margin: 0 0 .8rem 1.2em; }
.locked-body li { font-size: .86rem; line-height: 1.7; color: #334155; margin-bottom: .2rem; }
.locked-body .why { background: #f5f3ff; border-left: 4px solid #6d28d9; padding: .6rem .8rem; border-radius: 6px; font-size: .86rem; line-height: 1.7; color: #3b2f5c; margin-bottom: .8rem; }
.locked-body a { color: #6d28d9; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: .6rem; }
.locked-body .lock-try { background: #fffbeb; border: 1px dashed #f59e0b; border-radius: 8px; padding: .6rem .8rem; color: #78350f; }
.locked-body .lock-try button { margin-top: .4rem; }

/* ── Amazon ── */
.amazon-card h2 { font-size: 1.05rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.amazon-item {
  display: flex; gap: .7rem; align-items: flex-start; padding: .8rem; border-radius: 10px;
  border: 1px solid #f5f5f4; background: #fafaf9; text-decoration: none; color: inherit; transition: border-color .15s;
}
.amazon-item:hover { border-color: #6d28d9; }
.amazon-item-icon { font-size: 1.6rem; line-height: 1; }
.amazon-item-name { font-size: .88rem; font-weight: 700; color: #1c1917; }
.amazon-item-desc { font-size: .76rem; color: #78716c; margin-top: .15rem; }
.amazon-item-link { font-size: .76rem; color: #6d28d9; font-weight: 600; margin-top: .3rem; }

/* ── Scene grid ── */
.scene-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.scene-item { background: #f5f3ff; border-radius: 10px; padding: .9rem; }
.scene-item strong { display: block; font-size: .92rem; color: #4c1d95; margin-bottom: .3rem; }
.scene-item p { font-size: .84rem; color: #57534e; }

/* ── Guide ── */
.guide-card h3 { font-size: 1rem; font-weight: 700; color: #292524; margin: 1.1rem 0 .4rem; padding-left: .6rem; border-left: 4px solid #6d28d9; }
.guide-card h3:first-of-type { margin-top: 0; }
.guide-card p { font-size: .9rem; color: #44403c; margin-bottom: .5rem; }
.guide-card p strong { color: #5b21b6; }

/* ── Maker note ── */
.maker-note { background: #fffdf5; border: 1.5px solid #f2e6c4; }
.maker-note h2 { color: #7a5c00; }
.mn-item { padding: .85rem 0; border-bottom: 1px dashed #eadfb8; }
.mn-item:last-of-type { border-bottom: none; }
.mn-head { font-size: .92rem; font-weight: 700; color: #8a6a00; margin-bottom: .4rem; }
.mn-item p { font-size: .88rem; line-height: 1.85; color: #5c534a; }
.mn-sign { text-align: right; font-size: .8rem; color: #b09a5e; margin-top: .9rem; font-style: italic; }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; gap: .9rem; }
.faq-item { border-bottom: 1px solid #f5f5f4; padding-bottom: .9rem; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .92rem; font-weight: 700; color: #6d28d9; margin-bottom: .3rem; }
.faq-a { font-size: .86rem; color: #44403c; }

/* ── Related ── */
.related-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.related-tool-item {
  display: flex; flex-direction: column; gap: .15rem; padding: .8rem; border-radius: 10px;
  border: 1px solid #f5f5f4; background: #fafaf9; text-decoration: none; color: #1c1917; font-size: .88rem; font-weight: 700;
}
.related-tool-item:hover { border-color: #6d28d9; }
.related-tool-item span { font-size: 1.4rem; }
.related-tool-item small { font-size: .74rem; color: #78716c; font-weight: 400; }

/* ── Footer ── */
footer { text-align: center; padding: 1.6rem 1rem 2.2rem; font-size: .8rem; color: #78716c; border-top: 1px solid #ddd6fe; }
footer a { color: #6d28d9; text-decoration: none; }
footer a:hover { text-decoration: underline; }
.amazon-notice { font-size: .72rem; color: #a8a29e; margin-top: .5rem; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1c1917; color: #fff; padding: .6rem 1.1rem; border-radius: 999px; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 400;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 780px) {
  .work-grid { grid-template-columns: 1fr; }
  .out-card { position: static; }
  .related-tools { grid-template-columns: repeat(2, 1fr); }
  .scene-grid, .amazon-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; }
}
@media (max-width: 480px) {
  .opt-grid { grid-template-columns: 1fr; }
}
