:root {
  --bg: #0f1115;
  --panel: #171a20;
  --panel-2: #1e232b;
  --line: #2e3643;
  --text: #f5f7fb;
  --muted: #a9b2bf;
  --accent: #a6e22e;
  --base-line: #67b7ff;
  --cut-line: #ff4fd8;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}
body { min-height: 100vh; }
.page { max-width: 1440px; margin: 0 auto; padding: 24px; }
.page-header { margin-bottom: 20px; }
.home-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .03em;
}
.home-link:hover { color: var(--text); }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.2; }
.lead { margin: 0; color: var(--muted); line-height: 1.7; }
.layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.controls { padding: 18px; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
.block + .block { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.block h2 { margin: 0 0 12px; font-size: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 13px; color: var(--muted); }
input[type="number"], select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; outline: none;
}
input[type="number"]:focus, select:focus { border-color: var(--accent); }
.file-input { display: grid; gap: 10px; }
.file-input span {
  display: inline-flex; justify-content: center; align-items: center; min-height: 44px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
  cursor: pointer; font-weight: 700;
}
.file-input input { width: 100%; color: var(--muted); }
.note { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.button-grid { display: grid; gap: 10px; }
button {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; font-weight: 700;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .38; cursor: not-allowed; }
.auto-fields {
  display: none;
  gap: 4px;
  padding: 12px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
}

.stage-panel { padding: 16px; }
.stage-toolbar { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.legend { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.legend-line { display: inline-block; width: 28px; height: 0; border-top: 3px solid; }
.legend-line.base { border-color: var(--base-line); }
.legend-line.cut { border-color: var(--cut-line); }
.auto-status {
  margin-left: auto;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}
.auto-status[data-tone="success"] { color: #d9ff9a; border-color: rgba(166,226,46,.45); }
.auto-status[data-tone="working"] { color: #d8e9ff; border-color: rgba(103,183,255,.45); }
.auto-status[data-tone="error"] { color: #ffb4b4; border-color: rgba(255,122,122,.45); }
.stage-wrap {
  position: relative; min-height: 720px; border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; background: #11151b;
}
#stageCanvas { display: block; width: 100%; height: 720px; touch-action: none; cursor: default; }
.empty-state {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted);
  padding: 24px; text-align: center; line-height: 1.8; pointer-events: none;
}
.info-list { display: grid; gap: 10px; }
.info-list div {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px;
}
.info-list span { color: var(--muted); }
.info-list strong { text-align: right; }
.hidden { display: none !important; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .controls { position: static; max-height: none; overflow: visible; }
  .stage-wrap { min-height: 520px; }
  #stageCanvas { height: 520px; }
  .auto-status { width: 100%; margin-left: 0; border-radius: 10px; }
}