.region-editor { box-sizing:border-box; width:calc(100vw - 32px); max-width:1440px; height:calc(100dvh - 40px); max-height:960px; padding:0; border:1px solid var(--lm-border-input); border-radius:12px; color:var(--lm-text); background:var(--lm-page); font:14px/1.5 'Noto Sans SC','Microsoft YaHei',sans-serif; }
.region-editor::backdrop { background:#17191ca8; }
.region-editor[open] { display:flex; flex-direction:column; }
.region-editor * { box-sizing:border-box; }
.region-editor header,.region-editor footer { display:flex; align-items:center; gap:12px; padding:12px 16px; background:var(--lm-surface); flex-shrink:0; }
.region-editor header { border-bottom:1px solid var(--lm-divider); }
.region-editor h2 { margin:0 auto 0 0; font-size:16px; }
.region-editor h3 { margin:0 0 8px; font-size:14px; }
.region-editor button { font:inherit; min-height:34px; padding:5px 10px; border:1px solid var(--lm-border-input); border-radius:7px; background:var(--lm-surface); color:var(--lm-text); cursor:pointer; }
.region-editor button:hover:not(:disabled) { background:var(--lm-page); }
.region-editor button:disabled { opacity:.45; cursor:default; }
.region-editor :is(input,select,textarea) { font:inherit; min-width:0; border:1px solid var(--lm-border-input); border-radius:6px; background:var(--lm-surface); color:var(--lm-text); padding:6px; }
.region-editor :is(button,input,select,textarea):focus-visible { outline:2px solid var(--lm-primary); outline-offset:2px; }
.region-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:10px 16px; border-bottom:1px solid var(--lm-divider); background:var(--lm-surface); flex-shrink:0; }
.region-toolbar label { display:flex; align-items:center; gap:6px; font-size:12px; }
.region-source { max-width:100%; }
.region-source select { max-width:260px; }
.region-tools,.region-colors,.region-history { display:flex; gap:4px; }
.region-tools button[aria-pressed=true] { border-color:var(--lm-primary); background:var(--lm-primary-soft); }
.region-colors button { width:28px; min-height:28px; height:28px; padding:0; border-radius:50%; border:5px solid var(--lm-surface); background:var(--region-color) !important; box-shadow:0 0 0 1px var(--lm-divider); }
.region-colors button[aria-pressed=true] { box-shadow:0 0 0 2px var(--lm-text); }
.region-toolbar input[type=checkbox],.region-toolbar input[type=range] { accent-color:var(--lm-primary); }
.region-toolbar input[type=range] { width:90px; padding:0; }
.region-toolbar output { min-width:44px; }
.region-body { display:grid; grid-template-columns:minmax(0,1fr) 320px; flex:1; min-height:0; }
.region-viewport { display:flex; align-items:center; justify-content:center; overflow:hidden; min-width:0; min-height:0; padding:12px; }
.region-viewport canvas { display:block; flex:none; touch-action:none; cursor:crosshair; background-color:#fff; background-image:conic-gradient(#ddd 25%,#fff 0 50%,#ddd 0 75%,#fff 0); background-size:16px 16px; box-shadow:0 2px 12px #0002; }
.region-side { display:flex; flex-direction:column; min-height:0; min-width:0; padding:14px; overflow:auto; border-left:1px solid var(--lm-divider); background:var(--lm-surface); }
.region-notes { flex:0 1 auto; max-height:50%; min-height:90px; overflow:auto; }
.region-object-results { margin-bottom:12px; }
.region-object-results summary { cursor:pointer; font-weight:600; }
.region-object-results [data-objects] { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; max-height:180px; overflow:auto; padding:3px; }
.region-object-results button { display:grid; justify-items:center; align-content:start; grid-template-rows:65px auto; gap:4px; font-size:12px; min-width:0; padding:5px; }
.region-object-results canvas { width:100%; height:65px; object-fit:contain; background:var(--lm-page); }
.region-hint { font-size:12px; color:var(--lm-text-muted); margin:6px 0 12px; }
.region-list { display:grid; gap:10px; }
.region-card { border:1px solid var(--lm-divider); border-left:4px solid var(--region-color); border-radius:8px; padding:8px; min-width:0; }
.region-card > div { display:flex; align-items:center; justify-content:space-between; gap:6px; margin-bottom:6px; }
.region-card label { font-size:13px; font-weight:600; }
.region-card button { min-height:28px; padding:1px 8px; border:0; }
.region-card textarea { display:block; width:100%; min-height:64px; resize:vertical; }
.region-references { display:flex; flex-direction:column; flex:1 1 220px; min-height:190px; margin-top:14px; border-top:1px solid var(--lm-divider); padding-top:10px; }
.region-reference-search { display:flex; align-items:center; flex:none; gap:6px; margin-bottom:8px; font-size:12px; white-space:nowrap; }
.region-reference-search input { flex:1; width:0; }
.region-references [data-references] { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:max-content; align-content:start; flex:1; gap:8px; overflow:auto; min-height:0; padding:3px; }
.region-references .region-reference-card { display:grid; grid-template-rows:auto auto auto auto; align-content:start; gap:3px; padding:6px; min-width:0; font-size:12px; text-align:left; }
.region-reference-card[data-used=true] { border-color:var(--lm-primary); background:var(--lm-primary-soft); }
.region-reference-preview { position:relative; display:flex; align-items:center; justify-content:center; width:100%; min-height:80px; aspect-ratio:4/3; overflow:hidden; border-radius:4px; background:var(--lm-page); color:var(--lm-text-muted); }
.region-reference-preview img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
.region-reference-name { width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.region-reference-badge { color:var(--lm-text-muted); font-size:11px; }
.region-editor footer { border-top:1px solid var(--lm-divider); }
.region-export-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.region-export-actions label { display:flex; align-items:center; gap:6px; font-size:12px; }
.region-export-actions select { max-width:150px; }
.region-editor [data-status] { flex:1; margin:0; font-size:12px; color:var(--lm-text-muted); overflow-wrap:anywhere; }
.region-editor [data-status][data-error=true] { color:var(--danger,#b53d36); }
.region-editor button.region-primary { flex-shrink:0; background:var(--lm-primary); color:#17191c; border-color:var(--lm-primary); }
.region-editor [hidden] { display:none !important; }
@media(max-width:760px) {
  .region-editor { width:100vw; height:100dvh; max-height:none; max-width:none; border-radius:0; margin:0; }
  .region-toolbar { gap:8px; padding:8px; max-height:174px; overflow:auto; }
  .region-source { flex-basis:100%; }
  .region-source select { flex:1; max-width:calc(100% - 36px); }
  .region-body { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(130px,1fr) minmax(100px,36%); }
  .region-side { display:block; border-left:0; border-top:1px solid var(--lm-divider); padding:10px; }
  .region-notes { max-height:none; }
  .region-references { height:320px; }
  .region-editor header,.region-editor footer { padding:8px 10px; }
  .region-editor footer { gap:8px; flex-wrap:wrap; }
  .region-editor [data-status] { flex-basis:100%; }
  .region-export-actions { flex:1; flex-wrap:wrap; }
  .region-export-actions select { max-width:130px; }
}
@media(pointer:coarse) { .region-editor button { min-height:40px; } .region-colors button { width:32px; min-height:32px; height:32px; } }
