:root {
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --ink: #1c1a16;
  --muted: #6b655c;
  --line: #ddd4c4;
  --accent: #0f6e56;
  --accent-soft: #e4f3ee;
  --cut: #2a8fd6;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(28, 26, 22, 0.08);
  --font: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 110, 86, 0.08), transparent 40%),
    linear-gradient(180deg, #f7f4ed 0%, var(--bg) 100%);
  min-height: 100vh;
}

.top {
  padding: 36px 24px 12px;
}
.top-inner {
  max-width: 1180px;
  margin: 0 auto;
}
.brand {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 12px;
  vertical-align: middle;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}
.lead {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px 64px;
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
}
.hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
  border: 2px dashed #cbbfaa;
  border-radius: 14px;
  background: #faf7f1;
  cursor: pointer;
  transition: 0.15s ease;
}
.drop:hover,
.drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop-title { font-weight: 600; }
.drop-sub { font-size: 12px; color: var(--muted); }

.status {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f0ece3;
  color: var(--ink);
  font-size: 13px;
}
.status.error { background: #fdecea; color: var(--danger); }
.status.ok { background: var(--accent-soft); color: var(--accent); }

.editor-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.meta {
  font-size: 13px;
  color: var(--muted);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
}

.canvas-wrap { min-width: 0; }
.canvas-scroll {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(45deg, #ece7dc 25%, transparent 25%),
    linear-gradient(-45deg, #ece7dc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ece7dc 75%),
    linear-gradient(-45deg, transparent 75%, #ece7dc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f7f3ea;
}

.canvas {
  position: relative;
  display: inline-block;
  min-width: 100%;
}
.canvas img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.cut-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cut-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--cut);
  pointer-events: auto;
  cursor: ns-resize;
  z-index: 2;
}
.cut-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 16px;
}
.cut-line .cut-label {
  position: absolute;
  left: 8px;
  top: -22px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--cut);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}
.cut-line .cut-remove {
  position: absolute;
  right: 8px;
  top: -14px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--danger);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.sidebar h3 {
  margin: 0 0 14px;
  font-size: 14px;
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
}
.field span { color: var(--muted); }
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
.field strong { font-size: 18px; }

.actions {
  display: grid;
  gap: 8px;
  margin: 8px 0 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  color: #fff;
}
.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.btn.download {
  background: #1c1a16;
  color: #fff;
  margin-bottom: 16px;
}

.slice-list {
  max-height: 240px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.slice-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #efe9de;
}
.slice-item strong { color: var(--ink); }

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .editor-grid { grid-template-columns: 1fr; }
  .canvas-scroll { max-height: 55vh; }
}
