/* 图片是主角。权限状态不参与布局；移动端可视区与全屏底色分层。 */
.image-editor {
  --ie-mobile: 0;
  --ie-bg: var(--bg-base);
  --ie-surface: var(--bg-floating);
  --ie-ink: var(--text-main);
  --ie-muted: var(--text-secondary);
  --ie-line: var(--border-light);
  position: fixed; inset: 0; z-index: 10000; background: var(--ie-bg); color: var(--ie-ink);
  isolation: isolate; overscroll-behavior: none; -webkit-font-smoothing: antialiased;
}
.image-editor [hidden] { display: none !important; }
.ie-shell { position: absolute; inset: 0 auto auto 0; width: 100%; height: 100%; display: grid; grid-template-rows: 76px minmax(0, 1fr) 108px; padding: var(--app-top-inset) 32px 0; }
.ie-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; position: relative; z-index: 3; }
.ie-header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.image-editor button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.image-editor button:disabled { cursor: default; }
.ie-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--ie-ink); background: transparent; flex-shrink: 0; }
.ie-icon svg { width: 20px; height: 20px; }
.ie-back, .ie-save { justify-self: start; background: var(--bg-hover); }
.ie-save:disabled { opacity: .28; }
.ie-count { display: flex; align-items: center; justify-content: center; gap: 4px; border: 0; background: none; color: var(--ie-ink); font-size: 14px !important; font-weight: 500 !important; letter-spacing: .02em; min-height: 44px; }
.ie-count:disabled { color: var(--ie-muted); }
.ie-count svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; display: none; }
.has-points .ie-count svg { display: block; }
.ie-send { justify-self: end; background: var(--ie-ink); color: var(--ie-bg); border: 0; border-radius: 999px; min-width: 76px; min-height: 40px; padding: 9px 23px; font-size: 14px !important; font-weight: 500 !important; transition: opacity var(--transit-fast), background var(--transit-fast); }
.ie-send:disabled { opacity: .28; }
.ie-stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; }
.ie-canvas { position: relative; flex-shrink: 0; touch-action: manipulation; opacity: 0; transition: opacity var(--transit-fast); }
.image-ready .ie-canvas { opacity: 1; }
.ie-image { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.is-editing.is-annotating .ie-canvas { cursor: crosshair; }
.ie-pins { position: absolute; inset: 0; pointer-events: none; }
.ie-pin { position: absolute; transform: translate(-50%, -50%) scale(var(--ie-marker-scale, 1)); width: 26px; height: 26px; display: grid; place-items: center; border: 1.5px solid #fff; border-radius: 50%; background: #17191d; color: #fff; font-size: 12px !important; font-weight: 600 !important; pointer-events: auto; box-shadow: 0 1px 4px #0003; }
.ie-pin.is-selected { background: #fff; color: #17191d; border-color: #17191d; }
.ie-pin::after { content: ''; position: absolute; width: 44px; height: 44px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ie-footer { display: flex; align-items: center; justify-content: center; }
.ie-done-mode, .ie-reset-zoom { border: 1px solid var(--ie-line); border-radius: 999px; padding: 9px 16px; min-height: 40px; color: var(--ie-ink); font-size: 12px !important; background: var(--ie-surface); }
.ie-extra { display: none; border: 0; border-bottom: 1px solid var(--ie-line); padding: 6px 0; color: var(--ie-muted); background: none; font-size: 12px !important; }
.ie-overall { display: flex; align-items: flex-start; gap: 20px; width: min(800px, 100%); padding: 15px 20px; background: var(--ie-surface); border: 1px solid var(--ie-line); border-radius: 16px; }
.ie-overall-label { flex-shrink: 0; padding-top: 2px; font-size: 12px; line-height: 1.8; color: var(--ie-muted); }
.ie-overall-input { flex: 1; min-width: 0; resize: none; font: inherit; font-size: 14px; line-height: 1.6; border: 0; outline: none; background: transparent; color: var(--ie-ink); }
.ie-overall-input::placeholder { color: var(--ie-muted); opacity: .65; }
.ie-overall:focus-within { border-color: var(--ie-muted); }
.ie-dock { position: absolute; width: 320px; z-index: 4; }
.ie-note { background: var(--ie-surface); border: 1px solid var(--ie-line); border-radius: 18px; padding: 10px 10px 12px 18px; box-shadow: 0 12px 36px color-mix(in srgb, var(--shadow-overlay) 30%, transparent); }
.ie-note-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ie-note-title { color: var(--ie-muted); font-size: 12px; font-weight: 500; }
.ie-note-done { width: 32px; height: 32px; background: var(--ie-ink); color: var(--ie-bg); }
.ie-note-done svg { width: 17px; height: 17px; }
.ie-note-writing { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; }
.ie-note-input { display: block; flex: 1; width: 100%; min-width: 0; min-height: 54px; max-height: 180px; resize: vertical; font: inherit; font-size: 14px; line-height: 1.65; color: var(--ie-ink); background: transparent; padding: 0; border: 0; border-radius: 0; outline: none; box-shadow: none; }
.ie-note-input::placeholder { color: var(--ie-muted); opacity: .65; }
.ie-note-delete { width: 28px; height: 32px; color: var(--ie-muted); }
.ie-note-delete svg { width: 16px; height: 16px; }
.has-global .ie-dock { left: 50% !important; top: auto !important; bottom: 20px; transform: translateX(-50%); width: min(480px, calc(100% - 48px)); }
.ie-list { position: absolute; top: calc(66px + var(--app-top-inset)); left: 50%; transform: translateX(-50%); z-index: 5; width: min(340px, calc(100% - 32px)); max-height: 60%; overflow-y: auto; overscroll-behavior: contain; background: var(--ie-surface); border: 1px solid var(--ie-line); border-radius: 18px; box-shadow: 0 12px 36px color-mix(in srgb, var(--shadow-overlay) 25%, transparent); padding: 8px; }
.ie-list-note { display: flex; align-items: flex-start; width: 100%; gap: 12px; padding: 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ie-ink); text-align: left; }
.ie-list-number { flex: 0 0 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--ie-line); border-radius: 50%; font-size: 11px; }
.ie-list-text { font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.ie-status { position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 6; max-width: calc(100% - 32px); width: max-content; padding: 10px 16px; border-radius: 12px; background: var(--ie-surface); color: var(--error-text); border: 1px solid var(--ie-line); font-size: 13px; box-shadow: var(--shadow-ambient); }
.image-editor button:focus-visible { outline: 2px solid var(--ie-muted); outline-offset: 4px; }
@media (hover: hover) {
  .ie-icon:hover, .ie-list-note:hover { background: var(--bg-hover); }
  .ie-note-done:hover { background: var(--ie-ink); opacity: .8; }
  .ie-send:not(:disabled):hover { opacity: .82; }
}
@media (max-width: 760px), (hover: none) and (pointer: coarse), (max-width: 1024px) and (max-height: 500px) {
  .image-editor { --ie-mobile: 1; }
  .has-zoom .ie-stage { touch-action: none; overflow: hidden; }
  .ie-canvas { transform-origin: center; }
  .image-editor:not(.is-annotating) .ie-pins, .image-editor:not(.is-annotating) .ie-count svg { display: none; }
  .ie-footer { gap: 12px; }
  .ie-shell { padding: var(--app-top-inset) 12px env(safe-area-inset-bottom); grid-template-rows: 60px minmax(0, 1fr) 52px; }
  .ie-header { gap: 12px; padding: 0 4px; }
  .ie-back { width: 40px; height: 40px; }
  .ie-count { font-size: 14px !important; }
  .ie-send { min-width: 68px; min-height: 40px; padding: 9px 19px; }
  .ie-image { border-radius: 12px; }
  .ie-pin { width: 24px; height: 24px; font-size: 11px !important; }
  .ie-extra { font-size: 12px !important; display: block; }
  .ie-overall { display: none; }
  .has-note .ie-shell, .has-global .ie-shell { grid-template-rows: 60px minmax(0, 1fr) auto; gap: 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .has-note .ie-footer, .has-global .ie-footer { display: none; }
  .ie-dock, .has-global .ie-dock { position: relative; width: 100%; left: auto !important; top: auto !important; bottom: auto; transform: none; }
  .ie-note { padding: 8px 10px 12px 16px; border-radius: 18px; box-shadow: none; }
  .ie-note-done { width: 36px; height: 36px; }
  .ie-note-heading { min-height: 36px; }
  .ie-note-writing { margin-top: 4px; }
  .ie-note-input { font-size: 16px; min-height: 52px; max-height: 96px; resize: none; }
  .ie-note-delete { width: 36px; height: 36px; }
  .ie-note-done::after, .ie-note-delete::after { content: ''; position: absolute; width: 44px; height: 44px; }
  .ie-list { top: calc(58px + var(--app-top-inset)); }
}
@media (max-height: 500px) and (max-width: 760px) {
  .ie-shell, .has-note .ie-shell, .has-global .ie-shell { grid-template-rows: 48px minmax(0, 1fr) auto; gap: 6px; }
  .ie-note { padding-top: 6px; padding-bottom: 8px; }
  .ie-note-input { min-height: 44px; }
  .ie-footer { min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .ie-canvas, .ie-send { transition: none; }
}
