/* ========================================
   AI Narration Maker - Main Stylesheet
   ======================================== */

/* ---------- CSS変数 ---------- */
:root {
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-primary-light: #a5b4fc;
  --color-primary-bg: #eef2ff;
  --color-secondary: #10b981;
  --color-accent: #f59e0b;
  --color-product: #8b5cf6;
  --color-product-light: #ede9fe;

  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;

  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: all 0.2s ease;
}

/* ---------- リセット & ベース ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans JP', 'Inter', system-ui, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

/* ---------- ヘッダー ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-product));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.3px;
}

.logo-badge {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 16px;
  transition: var(--transition);
  position: relative;
}

.btn-icon:not(:disabled):hover {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-icon .tooltip {
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--color-text-primary);
  color: white;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.btn-icon:hover .tooltip {
  opacity: 1;
}

/* ---------- メインコンテンツ ---------- */
.app-main {
  flex: 1;
  padding: 32px 24px 60px;
}

/* ---------- ステップインジケーター ---------- */
.step-indicator-wrap {
  max-width: 700px;
  margin: 0 auto 32px;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
  transition: var(--transition);
}

.step.active, .step.done {
  opacity: 1;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.step.active .step-num {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 0 0 4px var(--color-primary-bg);
}

.step.done .step-num {
  background: var(--color-success);
  color: white;
}

.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.step.active .step-label, .step.done .step-label {
  color: var(--color-text-secondary);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  min-width: 40px;
  max-width: 80px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.step-line.done {
  background: var(--color-success);
}

/* ---------- コンテンツラップ ---------- */
.content-wrap {
  max-width: 820px;
  margin: 0 auto;
}

/* ---------- セクション ---------- */
.step-section {
  display: none;
}

.step-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  margin-bottom: 28px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.section-title i {
  margin-right: 8px;
  opacity: 0.8;
}

.section-desc {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ---------- モードカード ---------- */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.mode-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  text-align: left;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-primary-bg), transparent);
  opacity: 0;
  transition: var(--transition);
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md), 0 0 0 3px var(--color-primary-bg);
  transform: translateY(-2px);
}

.mode-card-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.mode-card-icon.product {
  background: linear-gradient(135deg, var(--color-product), #6d28d9);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.mode-card-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.mode-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.mode-card-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.mode-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.mode-card-tags li {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
}

.mode-card-arrow {
  color: var(--color-text-muted);
  font-size: 16px;
  position: relative;
  z-index: 1;
  transition: var(--transition);
  align-self: center;
}

.mode-card:hover .mode-card-arrow {
  color: var(--color-primary);
  transform: translateX(4px);
}

/* ---------- フューチャーバナー ---------- */
.future-banner {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #c7d2fe;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
}

.future-banner i {
  color: var(--color-accent);
  font-size: 16px;
  flex-shrink: 0;
}

/* ---------- フォーム ---------- */
.input-form {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-label.required::after {
  content: '必須';
  font-size: 10px;
  font-weight: 600;
  background: #fee2e2;
  color: var(--color-danger);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.form-input,
.form-textarea,
.form-select {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-surface);
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

.form-textarea {
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ---------- スタイルセクション ---------- */
.style-section {
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
  margin-bottom: 24px;
}

.style-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---------- 戻るボタン ---------- */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  margin-bottom: 16px;
  transition: var(--transition);
}

.btn-back:hover {
  color: var(--color-primary);
}

/* ---------- ボタン ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-border);
  color: var(--color-text-primary);
}

.form-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ---------- 結果画面 ---------- */
.result-tabs {
  display: flex;
  gap: 4px;
  background: var(--color-border-light);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.result-tab {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.result-tab:hover {
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.5);
}

.result-tab.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

.result-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-border-light);
  flex-wrap: wrap;
  gap: 10px;
}

.result-badge {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
}

.result-badge.script {
  background: #e0f2fe;
  color: #0277bd;
}

.result-badge.prompt {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.result-badge.prompt-advanced {
  background: #fef3c7;
  color: #b45309;
}

.result-badge.api {
  background: #f0fdf4;
  color: #166534;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.btn-copy, .btn-edit-script {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-copy {
  background: var(--color-primary);
  color: white;
}

.btn-copy:hover {
  background: var(--color-primary-dark);
}

.btn-copy.copied {
  background: var(--color-success);
}

.btn-edit-script {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
  border: 1.5px solid var(--color-border);
}

.btn-edit-script:hover {
  background: var(--color-border);
}

.result-body {
  padding: 0;
}

.result-textarea {
  width: 100%;
  border: none;
  outline: none;
  padding: 20px;
  font-size: 14px;
  line-height: 1.8;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--color-text-primary);
  background: var(--color-surface);
  resize: vertical;
  min-height: 220px;
}

.result-textarea:read-only {
  background: #fafafa;
}

.result-pre {
  padding: 20px;
  font-size: 13px;
  line-height: 1.7;
  font-family: 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
  color: var(--color-text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  background: #1e1e2e;
  color: #cdd6f4;
  min-height: 200px;
  overflow-x: auto;
}

.result-tips {
  padding: 14px 20px;
  background: #fffbeb;
  border-top: 1px solid #fef3c7;
  font-size: 13px;
  color: #92400e;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.6;
}

.result-tips i {
  margin-top: 1px;
  flex-shrink: 0;
}

.result-tips code {
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ---------- 将来機能ブロック ---------- */
.future-feature-block {
  border-top: 1px solid var(--color-border);
  padding: 16px 20px;
}

.future-feature-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #1e1b4b10, #312e8110);
  border: 1px dashed var(--color-primary-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.future-feature-inner > i {
  font-size: 24px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.future-feature-inner > div {
  flex: 1;
}

.future-feature-inner strong {
  display: block;
  font-size: 14px;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.future-feature-inner p {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.btn-future {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-border-light);
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: not-allowed;
  flex-shrink: 0;
}

/* ---------- 次のステップ ---------- */
.next-steps {
  margin: 24px 0;
}

.next-steps-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.next-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.next-step-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: var(--transition);
  text-decoration: none;
}

.next-step-card:not(.future):hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.next-step-card.future {
  opacity: 0.55;
  cursor: not-allowed;
}

.next-step-card i {
  font-size: 20px;
  color: var(--color-primary);
}

.next-step-card.future i {
  color: var(--color-text-muted);
}

.next-step-card strong {
  font-size: 13px;
  color: var(--color-text-primary);
  font-weight: 600;
}

.next-step-card span {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ========================================
   TTS パネル & API連携スタイル
   ======================================== */

/* --- ヘッダーAPIキーボタン --- */
.btn-api-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary-light);
  transition: var(--transition);
  cursor: pointer;
}

.btn-api-key:hover {
  background: var(--color-primary);
  color: white;
}

.btn-api-key.has-key {
  background: #f0fdf4;
  color: #166534;
  border-color: #86efac;
}

/* --- TTSパネル（ライトテーマ） --- */
.tts-panel {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  border: 2px solid #e0e7ff;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.10);
}

.tts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.tts-panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tts-model-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: 'Menlo', 'Consolas', monospace;
  background: #eef2ff;
  color: #4f46e5;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #c7d2fe;
  letter-spacing: 0.3px;
}

.tts-panel-label {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.tts-panel-label i {
  margin-right: 6px;
  color: #6366f1;
}

.tts-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tts-voice-select-wrap,
.tts-prompt-select-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tts-voice-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.tts-voice-select {
  background: #f8fafc;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 7px 28px 7px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  transition: var(--transition);
}

.tts-voice-select:hover,
.tts-voice-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
  background-color: #f0f4ff;
}

.tts-voice-select option {
  background: #ffffff;
  color: #1e293b;
}

/* --- モデル選択行 --- */
.tts-model-row {
  margin-bottom: 16px;
}

.tts-model-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tts-model-card {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-md);
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  transition: var(--transition);
  overflow: hidden;
}

.tts-model-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tts-model-card:hover {
  border-color: #a5b4fc;
  background: #eef2ff;
}

.tts-model-card:has(input:checked) {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.tts-model-card-inner {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tts-model-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.tts-model-name {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.tts-model-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.tts-model-tag.best {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.tts-model-tag.recommended {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.tts-model-tag.pro {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.tts-model-card-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
}

.tts-model-price {
  font-size: 10px;
  font-family: 'Menlo', 'Consolas', monospace;
  color: #94a3b8;
  margin-top: 2px;
}

/* --- 音声・プロンプト設定行 --- */
.tts-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* --- 生成ボタン行 --- */
.tts-generate-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-tts-generate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  cursor: pointer;
  border: none;
}

.btn-tts-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
  background: linear-gradient(135deg, #818cf8, #6366f1);
}

.btn-tts-generate:active {
  transform: translateY(0);
}

.btn-tts-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tts-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6366f1;
  font-size: 14px;
  font-weight: 500;
}

.tts-status-spinner {
  color: #6366f1;
  font-size: 16px;
}

.tts-cost-note {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.tts-cost-note i {
  color: #94a3b8;
}

/* --- Free Tier説明 --- */
.tts-freetier-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: #0369a1;
  line-height: 1.6;
}

.tts-freetier-note i {
  color: #0ea5e9;
  flex-shrink: 0;
  margin-top: 2px;
}

.tts-freetier-note strong {
  color: #0c4a6e;
}

.tts-freetier-note a {
  color: #6366f1;
  text-decoration: underline;
}

.tts-freetier-note a:hover {
  color: #4f46e5;
}

/* --- 音声プレイヤー（ライト） --- */
.tts-player-wrap {
  margin-top: 16px;
  background: #f8fafc;
  border: 2px solid #c7d2fe;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tts-player-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tts-player-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
}

.tts-audio-player {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  outline: none;
  accent-color: #6366f1;
}

.tts-audio-player::-webkit-media-controls-panel {
  background: #eef2ff;
}

.tts-audio-player::-webkit-media-controls-play-button {
  background-color: #6366f1;
  border-radius: 50%;
}

.tts-audio-player::-webkit-media-controls-current-time-display,
.tts-audio-player::-webkit-media-controls-time-remaining-display {
  color: #1e293b;
  font-size: 13px;
}

.tts-audio-player::-webkit-media-controls-timeline {
  accent-color: #6366f1;
}

.tts-player-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn-tts-download,
.btn-tts-regenerate {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  cursor: pointer;
}

.btn-tts-download {
  background: #d1fae5;
  color: #065f46;
  border: 1.5px solid #6ee7b7;
}

.btn-tts-download:hover {
  background: #a7f3d0;
  color: #064e3b;
}

.btn-tts-regenerate {
  background: #eef2ff;
  color: #4f46e5;
  border: 1.5px solid #c7d2fe;
}

.btn-tts-regenerate:hover {
  background: #e0e7ff;
  color: #3730a3;
}

/* --- TTSエラーバナー（ライト） --- */
.tts-error-banner {
  margin-top: 14px;
  animation: fadeIn 0.25s ease;
}

.tts-error-inner {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
}

@media (max-width: 480px) {
  .tts-error-inner {
    grid-template-columns: auto 1fr;
  }
  .tts-error-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
}

.tts-error-icon {
  color: #ef4444;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tts-error-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tts-error-text strong {
  font-size: 13px;
  font-weight: 700;
  color: #b91c1c;
}

.tts-error-text span {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.tts-error-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn-tts-error-action {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-tts-error-action:hover {
  background: #fecaca;
  color: #991b1b;
}

.btn-tts-error-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-tts-error-close:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* --- APIキー未設定警告（ライト） --- */
.tts-no-key {
  margin-top: 14px;
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: #92400e;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tts-no-key-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tts-no-key-inner > i {
  font-size: 22px;
  color: #f59e0b;
  flex-shrink: 0;
}

.tts-no-key-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tts-no-key-text strong {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
}

.tts-no-key-text span {
  font-size: 12px;
  color: #b45309;
}

.btn-no-key-set {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-default);
  flex-shrink: 0;
}

.btn-no-key-set:hover {
  background: #d97706;
}

.tts-no-key-howto {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid #fde68a;
}

.tts-no-key-howto a {
  font-size: 12px;
  font-weight: 600;
  color: #d97706;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tts-no-key-howto a:hover {
  color: #92400e;
  text-decoration: underline;
}

.tts-no-key-hint {
  font-size: 11px;
  color: #b45309;
}

/* ヘッダーAPIキー未設定 */
.btn-api-key.no-key {
  border-color: #f59e0b !important;
  color: #92400e !important;
  background: #fffbeb !important;
  animation: pulse-warn 2s infinite;
}

@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

/* --- active-feature (実装済み) --- */
.active-feature {
  border-color: #6ee7b7 !important;
  background: linear-gradient(135deg, #f0fdf4, #ffffff) !important;
}

.btn-tts-goto {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: #d1fae5;
  color: #065f46;
  border: 1.5px solid #6ee7b7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-tts-goto:hover {
  background: #a7f3d0;
  color: #064e3b;
}

/* --- レート制限カウントダウン表示（ライト） --- */
.tts-rate-countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  margin-top: 10px;
}

.tts-rate-countdown i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ========================================
   モーダル スタイル
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title i {
  color: var(--color-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 15px;
  transition: var(--transition);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-info {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.6;
}

.modal-info i {
  font-size: 16px;
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 1px;
}

.api-key-input-wrap {
  position: relative;
}

.api-key-input-wrap .form-input {
  width: 100%;
  padding-right: 44px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.btn-toggle-key {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 4px;
}

.btn-toggle-key:hover {
  color: var(--color-primary);
}

.modal-current-key {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  flex-wrap: wrap;
}

.modal-key-label {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.modal-current-key code {
  font-size: 12px;
  font-family: 'Menlo', 'Consolas', monospace;
  color: var(--color-text-secondary);
  flex: 1;
  word-break: break-all;
}

.btn-clear-key {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: #fee2e2;
  color: var(--color-danger);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid #fca5a5;
  flex-shrink: 0;
}

.btn-clear-key:hover {
  background: #fca5a5;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--color-border);
}

/* ========================================
   動画プレビューパネル（ライトテーマ）
   ======================================== */
.video-preview-panel {
  margin-top: 20px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.video-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.video-preview-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-preview-title i {
  color: #6366f1;
}

.video-preview-badge {
  font-size: 11px;
  font-weight: 600;
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 2px 10px;
}

/* --- 画像ドロップゾーン --- */
.img-dropzone {
  border: 2px dashed #c7d2fe;
  border-radius: var(--radius-md);
  background: #eef2ff;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.img-dropzone:hover,
.img-dropzone.dragover {
  border-color: #6366f1;
  background: #e0e7ff;
}

.img-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.img-dropzone-inner i {
  font-size: 36px;
  color: #a5b4fc;
}

.img-dropzone-inner p {
  font-size: 14px;
  font-weight: 600;
  color: #4f46e5;
  line-height: 1.5;
}

.img-dropzone-inner span {
  font-size: 12px;
  color: #64748b;
}

/* --- サムネイル一覧 --- */
.img-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.img-thumb {
  position: relative;
  width: 80px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.img-thumb:hover {
  border-color: #6366f1;
}

.img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(239,68,68,0.85);
  color: white;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
}

.img-thumb:hover .img-thumb-del {
  opacity: 1;
}

.img-thumb-num {
  position: absolute;
  bottom: 2px;
  left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.img-thumb.dragging {
  opacity: 0.5;
}

.img-thumb.drag-over {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.3);
}

.img-thumb-add {
  background: #f1f5f9;
  border: 2px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
  transition: var(--transition);
}

.img-thumb-add i {
  font-size: 18px;
  color: #94a3b8;
}

.img-thumb-add:hover {
  border-color: #6366f1;
  background: #eef2ff;
  color: #6366f1;
}

.img-thumb-add:hover i {
  color: #6366f1;
}

/* --- Canvas プレイヤー --- */
.canvas-player-wrap {
  margin-top: 16px;
  background: #1e293b;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-canvas {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.canvas-player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #0f172a;
  flex-wrap: wrap;
}

.btn-canvas-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #6366f1;
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  border: none;
}

.btn-canvas-play:hover {
  background: #4f46e5;
}

.canvas-player-info {
  font-size: 12px;
  color: #94a3b8;
  flex: 1;
  text-align: center;
}

.btn-canvas-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #334155;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  border: none;
}

.btn-canvas-reset:hover {
  background: #475569;
  color: #e2e8f0;
}

.canvas-player-note {
  font-size: 11px;
  color: #94a3b8;
  background: #0f172a;
  padding: 8px 16px 10px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  display: flex;
  align-items: center;
  gap: 6px;
}

.canvas-player-note i {
  color: #6366f1;
  flex-shrink: 0;
}

/* ---------- 動画エクスポート ---------- */
.export-area {
  background: #0f172a;
  border-top: 1px solid rgba(99,102,241,0.2);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-export-video {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  flex: 1;
  justify-content: center;
}

.btn-export-video:hover:not(:disabled) {
  opacity: .88;
  transform: translateY(-1px);
}

.btn-export-video:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.btn-export-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  color: #f87171;
  border: 1px solid #f87171;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.btn-export-cancel:hover {
  background: #fee2e2;
  color: #dc2626;
}

.export-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.export-progress-bar {
  height: 6px;
  background: #1e293b;
  border-radius: 99px;
  overflow: hidden;
}

.export-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 99px;
  transition: width .15s linear;
}

.export-progress-text {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

.export-note {
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.5;
  margin: 0;
}

.export-note i {
  color: #6366f1;
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- レスポンシブ追加 --- */
@media (max-width: 600px) {
  .tts-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tts-model-cards {
    grid-template-columns: 1fr;
  }

  .tts-settings-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .tts-generate-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .tts-cost-note {
    margin-left: 0;
  }

  .tts-player-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-api-key span {
    display: none;
  }

  .modal-box {
    max-width: 100%;
  }
}

/* ========================================
   AI 画像生成パネル
   ======================================== */
.img-gen-panel {
  background: linear-gradient(135deg, #f5f3ff, #eef2ff);
  border: 2px solid #c7d2fe;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.img-gen-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.img-gen-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #3730a3;
}

.img-gen-title i {
  color: #6366f1;
  font-size: 15px;
}

.img-gen-badge {
  font-size: 10px;
  font-weight: 700;
  background: #6366f1;
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.img-gen-desc {
  font-size: 12px;
  color: #4f46e5;
  padding-left: 2px;
}

.img-gen-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.img-gen-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.img-gen-label {
  font-size: 12px;
  font-weight: 600;
  color: #4f46e5;
  white-space: nowrap;
}

.img-gen-select {
  background: white;
  color: #1e293b;
  border: 1.5px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 6px 24px 6px 9px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236366f1'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 13px;
  transition: var(--transition);
}

.img-gen-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.btn-img-gen {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 10px rgba(99,102,241,0.35);
  white-space: nowrap;
}

.btn-img-gen:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(99,102,241,0.5);
}

.btn-img-gen:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: #94a3b8;
}

.btn-img-gen-cancel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1.5px solid #fca5a5;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-img-gen-cancel:hover {
  background: #fecaca;
}

/* 進捗バー */
.img-gen-progress {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.img-gen-progress-bar {
  height: 6px;
  background: #e0e7ff;
  border-radius: 99px;
  overflow: hidden;
}

.img-gen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.img-gen-progress-text {
  font-size: 12px;
  color: #4f46e5;
  font-weight: 500;
}

/* モデル説明ノート */
.img-gen-model-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #4f46e5;
  background: rgba(99,102,241,0.07);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  margin-top: 8px;
}

.img-gen-model-note i {
  color: #818cf8;
  flex-shrink: 0;
}

/* コスト案内 */
.img-gen-cost-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #6366f1;
  margin-top: 10px;
}

.img-gen-cost-note i {
  color: #a5b4fc;
}

/* 区切り線 */
.img-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
}

.img-divider::before,
.img-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* サムネイルのAI生成バッジ */
.img-thumb-ai-badge {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 9px;
  font-weight: 700;
  background: rgba(99,102,241,0.85);
  color: white;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

/* 生成中のスケルトンサムネイル */
.img-thumb-skeleton {
  background: linear-gradient(90deg, #e0e7ff 25%, #c7d2fe 50%, #e0e7ff 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border: 2px dashed #a5b4fc !important;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- フッター ---------- */
.app-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 20px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 13px;
  color: var(--color-text-muted);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 13px;
  color: var(--color-text-muted);
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text-primary);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast i {
  color: var(--color-success);
  font-size: 16px;
}

/* ---------- スクロールバー ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 768px) {
  .app-main {
    padding: 20px 16px 40px;
  }

  .mode-cards {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: 1;
  }

  .style-grid {
    grid-template-columns: 1fr;
  }

  .input-form {
    padding: 20px 16px;
  }

  .result-tabs {
    flex-direction: column;
  }

  .result-tab {
    flex: none;
  }

  .next-steps-grid {
    grid-template-columns: 1fr;
  }

  .step-indicator {
    display: none;
  }

  .future-feature-inner {
    flex-direction: column;
    text-align: center;
  }

  .section-title {
    font-size: 20px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 16px;
  }

  .logo-text {
    font-size: 15px;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .result-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========================================
   入力モード切替タブ
   ======================================== */
.input-mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid #c7d2fe;
  width: fit-content;
}

.input-mode-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  color: #6366f1;
  background: #fff;
  border: none;
  cursor: pointer;
  transition: var(--transition-default);
  white-space: nowrap;
}

.input-mode-tab:first-child {
  border-right: 1.5px solid #c7d2fe;
}

.input-mode-tab i {
  font-size: 13px;
}

.input-mode-tab:hover:not(.active) {
  background: #eef2ff;
}

.input-mode-tab.active {
  background: #6366f1;
  color: #fff;
}

.input-mode-tab.active i {
  color: #fff;
}

/* 直接入力フォーム */
.manual-script-form {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.manual-script-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1.5px solid #c7d2fe;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.manual-script-header > i {
  font-size: 22px;
  color: #6366f1;
  flex-shrink: 0;
  margin-top: 2px;
}

.manual-script-title {
  font-size: 15px;
  font-weight: 700;
  color: #3730a3;
  margin-bottom: 3px;
}

.manual-script-desc {
  font-size: 13px;
  color: #4338ca;
  line-height: 1.5;
}

.manual-script-textarea {
  font-size: 14px;
  line-height: 1.8;
  font-family: 'Noto Sans JP', sans-serif;
  min-height: 200px;
  resize: vertical;
}

/* ========================================
   フロー STEPバッジ
   ======================================== */
.flow-step-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  background: #6366f1;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.flow-step-badge--img {
  background: #8b5cf6;
}

.flow-step-badge--upload {
  background: #0891b2;
  font-size: 10px;
  padding: 1px 7px;
}

.tts-panel-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
  font-weight: 400;
}

/* ========================================
   手順ガイド（動画スライド作成の流れ）
   ======================================== */
.slide-howto {
  background: #fff;
  border: 1.5px solid #c7d2fe;
  border-radius: var(--radius-md);
  padding: 14px 18px 12px;
  margin-bottom: 18px;
}

.slide-howto-title {
  font-size: 13px;
  font-weight: 700;
  color: #4338ca;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.slide-howto-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.slide-howto-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 100px;
  flex: 1;
  transition: var(--transition-default);
}

.slide-howto-step.completed {
  background: #f0fdf4;
  border-color: #86efac;
}

.slide-howto-step.active {
  background: #eef2ff;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.slide-howto-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.slide-howto-step.completed .slide-howto-num {
  background: #22c55e;
  color: #fff;
}

.slide-howto-step.active .slide-howto-num {
  background: #6366f1;
  color: #fff;
}

.slide-howto-body {
  flex: 1;
  min-width: 0;
}

.slide-howto-label {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 4px;
}

.slide-howto-step.completed .slide-howto-label {
  color: #16a34a;
}

.slide-howto-step.completed .slide-howto-label i {
  color: #22c55e;
  font-size: 11px;
}

.slide-howto-step.active .slide-howto-label {
  color: #4338ca;
}

.slide-howto-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.4;
}

.slide-howto-arrow {
  color: #94a3b8;
  font-size: 13px;
  flex-shrink: 0;
  padding: 0 2px;
  align-self: center;
}

.howto-or {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin: 0 2px;
}

.slide-howto-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 10px;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #713f12;
  line-height: 1.5;
}

.slide-howto-note i {
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 1px;
}

/* モデルカードの「おすすめ」バッジを見やすく */
.tts-model-tag.best {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.tts-model-tag.recommended {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

@media (max-width: 640px) {
  .slide-howto-steps {
    gap: 4px;
  }
  .slide-howto-step {
    flex-basis: calc(50% - 20px);
    min-width: 0;
  }
  .slide-howto-arrow {
    display: none;
  }
}
