:root {
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #233a54;
  background: #f5f8fc;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; min-height: 590px; display: flex; flex-direction: column; }
button, input { font: inherit; }
button {
  border: 1px solid #ccd9e8; background: #fff; color: #29445f;
  border-radius: 9px; padding: 8px 12px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
button:hover { border-color: #82aee0; background: #f0f7ff; box-shadow: 0 2px 7px #1a508015; }
button:active { transform: translateY(1px); }
button.primary { background: #2377c7; color: #fff; border-color: #2377c7; font-weight: 650; }
button.primary:hover { background: #1468b8; }
button:focus-visible, input:focus-visible { outline: 3px solid #a6d2ff; outline-offset: 2px; }
kbd { font-family: inherit; font-size: 11px; border: 1px solid #d1deea; border-radius: 5px; padding: 1px 5px; color: #63809b; background: #f5f9fe; }
.topbar {
  min-height: 68px; background: #f9fbff; color: #233a54; border-bottom: 1px solid #d9e4ef;
  display: flex; align-items: center; gap: 18px; padding: 10px 17px;
  box-shadow: 0 2px 9px #315b8010; z-index: 1;
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand strong { font-size: 17px; letter-spacing: .2px; }
.brand small { display: block; font-size: 11px; color: #748aa1; }
.brand-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 12px; background: #e2efff; font-size: 26px; color: #2873bd; }
.image-path { color: #6a8199; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 120px; font-size: 12px; }
.top-actions { display: flex; gap: 7px; }
.top-actions #helpButton { background: #edf5ff; border-color: #c5dafa; color: #1c65a9; }
.top-actions #helpButton:hover { background: #deedff; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 14px; background: #fff; border-bottom: 1px solid #dce5ef; }
.tool-group { display: flex; gap: 5px; flex-wrap: wrap; }
.toolbar button { padding: 7px 10px; }
.toolbar button.active { border-color: #4b92d7; background: #e6f2ff; color: #145e9d; font-weight: 700; }
.divider { width: 1px; height: 28px; flex: none; background: #cbdbe9; margin: 0 2px; }
.workspace { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 326px; min-width: 250px; max-width: min(55vw, 650px); flex: none;
  resize: horizontal; overflow: auto; background: #f6f9fd; border-right: 1px solid #d7e2ed;
  padding: 11px; display: flex; flex-direction: column; gap: 10px;
}
.panel { background: #fff; border: 1px solid #dce5ef; border-radius: 12px; padding: 12px; box-shadow: 0 2px 6px #315b800b; }
.category-panel label { display: block; font-weight: 700; margin-bottom: 7px; }
.category-field { display: flex; gap: 6px; align-items: stretch; }
.category-field input { min-width: 0; flex: 1; padding: 9px 10px; border: 1px solid #bdcbd9; border-radius: 8px; background: #fff; color: #233a54; }
.category-field select { width: 112px; flex: none; padding: 8px 6px; border: 1px solid #bdcbd9; border-radius: 8px; background: #f7fbff; color: #325a7e; cursor: pointer; font: inherit; }
.category-field select:focus-visible { outline: 3px solid #a6d2ff; outline-offset: 2px; }
.hint { font-size: 11px; color: #6d8297; line-height: 1.5; margin: 7px 0 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-heading h2 { font-size: 14px; margin: 0; }
.panel-heading span { color: #75899b; }
.objects-panel { flex: 1 0 175px; min-height: 175px; display: flex; flex-direction: column; }
.object-list { overflow: auto; flex: 1; min-height: 75px; border: 1px solid #e3eaf2; border-radius: 8px; background: #fbfcfe; }
.object-row { display: flex; align-items: center; gap: 7px; padding: 6px 7px; border-bottom: 1px solid #edf1f6; cursor: pointer; font-size: 12px; }
.object-row:hover { background: #eef6ff; }
.object-row.selected { background: #dcecff; color: #0b569f; }
.object-row input { accent-color: #2274cc; }
.object-row .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.object-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.object-row .muted { color: #8799a9; }
.visibility-actions { display: flex; gap: 6px; margin-top: 8px; }
.visibility-actions button { flex: 1; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.edit-grid button { padding: 7px 4px; font-size: 12px; }
.checkline { display: flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 12px; color: #43586c; }
.checkline input { accent-color: #216dc2; }
.viewer { position: relative; flex: 1; min-width: 0; min-height: 0; background: #e8eff6; overflow: hidden; }
.viewer canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.empty-state { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, 80%); text-align: center; color: #2e4a66; pointer-events: auto; }
.empty-state h1 { font-size: 24px; margin: 10px 0; }
.empty-state p { line-height: 1.7; color: #6a8198; }
.empty-symbol { font-size: 48px; color: #6ca7dc; }
.zoom-label { position: absolute; bottom: 7px; right: 3px; background: #ffffffd9; color: #496680; border: 1px solid #cfdeed; border-radius: 7px; padding: 4px 6px; font-size: 12px; pointer-events: none; box-shadow: 0 2px 8px #355a8020; }
.statusbar { display: flex; justify-content: space-between; gap: 12px; min-height: 30px; align-items: center; padding: 5px 12px; background: #fff; border-top: 1px solid #d7e0ea; color: #49637b; font-size: 12px; }
.statusbar #dirty { color: #bc4b31; }
dialog { border: 1px solid #c3d4e6; border-radius: 15px; box-shadow: 0 20px 65px #29476a35; width: min(440px, 92vw); max-height: min(80vh, 720px); overflow: auto; padding: 22px; color: #233a54; background: #fff; }
dialog::backdrop { background: #54739065; }
dialog h2 { font-size: 18px; margin: 0 0 10px; }
dialog p { line-height: 1.6; color: #516b82; margin: 0 0 14px; }
dialog label:not(.checkline) { display: block; font-weight: 650; margin: 12px 0 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.hidden { display: none !important; }
#helpDialog { width: min(640px, calc(100vw - 28px)); padding: 0; max-height: min(78vh, 650px); }
.help-header { position: sticky; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 15px; background: #f4f9ff; border-bottom: 1px solid #dce7f2; }
.help-header h2 { margin: 2px 0 0; font-size: 20px; }
.eyebrow { color: #3980be; font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.help-header button { border-radius: 50%; width: 32px; height: 32px; padding: 0; }
.help-content { padding: 16px 22px 22px; }
.help-content section { margin-bottom: 14px; }
.help-content h3 { margin: 0 0 5px; font-size: 14px; color: #2d6fa9; }
.help-content p { margin: 0; font-size: 13px; }
.shortcut-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding-top: 12px; border-top: 1px solid #e1eaf3; font-size: 12px; color: #516b82; }
.shortcut-grid kbd { text-align: right; font-size: 11px; }
@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; }
  .image-path { order: 3; flex: 1 0 100%; }
  .sidebar { width: 280px; }
  .toolbar { gap: 5px; }
}
@media (max-width: 700px) {
  .workspace { flex-direction: column; }
  .sidebar { resize: none; width: 100%; max-width: none; height: 255px; flex-direction: row; overflow: auto; }
  .sidebar > .panel { min-width: 225px; max-width: 310px; }
  .viewer { min-height: 250px; }
  .top-actions { flex-wrap: wrap; }
  .toolbar .divider { display: none; }
}
