/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #4a044e 50%, #0f172a 100%);
  --surface: rgba(255,255,255,0.07);
  --surface-hover: rgba(255,255,255,0.12);
  --border: rgba(255,255,255,0.15);
  --border-focus: rgba(167,139,250,0.6);
  --text-primary: #f1f5f9;
  --text-secondary: #e9d5ff;
  --text-muted: rgba(196,181,253,0.6);
  --accent: #a78bfa;
  --accent-dark: #7c3aed;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --radius: 10px;
  --radius-lg: 16px;
  --font: 'Noto Sans JP', 'Segoe UI', 'Hiragino Sans', sans-serif;
  --header-h: 56px;
  --blur: blur(12px);
}

body {
  font-family: var(--font);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.6;
}

/* ===== ポータルヘッダー（Nouki-Kanri と同一デザイン） ===== */
.portal-header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  height: var(--header-h); padding: 0 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.portal-header-logo {
  font-size: 1.05rem; font-weight: 700; color: #fff;
}
.portal-header-actions {
  display: flex; align-items: center; gap: 0.5rem;
}
.portal-header-back {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; color: rgba(255,255,255,0.85); text-decoration: none;
  padding: 0.3rem 0.75rem; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.2s, color 0.2s;
}
.portal-header-back:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ===== ヘッダー設定ボタン ===== */
.header-settings-btn {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; color: rgba(255,255,255,0.85);
  padding: 0.3rem 0.75rem; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent; cursor: pointer;
  font-family: var(--font);
  transition: background 0.2s, color 0.2s;
}
.header-settings-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.header-settings-btn.is-custom {
  border-color: rgba(167,139,250,0.6);
  color: #c4b5fd;
}

/* ===== サムネイルプロンプト設定モーダル ===== */
.prompt-settings-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 1rem;
}
.prompt-settings-overlay.open { display: flex; }

.prompt-settings-modal {
  background: #1e1b4b;
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 680px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.prompt-settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.prompt-settings-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.95rem; color: var(--text-primary);
}
.prompt-settings-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem; padding: 0.25rem 0.5rem;
  border-radius: 6px; transition: background 0.15s, color 0.15s;
}
.prompt-settings-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.prompt-settings-desc {
  font-size: 0.8rem; color: var(--text-muted); line-height: 1.6;
  padding: 0.75rem 1.25rem 0; flex-shrink: 0;
}
.prompt-settings-modal .field-label {
  display: block; padding: 0.75rem 1.25rem 0.3rem; flex-shrink: 0;
}
.prompt-settings-textarea {
  flex: 1; margin: 0 1.25rem;
  min-height: 260px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font); font-size: 0.8rem; line-height: 1.65;
  padding: 0.75rem;
  resize: vertical;
  transition: border-color 0.2s;
}
.prompt-settings-textarea:focus {
  outline: none; border-color: var(--border-focus);
}

.prompt-settings-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.prompt-save-btn {
  background: var(--accent-dark); border: none;
  color: #fff; font-family: var(--font);
  font-size: 0.85rem; font-weight: 600;
  padding: 0.45rem 1.25rem; border-radius: 8px;
  cursor: pointer; transition: opacity 0.2s;
}
.prompt-save-btn:hover { opacity: 0.85; }

/* ===== ログインオーバーレイ（Nouki-Kanri と同一） ===== */
#haru-login-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f172a 0%, #4a044e 50%, #0f172a 100%);
  align-items: center; justify-content: center;
  font-family: var(--font);
}
#haru-login-overlay.visible { display: flex; }
.haru-login-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: var(--blur);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%; max-width: 320px;
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
  text-align: center; color: var(--text-primary);
}
.haru-login-logo { font-size: 2.8rem; }
.haru-login-title { font-size: 1.5rem; font-weight: 700; }
.haru-login-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  background: #fff; color: #1f2937;
  border: none; border-radius: 12px;
  padding: 0.75rem 1.25rem; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; font-family: var(--font);
  transition: box-shadow 0.2s, transform 0.15s;
}
.haru-login-btn:hover { box-shadow: 0 4px 20px rgba(255,255,255,0.2); transform: translateY(-1px); }

/* ===== メインレイアウト ===== */
.main-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ===== ガラスカード ===== */
.card {
  background: var(--surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

/* ===== アコーディオン（統一） ===== */
.card.accordion {
  padding: 0;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.1rem 1.5rem;
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  font-family: var(--font);
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
}
.accordion-header:hover {
  background: rgba(255,255,255,0.04);
}
.accordion-header.open {
  border-bottom-color: var(--border);
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.accordion-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.accordion-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.accordion-chevron {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.accordion-header.open .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}
.accordion-body.open {
  max-height: 4000px;
}

.accordion-body-inner {
  padding: 1.25rem 1.5rem;
}

/* ===== アップロードエリア ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(255,255,255,0.03);
}
.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(167,139,250,0.08);
}
.upload-icon {
  font-size: 2.5rem; margin-bottom: 0.75rem;
}
.upload-title {
  font-size: 1rem; font-weight: 600; color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.upload-sub {
  font-size: 0.8rem; color: var(--text-muted);
}
.upload-formats {
  margin-top: 0.75rem;
  font-size: 0.75rem; color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border-radius: 6px; padding: 0.4rem 0.75rem;
  display: inline-block;
}

/* ファイル選択済み表示 */
.file-info {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(167,139,250,0.1);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: var(--radius); padding: 0.75rem 1rem;
}
.file-info-icon { font-size: 1.5rem; }
.file-info-name { font-weight: 600; font-size: 0.9rem; }
.file-info-size { font-size: 0.78rem; color: var(--text-muted); }
.file-clear-btn {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
  padding: 0.25rem; border-radius: 4px;
  transition: color 0.2s;
}
.file-clear-btn:hover { color: var(--danger); }

.settings-full { grid-column: 1 / -1; }

.field-label {
  display: block; font-size: 0.8rem; color: var(--text-muted);
  margin-bottom: 0.4rem; font-weight: 500;
}
select, input[type="number"], input.settings-text-input, textarea.settings-textarea {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}
select:focus, input[type="number"]:focus, input.settings-text-input:focus, textarea.settings-textarea:focus {
  border-color: var(--border-focus);
}
select option { background: #1e0a2e; color: var(--text-primary); }
select optgroup { background: #150720; color: var(--text-muted); }
textarea.settings-textarea {
  resize: vertical; min-height: 80px;
}

.start-btn {
  width: 100%; max-width: 400px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; border: none; border-radius: var(--radius-lg);
  font-family: var(--font); font-size: 1rem; font-weight: 700;
  padding: 0.9rem 2rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(102,126,234,0.4);
}
.start-btn:hover:not(:disabled) {
  opacity: 0.9; transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(102,126,234,0.5);
}
.start-btn:disabled {
  opacity: 0.45; cursor: not-allowed;
}

/* 進捗表示 */
.progress-area {
  width: 100%; max-width: 500px;
  display: none; flex-direction: column; align-items: center; gap: 0.75rem;
}
.progress-area.visible { display: flex; }
.progress-label {
  font-size: 0.875rem; color: var(--text-secondary); font-weight: 500;
}
.progress-bar-wrap {
  width: 100%; height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #a78bfa);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* エラーメッセージ */
.error-msg {
  display: none; align-items: flex-start; gap: 0.6rem;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  color: #fca5a5; font-size: 0.85rem; line-height: 1.5;
  width: 100%;
}
.error-msg.visible { display: flex; }
.error-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }

/* ===== 字幕エディタ ===== */
.editor-section { display: none; }
.editor-section.visible { display: block; }

.editor-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin-bottom: 1rem;
}
.toolbar-btn {
  display: flex; align-items: center; gap: 0.35rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-secondary);
  font-family: var(--font); font-size: 0.8rem;
  padding: 0.35rem 0.75rem; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.toolbar-btn:hover:not(:disabled) {
  background: var(--surface-hover); border-color: var(--border-focus);
}
.toolbar-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.toolbar-btn.danger:hover:not(:disabled) {
  border-color: rgba(248,113,113,0.5); color: #fca5a5;
}

/* 字幕リスト */
.subtitle-list {
  display: flex; flex-direction: column; gap: 0.5rem;
}
.subtitle-row {
  display: grid;
  grid-template-columns: 2rem 5.5rem 5.5rem 1fr auto;
  align-items: start;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  transition: border-color 0.2s;
}
.subtitle-row:hover { border-color: rgba(167,139,250,0.3); }
.subtitle-index {
  font-size: 0.75rem; color: var(--text-muted);
  padding-top: 0.3rem; text-align: right;
}
.subtitle-time {
  font-size: 0.72rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.3rem; white-space: nowrap;
}
.subtitle-text-area {
  width: 100%;
  background: transparent;
  border: none; border-bottom: 1px solid transparent;
  color: var(--text-primary);
  font-family: var(--font); font-size: 0.875rem; line-height: 1.5;
  padding: 0.15rem 0.25rem;
  resize: none; overflow: hidden;
  outline: none;
  min-height: 1.6rem;
  transition: border-color 0.15s;
}
.subtitle-text-area:focus {
  border-bottom-color: var(--border-focus);
  background: rgba(167,139,250,0.05);
  border-radius: 4px;
}
.row-reset-btn {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 0.85rem; padding: 0.2rem;
  border-radius: 4px; transition: color 0.2s;
  flex-shrink: 0; align-self: start; margin-top: 0.2rem;
}
.row-reset-btn:hover { color: var(--accent); }

.download-buttons {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
}
.dl-btn {
  display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 1.1rem;
  font-family: var(--font); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.dl-btn:hover { transform: translateY(-1px); }
.dl-btn-primary {
  background: linear-gradient(135deg, rgba(102,126,234,0.25), rgba(118,75,162,0.25));
  color: #c4b5fd; border-color: rgba(167,139,250,0.4);
}
.dl-btn-primary:hover {
  background: linear-gradient(135deg, rgba(102,126,234,0.4), rgba(118,75,162,0.4));
  border-color: rgba(167,139,250,0.7);
}
.dl-btn-secondary {
  background: var(--surface); color: var(--text-muted);
}
.dl-btn-secondary:hover { background: var(--surface-hover); color: var(--text-secondary); }

/* ===== ユーティリティ ===== */
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease both; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* ===== 要約セクション ===== */

.summary-settings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (min-width: 600px) {
  .summary-settings { grid-template-columns: 1fr 2fr; }
  .summary-settings .settings-full { grid-column: 1 / -1; }
}

.summary-start-btn {
  margin-bottom: 0.5rem;
}

.summary-result-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.summary-result-textarea {
  width: 100%;
  min-height: 180px;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.75;
  resize: vertical;
  font-family: var(--font);
  overflow-y: auto;
  transition: border-color 0.2s;
}
.summary-result-textarea:focus { outline: none; border-color: var(--border-focus); }

.summary-dl-btn { width: 100%; }

/* ===== YouTube タイトル / サムネイル セクション共通 ===== */

.yt-settings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.yt-start-btn {
  margin-bottom: 0.5rem;
}

/* ===== YouTube タイトル候補 ===== */

.title-result-area {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.title-candidate-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.title-candidate-card:hover {
  border-color: var(--border-focus);
}

.title-candidate-num {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  background: rgba(167,139,250,0.12);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.title-candidate-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.title-copy-btn {
  flex-shrink: 0;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  background: rgba(167,139,250,0.15);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: var(--font);
}
.title-copy-btn:hover {
  background: rgba(167,139,250,0.3);
  color: var(--text-primary);
}

/* ===== YouTube サムネイル候補カード ===== */

.thumbnail-result-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  transition: border-color 0.2s;
}
.thumbnail-result-card:hover {
  border-color: var(--border-focus);
}

.thumbnail-result-num {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

.thumbnail-preview-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  display: block;
  background: rgba(255,255,255,0.05);
}

.thumbnail-prompt-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.thumbnail-dl-btn {
  display: block;
  text-align: center;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  background: rgba(167,139,250,0.12);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: var(--radius);
  color: var(--accent);
  text-decoration: none;
  transition: background 0.15s;
  font-family: var(--font);
}
.thumbnail-dl-btn:hover {
  background: rgba(167,139,250,0.25);
  color: var(--text-primary);
}

/* ===== サムネイル 2段階UI ===== */

.stage-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.stage-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.stage2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.stage2-header .stage-label { margin-bottom: 0; }

.back-to-draft-btn {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.2s, border-color 0.2s;
}
.back-to-draft-btn:hover {
  color: var(--accent);
  border-color: var(--border-focus);
}

/* 草案グリッド（Step 1 結果） */
.thumbnail-draft-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.25rem;
}
@media (max-width: 640px) {
  .thumbnail-draft-grid { grid-template-columns: 1fr; }
}

/* 草案を選択するボタン */
.draft-select-btn {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(52,211,153,0.15);
  border: 1px solid rgba(52,211,153,0.35);
  border-radius: var(--radius);
  color: var(--success);
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font);
  text-align: center;
}
.draft-select-btn:hover { background: rgba(52,211,153,0.28); }

/* 選択済み草案プレビュー */
.selected-draft-wrap {
  margin-bottom: 1rem;
}
.selected-draft-img {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border-focus);
  display: block;
}

/* 人物スロット */
.person-slots-wrap { margin-bottom: 1rem; }
.person-slots-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.person-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}
.person-slot {
  position: relative;
  aspect-ratio: 1;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.15);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-align: center;
}
.person-slot:hover {
  border-color: var(--border-focus);
  background: rgba(167,139,250,0.07);
}
.person-slot-icon { font-size: 1.8rem; }
.person-slot-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.person-slot-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 0.4rem;
}
.person-slot-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.person-slot-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.65);
  font-size: 0.7rem;
  color: #fff;
  text-align: center;
  padding: 0.2rem;
}
.person-slot-clear {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(248,113,113,0.85);
  border: none;
  color: #fff;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  z-index: 1;
  transition: background 0.15s;
}
.person-slot-clear:hover { background: var(--danger); }

/* 差し替え結果 */
.swap-result-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.swap-result-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid rgba(52,211,153,0.4);
  display: block;
}

/* アコーディオン body の最大高さを拡張（Stage 2 コンテンツ対応） */
.accordion-body.open { max-height: 9000px; }
