/* modules/image-editor/image-editor.css  2026-11-17 23:49:20 */
/* Portable image editor styles. The selectors are module-owned and require no host CSS. */

  .image-editor-overlay,
  .modal {
    background: rgba(28, 22, 49, 0.32);
    backdrop-filter: blur(6px);
  }

  .image-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-layer-modal);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .image-editor-overlay[hidden] {
    display: none;
  }

  .image-editor-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    padding: 14px;
    gap: 12px;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: none;
    overflow: hidden;
  }

  .image-editor-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
  }

  .image-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    flex-wrap: nowrap;
    align-self: center;
    width: auto;
    min-width: 0;
    padding: 8px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    flex: 1 1 auto;
    position: relative;
    z-index: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  .image-editor-toolbar-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 0;
  }

  .image-editor-tools,
  .image-editor-window-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .image-editor-color-palette,
  .image-editor-zoom {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .image-editor-zoom {
    flex: 0 0 auto;
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px solid rgba(77, 66, 116, 0.16);
  }

  .image-editor-color-palette {
    order: 2;
    flex: 0 1 auto;
    justify-content: flex-start;
    min-width: 0;
  }

  .image-editor-tools {
    order: 1;
  }

  .image-editor-zoom {
    order: 3;
  }

  .image-editor-window-controls {
    position: static;
    z-index: 2;
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .image-editor-color {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(77, 66, 116, 0.2);
    border-radius: 999px;
    background: var(--palette-color);
    box-shadow: none;
    cursor: pointer;
  }

  .image-editor-color.is-active {
    box-shadow: 0 0 0 2px rgba(120, 88, 220, 0.5);
    transform: scale(1.06);
  }

  .image-editor-tool-btn.compact {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .image-editor-zoom-value {
    min-width: 54px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(77, 66, 116, 0.2);
    border-radius: 6px;
    background: #f7f5ff;
    color: #473a70;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
  }

  .image-editor-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(77, 66, 116, 0.2);
    border-radius: 6px;
    background: #f7f5ff;
    color: #473a70;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
  }

  .image-editor-tool-btn:hover {
    background: #efeaff;
    border-color: rgba(120, 88, 220, 0.35);
    transform: translateY(-1px);
  }

  .image-editor-tool-btn.is-active {
    background: #e5dcff;
    border-color: rgba(120, 88, 220, 0.5);
    color: #473a70;
    box-shadow: none;
  }

  .image-editor-tool-btn.primary {
    background: #e5dcff;
    border-color: rgba(120, 88, 220, 0.5);
    color: #473a70;
  }

  .image-editor-tool-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .image-editor-tool-btn.primary svg {
    stroke-width: 2;
  }

  .image-editor-tool-btn .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .image-editor-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: auto;
    max-width: none;
    max-height: none;
    border-radius: 22px;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
  }

  .image-editor-stage-viewport {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
    scrollbar-width: none;
    display: flex;
    align-items: safe center;
    justify-content: safe center;
    padding: 10px 0 0;
  }

  .image-editor-stage-viewport::-webkit-scrollbar {
    display: none;
  }

  .image-editor-stage-viewport::-webkit-scrollbar-track {
    background: rgba(117, 96, 176, 0.12);
  }

  .image-editor-stage-viewport::-webkit-scrollbar-thumb {
    min-height: 36px;
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(105, 83, 178, 0.62);
    background-clip: padding-box;
  }

  .image-editor-scrollbar {
    position: absolute;
    z-index: 8;
    border-radius: 999px;
    background: rgba(117, 96, 176, 0.14);
    pointer-events: auto;
    cursor: pointer;
  }

  .image-editor-scrollbar[hidden] {
    display: none;
  }

  .image-editor-scrollbar.is-horizontal {
    right: 12px;
    bottom: 3px;
    left: 12px;
    height: 8px;
  }

  .image-editor-scrollbar.is-vertical {
    top: 12px;
    right: 3px;
    bottom: 12px;
    width: 8px;
  }

  .image-editor-scrollbar-thumb {
    position: absolute;
    border-radius: inherit;
    background: rgba(105, 83, 178, 0.76);
    cursor: grab;
  }

  .image-editor-scrollbar-thumb:active {
    cursor: grabbing;
  }

  .image-editor-scrollbar.is-horizontal .image-editor-scrollbar-thumb {
    top: 0;
    bottom: 0;
  }

  .image-editor-scrollbar.is-vertical .image-editor-scrollbar-thumb {
    right: 0;
    left: 0;
  }

  .image-editor-overlay.is-space-pan .image-editor-stage-viewport,
  .image-editor-overlay.is-space-pan .image-editor-stage,
  .image-editor-overlay.is-space-pan .image-editor-annotation {
    cursor: grab !important;
  }

  .image-editor-overlay.is-panning .image-editor-stage-viewport,
  .image-editor-overlay.is-panning .image-editor-stage,
  .image-editor-overlay.is-panning .image-editor-annotation {
    cursor: grabbing !important;
  }

  .image-editor-stage {
    position: relative;
    display: block;
    flex: 0 0 auto;
    overflow: visible;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(93, 58, 219, 0.12);
    user-select: none;
    touch-action: none;
  }

  .image-editor-stage.is-pencil-tool {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M6 14 15.7 4.3a3 3 0 0 1 4.2 0l.8.8a3 3 0 0 1 0 4.2L9 19z' fill='%23ffffff' stroke='%2326354f' stroke-width='1.8' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M4 20 6 14 9 19z' fill='%235d3adb' stroke='%235d3adb' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='m6 14 3 5' fill='none' stroke='%2326354f' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E") 3 15, crosshair;
  }

  .image-editor-preview-image {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    border-radius: inherit;
  }

  .image-editor-annotation-layer,
  .image-editor-draft-layer {
    position: absolute;
    inset: 0;
    border-radius: inherit;
  }

  .image-editor-annotation-layer {
    pointer-events: auto;
  }

  .image-editor-draft-layer {
    pointer-events: none;
  }

  .image-editor-selection-box {
    position: absolute;
    border: 1px solid rgba(16, 156, 235, 0.95);
    background: rgba(46, 181, 255, 0.16);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
    border-radius: 12px;
    pointer-events: none;
  }

  .image-editor-annotation-host {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
  }

  .image-editor-annotation {
    position: absolute;
    pointer-events: auto;
    box-sizing: border-box;
    user-select: none;
    touch-action: none;
  }

  .image-editor-annotation-host:not(.is-editable) .image-editor-annotation {
    pointer-events: none;
  }

  .image-editor-annotation.is-selected {
    outline: 3px solid rgba(46, 181, 255, 0.98);
    outline-offset: 3px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92), 0 0 14px rgba(46, 181, 255, 0.72);
  }

  .image-editor-annotation.is-dragging {
    cursor: grabbing !important;
  }

  .image-editor-annotation.is-number,
  .image-editor-annotation.is-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 2px solid var(--image-annotation-color, rgba(93, 58, 219, 0.92));
    background: color-mix(in srgb, var(--image-annotation-color, #5d3adb) 15%, rgba(255, 255, 255, 0.8));
    color: var(--image-annotation-color, #3f2f22);
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    transform: translate(-50%, -50%);
    box-shadow: 0 8px 18px rgba(93, 58, 219, 0.16);
  }

  .image-editor-annotation.is-text {
    min-width: 110px;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 14px;
    border: 2px solid var(--image-annotation-color, rgba(93, 58, 219, 0.88));
    background: rgba(255, 255, 255, 0.8);
    color: var(--image-annotation-color, #3f2f22);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    white-space: pre-wrap;
    transform: translate(-50%, -50%);
    box-shadow: 0 8px 18px rgba(93, 58, 219, 0.12);
  }

  .image-editor-annotation.is-text[contenteditable="true"] {
    user-select: text;
    cursor: text;
    outline: 2px solid rgba(131, 99, 239, 0.28);
    outline-offset: 2px;
  }

  .image-editor-annotation.is-text.is-editing {
    box-shadow: 0 0 0 2px rgba(46, 181, 255, 0.22), 0 8px 18px rgba(93, 58, 219, 0.12);
  }

  .image-editor-annotation.is-rect {
    border: 3px solid var(--image-annotation-color, rgba(93, 58, 219, 0.92));
    background: color-mix(in srgb, var(--image-annotation-color, #5d3adb) 10%, transparent);
    border-radius: 18px;
  }

  .image-editor-annotation.is-arrow {
    overflow: visible;
    background: transparent;
    pointer-events: none;
  }

  .image-editor-annotation.is-stroke {
    overflow: visible;
    background: transparent;
    pointer-events: none;
  }

  .image-editor-annotation.is-arrow.is-selected,
  .image-editor-annotation.is-stroke.is-selected {
    outline: none;
  }

  .image-editor-annotation-arrow-svg,
  .image-editor-annotation-stroke-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
  }

  .image-editor-annotation-arrow-line {
    stroke: var(--image-annotation-color, rgba(93, 58, 219, 0.95));
    stroke-width: calc(3.2px * var(--image-annotation-render-scale, 1));
    stroke-linecap: round;
    fill: none;
  }

  .image-editor-annotation-arrow-head {
    pointer-events: none;
  }

  .image-editor-annotation-arrow-line.hit {
    stroke: transparent;
    stroke-width: calc(24px * var(--image-annotation-render-scale, 1));
    pointer-events: none;
  }

  .image-editor-annotation-stroke-line {
    stroke: var(--image-annotation-color, rgba(93, 58, 219, 0.95));
    stroke-width: calc(3.2px * var(--image-annotation-render-scale, 1));
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
  }

  .image-editor-annotation-stroke-line.hit {
    stroke: transparent;
    stroke-width: calc(24px * var(--image-annotation-render-scale, 1));
    pointer-events: none;
  }

  .image-editor-annotation-host.is-editable .image-editor-annotation-arrow-line.hit,
  .image-editor-annotation-host.is-editable .image-editor-annotation-stroke-line.hit {
    pointer-events: stroke;
    cursor: move;
  }

  .image-editor-annotation.is-arrow.is-selected .image-editor-annotation-arrow-line:not(.hit),
  .image-editor-annotation.is-stroke.is-selected .image-editor-annotation-stroke-line:not(.hit) {
    stroke: rgba(16, 156, 235, 1);
    stroke-width: calc(5px * var(--image-annotation-render-scale, 1));
    filter: drop-shadow(0 0 4px rgba(46, 181, 255, 1));
  }

  .image-editor-annotation-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 999px;
    background: rgba(16, 156, 235, 1);
    box-shadow: 0 0 0 2px rgba(16, 156, 235, 0.92), 0 3px 10px rgba(16, 156, 235, 0.45);
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: nwse-resize;
    z-index: 4;
  }

  .image-editor-annotation-handle[data-annotation-handle^="arrow-"] {
    cursor: crosshair;
  }

  .image-editor-preview-draft {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .image-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-layer-modal);
    display: none;
    pointer-events: none;
  }

  .image-preview-overlay.open {
    display: block;
  }

  .image-preview-shell {
    position: fixed;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    width: fit-content;
    height: fit-content;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    transform: translate(-50%, -50%);
    border: 1px solid rgba(88, 71, 144, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 20px 48px rgba(24, 18, 44, 0.32);
    overflow: hidden;
    pointer-events: auto;
  }

  .image-preview-shell.is-maximized {
    left: 16px !important;
    top: 16px !important;
    width: calc(100vw - 32px);
    height: calc(100vh - 32px);
    max-width: none;
    max-height: none;
    transform: none !important;
  }

  .image-preview-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 36px;
    padding: 0 8px 0 12px;
    border-bottom: 1px solid rgba(88, 71, 144, 0.14);
    background: #f7f5ff;
    color: #473a70;
    cursor: grab;
    user-select: none;
    touch-action: none;
  }

  .image-preview-titlebar:active {
    cursor: grabbing;
  }

  .image-preview-title {
    overflow: hidden;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .image-preview-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(88, 71, 144, 0.18);
    border-radius: 7px;
    background: #fff;
    color: #4d3f78;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
  }

  .image-preview-close:hover {
    border-color: rgba(120, 88, 220, 0.44);
    background: #eee9ff;
  }

  .image-preview-body {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 84px);
    padding: 12px;
    overflow: auto;
    scrollbar-gutter: stable;
    background: rgba(247, 245, 255, 0.7);
  }

  .image-preview-shell.is-maximized .image-preview-body {
    flex: 1 1 auto;
    max-width: none;
    max-height: none;
  }

  .image-preview-image {
    display: block;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
  }

  .topic-image-host.is-selected {
    box-sizing: border-box;
    border: 2px solid #39b8ff;
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(57, 184, 255, 0.32);
  }

  .topic-image-resize-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #39b8ff;
    box-shadow: 0 1px 4px rgba(22, 86, 130, 0.32);
    cursor: nwse-resize;
    pointer-events: auto;
    z-index: 4;
  }

  .image-preview-launcher {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(88, 71, 144, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #5a4a92;
    box-shadow: 0 6px 14px rgba(24, 18, 44, 0.12);
    cursor: pointer;
    pointer-events: auto;
    z-index: 3;
  }

  .image-preview-launcher:hover {
    background: rgba(245, 240, 255, 0.98);
    border-color: rgba(120, 88, 220, 0.32);
  }

  .image-preview-launcher svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
