/* AIプロンプト精密作成ツール - スタイル
 * すべてのセレクタは .apt2-wrap 配下に限定しており、他ページ・他要素へ影響しない設計。
 * Googleフォントの @import はここでは使わない（別スタイルシートとしてenqueueし、レンダリングブロックを回避）。
 */

.apt2-wrap *, .apt2-wrap *::before, .apt2-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

.apt2-wrap {
  --bg: #faf8f4;
  --surface: #f3ede3;
  --border: #ddd3c4;
  --border-light: #e8dfd2;
  --accent: #7c5c3e;
  --accent-hover: #6a4e34;
  --accent-light: #b8956a;
  --accent-pale: rgba(124,92,62,0.08);
  --text: #2e2218;
  --muted: #7a6a58;
  --muted-light: #a89880;
  --white: #fffcf7;
  --danger: #9b4a2a;
  --success: #4a7a52;
  --tag-bg: #e8ddd0;
  --tag-active: #7c5c3e;
  --tag-active-text: #fffcf7;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
  background: var(--bg);
  width: 100%;
  max-width: 100%;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.apt2-header {
  background: var(--accent);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 16px 16px 0 0;
}
.apt2-header-title { font-family: 'Shippori Mincho', serif; font-size: 1.1em; color: #fffcf7; font-weight: 600; letter-spacing: 0.06em; }
.apt2-header-sep { color: rgba(255,252,247,0.3); }
.apt2-header-sub { font-size: 0.76em; color: rgba(255,252,247,0.6); font-weight: 300; }

.apt2-tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.apt2-tabs::-webkit-scrollbar { display: none; }
.apt2-tab { padding: 12px 22px; font-size: 0.8em; font-weight: 500; color: var(--muted); cursor: pointer; border: none; background: transparent; white-space: nowrap; border-bottom: 2px solid transparent; transition: all 0.15s; font-family: 'Noto Sans JP', sans-serif; }
.apt2-tab:hover { color: var(--accent); background: var(--accent-pale); }
.apt2-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); background: var(--white); }

.apt2-main { display: flex; min-height: 1200px; position: relative; }

.apt2-input-col { flex: 4; padding: 15px 28px 15px 32px; background: var(--white); overflow-y: auto; max-height: 164vh; scrollbar-width: thin; scrollbar-color: #F2EDE7 transparent; }
.apt2-input-col::-webkit-scrollbar { width: 10px; }
.apt2-input-col::-webkit-scrollbar-track { background: transparent; }
.apt2-input-col::-webkit-scrollbar-thumb { background-color: #F2EDE7; border-radius: 10px; }

.apt2-output-box { scrollbar-width: thin; scrollbar-color: #F2EDE7 transparent; }
.apt2-output-box::-webkit-scrollbar { width: 10px; }
.apt2-output-box::-webkit-scrollbar-track { background: transparent; }
.apt2-output-box::-webkit-scrollbar-thumb { background-color: #F2EDE7; border-radius: 10px; }

.apt2-resizer { width: 5px; background: var(--border); cursor: col-resize; flex-shrink: 0; position: relative; transition: background 0.15s; touch-action: none; }
.apt2-resizer:hover, .apt2-resizer.dragging { background: var(--accent-light); }
.apt2-resizer::after { content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:2px; height:28px; background:var(--accent-light); border-radius:2px; opacity:0.5; }

.apt2-output-col { flex: 1; min-width: 180px; padding: 22px 24px 24px 20px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.apt2-output-header { display: flex; justify-content: space-between; align-items: center; }
.apt2-output-label { font-size: 0.72em; font-weight: 500; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.apt2-char-count { font-size: 0.72em; color: var(--muted-light); }

.apt2-output-box { flex: 1; background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-size: 0.82em; line-height: 1.8; color: var(--text); overflow-y: auto; font-family: 'Noto Sans JP', sans-serif; resize: none; outline: none; min-height: 600px; white-space: pre-wrap; transition: border-color 0.15s; }
.apt2-output-box:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(124,92,62,0.08); }

.apt2-copy-msg { font-size: 0.75em; color: var(--success); font-weight: 500; min-height: 1.1em; text-align: right; }

.apt2-btn-row { display: flex; flex-direction: column; gap: 8px; }
.apt2-btn-primary { width: 100%; padding: 10px 12px; background: var(--accent); color: #fffcf7; border: none; border-radius: 8px; font-family: 'Noto Sans JP', sans-serif; font-size: 0.82em; font-weight: 500; cursor: pointer; transition: background 0.15s; }
.apt2-btn-primary:hover { background: var(--accent-hover); }
.apt2-btn-ghost { width: 100%; padding: 10px 12px; background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; font-family: 'Noto Sans JP', sans-serif; font-size: 0.82em; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.apt2-btn-ghost:hover { color: var(--danger); border-color: var(--danger); }
.apt2-btn-undo { width: 100%; padding: 10px 12px; background: transparent; color: var(--muted-light); border: 1px solid var(--border-light); border-radius: 8px; font-family: 'Noto Sans JP', sans-serif; font-size: 0.82em; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.apt2-btn-undo:hover { color: var(--accent); border-color: var(--accent-light); }
.apt2-btn-undo:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.apt2-sample-btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.apt2-sample-btn { padding: 5px 12px; background: var(--tag-bg); border: 1px solid transparent; border-radius: 16px; font-size: 0.75em; color: var(--muted); cursor: pointer; transition: all 0.13s; font-family: 'Noto Sans JP', sans-serif; }
.apt2-sample-btn:hover { border-color: var(--accent-light); color: var(--accent); background: var(--accent-pale); }
.apt2-sample-btn.selected { background: var(--tag-active); color: var(--tag-active-text); border-color: var(--tag-active); }

.apt2-custom-tag-input.apt2-basic-list-pending:not(:placeholder-shown) { background: #fdeceb; border-color: #e2a8a3; }
.apt2-custom-tag-input.apt2-basic-list-pending:not(:placeholder-shown):focus { border-color: #d98884; box-shadow: 0 0 0 3px rgba(220,90,80,0.12); }

.apt2-tab[data-mode="basic"] { background: #FFD185; color: var(--text); }
.apt2-tab[data-mode="basic"]:hover { background: #ffc76b; color: var(--text); }
.apt2-tab[data-mode="basic"].active { background: #FFD185; color: var(--text); border-bottom-color: var(--accent); }

.apt2-tpl-area { background: var(--surface); border-radius: 10px; padding: 14px; }
.apt2-tpl-title { font-size: 0.7em; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; font-weight: 500; }
.apt2-tpl-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.apt2-tpl-item { display: flex; align-items: center; gap: 4px; background: var(--white); border: 1px solid var(--border-light); border-radius: 6px; padding: 5px 7px; }
.apt2-tpl-name { flex: 1; font-size: 0.75em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apt2-tpl-load { padding: 3px 7px; border: none; background: var(--accent-pale); color: var(--accent); border-radius: 4px; font-size: 0.7em; cursor: pointer; font-family: 'Noto Sans JP', sans-serif; white-space: nowrap; }
.apt2-tpl-load:hover { background: rgba(124,92,62,0.15); }
.apt2-tpl-del { padding: 3px 7px; border: none; background: rgba(155,74,42,0.08); color: var(--danger); border-radius: 4px; font-size: 0.7em; cursor: pointer; font-family: 'Noto Sans JP', sans-serif; white-space: nowrap; }
.apt2-tpl-del:hover { background: rgba(155,74,42,0.18); }
.apt2-tpl-save-row { display: flex; gap: 5px; }
.apt2-tpl-save-row input { flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; font-family: 'Noto Sans JP', sans-serif; font-size: 0.75em; background: var(--white); color: var(--text); outline: none; min-width: 0; }
.apt2-tpl-save-row input:focus { border-color: var(--accent-light); }
.apt2-tpl-save-row button { padding: 6px 10px; background: var(--accent); color: #fff; border: none; border-radius: 5px; font-size: 0.75em; cursor: pointer; font-family: 'Noto Sans JP', sans-serif; white-space: nowrap; }
.apt2-tpl-empty { font-size: 0.73em; color: var(--muted-light); }

.apt2-section-label { font-size: 0.68em; font-weight: 500; color: var(--accent); letter-spacing: 0.12em; text-transform: uppercase; margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 6px; }

.apt2-packs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.apt2-pack-card { flex: 1; min-width: 120px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: all 0.15s; }
.apt2-pack-card:hover { border-color: var(--accent-light); background: var(--accent-pale); }
.apt2-pack-card.selected { border-color: var(--accent); background: var(--accent-pale); }
.apt2-pack-icon { font-size: 1.3em; margin-bottom: 4px; }
.apt2-pack-name { font-size: 0.8em; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.apt2-pack-desc { font-size: 0.7em; color: var(--muted); line-height: 1.4; }

.apt2-role-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.apt2-role-select-col { flex: 0 0 220px; }
.apt2-role-select { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); font-family: 'Noto Sans JP', sans-serif; font-size: 0.85em; outline: none; cursor: pointer; transition: border-color 0.15s; }
.apt2-role-select:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(124,92,62,0.08); }
.apt2-role-suggest-col { flex: 1; min-width: 220px; display: flex; align-items: center; }
.apt2-role-suggest-empty { font-size: 0.73em; color: var(--muted-light); }

.apt2-field { margin-bottom: 16px; }
.apt2-field-label { font-size: 0.76em; font-weight: 500; color: var(--muted); letter-spacing: 0.04em; display: block; margin-bottom: 6px; }
.apt2-field-req { color: var(--danger); margin-left: 2px; }

.apt2-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.apt2-tag { padding: 5px 12px; background: var(--tag-bg); border: 1.5px solid transparent; border-radius: 20px; font-size: 0.78em; color: var(--muted); cursor: pointer; transition: all 0.13s; user-select: none; font-family: 'Noto Sans JP', sans-serif; }
.apt2-tag:hover { border-color: var(--accent-light); color: var(--accent); }
.apt2-tag.selected { background: var(--tag-active); color: var(--tag-active-text); border-color: var(--tag-active); }

.apt2-custom-tag-area { display: flex; flex-direction: column; gap: 4px; }
.apt2-custom-tag-row { display: flex; gap: 6px; align-items: center; }
.apt2-custom-tag-input { flex: 1; padding: 5px 10px; border: 1px dashed var(--border); border-radius: 6px; font-family: 'Noto Sans JP', sans-serif; font-size: 0.78em; color: var(--text); background: var(--white); outline: none; transition: border-color 0.13s; }
.apt2-custom-tag-input:focus { border-color: var(--accent-light); border-style: solid; }
.apt2-custom-tag-input::placeholder { color: var(--muted-light); }
.apt2-custom-tag-del { padding: 4px 8px; border: none; background: rgba(155,74,42,0.08); color: var(--danger); border-radius: 5px; font-size: 0.75em; cursor: pointer; }

.apt2-textarea { width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); font-family: 'Noto Sans JP', sans-serif; font-size: 0.88em; line-height: 1.65; resize: vertical; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.apt2-textarea:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(124,92,62,0.08); }

.apt2-extra-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.apt2-extra-item { background: var(--surface); border: 1px solid var(--border-light); border-radius: 10px; padding: 12px 14px; }
.apt2-extra-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.apt2-extra-item-header input { flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-family: 'Noto Sans JP', sans-serif; font-size: 0.82em; font-weight: 500; color: var(--text); background: var(--white); outline: none; }
.apt2-extra-item-header input:focus { border-color: var(--accent-light); }
.apt2-extra-del { padding: 5px 10px; border: none; background: rgba(155,74,42,0.09); color: var(--danger); border-radius: 6px; font-size: 0.75em; cursor: pointer; white-space: nowrap; }
.apt2-extra-del:hover { background: rgba(155,74,42,0.18); }
.apt2-extra-item textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; font-family: 'Noto Sans JP', sans-serif; font-size: 0.82em; color: var(--text); background: var(--white); resize: vertical; outline: none; min-height: 56px; line-height: 1.6; }
.apt2-extra-item textarea:focus { border-color: var(--accent-light); }

.apt2-add-field-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border: 1.5px dashed var(--accent-light); border-radius: 8px; background: transparent; color: var(--accent); font-size: 0.78em; cursor: pointer; font-family: 'Noto Sans JP', sans-serif; transition: all 0.14s; }
.apt2-add-field-btn:hover { background: var(--accent-pale); }

.apt2-rules { display: flex; flex-direction: column; gap: 8px; }
.apt2-rule-label { display: flex; align-items: center; gap: 9px; font-size: 0.83em; color: var(--text); cursor: pointer; line-height: 1.4; }
.apt2-rule-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

.apt2-format-sample { width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); font-family: 'Noto Sans JP', sans-serif; font-size: 0.85em; line-height: 1.65; resize: vertical; outline: none; min-height: 80px; }
.apt2-format-sample:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(124,92,62,0.08); }

@media (max-width: 680px) {
  .apt2-main { flex-direction: column; }
  .apt2-resizer { display: none; }
  .apt2-input-col { max-height: none; }
}
