:root {
  --bg: #0c1118;
  --panel: #141c27;
  --line: #243044;
  --text: #e7eef8;
  --muted: #8fa3bb;
  --accent: #3d9cff;
  --warn: #f0b429;
  --ok: #3dd68c;
  --path: #ff7a45;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #101826;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #2d7dff, #18c5c2);
  display: grid; place-items: center; font-weight: 800; letter-spacing: 0.5px;
}
h1 { margin: 0; font-size: 18px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.chip {
  background: #16324a; color: #7fd0ff; border-radius: 999px;
  padding: 6px 12px; font-size: 12px;
}
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  min-height: 0;
}
.canvas-pane {
  display: flex; flex-direction: column; min-width: 0; background: #0b1320;
}
.canvas-toolbar {
  height: 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.hint { font-size: 12px; }
#stage { flex: 1; width: 100%; display: block; cursor: crosshair; }
.legend {
  height: 36px; display: flex; gap: 16px; align-items: center;
  padding: 0 16px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line);
}
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.swatch.outer { background: #7fd0ff; }
.swatch.inner { background: #3dd68c; }
.swatch.path { background: var(--path); }
.swatch.rough { background: #ffb020; }
.swatch.point { background: var(--warn); }
.side {
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
}
details { border-bottom: 1px solid var(--line); }
summary {
  cursor: pointer; padding: 12px 14px; font-size: 13px; font-weight: 700;
  color: #d5e6f8; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "▾"; float: right; color: var(--muted); }
.mod { padding: 0 14px 14px; display: grid; gap: 8px; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea, button {
  font: inherit; color: var(--text);
}
input, select, textarea {
  background: #0f1826; border: 1px solid #2a415c; border-radius: 8px;
  padding: 7px 9px; width: 100%;
}
textarea { height: 180px; resize: vertical; font-family: Consolas, "Courier New", monospace; font-size: 11px; line-height: 1.4; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }
.radio-row { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 8px; }
.grow { flex: 1; }
.btn {
  background: #1c5fa8; color: #fff; border: none; border-radius: 8px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.btn:hover { background: #2474cc; }
.btn.ghost { background: #1a2738; border: 1px solid #2a415c; }
label b { color: #cfe6ff; font-weight: 600; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { max-height: 48vh; }
}
