/* ============================================================
   CSS変数（ダーク/ライトテーマ）
============================================================ */
:root {
  --bg:         #1e1e2e;
  --bg-surface: #2a2a3e;
  --bg-input:   #1a1a2a;
  --bg-hover:   #333350;
  --accent:     #7c3aed;
  --accent-light: #9f67fa;
  --accent-dim: rgba(124, 58, 237, 0.2);
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --border:     #3d3d5c;
  --border-focus: #7c3aed;
  --success:    #22c55e;
  --error:      #ef4444;
  --warning:    #f59e0b;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --header-h:   56px;
}

[data-theme="light"] {
  --bg:         #f8f9fc;
  --bg-surface: #ffffff;
  --bg-input:   #f1f3f7;
  --bg-hover:   #e8eaf0;
  --text:       #1a1a2e;
  --text-muted: #4a5568;
  --text-dim:   #9aa5b4;
  --border:     #d0d5e8;
  --border-focus: #7c3aed;
  --shadow:     0 4px 24px rgba(0,0,0,0.08);
}

/* ============================================================
   ベース
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ============================================================
   ヘッダー
============================================================ */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem;
  z-index: 100;
}

.logo {
  font-size: 1.1rem; font-weight: 700;
  color: var(--accent-light);
  white-space: nowrap;
}

.header-nav {
  display: flex; gap: 4px;
  margin: 0 auto;
}

.nav-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px 14px;
  border-radius: var(--radius); font-size: 0.9rem;
  transition: all 0.15s;
}
.nav-btn:hover { color: var(--text); background: var(--bg-hover); }
.nav-btn.active { color: var(--accent-light); background: var(--accent-dim); }

.header-right { display: flex; align-items: center; gap: 8px; }

#app { padding-top: var(--header-h); }

/* ============================================================
   ボタン
============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #6d28d9; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px 8px; font-size: 1rem;
  border-radius: var(--radius);
}
.btn-icon:hover { color: var(--text); background: var(--bg-hover); }

/* ============================================================
   フォーム
============================================================ */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 8px 12px; font-size: 0.9rem;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.form-textarea { resize: vertical; }
.form-hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; display: block; }
.required { color: var(--error); }
.form-row { display: flex; gap: 0.75rem; }
.form-group.half { flex: 1; }
.input-with-action { display: flex; gap: 8px; }
.input-with-action .form-input { flex: 1; }

/* label.toggle: .form-group label { display:block } より詳細度を同等にして後勝ちさせる */
label.toggle {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; margin-bottom: 0;
}
.toggle input { display: none; }
.toggle-slider {
  width: 52px; height: 26px; background: var(--border);
  border-radius: 13px; position: relative; transition: background 0.2s;
  flex-shrink: 0;
}
/* OFF ラベル（右側に表示） */
.toggle-slider::before {
  content: 'OFF'; position: absolute;
  right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 9px; font-weight: 700; letter-spacing: 0.3px;
  color: rgba(255,255,255,0.45); pointer-events: none;
}
/* ON ラベル（左側に表示） */
.toggle input:checked ~ .toggle-slider::before {
  content: 'ON'; left: 7px; right: auto;
  color: rgba(255,255,255,0.95);
}
/* ノブ */
.toggle-slider::after {
  content: ''; position: absolute; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked ~ .toggle-slider { background: var(--accent); }
.toggle input:checked ~ .toggle-slider::after { transform: translateX(26px); }
.toggle-label { font-size: 0.875rem; color: var(--text-muted); }

/* ============================================================
   セクション・コンテナ
============================================================ */
.section { margin-bottom: 1.25rem; }
.section-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

.screen { max-width: 1400px; margin: 0 auto; }

/* ============================================================
   メインレイアウト（2カラム）
============================================================ */
.generate-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 0;
  height: calc(100vh - var(--header-h));
}

.panel {
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 1.25rem;
}

.panel-input {
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.panel-preview {
  background: var(--bg-surface);
}

/* ============================================================
   モードタブ
============================================================ */
.mode-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 8px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s; text-align: center; position: relative;
}
.mode-tab:hover { border-color: var(--accent); }
.mode-tab.active { border-color: var(--accent); background: var(--accent-dim); }
.mode-icon { font-size: 1.2rem; }
.mode-label { font-size: 0.78rem; font-weight: 500; color: var(--text); }
.mode-badge {
  font-size: 0.65rem; padding: 1px 6px;
  background: var(--bg-hover); color: var(--text-dim);
  border-radius: 10px;
}

/* ============================================================
   ファイルアップロード
============================================================ */
.file-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem; text-align: center; color: var(--text-muted);
  transition: border-color 0.2s;
  cursor: pointer;
}
.file-upload-area:hover, .file-upload-area.drag-over { border-color: var(--accent); }
.upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.selected-files { margin-top: 0.75rem; }
.selected-file {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--bg-input);
  border-radius: var(--radius); margin-bottom: 4px; font-size: 0.85rem;
}
.selected-file-name { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-size { color: var(--text-dim); margin-left: 8px; }
.selected-file-remove { color: var(--error); cursor: pointer; background: none; border: none; padding: 0 4px; }

/* ============================================================
   折りたたみ
============================================================ */
.collapsible { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.collapsible-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; cursor: pointer;
  background: var(--bg-surface); font-size: 0.875rem; font-weight: 500;
  list-style: none;
}
.collapsible-header:hover { background: var(--bg-hover); }
.collapsible-body { padding: 1rem; border-top: 1px solid var(--border); }
.collapsible[open] .collapsible-arrow { transform: rotate(180deg); }
.collapsible-arrow { transition: transform 0.2s; font-size: 0.7rem; }

/* ============================================================
   生成ボタン・ステータス
============================================================ */
#generate-btn { position: relative; overflow: hidden; }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-message {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: var(--error); padding: 10px 14px; border-radius: var(--radius);
  font-size: 0.875rem; margin-top: 0.5rem;
}

.progress-bar {
  height: 4px; background: var(--bg-hover); border-radius: 2px;
  overflow: hidden; margin-top: 0.5rem;
}
.progress-fill {
  height: 100%; width: 0%; background: var(--accent);
  transition: width 0.3s;
  animation: progress-pulse 1.5s ease-in-out infinite;
}
@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.status-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; text-align: center; }
.status-message { font-size: 0.85rem; margin-top: 6px; padding: 6px 10px; border-radius: var(--radius); }
.status-message.success { background: rgba(34,197,94,0.1); color: var(--success); }
.status-message.error { background: rgba(239,68,68,0.1); color: var(--error); }

/* ============================================================
   プレビューパネル
============================================================ */
.preview-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text-dim); gap: 0.75rem;
}
.preview-empty-icon { font-size: 3rem; }

.preview-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem;
}
.preview-toolbar-left { display: flex; gap: 4px; }
.preview-toolbar-right { display: flex; gap: 8px; }

.preview-title-input {
  width: 100%; font-size: 1.5rem; font-weight: 700;
  background: none; border: none; color: var(--text);
  padding: 0.5rem 0; border-bottom: 2px solid transparent;
  margin-bottom: 1rem; font-family: inherit;
}
.preview-title-input:focus { outline: none; border-bottom-color: var(--accent); }

/* ============================================================
   noteっぽいプレビュー
============================================================ */
.note-article {
  max-width: 680px;
  line-height: 1.9;
  font-size: 0.95rem;
}

[data-theme="light"] .note-article {
  color: #1a1a2e;
}

.note-article h1, .note-article h2, .note-article h3 {
  font-weight: 700; line-height: 1.4; margin: 1.5em 0 0.5em;
}
.note-article h1 { font-size: 1.5rem; }
.note-article h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.25em; }
.note-article h3 { font-size: 1.1rem; }
.note-article p { margin: 0.75em 0; }
.note-article ul, .note-article ol { padding-left: 1.5em; margin: 0.75em 0; }
.note-article li { margin: 0.3em 0; }
.note-article strong { font-weight: 700; }
.note-article em { font-style: italic; }
.note-article code {
  background: var(--bg-input); padding: 1px 5px; border-radius: 3px;
  font-family: 'Fira Code', 'Cascadia Code', monospace; font-size: 0.85em;
}
.note-article pre {
  background: var(--bg-input); padding: 1rem; border-radius: var(--radius);
  overflow-x: auto; margin: 1em 0;
}
.note-article pre code { background: none; padding: 0; }
.note-article blockquote {
  border-left: 3px solid var(--accent); margin: 1em 0;
  padding: 0.5em 1em; color: var(--text-muted);
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.note-article hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

.note-article .streaming-cursor::after {
  content: '▋';
  animation: blink 0.7s step-end infinite;
  color: var(--accent-light);
}
@keyframes blink { 50% { opacity: 0; } }

.edit-textarea {
  width: 100%; min-height: 60vh;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  padding: 1rem; font-size: 0.9rem; font-family: 'Fira Code', monospace;
  resize: vertical; line-height: 1.7;
}
.edit-textarea:focus { outline: none; border-color: var(--border-focus); }

/* ============================================================
   SNS
============================================================ */
.sns-card { background: var(--bg-input); border-radius: var(--radius); padding: 1rem; }
.sns-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; }
.sns-textarea { min-height: auto; background: var(--bg-surface) !important; }
.sns-char-count { font-size: 0.75rem; color: var(--text-muted); text-align: right; margin-top: 2px; }

/* ============================================================
   チェックボックスグリッド
============================================================ */
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.checkbox-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; cursor: pointer; padding: 4px;
}
.checkbox-item input { accent-color: var(--accent); }

/* ============================================================
   出力設定 Markdown記法グループ
============================================================ */
.md-settings-group {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.md-settings-group-label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 5px 12px;
  background: var(--bg-hover);
}
.md-settings-group .checkbox-grid {
  padding: 10px 12px;
}

/* ラジオボタングループ */
.radio-group { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.radio-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; cursor: pointer;
}
.radio-item input[type="radio"] { accent-color: var(--accent); cursor: pointer; }

/* ============================================================
   モバイル ボトムナビ（600px以下で表示）
============================================================ */
.mobile-bottom-nav { display: none; }

.mobile-nav-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px 0;
  transition: color 0.15s;
}
.mobile-nav-btn:hover { color: var(--text); }
.mobile-nav-btn.active { color: var(--accent-light); background: var(--accent-dim); }
.mobile-nav-icon { font-size: 1.3rem; line-height: 1; }
.mobile-nav-label { font-size: 0.68rem; font-weight: 600; }

/* ============================================================
   ウィザード
============================================================ */
.wizard-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}

.wizard-container {
  background: var(--bg-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); width: min(560px, 95vw);
  max-height: 90vh; overflow-y: auto;
  padding: 2rem;
}

.wizard-progress { margin-bottom: 2rem; }
.wizard-steps {
  display: flex; align-items: center; justify-content: center; gap: 0;
}
.step {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-hover); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; transition: all 0.2s;
  flex-shrink: 0;
}
.step.active { background: var(--accent); color: #fff; }
.step.done { background: var(--success); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); max-width: 40px; }

.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-icon { font-size: 3rem; margin-bottom: 1rem; text-align: center; }
.wizard-step h2 { font-size: 1.5rem; text-align: center; margin-bottom: 0.75rem; }
.wizard-step p { color: var(--text-muted); text-align: center; margin-bottom: 1.5rem; }

.wizard-features {
  list-style: none; margin: 1rem 0 1.5rem;
  display: flex; flex-direction: column; gap: 8px;
}
.wizard-features li {
  background: var(--bg-input); padding: 8px 14px;
  border-radius: var(--radius); font-size: 0.9rem;
}
.wizard-note { font-size: 0.8rem !important; color: var(--text-dim) !important; }

.wizard-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.5rem;
}

.wizard-summary {
  background: var(--bg-input); border-radius: var(--radius);
  padding: 1rem; margin: 1rem 0;
}
.wizard-summary-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; padding: 4px 0;
}
.wizard-summary-item .ok { color: var(--success); }
.wizard-summary-item .ng { color: var(--text-dim); }

/* ============================================================
   設定モーダル
============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; backdrop-filter: blur(4px);
}

.modal-container {
  background: var(--bg-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); width: min(680px, 95vw);
  max-height: 85vh; display: flex; flex-direction: column;
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; }

.modal-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

.settings-tabs { display: flex; gap: 4px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  padding: 6px 12px; border-radius: var(--radius); border: none;
  background: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem;
  transition: all 0.15s;
}
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: var(--accent-dim); color: var(--accent-light); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   プロンプト管理
============================================================ */
.prompt-item {
  background: var(--bg-input); border-radius: var(--radius);
  padding: 0.75rem 1rem; margin-bottom: 0.5rem;
  display: flex; flex-direction: column; gap: 8px;
}
.prompt-item-header { display: flex; justify-content: space-between; align-items: center; }
.prompt-item-name { font-weight: 600; font-size: 0.875rem; }
.prompt-item-body { font-size: 0.8rem; color: var(--text-muted); white-space: pre-wrap; }
.prompt-item-actions { display: flex; gap: 4px; }

/* ============================================================
   履歴
============================================================ */
.history-container { padding: 1.5rem; max-width: 900px; margin: 0 auto; }
.screen-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; }
.history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.history-item {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.15s;
}
.history-item:hover { border-color: var(--accent); }
.history-item-title { font-weight: 600; font-size: 1rem; }
.history-item-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 1rem; }
.history-item-actions { display: flex; gap: 8px; margin-top: 8px; }
.history-status {
  display: inline-block; font-size: 0.72rem; padding: 2px 8px;
  border-radius: 10px; font-weight: 600;
}
.history-status.draft { background: var(--accent-dim); color: var(--accent-light); }
.history-status.published { background: rgba(34,197,94,0.15); color: var(--success); }

.empty-message { color: var(--text-dim); text-align: center; padding: 3rem 0; }

/* ============================================================
   再生成
============================================================ */
.regen-section { margin-top: 1rem; }

/* ============================================================
   プレビューメタ
============================================================ */
.preview-meta { margin-top: 1rem; }

/* ============================================================
   モード① Obsidian 接続ステータス
============================================================ */
.obsidian-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.obsidian-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.status-dot.connected    { background: var(--success); }
.status-dot.disconnected { background: var(--error); }
.status-dot.connecting   { background: var(--warning); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ============================================================
   モード① 検索結果
============================================================ */
.search-results { margin-top: 8px; }

.search-searching,
.search-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.search-results-actions { display: flex; gap: 4px; }

.search-result-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
}
.search-result-item:hover { border-color: var(--accent); }

.search-result-item input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.search-result-body  { flex: 1; min-width: 0; }

.search-result-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-preview {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   モード① ファイルアップロードセクション
============================================================ */
.mode1-file-section { margin-top: 16px; }

.section-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================
   ユーティリティ
============================================================ */
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* ============================================================
   スクロールバー
============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================================
   レスポンシブ
============================================================ */
@media (max-width: 800px) {
  .generate-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .panel { height: auto; }
  .panel-preview { border-top: 1px solid var(--border); }
  .mode-tabs { grid-template-columns: 1fr 1fr; }
}

/* モバイル：ボトムナビ表示・ヘッダーナビ非表示 */
@media (max-width: 600px) {
  .header-nav { display: none; }

  .mobile-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 100;
  }

  /* ボトムナビ分のパディング */
  #app { padding-bottom: 56px; }

  /* ヘッダーを小さく */
  .header { gap: 0.5rem; padding: 0 0.75rem; }
  .logo { font-size: 0.95rem; }
  .header-right .btn-ghost { font-size: 0.8rem; padding: 6px 10px; }
}

/* ============================================================
   ログイン画面
============================================================ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 9999;
}
.login-screen.hidden { display: none; }

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}

.login-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--accent-light);
  margin: 0 0 0.25rem;
  text-align: center;
}
.login-subtitle {
  font-size: 0.85rem; color: var(--text-muted);
  text-align: center; margin: 0 0 1.5rem;
}

.login-tabs {
  display: flex; gap: 0.5rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 4px; margin-bottom: 1.5rem;
}
.login-tab {
  flex: 1; padding: 0.5rem;
  border: none; background: transparent;
  color: var(--text-muted); border-radius: calc(var(--radius) - 2px);
  cursor: pointer; font-size: 0.875rem; transition: all 0.15s;
}
.login-tab.active {
  background: var(--accent); color: #fff; font-weight: 600;
}

.login-desc {
  font-size: 0.85rem; color: var(--text-muted);
  margin: 0 0 1rem; line-height: 1.6;
}
.login-message {
  font-size: 0.85rem; margin: 0.5rem 0;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
}
.login-message.error   { background: rgba(239,68,68,0.1);  color: var(--error); }
.login-message.success { background: rgba(34,197,94,0.1);  color: var(--success); }
.login-message.hidden  { display: none; }

.login-btn {
  width: 100%; margin-top: 1rem;
  padding: 0.75rem; font-size: 1rem; font-weight: 600;
}
