/* アイコン抽出・デバッグツール（SWELLテーマ変数自動追従） */
.cie-wrapper {
  --cie-accent: var(--swl-color_main, var(--wp--preset--color--primary, #0066cc));
  --cie-bg: var(--swl-color_bg, var(--wp--preset--color--base, transparent));
  --cie-surface: rgba(128, 128, 128, 0.06);
  --cie-border: rgba(128, 128, 128, 0.25);
  --cie-radius: var(--swl-radius, 8px);
  font-family: inherit;
  color: inherit;
  background: var(--cie-bg);
  max-width: 1020px;
  margin: 1.5em auto;
  padding: 1.4em;
  border: 1px solid var(--cie-border);
  border-radius: var(--cie-radius);
  box-sizing: border-box;
}
.cie-wrapper * { box-sizing: border-box; }
.cie-section { margin-bottom: 1.2em; }

/* ドロップゾーン */
.cie-dropzone {
  border: 2px dashed var(--cie-border);
  border-radius: var(--cie-radius);
  background: var(--cie-surface);
  padding: 1.8em 1em;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cie-dropzone:hover, .cie-dropzone.is-dragover {
  border-color: var(--cie-accent);
  background: rgba(128, 128, 128, 0.12);
}
.cie-drop-icon { font-size: 2em; line-height: 1.1; margin-bottom: 0.2em; }
.cie-drop-main { font-weight: bold; font-size: 1em; margin: 0.2em 0; }
.cie-drop-exts { font-size: 0.82em; opacity: 0.8; margin: 0.3em 0 0.7em; }
.cie-drop-exts code {
  background: rgba(128, 128, 128, 0.15);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  margin: 0 0.1em;
}
.cie-security-badge {
  display: inline-block;
  font-size: 0.78em;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: inherit;
  padding: 0.35em 0.8em;
  border-radius: 99px;
}

/* 健康診断バー */
.cie-health-bar {
  background: var(--cie-surface);
  border: 1px solid var(--cie-border);
  border-left: 4px solid var(--cie-accent);
  border-radius: var(--cie-radius);
  padding: 0.7em 1em;
  margin-bottom: 1.2em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6em 1.2em;
  font-size: 0.85em;
}
.cie-health-title { font-weight: bold; white-space: nowrap; }
.cie-health-items { display: flex; flex-wrap: wrap; gap: 0.4em 0.9em; }
.cie-h-pill {
  background: rgba(128, 128, 128, 0.12);
  padding: 0.15em 0.6em;
  border-radius: 4px;
  font-size: 0.92em;
}
.cie-h-pill.is-warn { background: rgba(245, 158, 11, 0.2); border: 1px solid rgba(245, 158, 11, 0.5); }
.cie-h-pill.is-good { background: rgba(16, 185, 129, 0.18); border: 1px solid rgba(16, 185, 129, 0.4); }

/* ツールバー */
.cie-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8em;
  margin-bottom: 0.8em;
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--cie-border);
}
.cie-tabs { display: flex; gap: 0.4em; flex-wrap: wrap; }
.cie-tab {
  appearance: none;
  border: 1px solid var(--cie-border);
  background: var(--cie-surface);
  color: inherit;
  padding: 0.45em 0.9em;
  border-radius: var(--cie-radius);
  cursor: pointer;
  font-size: 0.88em;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.cie-tab.is-active {
  background: var(--cie-accent);
  border-color: var(--cie-accent);
  color: #fff;
}
.cie-badge {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.05em 0.45em;
  border-radius: 99px;
  font-size: 0.82em;
}
.cie-bg-switcher {
  display: flex;
  align-items: center;
  gap: 0.3em;
  flex-wrap: wrap;
  font-size: 0.8em;
}
.cie-bg-label { opacity: 0.75; margin-right: 0.2em; }
.cie-bg-btn {
  appearance: none;
  border: 1px solid var(--cie-border);
  background: transparent;
  color: inherit;
  padding: 0.25em 0.55em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.92em;
}
.cie-bg-btn.is-active {
  background: var(--cie-accent);
  border-color: var(--cie-accent);
  color: #fff;
}

/* マスター・ディテール 2ペイン */
.cie-main-split {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 1em;
  align-items: start;
}
@media (max-width: 780px) {
  .cie-main-split { grid-template-columns: 1fr; }
}

.cie-master-pane {
  border: 1px solid var(--cie-border);
  border-radius: var(--cie-radius);
  padding: 0.8em;
  background: var(--cie-surface);
}
.cie-master-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7em;
  font-size: 0.85em;
}
.cie-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  cursor: pointer;
  user-select: none;
}
.cie-check-label input[type="checkbox"] {
  accent-color: var(--cie-accent);
  width: 1.05em;
  height: 1.05em;
  cursor: pointer;
}
.cie-selected-info { font-weight: bold; color: var(--cie-accent); }

.cie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.7em;
  max-height: 520px;
  overflow-y: auto;
  padding: 0.4em;
  border-radius: 6px;
}

/* 背景バリエーション */
.bg-checker {
  background-color: #f4f4f4;
  background-image: linear-gradient(45deg, #dcdcdc 25%, transparent 25%),
                    linear-gradient(-45deg, #dcdcdc 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #dcdcdc 75%),
                    linear-gradient(-45deg, transparent 75%, #dcdcdc 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}
.bg-light { background: #ffffff; }
.bg-dark { background: #1c1f24; }
.bg-winfolder { background: #f3f6fa; }
.bg-windesktop {
  background: linear-gradient(135deg, #1b4b8a 0%, #2a7de1 50%, #5bb2ff 100%);
}

/* アイコンカード */
.cie-card {
  position: relative;
  border: 2px solid rgba(128, 128, 128, 0.25);
  border-radius: 6px;
  padding: 0.55em 0.4em 0.45em;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(2px);
}
.bg-dark .cie-card { background: rgba(255, 255, 255, 0.05); color: #eee; }
.bg-windesktop .cie-card { background: rgba(0, 0, 0, 0.18); color: #fff; border-color: rgba(255,255,255,0.3); }
.cie-card:hover { transform: translateY(-2px); border-color: var(--cie-accent); }
.cie-card.is-active {
  border-color: var(--cie-accent);
  box-shadow: 0 0 0 2px var(--cie-accent);
}
.cie-card-cb {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--cie-accent);
  cursor: pointer;
  z-index: 2;
}
.cie-card-thumb {
  width: 56px;
  height: 56px;
  margin: 0.2em auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.cie-card-thumb img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}

/* 合成プレビュー装飾（Winフォルダ横 & デスクトップショートカット） */
.bg-winfolder .cie-card-thumb::before {
  content: "📁";
  font-size: 28px;
  margin-right: 4px;
  opacity: 0.9;
}
.bg-winfolder .cie-card-thumb img { max-width: 34px; max-height: 34px; }

.bg-windesktop .cie-card-thumb::after {
  content: "↗";
  position: absolute;
  bottom: 4px;
  left: 8px;
  width: 14px;
  height: 14px;
  background: #fff;
  color: #0066cc;
  font-size: 11px;
  font-weight: bold;
  line-height: 14px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.cie-card-title {
  font-size: 0.74em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.2em;
  font-weight: 600;
}
.cie-card-sub {
  font-size: 0.68em;
  opacity: 0.8;
  margin-top: 0.1em;
}
.cie-card-sub.is-lowdpi { color: #d97706; font-weight: bold; }
.bg-dark .cie-card-sub.is-lowdpi, .bg-windesktop .cie-card-sub.is-lowdpi { color: #fbbf24; }

/* 右ペイン（ディテール） */
.cie-detail-pane {
  border: 1px solid var(--cie-border);
  border-radius: var(--cie-radius);
  padding: 0.9em;
  background: var(--cie-surface);
  min-height: 320px;
}
.cie-detail-empty {
  text-align: center;
  opacity: 0.7;
  font-size: 0.86em;
  padding: 4em 1em;
  line-height: 1.6;
}
.cie-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--cie-border);
  padding-bottom: 0.5em;
  margin-bottom: 0.8em;
  font-size: 0.92em;
}
.cie-det-meta { font-size: 0.8em; opacity: 0.75; }

.cie-det-hero {
  display: flex;
  gap: 0.8em;
  align-items: center;
  margin-bottom: 0.9em;
}
.cie-det-preview-box {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border: 1px solid var(--cie-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cie-det-preview-box img { max-width: 64px; max-height: 64px; object-fit: contain; }
.cie-det-snippet-area { flex: 1; min-width: 0; }
.cie-mini-label { font-size: 0.74em; opacity: 0.75; margin-bottom: 0.2em; }
.cie-snippet-box {
  display: flex;
  align-items: center;
  gap: 0.3em;
  background: rgba(128, 128, 128, 0.12);
  padding: 0.25em 0.45em;
  border-radius: 4px;
  margin-bottom: 0.4em;
}
.cie-snippet-box code {
  flex: 1;
  font-size: 0.78em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cie-detail-block {
  border-top: 1px solid var(--cie-border);
  padding-top: 0.7em;
  margin-top: 0.7em;
}
.cie-block-title {
  font-size: 0.82em;
  font-weight: bold;
  margin-bottom: 0.5em;
}
.cie-tree-list {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  max-height: 210px;
  overflow-y: auto;
}
.cie-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4em;
  background: rgba(128, 128, 128, 0.08);
  padding: 0.35em 0.55em;
  border-radius: 4px;
  font-size: 0.8em;
}
.cie-tree-item-left {
  display: flex;
  align-items: center;
  gap: 0.45em;
}
.cie-tree-item-left img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(128,128,128,0.3);
  border-radius: 2px;
}

/* 簡易PNG加工オプション */
.cie-proc-controls {
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  font-size: 0.8em;
  padding-top: 0.4em;
}
.cie-proc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5em;
}
.cie-proc-row select {
  padding: 0.25em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--cie-border);
  background: var(--cie-bg);
  color: inherit;
  font-size: 0.95em;
}
.cie-proc-btns { display: flex; gap: 0.4em; flex-wrap: wrap; }

/* ボタン類 */
.cie-tiny-btn {
  appearance: none;
  border: 1px solid var(--cie-border);
  background: rgba(128, 128, 128, 0.12);
  color: inherit;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  font-size: 0.85em;
  cursor: pointer;
  white-space: nowrap;
}
.cie-tiny-btn:hover { border-color: var(--cie-accent); }

.cie-footer-actions {
  margin-top: 1.2em;
  padding-top: 1em;
  border-top: 1px solid var(--cie-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
  justify-content: space-between;
  align-items: center;
}
.cie-zip-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  flex: 1 1 360px;
}
.cie-select {
  padding: 0.6em 0.7em;
  border-radius: var(--cie-radius);
  border: 1px solid var(--cie-border);
  background: var(--cie-bg);
  color: inherit;
  font-size: 0.88em;
}
.cie-btn {
  appearance: none;
  border: 1px solid var(--cie-accent);
  background: var(--cie-accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: bold;
  padding: 0.65em 1.2em;
  border-radius: var(--cie-radius);
  cursor: pointer;
  transition: opacity 0.2s;
}
.cie-btn:hover:not(:disabled) { opacity: 0.86; }
.cie-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cie-btn-outline { background: transparent; color: var(--cie-accent); }
.cie-btn-sm { padding: 0.3em 0.7em; font-size: 0.8em; }
.cie-btn-accent-alt {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

/* 上限仕様・安全注記ボックス */
.cie-note-box {
  margin-top: 1.2em;
  padding: 0.9em 1.1em;
  background: var(--cie-surface);
  border: 1px solid var(--cie-border);
  border-radius: var(--cie-radius);
  font-size: 0.82em;
  line-height: 1.6;
  opacity: 0.9;
}
.cie-note-box ul {
  margin: 0.4em 0 0 1.2em;
  padding: 0;
}
.cie-note-box li {
  margin-bottom: 0.25em;
}