/* Separate tool styles from Create — 도구 스타일을 Create와 분리한다. */
.sm-image-tool-nav { display: flex; overflow-x: auto; background: #FFE1E9; border-top: 1px solid var(--sm-line); padding: 0 24px; gap: 28px; min-height: 44px; scrollbar-width: none; }
.sm-image-tool-nav::-webkit-scrollbar { display: none; }
.sm-image-tool-nav button { white-space: nowrap; flex: 0 0 auto; padding: 0 2px; font: 400 13px/42px SMTOWN, sans-serif; color: #43537A; border-bottom: 2px solid transparent; }
.sm-image-tool-nav button[aria-current='page'] { color: #223055; border-bottom-color: #223055; }
.sm-image-tool-nav button:focus-visible { outline: 2px solid #223055; outline-offset: -3px; }
.sm-image-working { font-weight: 700; }
.sm-image-tools { color: #223055; background: #FFE1E9; height: 100dvh; display: flex; flex-direction: column; font: 400 14px/1.5 SMTOWN, 'Malgun Gothic', sans-serif; }
.sm-image-tools [hidden] { display: none !important; }
.sm-it-workspace { display: grid; grid-template-columns: minmax(310px, 370px) minmax(0, 1fr); flex: 1; min-height: 0; }
.sm-it-controls { background: #FDEAF0; overflow-y: auto; border-right: 1px solid var(--sm-line); padding-bottom: 24px; }
.sm-it-heading { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.sm-it-heading h1 { margin: 0; font-size: 18px; font-weight: 400; letter-spacing: -.02em; }
.sm-it-description { margin: 6px 24px 20px; color: #43537A; font-size: 12px; }
.sm-it-section { border-top: 1px solid var(--sm-line); padding: 18px 24px; }
.sm-it-section-label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 12px; }
.sm-it-section-label > span:last-child:not(:first-child) { color: #43537A; }
.sm-it-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; min-width: 0; }
.sm-it-field > span, .sm-it-prompt-label { font-size: 12px; color: #43537A; }
.sm-it-field:last-child { margin-bottom: 0; }
.sm-image-tools select, .sm-image-tools textarea { font: inherit; color: #223055; background: transparent; border: 1px solid var(--sm-line); border-radius: 0; width: 100%; }
.sm-image-tools select { height: 40px; padding: 0 10px; font-size: 13px; }
.sm-image-tools textarea { padding: 12px; margin-top: 8px; resize: vertical; min-height: 84px; line-height: 1.65; }
.sm-image-tools textarea::placeholder { color: #63708B; }
.sm-image-tools :is(button, select, textarea, input):focus-visible { outline: 2px solid #43537A; outline-offset: 3px; }
.sm-image-tools button { cursor: pointer; }
.sm-image-tools :is(button, select, textarea):disabled, .sm-it-upload.is-disabled { opacity: .45; cursor: default; }
.sm-it-text-button { color: #43537A; font-size: 12px; text-underline-offset: 4px; }
.sm-it-text-button:hover { text-decoration: underline; }
.sm-it-upload { position: relative; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--sm-line); min-height: 46px; padding: 10px 12px; font-size: 12px; cursor: pointer; gap: 10px; }
.sm-it-upload:hover { background: #FFE1E9; }
.sm-it-upload > span:last-of-type { font-size: 19px; font-weight: 300; }
.sm-it-upload input, .sm-it-project label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sm-it-upload:focus-within, .sm-it-project label:focus-within { outline: 2px solid #43537A; outline-offset: 3px; }
.sm-it-source { text-align: center; margin-bottom: 10px; background: #FEF5F8; }
.sm-it-source-image { display: inline-block; position: relative; max-width: 100%; vertical-align: top; line-height: 0; }
.sm-it-source img { width: auto; height: auto; max-height: 230px; max-width: 100%; user-select: none; }
.sm-it-source-image.is-selecting { touch-action: none; cursor: crosshair; }
.sm-it-region { position: absolute; pointer-events: none; border: 2px solid #D12F76; background: #FF008012; }
.sm-it-region-controls { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 10px; font-size: 12px; }
.sm-it-region-controls button { border-bottom: 1px solid var(--sm-line); min-height: 32px; }
.sm-it-region-controls button[aria-pressed='true'] { border-color: #223055; }
.sm-it-region-controls p { flex-basis: 100%; margin: 0; color: #43537A; font-size: 11px; }
.sm-it-references { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sm-it-reference { position: relative; min-width: 0; margin-bottom: 14px; }
.sm-it-reference > img { width: 100%; height: 110px; object-fit: contain; background: #FEF5F8; }
.sm-it-reference > select { height: 34px; font-size: 12px; margin-top: 6px; }
.sm-it-reference > span { display: inline-block; padding-top: 4px; font-size: 11px; }
.sm-it-reference-actions { display: flex; justify-content: space-between; }
.sm-it-reference-actions button { width: 32px; min-height: 30px; font-size: 17px; }
.sm-it-output-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sm-it-output-options .sm-it-field { margin: 0; }
.sm-it-submit-area { padding: 18px 24px; border-top: 1px solid var(--sm-line); }
.sm-it-generate { width: 100%; min-height: 48px; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #FFC8D7; color: #223055; border: 1px solid #B998AA; font-size: 14px; }
.sm-it-generate:not(:disabled):hover { background: #FFB7CA; }
.sm-it-note { margin: 10px 0 0; color: #43537A; font-size: 11px; line-height: 1.6; }
.sm-it-error { font-size: 12px; color: #8D1947; line-height: 1.6; margin-bottom: 12px; }
.sm-it-project { margin: 2px 24px 0; padding-top: 16px; border-top: 1px solid var(--sm-line); }
.sm-it-project > div { display: flex; gap: 20px; font-size: 12px; }
.sm-it-project label { position: relative; cursor: pointer; }
.sm-it-project p { margin: 10px 0 0; color: #43537A; font-size: 11px; line-height: 1.6; }
.sm-it-output { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; background: #FEF5F8; }
.sm-it-result-heading { min-height: 50px; flex-shrink: 0; border-bottom: 1px solid var(--sm-line); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.sm-it-result-heading > span:last-child { color: #43537A; font-size: 11px; }
.sm-it-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; flex: 1; min-height: 350px; padding: 32px; }
.sm-it-empty-frame { width: 64px; height: 48px; border: 1px solid #B998AA; margin-bottom: 20px; }
.sm-it-empty p { margin: 0 0 6px; font-size: 16px; }
.sm-it-empty > span { font-size: 12px; color: #43537A; text-align: center; }
.sm-it-result-stage { display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 280px; flex: 1; }
.sm-it-result-stage img { object-fit: contain; max-height: 55dvh; max-width: 100%; width: auto; height: auto; }
.sm-it-result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 24px; border-top: 1px solid var(--sm-line); flex-shrink: 0; }
.sm-it-result-actions button { font-size: 12px; min-height: 36px; }
.sm-it-result-actions button[aria-pressed='true'] { text-decoration: underline; text-underline-offset: 4px; }
.sm-it-result-actions select { font-size: 12px; height: 36px; max-width: 180px; }
.sm-it-history { display: flex; overflow-x: auto; flex: 0 0 auto; padding: 14px 24px 4px; gap: 10px; border-top: 1px solid var(--sm-line); }
.sm-it-history button { border: 1px solid transparent; padding: 3px; flex: 0 0 auto; }
.sm-it-history button.is-selected { border-color: #223055; }
.sm-it-history img { width: 58px; height: 58px; object-fit: contain; }
.sm-it-history-note { padding: 0 24px 16px; font-size: 11px; color: #43537A; }
@media (max-width: 767px) {
  .sm-image-tool-nav { padding: 0 16px; gap: 24px; }
  .sm-image-tools { height: auto; min-height: 100dvh; }
  .sm-it-workspace { grid-template-columns: minmax(0, 1fr); }
  .sm-it-controls { overflow: visible; border-right: 0; border-bottom: 1px solid var(--sm-line); }
  .sm-it-output { overflow: visible; }
  .sm-it-heading { padding: 18px 20px 0; }
  .sm-it-description { margin-left: 20px; margin-right: 20px; }
  .sm-it-section, .sm-it-submit-area { padding: 18px 20px; }
  .sm-it-project { margin-left: 20px; margin-right: 20px; }
  .sm-image-tools textarea { font-size: 16px; }
  .sm-image-tools select { font-size: 16px; }
  .sm-it-result-stage { padding: 20px; }
  .sm-it-result-stage img { max-height: 60dvh; }
  .sm-it-result-actions { gap: 8px 18px; padding: 12px 20px; }
  .sm-it-result-actions select { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .sm-image-tools * { scroll-behavior: auto; } }

.sm-it-view-output { display: inline-block; margin-top: 12px; font-size: 12px; text-underline-offset: 4px; }
.sm-it-output { scroll-margin-top: 160px; }
.sm-image-tools * { scrollbar-width: thin; scrollbar-color: #BD9CAC transparent; }
.sm-image-tools ::-webkit-scrollbar { width: 4px; height: 4px; }
.sm-image-tools ::-webkit-scrollbar-track { background: transparent; }
.sm-image-tools ::-webkit-scrollbar-thumb { background: #BD9CAC; border-radius: 0; }

.sm-it-undo { display: flex; justify-content: space-between; align-items: center; margin: 0 24px 16px; padding: 10px 0; border-top: 1px solid var(--sm-line); border-bottom: 1px solid var(--sm-line); font-size: 12px; }
.sm-it-undo button { text-decoration: underline; text-underline-offset: 4px; min-height: 28px; }

/* Local comparison styles — 로컬 비교 화면 스타일이다. */


/* Separate work tools and image libraries — 작업 도구와 보관함을 구분한다. */
.sm-image-tool-nav { gap: 8px; padding: 0 20px; min-height: 42px; background: #FEF5F8; border-bottom: 1px solid var(--sm-line); }
.sm-image-tool-nav button { padding: 0 12px; line-height: 40px; font-size: 12px; color: #69728A; }
.sm-image-tool-nav button[aria-current='page'] { color: #223055; background: #FFE1E9; border-bottom: 2px solid #223055; }
.sm-image-tool-nav .sm-nav-library { margin-left: auto; border-left: 1px solid var(--sm-line); padding-left: 20px; }
.sm-brush-editor { padding: 18px 24px; border-bottom: 1px solid var(--sm-line); }
.sm-brush-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.sm-brush-toolbar button { padding: 6px; border-bottom: 1px solid transparent; }
.sm-brush-toolbar button[aria-pressed='true'] { border-color: #223055; }
.sm-brush-toolbar label { display: flex; align-items: center; gap: 6px; }
.sm-brush-toolbar input[type='number'] { width: 56px; background: transparent; border: 1px solid var(--sm-line); }
.sm-brush-toolbar input[type='range'] { width: 90px; accent-color: #223055; }
.sm-brush-toolbar select { width: 65px; }
.sm-brush-scroll { overflow: auto; max-height: 60dvh; margin-top: 14px; }
.sm-brush-image { position: relative; line-height: 0; }
.sm-brush-image img { width: 100%; height: auto; display: block; user-select: none; }
.sm-brush-image canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .48; filter: sepia(1) saturate(8) hue-rotate(285deg); cursor: crosshair; touch-action: none; }
.sm-camera-gizmo { width: 180px; max-width: 100%; margin: 0 auto; touch-action: none; cursor: grab; }
.sm-camera-gizmo svg { width: 100%; display: block; }
.sm-camera-slider { display: flex; align-items: center; gap: 10px; font-size: 12px; margin: 10px 0; }
.sm-camera-slider input { min-width: 0; flex: 1; accent-color: #223055; }
.sm-camera-slider span { min-width: 40px; text-align: right; }
.sm-archive-main { overflow-y: auto; flex: 1; padding-bottom: 24px; }
.sm-archive-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 24px 18px; padding: 20px 24px; }
.sm-archive-grid button { text-align: left; }
.sm-archive-grid img { display: block; width: 100%; height: 190px; object-fit: contain; background: #FEF5F8; }
.sm-archive-grid span { display: block; margin-top: 8px; font-size: 12px; }
.sm-archive-grid small { font-size: 11px; color: #69728A; }
.sm-archive-more { display: block; margin: 0 auto; padding: 12px 24px; border-bottom: 1px solid var(--sm-line); }
.sm-archive-dialog { background: #FEF5F8; color: #223055; border: 1px solid var(--sm-line); padding: 16px; max-width: 94vw; max-height: 94dvh; }
.sm-archive-dialog::backdrop { background: #22305580; }
.sm-archive-dialog > button { display: block; margin-left: auto; width: 32px; height: 32px; }
.sm-archive-dialog img { display: block; max-width: 86vw; max-height: 72dvh; object-fit: contain; }
.sm-archive-dialog > div { display: flex; gap: 24px; padding-top: 16px; }
@media(max-width:767px) {
 .sm-image-tool-nav { gap: 2px; padding: 0 12px; }
 .sm-image-tool-nav button { padding: 0 10px; font-size: 12px; }
 .sm-image-tool-nav .sm-nav-library { margin-left: 10px; padding-left: 14px; }
 .sm-archive-grid { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 16px; gap: 18px 12px; }
 .sm-archive-grid img { height: 150px; }
 .sm-brush-editor { padding: 16px; }
}


.sm-library{padding:24px;outline:none;color:#223055;background:#FEF5F8;min-height:60vh}.sm-library-heading{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.sm-library-heading h2{font-size:20px;margin-right:auto}.sm-library button,.sm-library select,.sm-library input{font:inherit;color:inherit;background:transparent;border:1px solid #22305533;padding:8px;font-size:12px}.sm-library nav{display:flex;gap:8px;padding:16px 0;overflow:auto}.sm-library nav [aria-current=page]{background:#FFE1E9}.sm-library-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:16px}.sm-library-grid article{min-width:0;display:flex;flex-direction:column;gap:5px}.sm-library-grid article button{padding:0;text-align:left;border:0}.sm-library-grid img{width:100%;height:160px;object-fit:contain;background:#FDEAF0}.sm-library-grid span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sm-library-grid small{font-size:10px;opacity:.65}.sm-library-dialog,.sm-library-preview{width:92vw;max-width:1200px;max-height:90dvh;border:1px solid #22305533;background:#FEF5F8;color:#223055;padding:16px}.sm-library-dialog::backdrop,.sm-library-preview::backdrop{background:#22305566}.sm-library-preview img{display:block;max-width:100%;max-height:80dvh;object-fit:contain;margin:auto}.sm-library-pick{font:inherit;font-size:11px;color:#223055;background:transparent;border:0;padding:8px;cursor:pointer;text-decoration:underline;text-underline-offset:3px}@media(max-width:600px){.sm-library{padding:14px}.sm-library-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.sm-library-grid img{height:130px}}

.sm-inpaint-ref-slot .sm-it-upload { min-height: 96px; border-style: dashed; }
.sm-it-field input[type="range"] { width:100%; accent-color:#223055; cursor:pointer; }

/* Keep editor and result heights while scrolling — 스크롤 중 편집기·결과 높이를 유지한다. */
.sm-it-output > .sm-brush-editor { flex: 0 0 auto; }
.sm-it-result-stage { flex: 0 0 auto; min-height: 280px; }
.sm-it-result-stage img { display: block; }
.sm-it-output > .sm-it-history { flex-shrink: 0; }

.sm-brush-scroll, .sm-fit-viewport { height: clamp(220px, 55dvh, 720px); max-height: none; overflow: auto; overscroll-behavior: contain; }
.sm-brush-image { flex: none; }
.sm-brush-image img { width:100%; height:100%; max-width:none; object-fit:contain; }
.sm-fitted-image { flex:0 0 auto; padding:18px 24px; min-width:0; }
.sm-fit-toolbar { display:flex; gap:16px; align-items:center; font-size:12px; margin-bottom:12px; }
.sm-fit-toolbar button { padding:6px 10px; border:1px solid var(--sm-line); }

.sm-library-full-frame { width:min(85vw,1100px); height:70dvh; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.sm-library-full-frame img { max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; }
.sm-archive-dialog .sm-fitted-image { width:min(82vw,1100px); }

.sm-canvas-views { display:flex; gap:18px; padding:10px 24px; flex-shrink:0; order:-1; }
.sm-canvas-views button { font-size:12px; padding:5px 0; border-bottom:1px solid transparent; }
.sm-canvas-views button[aria-pressed="true"] { border-color:#223055; }

/* Compact image-picker links — 작은 이미지 선택 버튼이다. */
.sm-saved-image-buttons{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:8px 0 0;font-size:11px}
.sm-saved-image-buttons button{padding:3px 0;border:0;background:transparent;color:var(--sm-blue,#223055);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.sm-saved-image-buttons button:disabled{opacity:.4;cursor:default}
.sm-saved-image-buttons [role=alert]{flex-basis:100%;color:#a3263e}

/* One canvas and a compact adjustment toolbar — 단일 캔버스와 작은 후보정 도구막대이다. */
.sm-photo-close-check{display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding:10px 18px;background:#FFE1E9;border-bottom:1px solid #22305522}.sm-photo-close-check span{margin-right:auto}.sm-photo-close-check button{text-decoration:underline;text-underline-offset:3px}
.sm-archive-dialog.is-editing{width:94vw;max-width:1500px;padding:0;max-height:94dvh;overflow:auto}
.sm-photo-editor{display:flex;flex-direction:column;min-width:0;color:#223055;font-size:12px;background:#FEF5F8}
.sm-photo-header,.sm-photo-toolbar,.sm-photo-options,.sm-photo-footer{display:flex;align-items:center;flex-wrap:wrap;gap:14px;padding:12px 18px;border-bottom:1px solid #22305522;flex-shrink:0}
.sm-photo-header strong{font-size:17px;font-weight:400}.sm-photo-header span{opacity:.65}.sm-photo-header button{margin-left:auto}
.sm-photo-editor button{border:0;background:transparent;color:inherit;padding:6px 4px;font:inherit;cursor:pointer}
.sm-photo-editor button:disabled{opacity:.4;cursor:default}.sm-photo-toolbar button[aria-pressed=true]{border-bottom:1px solid #223055}
.sm-photo-slider{display:flex;align-items:center;gap:8px}.sm-photo-slider input{width:110px}.sm-photo-slider output{width:28px;font-variant-numeric:tabular-nums}
.sm-photo-options input[type=text],.sm-photo-options input:not([type]){background:transparent;border:1px solid #22305533;padding:8px;min-width:220px}
.sm-photo-options input[type=color]{width:32px;height:24px;vertical-align:middle;border:0;background:transparent;padding:0}
.sm-photo-curve{width:130px;height:130px;border:1px solid #22305522;touch-action:none;overflow:visible}.sm-photo-curve circle{cursor:ns-resize}
.sm-photo-stage{height:56dvh;min-height:180px;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:12px;background:#FDEAF0}
.sm-photo-image{position:relative;height:100%;max-width:100%;width:auto;overflow:hidden}
.sm-photo-image canvas{display:block;width:100%;height:100%;max-width:100%;object-fit:contain;touch-action:none;cursor:crosshair}
.sm-photo-crop{position:absolute;border:1px solid white;outline:1px solid #223055;box-shadow:0 0 0 9999px #22305555;pointer-events:none}
.sm-photo-editor .sm-photo-text-handle{position:absolute;background:#FEF5F8cc;border:1px solid #22305566;padding:0 4px;transform:translateY(-100%);cursor:move;touch-action:none}
.sm-photo-footer{border-bottom:0}.sm-photo-footer [role=status]{margin-right:auto;font-size:11px}.sm-photo-footer button:last-child{background:#FFE1E9;padding:10px 14px}
@media(max-width:600px){.sm-photo-stage{height:44dvh}.sm-photo-options{gap:10px}.sm-photo-slider{width:100%}.sm-photo-slider input{flex:1}.sm-photo-header span{display:none}}
.sm-photo-stage{padding:0;display:block;overflow:auto}.sm-photo-image{max-width:none;max-height:none;flex:none}.sm-photo-image canvas{max-width:none;object-fit:fill}.sm-photo-stage .sm-photo-image{margin:0 auto}
