:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f5f5f3;
  --panel: #fff;
  --line: #d9d9d2;
  --text: #191919;
  --muted: #696966;
  --accent: #b42318;
  --blue: #155eef;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
.app { display: grid; grid-template-columns: 280px 1fr 300px; height: 100vh; min-width: 1080px; }
.sidebar, .rightbar { background: var(--panel); border-right: 1px solid var(--line); overflow: auto; }
.rightbar { border-right: 0; border-left: 1px solid var(--line); padding: 12px; }
.top { position: sticky; top: 0; z-index: 3; background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px; }
.title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.muted, .hint { color: var(--muted); font-size: 12px; }
.image-list { padding: 8px; }
.image-item { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; padding: 8px; border-radius: 6px; cursor: pointer; }
.image-item:hover { background: #f0f0ee; }
.image-item.active { border-color: var(--blue); background: #eef4ff; }
.image-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { border-color: #a8a8a0; background: #fafafa; }
button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
button.danger { border-color: var(--accent); color: var(--accent); }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.toolbar input { width: 72px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
.rightbar input[type="text"] { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.workspace { min-width: 0; display: grid; grid-template-rows: auto 1fr; }
.canvas-wrap { overflow: auto; padding: 18px; background: #e8e8e2; }
.stage { position: relative; display: inline-block; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
canvas { display: block; image-rendering: auto; cursor: crosshair; }
.stat { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.box-list { margin-top: 12px; }
.box-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 7px 6px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.box-row.active { border-color: var(--blue); background: #eef4ff; }
.box-main { min-width: 0; }
.box-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #eee; border-radius: 4px; padding: 1px 4px; }
button.primary .kbd { background: rgba(255,255,255,.22); }
.status { min-width: 220px; color: var(--muted); font-size: 13px; }
