/* ============================================
   StackPrompt Lite v5 - アコーディオン構造修正版
   ・margin廃止 → paddingで階層
   ・全カード overflow:hidden
   ・高さはJS scrollHeight で制御
   ・縦ラインは ::before 擬似要素
   ============================================ */

:root {
  --bg-start: #1a1a2e;
  --bg-mid: #16213e;
  --bg-end: #0f172a;
  --card-bg: rgba(39, 43, 65, 0.88);
  --card-border: rgba(99, 102, 241, 0.28);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --radius: 12px;
  --radius-nested: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --transition: 0.25s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(165deg, var(--bg-start) 0%, var(--bg-mid) 45%, var(--bg-end) 100%);
  background-attachment: fixed;
}

.app {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.logo-link { color: inherit; text-decoration: none; }
.logo-link:hover { color: var(--accent-hover); }
.badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  margin-left: 0.3rem;
  background: var(--accent);
  color: #1a1a2e;
  border-radius: 6px;
  vertical-align: middle;
}
.logo-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  vertical-align: middle;
  border: 1px solid transparent;
  cursor: default;
}
.logo-badge-lite {
  background: var(--accent);
  color: #1a1a2e;
}
.logo-badge-lite.is-active {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.logo-badge-pro {
  background: rgba(39, 43, 65, 0.9);
  color: var(--text-muted);
  border-color: var(--card-border);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.logo-badge-pro:hover {
  color: var(--text);
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.12);
}
.header-right {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.header-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}
.header-pro-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.header-nav-link {
  margin-left: 0.25rem;
  text-decoration: none;
  font-size: 0.85rem;
}

/* AI Prompt Generator ページ (v1.5) */
.ai-prompt-main { flex: 1; padding: 1rem 0 2rem; }
.ai-prompt-wrap { max-width: 640px; margin: 0 auto; }
.ai-prompt-preparing { margin-bottom: 1rem; background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); }
.ai-prompt-preparing-title { margin: 0 0 0.35rem 0; font-size: 1rem; font-weight: 600; color: #fcd34d; }
.ai-prompt-preparing .ai-prompt-desc { margin: 0; font-size: 0.88rem; }
.ai-prompt-page-title { margin: 0 0 0.5rem 0; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.ai-prompt-desc { margin: 0 0 1.5rem 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }
.ai-prompt-form-card .ai-prompt-section-title { margin: 1rem 0 0.4rem 0; font-size: 0.95rem; font-weight: 600; color: var(--text-muted); }
.ai-prompt-form-card .ai-prompt-section-title:first-child { margin-top: 0; }
.ai-prompt-select {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  color: var(--text);
  cursor: pointer;
}
.ai-prompt-select:focus { outline: none; border-color: var(--accent); }
.ai-prompt-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}
.ai-prompt-textarea:focus { outline: none; border-color: var(--accent); }
.ai-prompt-actions { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid rgba(99, 102, 241, 0.2); }
.ai-prompt-result-card .ai-prompt-section-title { margin: 1rem 0 0.4rem 0; font-size: 0.95rem; font-weight: 600; color: var(--text-muted); }
.ai-prompt-result-card .ai-prompt-section-title:first-child { margin-top: 0; }
.ai-prompt-output {
  width: 100%;
  min-height: 80px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: ui-monospace, monospace;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  color: var(--text);
  resize: vertical;
}
.ai-prompt-copy-row { margin-top: 1rem; }
.ai-prompt-history-notice {
  margin: 1rem 0 0.5rem 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-nested);
}
.ai-prompt-history-card { margin-top: 0.5rem; }
.ai-prompt-history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.ai-prompt-history-item {
  padding: 0.6rem 0.75rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.ai-prompt-history-item pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: inherit; }

/* 辞書ライブラリ（v1.5） */
.dict-main { flex: 1; padding: 1rem 0 2rem; }
.dict-wrap { max-width: 800px; margin: 0 auto; }
.dict-root { display: flex; flex-direction: column; gap: 1rem; }
.dict-category-card { padding: 1rem 1.25rem; }
.dict-category-title { margin: 0 0 0.75rem 0; font-size: 1rem; font-weight: 600; color: var(--accent); }
.dict-tags-wrap { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.dict-tag-chip {
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: rgba(30, 33, 50, 0.6);
  color: var(--text);
}
.dict-error { color: var(--text-muted); padding: 1rem; }

/* メインレイアウト：3カラム 左25% 中央45% 右30%・各カラム個別スクロール */
.mainLayout {
  display: flex;
  gap: 24px;
  flex: 1;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
}

.mainLayout.threeCol {
  display: grid;
  grid-template-columns: minmax(240px, 60%) minmax(160px, 20%) minmax(160px, 20%);
  gap: 20px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

/* スクロールはカラム全体のみ。アコーディオン内部はスクロール禁止 */
.col-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rightCol.col-scroll {
  padding-bottom: 120px;
}
.leftCol.col-scroll,
.centerCol.col-scroll {
  padding-bottom: 1rem;
}

@media (max-width: 1200px) {
  .mainLayout.threeCol {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "left right" "center center";
  }
  .mainLayout.threeCol .leftCol { grid-area: left; }
  .mainLayout.threeCol .centerCol { grid-area: center; }
  .mainLayout.threeCol .rightCol { grid-area: right; }
  .col-scroll { max-height: none; }
}

@media (max-width: 768px) {
  .mainLayout.threeCol {
    grid-template-columns: 1fr;
    grid-template-areas: "left" "center" "right";
  }
}

.leftCol,
.leftPanel {
  min-width: 0;
}

.leftCol-top {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
  align-items: flex-start;
}
.leftCol-top-buttons {
  flex: 0 0 auto;
  min-width: 0;
}
.intro-card {
  flex: 1 1 280px;
  min-width: 0;
  max-width: 100%;
  padding: 1.25rem 1.5rem;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.intro-card-lead {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}
.intro-card-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
  line-height: 1.55;
}
.intro-card-body:last-of-type {
  margin-bottom: 0.75rem;
}
.intro-card-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.9;
  margin: 0;
  line-height: 1.45;
}

.step-guide-card {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 100%;
  padding: 1rem 1.15rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.step-guide-title {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.step-guide-steps {
  margin: 0 0 0.5rem 0;
}
.step-guide-step {
  margin: 0 0 0.5rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.step-guide-step:last-child {
  margin-bottom: 0;
}
.step-guide-icon {
  display: inline-block;
  margin-right: 0.35rem;
  font-weight: 700;
  color: var(--accent);
}
.step-guide-result {
  margin: 0.5rem 0 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
}

.centerCol {
  min-width: 0;
}

.rightCol {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 左・中央を手前に。STEPナビ等の重なり防止 */
#char-layout .leftCol {
  position: relative;
  z-index: 2;
}
#char-layout .centerCol {
  position: relative;
  z-index: 1;
}
#char-layout .step2-sidebar {
  position: relative;
  z-index: 0;
}

.leftPanel {
  width: 320px;
  flex-shrink: 0;
}

.rightPanel {
  flex: 1;
  min-width: 50%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 中央：設計キャンバス（強調・フルワイド対応） */
.canvas-card,
.canvas-accordion {
  width: 100%;
}
.canvas-card {
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.centerCol .canvas-accordion {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
.centerCol .canvas-accordion .accordionBody {
  padding: 1rem 1.25rem 1.25rem;
}
.canvas-label {
  margin: 0 0 0.5rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.canvas-inner {
  position: relative;
  min-height: 100px;
}
.canvas-textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-size: 15px;
  line-height: 1.6;
  padding: 12px 14px;
  padding-right: 80px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  color: var(--text);
  font-family: inherit;
  margin-bottom: 8px;
}
.canvas-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.canvas-copy {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
}

/* 左カラム：コピーボタンを左端に配置 */
.canvas-inner.copy-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.canvas-copy-left {
  flex-shrink: 0;
  margin: 0;
  min-width: 60px;
}
.canvas-copy-left.copy-done {
  color: var(--accent);
  transition: color 0.2s ease;
}
.canvas-inner.copy-left .canvas-textarea {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  padding-right: 14px;
}
.leftCol .canvas-accordion .accordionBody {
  padding: 0.75rem 1rem 1rem;
}
.leftCol .accordionBody .canvas-inner.copy-left {
  margin: 0;
}
.canvas-accordion .accordionBody {
  padding: 0.75rem 1rem 1rem;
}
.negativeCanvas {
  min-height: 60px;
}

/* 全クリア：日本語プロンプトの上・右寄せ・誤操作防止 */
.prompt-clear-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
.btn-clear-all-inline {
  width: auto;
  min-width: 0;
  padding: 6px 14px;
  font-size: 0.82rem;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}
.btn-clear-all-inline:hover {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text);
}

/* 日本語キャンバス：編集可能 */
.jpCanvas-textarea {
  font-size: 15px;
  line-height: 1.6;
}
.canvas-textarea-ja {
  min-height: 100px;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}
.canvas-textarea-en {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

/* STEPラベル（対象→スタイル→確定） */
.step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1rem 0 0.4rem 0;
}
.step-label.step-1 { margin-top: 0.5rem; }

/* 旧レイアウト互換 */
.jpCanvas { order: 0; }
.jpCanvas .jpPrompt { margin-top: 0; }
.jpPrompt {
  width: 100%;
  min-height: 180px;
  padding: 1rem 1.25rem;
}
.jpPrompt-note { margin: 0 0 0.5rem 0; font-size: 0.75rem; color: var(--text-muted); }
.jpPrompt-inner { position: relative; min-height: 140px; }
.jpPrompt-text,
.jpPrompt .output-ja {
  font-size: 15px;
  line-height: 1.6;
  padding-right: 120px;
  min-height: 100px;
  margin-bottom: 0;
}
.btn-clear-all {
  margin-bottom: 0;
  margin-left: auto;
  font-size: 0.85rem;
  padding: 6px 12px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}
.header-right .btn-clear-all {
  margin-left: 0.5rem;
}
.btn-clear-all:hover {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text);
}
.jpPrompt-copy {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
}

.enPanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.strengthPanel {
  flex-shrink: 0;
}

.dna-accordion .dna-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 8px 0;
}

/* 色選択ポップオーバー（supportsColor タグクリック時） */
.color-picker-popover {
  position: fixed;
  z-index: 1001;
  background: #1c2233;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow);
  min-width: 200px;
}
.color-picker-popover.hidden {
  display: none;
}
.color-picker-title {
  margin: 0 0 8px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.color-picker-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.color-picker-buttons .color-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(30, 33, 50, 0.8);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}
.color-picker-buttons .color-btn:hover {
  background: rgba(99, 102, 241, 0.2);
}

.strength-panel {
  background: var(--card-bg);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  height: 100%;
}
.strength-panel-title {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}
.strength-panel .slider-row {
  margin-bottom: 10px;
}
.strength-panel .slider-row:last-child {
  margin-bottom: 0;
}

/* Prompt Density Engine */
.density-engine-wrap {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}
.density-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.density-btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(30, 33, 50, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.density-btn:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.4);
  background: rgba(45, 50, 75, 0.6);
}
.density-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.auto-detail-boost-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.auto-detail-boost-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}
.engine-wrap,
.negative-preset-wrap {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}
.engine-label,
.negative-preset-label {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.engine-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.engine-btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(30, 33, 50, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.engine-btn:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.4);
  background: rgba(45, 50, 75, 0.6);
}
.engine-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.negative-preset-select {
  width: 100%;
  max-width: 200px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(30, 33, 50, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  cursor: pointer;
}
.intent-wrap {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}
.intent-label {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.intent-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.intent-btn {
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(30, 33, 50, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.intent-btn:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.4);
  background: rgba(45, 50, 75, 0.6);
}
.intent-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.density-label {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.density-help-btn {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease;
}
.density-help-btn:hover {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.4);
}
.btn-help-inline {
  margin-left: 4px;
  vertical-align: middle;
}
.accordionHeader .btn-help-inline {
  flex-shrink: 0;
}
.strength-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 4px;
}
.strength-value {
  font-weight: 600;
  color: var(--accent);
  margin-left: 0.25rem;
}
.strength-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(30, 33, 50, 0.9);
  accent-color: var(--accent);
  cursor: pointer;
}

/* タグの重み (Weight) パネル */
.tag-weight-accordion {
  margin-top: 0.5rem;
}
.tag-weight-hint {
  margin: 0 0 8px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.tag-weight-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.tag-weight-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.tag-weight-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}
.tag-weight-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.tag-weight-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tag-weight-slider {
  width: 70px;
  height: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}
.tag-weight-value {
  min-width: 2ch;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.8rem;
}

/* Learning Mode */
.learning-mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.learning-mode-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}
.learning-panel-wrap {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(30, 33, 50, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  max-height: 220px;
  overflow-y: auto;
}
.learning-panel-wrap.hidden {
  display: none;
}
.learning-panel-title {
  margin: 0 0 8px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.learning-panel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.learning-panel-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.8rem;
}
.learning-panel-tag {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.learning-panel-weight {
  flex-shrink: 0;
  min-width: 2.5ch;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}
.learning-panel-source {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

.compare-mode-toggle {
  margin-top: 6px;
}

/* Compare Mode：2カラム Before/After */
.compare-panel-wrap {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(30, 33, 50, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  max-height: 280px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.compare-panel-wrap.hidden {
  display: none;
}
.compare-panel-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.compare-col {
  min-width: 0;
  overflow-y: auto;
  max-height: 240px;
}
.compare-col-title {
  margin: 0 0 6px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.compare-panel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.compare-panel-row {
  font-size: 0.8rem;
  padding: 2px 0;
  color: var(--text);
}
.compare-panel-row.compare-added {
  color: #4ade80;
}
.compare-panel-row.compare-removed {
  color: #f87171;
}
.compare-panel-row.compare-modified {
  color: #facc15;
}
.compare-panel-row.compare-engine {
  color: #60a5fa;
}

/* プロンプトタグライブラリ（右カラム・常時視認・内部スクロール） */
.tag-library-collapse {
  margin-top: 0.5rem;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius);
  background: rgba(30, 33, 50, 0.5);
}
.tag-library-summary {
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.tag-library-summary::-webkit-details-marker,
.tag-library-summary::marker {
  display: none;
}
.tag-library-summary::before {
  content: '▼ ';
  font-size: 0.7rem;
  opacity: 0.8;
}
.tag-library-collapse[open] .tag-library-summary::before {
  content: '▲ ';
}
.tag-library-count {
  margin-left: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.9;
}
.tag-library-wrap {
  margin-top: 0;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 80px;
}
.tag-library-half .tag-library-wrap {
  max-height: 420px;
}
.tag-library-empty {
  margin: 0 0 0.5rem 0;
  padding: 0.5rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.tag-library-empty.hidden {
  display: none;
}
.tag-library-empty-pro {
  font-size: 0.8rem;
  color: var(--accent);
  opacity: 0.9;
}
.tag-library-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text-muted);
}

/* カスタムプロンプトタグライブラリ（Pro）モック */
.custom-tag-library-pro {
  margin-top: 0.75rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius);
  background: rgba(30, 33, 50, 0.35);
  opacity: 0.92;
}
.custom-tag-library-pro-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.custom-tag-library-pro-title {
  flex: 1;
  min-width: 0;
}
.custom-tag-library-pro-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--accent);
  color: #1a1a2e;
  letter-spacing: 0.02em;
}
.custom-tag-library-pro-wrap {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
}
.custom-tag-library-pro-add-cat {
  width: 100%;
  margin-bottom: 0.75rem;
  opacity: 0.85;
  cursor: not-allowed;
}
.custom-tag-library-pro-categories {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.custom-tag-library-pro-category {
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-nested);
  background: rgba(15, 23, 42, 0.3);
}
.custom-tag-library-pro-cat-summary {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}
.custom-tag-library-pro-cat-summary::-webkit-details-marker,
.custom-tag-library-pro-cat-summary::marker {
  display: none;
}
.custom-tag-library-pro-cat-summary::before {
  content: '▶ ';
  font-size: 0.6rem;
  opacity: 0.8;
  margin-right: 0.25rem;
}
.custom-tag-library-pro-category[open] .custom-tag-library-pro-cat-summary::before {
  content: '▼ ';
}
.custom-tag-library-pro-cat-body {
  padding: 0 0.75rem 0.6rem;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
}
.custom-tag-library-pro-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.custom-tag-library-pro-chip {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(30, 33, 50, 0.5);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.custom-tag-library-pro-chip:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
}
.custom-tag-library-pro-add-tag {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  opacity: 0.85;
  cursor: not-allowed;
}

/* 背景・環境 / 画風・効果 */
.env-style-wrap {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.25);
}
.env-style-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text-muted);
}
.env-style-content {
  padding-top: 0.25rem;
}
.env-style-add-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}
.env-style-add-pro {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.75;
  cursor: default;
  user-select: none;
}
.env-style-details .accordion-content {
  padding: 0.5rem 0.75rem 0.75rem;
}
.env-style-nested .accordion-content {
  padding: 0.4rem 0.75rem 0.75rem;
}
.env-style-nested .tagButton {
  margin: 4px 0;
}

/* 人物設計（拡張） */
.person-design-details .accordion-content {
  padding: 0.5rem 0.75rem 0.75rem;
}
.person-design-nested .accordion-content {
  padding: 0.4rem 0.75rem 0.75rem;
}
.person-design-add-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}
.person-design-add-pro {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.75;
  cursor: default;
  user-select: none;
}
.person-design-nested .tagButton {
  margin: 4px 0;
}
.person-design-age-row {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.person-design-age-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.input-age-years {
  width: 4rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  background: rgba(30, 33, 50, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 6px;
  color: var(--text);
  text-align: center;
}
.input-age-years::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}
.person-design-age-suffix {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 衣装設計 */
.outfit-design-guide {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.outfit-design-guide p {
  margin: 4px 0;
}
.outfit-guide-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}
.outfit-design-details .accordion-content {
  padding: 0.5rem 0.75rem 0.75rem;
}
.outfit-design-nested .accordion-content {
  padding: 0.4rem 0.75rem 0.75rem;
}
.outfit-design-nested .tagButton {
  margin: 4px 0;
}

/* ポーズ設計 */
.pose-design-details .accordion-content {
  padding: 0.5rem 0.75rem 0.75rem;
}
.pose-design-nested .accordion-content {
  padding: 0.4rem 0.75rem 0.75rem;
}
.pose-design-nested .tagButton {
  margin: 4px 0;
}

.tag-lib-details .accordion-content {
  padding: 0.5rem 0.75rem 0.75rem;
}
.tagButton {
  display: block;
  width: 100%;
  padding: 8px;
  margin: 4px 0;
  background: #1e2638;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 0.88rem;
  text-align: left;
  transition: background 0.2s, border-color 0.2s;
}
.tagButton:hover {
  background: #2c3754;
  border-color: rgba(99, 102, 241, 0.3);
}
.tagButton.active {
  background: rgba(63, 75, 120, 0.65);
  border-color: var(--accent);
  color: var(--accent-hover);
}
/* 色・柄・質感：カード型で視認性向上（衣装選択と一直線導線） */
.style-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.rightCol .style-card {
  margin-bottom: 0.75rem;
}
.style-accordion-wrap {
  padding: 1rem 1.25rem;
}
.style-accordion-wrap .pending-display {
  margin-bottom: 0.75rem;
}
.style-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
/* 色・柄・質感アコーディオン：初期は閉じる・排他・開時強調・展開で自然に伸びる */
.style-accordion {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  background: rgba(30, 33, 50, 0.5);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.style-accordion[open] {
  background: rgba(45, 50, 75, 0.65);
  border-color: rgba(129, 140, 248, 0.45);
}
.style-accordion-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  transition: background 0.2s ease;
}
.style-accordion-summary::-webkit-details-marker { display: none; }
.style-accordion-summary:hover {
  background: rgba(255, 255, 255, 0.04);
}
.style-accordion[open] .style-accordion-summary {
  background: rgba(255, 255, 255, 0.06);
}
.style-accordion-arrow {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-top: -0.15rem;
}
.style-accordion[open] .style-accordion-arrow {
  transform: rotate(-135deg);
  border-color: var(--accent);
}
.style-accordion-label {
  flex: 1;
}
.style-accordion-body {
  padding: 0 0.85rem 0.75rem 0.85rem;
  overflow: visible;
}
.style-accordion-body .color-spec-guide {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 8px 0;
  line-height: 1.45;
}
.color-spec-card {
  margin-bottom: 0.75rem;
}
.color-spec-title {
  font-size: 0.95rem;
  margin: 0 0 6px 0;
  color: var(--text);
}
.color-spec-guide {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 10px 0;
  line-height: 1.45;
}
/* 共通スタイル確定パネル */
.style-confirm-panel {
  margin-bottom: 1rem;
}
.style-confirm-title {
  font-size: 0.95rem;
  margin: 0 0 6px 0;
  color: var(--text);
}
.style-confirm-guide {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 10px 0;
  line-height: 1.4;
}
.material-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 4px 0;
}
.style-confirm-panel .pending-display {
  margin-bottom: 10px;
}
.pending-display {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  min-height: 1.4em;
  line-height: 1.35;
}
.style-row {
  margin-bottom: 10px;
}
.style-row-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.color-none-row {
  margin-bottom: 8px;
}
.colorNoneBtn,
.patternNoneBtn,
.materialNoneBtn {
  font-size: 0.85rem;
  margin-right: 6px;
  margin-bottom: 4px;
}
.pattern-buttons-wrap,
.material-buttons-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
}
.pattern-buttons-wrap .tagButton,
.material-buttons-wrap .tagButton {
  margin: 0;
}
.color-confirm-btn {
  margin-top: 14px;
}
/* 色ボタンはハイライトしない（選択中は colorStatus で表示のみ） */
.colorStatus {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 6px;
  min-height: 1.2em;
  color: var(--text-muted);
}
.color-scope-display {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  min-height: 1.2em;
}
.color-scope-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 6px;
}
.color-scope-row:last-of-type {
  margin-bottom: 0;
}
.color-scope-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 4.5em;
}
.color-buttons-wrap .colorButton {
  margin: 0;
}
.person-design-hair-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 8px;
}
.person-design-hair-color-row .colorButton {
  margin: 0;
}
.pattern-option {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(30, 33, 50, 0.4);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition), border-color var(--transition);
}
.pattern-option:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
}
.tag-lib-add-pro {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.75;
  cursor: default;
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  background: rgba(30, 33, 50, 0.3);
  user-select: none;
}

.card-negative {
  margin-top: 1rem;
}
.card-negative .card-title {
  color: var(--text-muted);
}
.output-negative {
  min-height: 80px;
}
.output-negative:empty::before {
  content: "タグライブラリで Negative タグをクリックして追加";
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* 英語・Negative 折りたたみアコーディオン */
.output-accordion.accordion {
  background: #1d2235;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid var(--card-border);
}
.output-accordion .accordionHeader {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.output-accordion .accordionHeader::-webkit-details-marker,
.output-accordion .accordionHeader::marker {
  display: none;
}
.output-accordion .accordionHeader::before {
  content: "▶";
  font-size: 0.75rem;
  transition: transform 0.2s;
}
.output-accordion[open] .accordionHeader::before {
  content: "▼";
}
.output-accordion .accordionBody {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
}

/* 任意タグ追加UI */
.customTagBox {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.customTagBox .customTagInput,
.customTagBox input {
  flex: 1;
  min-width: 120px;
  background: #101522;
  border: 1px solid #2d3558;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.88rem;
}
.customTagBox .customTagInput:focus,
.customTagBox input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ＋ 任意タグ追加（全体）— 右カラム最下部に1ヶ所のみ */
.globalCustom,
.globalCustomTag {
  margin-top: 1rem;
  padding: 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.25);
}
.globalCustom-title,
.globalCustomTag-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.globalCustom-input,
.globalCustomTag-input {
  width: 100%;
  box-sizing: border-box;
  background: #101522;
  border: 1px solid #2d3558;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.88rem;
  margin-bottom: 10px;
}
.globalCustom-input:focus,
.globalCustomTag-input:focus {
  outline: none;
  border-color: var(--accent);
}
.globalCustom-buttons,
.globalCustom .buttonRow,
.globalCustomTag .buttonRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.globalCustom-buttons .btn,
.globalCustomTag .buttonRow .btn {
  flex: 1;
  min-width: 100px;
}

.custom-tag-section {
  margin-bottom: 1rem;
}
.custom-tag-section:last-child {
  margin-bottom: 0;
}
.custom-tag-label {
  margin: 0 0 0.35rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.custom-tag-hint {
  margin: 0.25rem 0 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.custom-tag-dict-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 0.5rem;
}
.custom-tag-dict-row .globalCustom-input {
  flex: 1;
  margin-bottom: 0;
  min-width: 0;
}
.custom-tag-dict-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.5rem;
  min-height: 24px;
}
.custom-tag-dict-item {
  display: inline-flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.custom-tag-dict-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 6px 0 0 6px;
  border: 1px solid var(--card-border);
  border-right: none;
  background: rgba(30, 33, 50, 0.8);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.custom-tag-dict-item .custom-tag-dict-del {
  padding: 0.2rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 0 6px 6px 0;
  border: 1px solid var(--card-border);
  border-left: none;
  background: rgba(30, 33, 50, 0.8);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.custom-tag-dict-item:hover .custom-tag-dict-del {
  opacity: 1;
}
.custom-tag-dict-del:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}
.custom-tag-dict-btn:hover {
  color: var(--text);
  border-color: rgba(99, 102, 241, 0.4);
}
.custom-tag-dict-item:hover .custom-tag-dict-btn {
  border-color: rgba(99, 102, 241, 0.4);
}
.custom-tag-dict-item:hover .custom-tag-dict-del {
  border-color: rgba(99, 102, 241, 0.4);
}
.custom-tag-dict-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
}

/* 選択中タグ：英語プロンプト直下・フル幅・折り返しグリッド・ドラッグ・weight・削除ホバー */
.current-tags-below-prompt {
  width: 100%;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}
.current-tags-below-prompt-label {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
/* 選択中タグ：4列カード型（ユーザー向けUI） */
.current-tags-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  min-height: 48px;
}
.current-tag-card {
  background: rgba(30, 33, 50, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.6rem 0.65rem;
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.current-tag-card:hover {
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.2);
}
.current-tag-card:active {
  cursor: grabbing;
}
.current-tag-card-dragging {
  opacity: 0.7;
}
.current-tag-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 2.2em;
}
.current-tag-card-name {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.current-tag-card-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.current-tag-card-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 2ch;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
  transition: background 0.2s;
}
.current-tag-card-value:hover {
  background: rgba(129, 140, 248, 0.15);
}
.current-tag-card-value-input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
}
.current-tag-card-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.current-tag-card-del:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
}
.current-tag-card-slider-wrap {
  width: 100%;
}
.current-tag-card-slider {
  width: 100%;
  height: 10px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 6px;
}
.current-tag-card-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.current-tag-card-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
@media (max-width: 900px) {
  .current-tags-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .current-tags-grid {
    grid-template-columns: 1fr;
  }
}
/* タグ変更時の軽いアニメーション */
.prompt-updated {
  animation: prompt-flash 0.4s ease;
}
.tags-updated {
  animation: tags-flash 0.4s ease;
}
@keyframes prompt-flash {
  0% { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.25); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes tags-flash {
  0% { background-color: transparent; }
  30% { background-color: rgba(99, 102, 241, 0.08); }
  100% { background-color: transparent; }
}
/* タグ管理カード（一時タグ・カスタム辞書・プリセット）：プロンプト下 */
.tag-management-below {
  width: 100%;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
.tag-management-below .globalCustom-title {
  margin-bottom: 0.75rem;
}

.image-studio-send-wrap {
  margin: 0.5rem 0 0.75rem 0;
}
.image-studio-send-btn {
  text-decoration: none;
  display: inline-block;
}

/* プリセット一覧 */
.custom-tag-preset {
  margin-top: 0.5rem;
}
.btn-block {
  width: 100%;
  margin-bottom: 0.5rem;
}
.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.35rem;
}
.preset-item-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: rgba(30, 33, 50, 0.8);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.preset-item-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

/* 英語プロンプト：編集可能テキストエリア */
.englishCanvas {
  display: block;
  width: 100%;
  min-height: 100px;
  resize: vertical;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.englishCanvas:focus {
  outline: none;
  border-color: var(--accent);
}

/* サブセクション任意タグ追加 */
.sectionCustomTag {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(99, 102, 241, 0.2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.sectionCustomTag-input {
  flex: 1;
  min-width: 120px;
  padding: 6px 8px;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text);
}
.sectionCustomTag-input:focus {
  outline: none;
  border-color: var(--accent);
}
.sectionCustomTag-btn {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* 📂 呼び出し（Pro）モーダル */
.invoke-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.invoke-modal-overlay.hidden {
  display: none;
}
.invoke-modal-backdrop {
  position: absolute;
  inset: 0;
}
.invoke-modalContent {
  position: relative;
  background: #1c2233;
  padding: 20px;
  border-radius: 12px;
  width: 420px;
  max-width: 95vw;
  border: 1px solid var(--card-border);
}
.invoke-modalContent h3 {
  margin: 0 0 16px 0;
  font-size: 1rem;
  color: var(--text);
}
.dummyCard {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(30, 33, 50, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.dummyThumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  background: #2c3555;
  border-radius: 6px;
}
.dummyCardText {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--text);
}
.dummyCardSmall {
  font-size: 12px;
  opacity: 0.6;
  color: var(--text-muted);
}
.invokeProNote {
  font-size: 12px;
  opacity: 0.6;
  color: var(--text-muted);
  margin: 16px 0 12px 0;
}
.invoke-modalContent #btn-invoke-modal-close {
  width: 100%;
}

.leftPanel-top {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.proButton {
  align-self: flex-start;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--text-muted);
  cursor: pointer;
}
.proButton:hover {
  background: rgba(99, 102, 241, 0.25);
  color: var(--accent-hover);
}

/* 🎲 ランダム生成ボタン（人物設計の一番上・カラー込み自動生成） */
.random-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.random-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.85;
}
.btn-random {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: var(--accent-hover);
  transition: background 0.2s, transform 0.1s;
}
.btn-random:hover {
  background: rgba(99, 102, 241, 0.4);
}
.btn-random:active {
  transform: scale(0.98);
}

.random-config-wrap {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(30, 33, 50, 0.5);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
}
.random-config-label {
  margin: 0 0 6px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.random-config-label + .random-mode-btns,
.random-config-label + .random-age-row {
  margin-top: 2px;
}
.random-mode-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.random-mode-btn {
  padding: 0.28rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(30, 33, 50, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.random-mode-btn:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.4);
}
.random-mode-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.random-age-row {
  margin-bottom: 6px;
}
.random-age-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.random-age-val {
  font-weight: 600;
  color: var(--accent);
  margin-left: 4px;
}
.random-age-slider {
  width: 100%;
  max-width: 140px;
  height: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}
.random-preset-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.random-preset-btn {
  padding: 0.25rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(30, 33, 50, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.random-preset-btn:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.4);
}

/* 年齢表現を強化する */
.age-correction-wrap {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(99, 102, 241, 0.2);
}
.age-correction-check-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.age-correction-check-wrap:hover {
  color: var(--text);
}
.age-correction-checkbox {
  accent-color: var(--accent);
  cursor: pointer;
}
.age-correction-label {
  user-select: none;
}
.age-correction-strength-label {
  margin: 0 0 4px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.age-correction-strength {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.age-correction-strength-btn {
  padding: 0.25rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(30, 33, 50, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.age-correction-strength-btn:hover {
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.4);
}
.age-correction-strength-btn[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* 全サブアコーディオン共通：タイトル＋Proバッジヘッダー */
.sectionHeader-wrap {
  display: flex;
  align-items: center;
  list-style: none;
}
.sectionHeader-wrap::-webkit-details-marker,
.sectionHeader-wrap::marker {
  display: none;
}
.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 0.5rem;
}
.proBadge {
  font-size: 11px;
  opacity: 0.6;
  color: #9aa3ff;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}

/* 🔒 キャラクター固定（Pro表示のみ） */
.pro-lock-card {
  margin-top: 1rem;
}
.pro-lock-title {
  margin: 0 0 0.25rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.pro-lock {
  opacity: 0.5;
  font-size: 12px;
  margin: 0 0 0.5rem 0;
  color: var(--text-muted);
}
.pro-lock-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.input-character-name {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  background: rgba(30, 33, 50, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 6px;
  color: var(--text);
}
.input-character-name::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

/* キャラクター固定（右下・state保持のみ） */
.character-lock {
  padding: 1rem;
}
.character-lock-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.character-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text);
}
.character-name-input:focus {
  outline: none;
  border-color: var(--accent);
}
.character-lock-note {
  margin: 0.5rem 0 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.model-lora-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.model-lora-card-title {
  margin: 0 0 6px 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.model-lora-card-title + .model-lora-input {
  margin-top: 2px;
}
.model-lora-card-title:not(:first-child) {
  margin-top: 12px;
}
.model-lora-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 0.88rem;
  color: var(--text);
  background: rgba(20, 26, 39, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  font-family: inherit;
}
.model-lora-input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}
.model-lora-input:focus {
  outline: none;
  border-color: var(--accent);
}
.model-lora-note {
  margin: 10px 0 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 右カラム：キャラ固定・画像エリア・任意タグのまとまり */
.rightCol-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 画像貼り付けエリア（ドラッグ＆ドロップ・サムネ表示・削除可能・保存しない・少し浮かせる） */
.imageDropZone {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 16px;
}
.dropZone-wrap {
  padding: 0;
  overflow: hidden;
}
.dropZone-wrap .dropZone-clear {
  margin: 8px 12px;
  width: calc(100% - 24px);
  font-size: 0.85rem;
}
.dropZone-wrap .dropZone-clear.hidden {
  display: none;
}
.dropZone {
  padding: 16px;
  border-radius: 12px;
  background: #141a27;
  min-height: 160px;
  border: 1px dashed #2f3a55;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropZone.preview-dragover,
.preview-box.preview-dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}
.dropZone-placeholder,
.preview-placeholder {
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}
.dropZone .preview-image,
.preview-box .preview-image {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
}
.dropZone .preview-image.hidden,
.preview-box .preview-image.hidden {
  display: none;
}
.dropZone-placeholder.hidden,
.preview-placeholder.hidden {
  display: none;
}

/* 旧プレビュー互換 */
.preview-card { margin-top: 1rem; }
.preview-card-title { margin: 0 0 0.5rem 0; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.preview-box {
  margin-top: 20px;
  padding: 16px;
  border-radius: 12px;
  background: #141a27;
  min-height: 180px;
  border: 1px dashed #2f3a55;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.preview-note { margin: 0.5rem 0 0 0; font-size: 0.72rem; color: var(--text-muted); opacity: 0.9; }
.pro-placeholders {
  margin-top: 0.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.pro-placeholder-inline {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.5;
}
.hidden {
  display: none !important;
}

/* 仮選択 → 確定：画面下部固定バー */
.prompt-confirm-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.confirm-button {
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s ease;
}
.confirm-button:hover {
  background: var(--accent-hover);
}

.draft-bar {
  position: fixed;
  bottom: 70px;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.97);
  border-top: 2px solid var(--card-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  padding: 0.75rem 1.5rem;
  transition: transform 0.25s var(--transition), opacity 0.25s var(--transition);
}
.draft-bar.hidden {
  display: none !important;
}
.draft-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.draft-bar-text {
  flex: 1;
  min-width: 200px;
}
.draft-bar-summary {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.draft-bar-detail {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.draft-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.draft-bar-btn {
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  white-space: nowrap;
}
#btn-apply-draft.draft-bar-btn {
  box-shadow: 0 0 20px rgba(129, 140, 248, 0.5);
  animation: draft-btn-glow 2s ease-in-out infinite;
}
@keyframes draft-btn-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(129, 140, 248, 0.5); }
  50% { box-shadow: 0 0 28px rgba(129, 140, 248, 0.75); }
}
#btn-apply-draft.draft-bar-btn:hover {
  box-shadow: 0 0 24px rgba(129, 140, 248, 0.8);
}

/* アコーディオン切れ修正（overflow を visible に） */
details,
.accordion-details {
  overflow: visible;
}
.accordion-content {
  overflow: visible;
  max-height: none;
}
.accordion {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ----- details/summary ベースのアコーディオン ----- */
.accordion-details {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.accordion-details summary {
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  transition: background var(--transition), color var(--transition);
}
.accordion-details summary::-webkit-details-marker {
  display: none;
}
.accordion-details summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.65rem;
  color: var(--accent);
  transition: transform 0.2s;
}
.accordion-details[open] summary::before {
  transform: rotate(90deg);
}
.accordion-details summary:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text);
}
.accordion-details .accordion-content {
  padding: 0.5rem 1rem 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
}
.accordion-details.nested {
  margin-top: 0.35rem;
  background: rgba(30, 33, 50, 0.5);
  border-radius: var(--radius-nested);
  border-color: rgba(99, 102, 241, 0.15);
}
.accordion-details.nested summary {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.accordion-details.nested .accordion-content {
  padding: 0.4rem 0.75rem 0.75rem;
}

/* 3階層目：padding-leftで階層を明示・左ボーダー */
.accordion-details.nested-lv3 {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 2px solid rgba(99, 102, 241, 0.2);
}

/* オプション：日本語 + 英語（小さく薄色）・クリックでタグ追加 */
.option {
  display: block;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  background: rgba(30, 33, 50, 0.5);
  transition: border-color var(--transition), background var(--transition);
  font-size: 0.88rem;
}
.option:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
}
.option.active {
  background: rgba(63, 75, 120, 0.65);
  border-color: var(--accent);
  color: var(--accent-hover);
}
.option .eng {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 0.15rem;
}
.option.active .eng {
  color: var(--accent-hover);
}

/* ＋追加項目（未実装）：クリック不可・薄グレー・hoverで「Proで解放予定」ツールチップ */
.option-add-more {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.75;
  cursor: default;
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  background: rgba(30, 33, 50, 0.3);
  user-select: none;
}

/* カード単位：角丸・はみ出し防止 */
.acc-item {
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: border-color var(--transition);
}
.acc-item:hover {
  border-color: rgba(129, 140, 248, 0.35);
}

.acc-header {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.acc-header:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text);
}
.acc-icon {
  font-size: 0.65rem;
  color: var(--accent);
  transition: transform var(--transition);
  display: inline-block;
}
.acc-item.is-open .acc-header .acc-icon {
  transform: rotate(90deg);
}

/* 開閉する本体：高さはJSで scrollHeight / 0 に設定 */
.acc-body {
  overflow: hidden;
  height: 0;
  transition: height var(--transition);
}
.acc-body-inner {
  padding: 0 1rem 1rem;
}

/* ネスト用：paddingで階層、::beforeで縦ライン */
.acc-inner {
  position: relative;
  padding-left: 1rem;
  gap: 0.3rem;
}
.acc-inner::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(99, 102, 241, 0.4);
  border-radius: 1px;
  pointer-events: none;
}

.acc-item.nested {
  overflow: hidden;
  border-radius: var(--radius-nested);
  background: rgba(30, 33, 50, 0.5);
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.acc-item.nested:hover {
  background: rgba(30, 33, 50, 0.65);
}
.acc-header-nested {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.acc-item.nested .acc-body .acc-body-inner,
.acc-item.nested .acc-body > * {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-bottom: 0.75rem;
}
.acc-item.nested .acc-body > .block-label:first-child,
.acc-item.nested .acc-body > .radio-group:first-child,
.acc-item.nested .acc-body > .checkbox-group:first-child,
.acc-item.nested .acc-body > .notice-box:first-child {
  padding-top: 0.25rem;
}

/* 親の acc-body 内の直下コンテンツ（ネスト以外）の padding */
#accordion-root .acc-body > .block-label,
#accordion-root .acc-body > .slider-row,
#accordion-root .acc-body > .btn-save-pro,
#accordion-root .acc-body > .radio-group,
#accordion-root .acc-body > .checkbox-group {
  padding-left: 1rem;
  padding-right: 1rem;
}
#accordion-root .acc-body > .acc-inner {
  padding-left: 1rem;
  padding-right: 0;
  padding-top: 0.5rem;
  padding-bottom: 0;
}
#accordion-root .acc-body > .block-label {
  padding-top: 0.75rem;
}
#accordion-root .acc-body > .btn-save-pro {
  padding-bottom: 1rem;
  margin-top: 0.5rem;
}

.block-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding-top: 0.5rem;
  padding-bottom: 0.2rem;
}
.block-label:first-child {
  padding-top: 0;
}
.slider-row {
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.slider-label {
  display: block;
}
.slider-desc {
  margin: 0.15rem 0 0.25rem 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.85;
  line-height: 1.35;
}
.slider-row .slider {
  margin-top: 0.2rem;
}
.slider-value {
  font-weight: 600;
  color: var(--accent);
  margin-left: 0.2rem;
}
.slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(30, 33, 50, 0.9);
  accent-color: var(--accent);
  cursor: pointer;
}

.btn-save-pro {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.1s;
}
.btn-save-pro:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent);
}
.btn-save-pro:active {
  transform: scale(0.98);
}

.notice-box {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #fde68a;
}
.notice-title {
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  color: #fcd34d;
}
.notice-box p {
  margin: 0.3rem 0;
}
.note {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: 0.4rem;
}

.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.radio-option, .checkbox-option {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  background: rgba(30, 33, 50, 0.5);
  transition: border-color var(--transition), background var(--transition), transform 0.12s ease;
}
.radio-option:hover, .checkbox-option:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateX(2px);
}
.radio-option:has(input:checked), .checkbox-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.22);
  color: var(--accent-hover);
}
.radio-option input, .checkbox-option input {
  margin: 0 0.5rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.radio-option span, .checkbox-option span {
  font-size: 0.86rem;
}

.acc-body-pro .pro-placeholder {
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.35rem;
  border-radius: 8px;
  background: rgba(30, 33, 50, 0.4);
  border: 1px dashed rgba(99, 102, 241, 0.2);
  color: var(--text-muted);
  font-size: 0.82rem;
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}
.pro-placeholder:hover {
  opacity: 1;
}
.pro-placeholder[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 4px;
  padding: 0.3rem 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
  z-index: 2;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 0.6rem 0;
  color: var(--text-muted);
}
.output-ja, .output-en,
.canvas-textarea-ja, .canvas-textarea-en {
  padding: 1rem;
  border-radius: 8px;
  background: rgba(30, 33, 50, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 0.92rem;
}

.btn {
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s, box-shadow var(--transition);
}
.btn:active {
  transform: scale(0.98);
}
a.btn,
a.proButton {
  text-decoration: none;
  display: inline-block;
}
.btn-primary {
  background: var(--accent);
  color: #1a1a2e;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 12px rgba(129, 140, 248, 0.4);
}
.btn-secondary {
  background: rgba(30, 33, 50, 0.9);
  color: var(--text);
  border: 1px solid var(--card-border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
}
.btn-block {
  width: 100%;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay[hidden] {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.modal-box {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text);
}
.modal-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.modal-note {
  margin: 0 0 0.5rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.modal-lite-note {
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
  color: var(--accent);
}
.modal-box .btn {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Pro機能です / Pro版で使用可能です 用モーダル */
.pro-feature-modal[hidden] {
  display: none !important;
}
.pro-feature-modal .modal-backdrop {
  cursor: pointer;
}
.pro-feature-modal-box {
  max-width: 320px;
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.pro-feature-modal-msg {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.pro-feature-modal .modal-actions {
  justify-content: center;
  margin-top: 0.75rem;
}

/* Proモーダル内：自分の辞書（張りぼて・非アクティブ） */
.pro-modal-dict {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.2);
}
.pro-modal-dict-lead {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.pro-modal-dict-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.pro-dict-category {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  background: rgba(15, 23, 42, 0.4);
  overflow: hidden;
}
.pro-dict-category-summary {
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.pro-dict-category-summary::-webkit-details-marker,
.pro-dict-category-summary::marker {
  display: none;
}
.pro-dict-category-body {
  padding: 0 0.75rem 0.75rem;
}
.pro-dict-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.5rem;
}
.pro-dict-chip {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}
.pro-dict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pro-dict-actions .btn {
  margin: 0;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
}
.pro-dict-add-category {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.pro-dict-add-btn.disabled,
.pro-dict-del-btn.disabled,
.pro-dict-add-category.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* 右スライドヘルプパネル（モーダル廃止・作業しながら読める） */
.help-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 500px;
  max-width: 100vw;
  height: 100vh;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
  z-index: 900;
  transform: translateX(100%);
  transition: transform 0.25s ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.help-panel.is-open {
  transform: translateX(0);
}
.help-panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-nested);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.help-panel-close:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}
.help-panel-inner {
  flex: 1;
  overflow-y: auto;
  padding: 52px 1.25rem 1.5rem 1.25rem;
}
.help-panel-title {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.help-panel-content {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}
.help-panel-content section {
  margin-bottom: 1rem;
}
.help-panel-content section:last-of-type {
  margin-bottom: 0.75rem;
}
.help-panel-content h3 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}
.help-panel-content p,
.help-panel-content ul {
  margin: 0 0 0.5rem 0;
  color: var(--text-muted);
}
.help-panel-content ul {
  padding-left: 1.2rem;
}
.help-panel-content code {
  font-size: 0.85em;
  padding: 0.1rem 0.35rem;
  background: rgba(99, 102, 241, 0.2);
  border-radius: 4px;
}
.help-panel-note {
  margin: 0.5rem 0 0 0 !important;
  padding: 0.6rem 0.75rem;
  background: rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-nested);
  font-size: 0.85rem;
  color: var(--text) !important;
}

/* ヘルプパネル表示時：メイン領域に余白を確保しパラメータと重ならない */
body.help-panel-open .app {
  margin-right: 500px;
  transition: margin-right 0.25s ease-out;
}
@media (max-width: 540px) {
  .help-panel { width: 100%; }
  body.help-panel-open .app { margin-right: 0; }
}

.footer {
  margin-top: 1.5rem;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 1.2rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1001;
  font-size: 0.9rem;
}
.toast.hidden {
  display: none;
}

@media (max-width: 960px) {
  .mainLayout {
    flex-direction: column;
  }
  .leftPanel {
    width: 100%;
    position: static;
  }
  .bottomRow {
    flex-direction: column;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 0.75rem;
  }
  .acc-header {
    padding: 0.65rem 0.9rem;
  }
  #accordion-root .acc-body > .block-label,
  #accordion-root .acc-body > .slider-row,
  #accordion-root .acc-body > .btn-save-pro,
  #accordion-root .acc-body > .radio-group,
  #accordion-root .acc-body > .checkbox-group {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
  #accordion-root .acc-body > .acc-inner {
    padding-left: 0.9rem;
  }
}
