/* =====================================================================
   style.css — 画像から色を抽出（カラーピッカー） ツール固有の微調整のみ。
   共通スタイルは /_shared/shirugear.css に任せる。
   ===================================================================== */

/* ドラッグ＆ドロップ枠 */
.icp-drop {
  border: 2px dashed var(--sg-border, #d1d5db);
  border-radius: var(--sg-radius, 8px);
  padding: 28px 16px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.icp-drop.is-dragover {
  border-color: var(--sg-primary, #3b5bdb);
  background: rgba(59, 91, 219, 0.06);
}
.icp-drop__text {
  margin: 0 0 12px;
  color: var(--sg-muted, #6b7280);
  font-size: 0.92rem;
  line-height: 1.6;
}
.icp-file-label {
  cursor: pointer;
}
.icp-drop__hint {
  margin-top: 12px;
}
.icp-privacy {
  margin-top: var(--sg-space-4);
}
.icp-error {
  margin-top: var(--sg-space-4);
  color: #b42318;
}

/* プレビュー Canvas */
.icp-canvas-hint {
  margin: 0 0 8px;
}
.icp-canvas-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}
.icp-canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--sg-radius, 8px);
  border: 1px solid var(--sg-border, #e5e7eb);
  cursor: crosshair;
  /* 透過画像が見やすいようチェッカー風の下地 */
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  touch-action: manipulation;
}

/* クリック地点マーカー（十字カーソル風） */
.icp-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* セクション見出し */
.icp-section-label {
  margin: 18px 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sg-muted, #555);
}

/* クリック地点の色 */
.icp-picked-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.icp-picked-swatch {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: var(--sg-radius, 10px);
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.icp-picked-codes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.icp-code {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--sg-border, #e5e7eb);
  border-radius: 8px;
  background: var(--sg-card, #fff);
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s;
}
.icp-code:hover {
  border-color: var(--sg-primary, #3b5bdb);
}
.icp-code__k {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sg-muted, #888);
  letter-spacing: 0.04em;
}
.icp-code__v {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--sg-text, #1a1a1a);
}
.icp-code.is-copied {
  border-color: var(--sg-primary, #3b5bdb);
  outline: 2px solid var(--sg-primary, #3b5bdb);
  outline-offset: 1px;
}

/* スウォッチ（ドミナント / パレット共通） */
.icp-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}
.icp-swatch {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--sg-radius, 10px);
  min-height: 88px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.08s ease;
}
.icp-swatch:hover { transform: translateY(-2px); }
.icp-swatch:active { transform: translateY(0); }
.icp-swatch__hex {
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.icp-swatch__rgb {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}
.icp-swatch__pct {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* 背景の明度に応じた文字色 */
.icp-swatch--light-text { color: #fff; }
.icp-swatch--light-text .icp-swatch__rgb,
.icp-swatch--light-text .icp-swatch__pct { color: rgba(255, 255, 255, 0.92); }
.icp-swatch--dark-text { color: #1a1a1a; }
.icp-swatch--dark-text .icp-swatch__rgb,
.icp-swatch--dark-text .icp-swatch__pct { color: rgba(0, 0, 0, 0.72); }

.icp-swatch.is-copied { outline: 2px solid var(--sg-primary, #3b5bdb); outline-offset: 2px; }

/* パレット一括コピー / エクスポート */
.icp-export {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.icp-export__btn {
  font-size: 0.85rem;
  padding: 7px 12px;
}
.icp-export__btn.is-copied {
  outline: 2px solid var(--sg-primary, #3b5bdb);
  outline-offset: 1px;
}

/* ダークテーマ時の下地・枠を馴染ませる */
.sg-dark .icp-canvas {
  border-color: rgba(255, 255, 255, 0.14);
}
.sg-dark .icp-code {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.14);
}
.sg-dark .icp-code__v {
  color: #f1f3f5;
}
@media (prefers-color-scheme: dark) {
  :root:not(.sg-light) .icp-code {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.14);
  }
  :root:not(.sg-light) .icp-code__v {
    color: #f1f3f5;
  }
}
