* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  font: 13px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #17181c; color: #d6d8de;
}
button {
  background: #33363f; color: #d6d8de;
  border: 1px solid #454954; border-radius: 4px;
  padding: 5px 12px; cursor: pointer; font: inherit;
}
button:hover:not(:disabled) { background: #3e424d; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: #2f6fdd; border-color: #3b7ce8; }
button.primary:hover:not(:disabled) { background: #3b7ce8; }
button.danger { border-color: #7a3b3b; }
button.danger:hover:not(:disabled) { background: #5a2f2f; }

#toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: #23252b; border-bottom: 1px solid #0c0d10;
}
#toolbar label { display: flex; align-items: center; gap: 6px; color: #a7acb9; }

#toolnav {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: #23252b; border-bottom: 1px solid #0c0d10;
}
#toolnav .brand { color: #a7acb9; font-weight: 600; margin-right: 8px; }
#toolnav a { color: #9cc4ff; text-decoration: none; padding: 3px 12px; border-radius: 4px; }
#toolnav a:hover { background: #262a33; }
#toolnav a.cur { background: #2f6fdd; color: #fff; }
.sep { width: 1px; height: 20px; background: #454954; }
.flex { flex: 1; }

input[type="text"], input[type="number"], select {
  background: #1b1d22; color: #d6d8de;
  border: 1px solid #454954; border-radius: 4px;
  padding: 4px 6px; font: inherit;
}
#prefix { width: 110px; }
#pad { width: 70px; }
#alpha-th { width: 56px; }
.chk input { accent-color: #2f6fdd; }

#main { flex: 1; display: flex; min-height: 0; }
#stage-wrap { flex: 1; position: relative; overflow: hidden; min-width: 0; }
#stage { position: absolute; inset: 0; display: block; cursor: crosshair; }
#stage-wrap.dropping::after {
  content: '松开以载入图片';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #9cc4ff;
  border: 2px dashed #3fa7ff; background: rgba(23, 24, 28, .7);
  pointer-events: none;
}

#side {
  width: 280px; flex: none;
  background: #1e2025; border-left: 1px solid #0c0d10;
  overflow-y: auto; display: flex; flex-direction: column;
}
#side section { padding: 10px 12px; border-bottom: 1px solid #2a2d34; }
#side h3 { font-size: 12px; font-weight: 600; color: #8b90a0; margin-bottom: 8px; }
#box-list { max-height: 240px; overflow-y: auto; }
#box-list .empty { color: #5d6270; padding: 6px 4px; }
.box-item {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 8px; border-radius: 4px; cursor: pointer;
}
.box-item:hover { background: #262a33; }
.box-item.sel { background: rgba(47, 111, 221, .2); outline: 1px solid #2f6fdd; }
.box-item .bl { color: #3fa7ff; font-weight: 600; }
.box-item.sel .bl { color: #ff8a3d; }
.box-item .br { color: #8b90a0; white-space: nowrap; }

.grid { display: grid; grid-template-columns: 40px 1fr; gap: 6px 8px; align-items: center; }
.grid label { color: #8b90a0; }
.grid input { width: 100%; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row button { flex: 1; }

.help ul { list-style: none; color: #8b90a0; }
.help li { margin-bottom: 5px; }
.help b { color: #c3c8d4; font-weight: 600; }

#statusbar {
  display: flex; gap: 18px;
  padding: 4px 12px; background: #23252b; border-top: 1px solid #0c0d10;
  color: #8b90a0;
}

#toast {
  position: fixed; left: 50%; bottom: 48px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(0, 0, 0, .8); color: #fff;
  padding: 8px 16px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: all .25s;
  z-index: 99; max-width: 80%;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.badge-edit {
  position: absolute; z-index: 50;
  width: 46px; height: 18px; padding: 0 2px;
  font: 12px/16px system-ui, sans-serif;
  background: #111318; color: #fff;
  border: 1px solid #3fa7ff; border-radius: 3px;
}
.badge-edit::-webkit-outer-spin-button,
.badge-edit::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
