/* 색상 팔레트 생성기 위젯 — 배치·상태만. 입력·버튼 기본 모양은 auto-tool.css .lt-widget
   #imagePreviewSection 은 스크립트가 style.display='grid' 로 연다. #paletteResults·#savedPalettes 는 'block'/'none' */
.method-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.lt-widget .tab-btn { border-radius: 0; font-weight: 400; color: var(--ink2); background: var(--bg); }
.lt-widget .tab-btn + .tab-btn { border-left-width: 0; }
.lt-widget .tab-btn:first-child { border-radius: var(--radius-control) 0 0 var(--radius-control); }
.lt-widget .tab-btn:last-child { border-radius: 0 var(--radius-control) var(--radius-control) 0; }
.lt-widget .tab-btn.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.lt-widget .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.lt-widget .btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.help-text { margin: 4px 0 0; font-size: 14px; color: var(--ink3); }
.lt-widget label { display: block; margin-bottom: 8px; font-weight: 700; color: var(--ink); }

.upload-area { padding: 32px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-control); cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.upload-area:hover, .upload-area.dragover { border-color: var(--brand); background: var(--surface); }
.upload-content h2 { margin-bottom: 4px; font-size: 17px; }
.upload-content p { margin: 0 0 16px; font-size: 14px; color: var(--ink3); }

.image-preview-section { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 20px; }
.image-preview { min-width: 0; }
#imageCanvas { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); }
.extraction-controls { min-width: 0; }
.control-group { margin-bottom: 16px; }
.color-slider { display: block; width: 100%; min-height: 44px; margin: 0; accent-color: var(--brand); }
#colorCountValue, #toleranceValue { font-variant-numeric: tabular-nums; }

.mood-selection, .harmony-types, .keyword-input, .base-color-selection { margin-bottom: 20px; }
.mood-grid, .harmony-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.trend-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.lt-widget :is(.mood-btn, .harmony-btn, .category-btn) { font-weight: 400; color: var(--ink2); }
.lt-widget :is(.mood-btn, .harmony-btn, .category-btn).active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.keyword-input input { width: 100%; max-width: 440px; }
.color-input-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.color-picker { width: 56px; height: 44px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--bg); cursor: pointer; }
.color-text-input { width: 140px; font-family: var(--font-mono); }

.trend-palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.trend-palette-card { min-width: 0; cursor: pointer; border-top: 1px solid var(--line); padding-top: 8px; }
.trend-palette-card:hover h4 { color: var(--brand); }
.trend-palette-preview { display: flex; height: 48px; border: 1px solid var(--line); }
.trend-color { flex: 1 1 0; }
.trend-palette-info h4 { margin: 8px 0 2px; font-size: 15px; font-weight: 700; color: var(--ink); }
.trend-palette-info p { margin: 0; font-size: 14px; color: var(--ink3); }

.palette-results { margin-top: 24px; padding-top: 20px; border-top: 3px double var(--ink); }
.palette-display { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.color-item { min-width: 0; }
.color-preview { display: flex; align-items: flex-end; height: 88px; border: 1px solid var(--line); }
/* "클릭하여 복사" 덮개(2026-12-05부터 견본을 누르면 HEX 복사): 색 위 글자는 대비를 보장할 수 없어 화면에서는 감춘다(골든이 innerText 로 읽으므로 display:none 은 쓰지 않는다) */
.color-preview { position: relative; cursor: pointer; }
.color-preview:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.color-overlay { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.color-name { margin: 8px 0 4px; font-size: 14px; font-weight: 700; color: var(--ink); }
.color-code { min-height: 24px; padding: 2px 0; font-family: var(--font-mono); font-size: 13px; color: var(--ink2); cursor: pointer; overflow-wrap: anywhere; }
.color-code:hover { color: var(--brand); text-decoration: underline; }
.palette-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }

.color-details { padding-bottom: 12px; border-bottom: 3px double var(--ink); }
.color-details h4 { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.color-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.color-detail-item { min-width: 0; padding: 8px 0; border-top: 1px solid var(--line); }
.color-detail-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.color-detail-preview { width: 20px; height: 20px; border: 1px solid var(--line); }
.color-detail-code { font-family: var(--font-mono); font-size: 13px; color: var(--ink2); overflow-wrap: anywhere; }

.saved-palettes { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.saved-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.saved-palette-item { min-width: 0; cursor: pointer; }
.saved-palette-preview { display: flex; height: 40px; border: 1px solid var(--line); }
.saved-palette-preview > div { flex: 1 1 0; }
.saved-palette-name { margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.saved-palette-item:hover .saved-palette-name { color: var(--brand); }
.saved-palette-date { font-size: 13px; color: var(--ink3); }

.error-message, .success-message { margin-bottom: 16px; padding: 12px 16px; font-size: 15px; border: 1px solid currentColor; border-radius: var(--radius-control); }
.error-message { color: var(--danger); }
.success-message { color: var(--brand); }

/* 만드는 중 표시: 스크립트가 body 끝에 붙였다가 지운다(.lt-widget 밖) */
.generating-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); opacity: .92; }
.generating-content p { margin: 0; font-size: 16px; color: var(--ink); }
.generating-spinner { display: none; }

@media (max-width: 719px) {
  .method-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lt-widget .tab-btn, .lt-widget .tab-btn + .tab-btn { border-width: 1px; border-radius: 0; }
  .lt-widget .tab-btn:nth-child(even) { border-left-width: 0; }
  .lt-widget .tab-btn:nth-child(n+3) { border-top-width: 0; }
  .image-preview-section { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .mood-grid, .harmony-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .upload-area { padding: 24px 16px; }
}
@media (prefers-reduced-motion: reduce) { .upload-area { transition: none; } }
