/* ============================================================
   CinePrompt Studio Design System (Vanilla CSS)
   ============================================================ */

:root {
  --bg-deep: #07080c;
  --bg-surface: #0e1118;
  --bg-card: rgba(18, 23, 34, 0.75);
  --bg-card-hover: rgba(26, 33, 50, 0.88);
  --bg-card-selected: rgba(245, 197, 24, 0.08);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(245, 197, 24, 0.4);
  --border-gold-glow: 0 0 20px rgba(245, 197, 24, 0.25);

  --gold-primary: #f5c518;
  --gold-glow: #e5a93b;
  --gold-dark: #b8860b;
  --accent-cyan: #00f2fe;
  --accent-purple: #9d4edd;
  --accent-red: #ff4757;

  --text-main: #f3f5f9;
  --text-secondary: #9da8c3;
  --text-muted: #5e6982;
  --text-gold: #ffd666;

  --font-serif: 'Cinzel', serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --dock-height: 230px;
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: var(--dock-height);
}

/* アンビエント発光背景 */
.ambient-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}

.glow-top {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--gold-primary), transparent 70%);
  top: -200px;
  right: -100px;
}

.glow-bottom {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
  bottom: 100px;
  left: -150px;
}

/* ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 12, 17, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 1.5rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--gold-primary);
  background: rgba(245, 197, 24, 0.12);
  border: 1px solid rgba(245, 197, 24, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.brand-title .highlight {
  color: var(--gold-primary);
  text-shadow: 0 0 15px rgba(245, 197, 24, 0.4);
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-family: var(--font-display);
  color: var(--text-secondary);
}

.stat-dot {
  width: 8px;
  height: 8px;
  background-color: var(--gold-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold-primary);
}

/* ボタン基本スタイル */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-glow));
  color: #0b0c10;
  border: none;
  box-shadow: 0 4px 15px rgba(245, 197, 24, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 197, 24, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-card);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-accent {
  background: linear-gradient(135deg, #f5c518 0%, #ff8c00 100%);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(245, 197, 24, 0.4);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(245, 197, 24, 0.6);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* コントロールセクション */
.control-section {
  position: relative;
  z-index: 30;
  padding: 1.5rem 1.5rem 0.5rem;
}

.control-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* 検索窓 */
.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: rgba(18, 23, 34, 0.85);
  border: 1px solid var(--border-card);
  padding: 14px 44px 14px 48px;
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition-smooth);
  backdrop-filter: blur(10px);
}

.search-box input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.15), 0 8px 24px rgba(0, 0, 0, 0.4);
  background: rgba(22, 28, 42, 0.95);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

.search-clear-btn:hover {
  color: var(--text-main);
}

/* 感情クイックフィルター */
.emotion-filter-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.8rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.emotion-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.chip.active {
  background: rgba(245, 197, 24, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.2);
}

/* カテゴリタブ */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--gold-primary);
  background: rgba(245, 197, 24, 0.1);
  border-bottom: 2px solid var(--gold-primary);
  border-radius: 8px 8px 0 0;
}

/* メインコンテンツエリア */
.main-content {
  position: relative;
  z-index: 20;
  padding: 1.5rem;
}

.content-container {
  max-width: 1400px;
  margin: 0 auto;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.results-info strong {
  color: var(--text-main);
}

.active-filter-text {
  color: var(--gold-primary);
  margin-left: 6px;
}

.results-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* カードグリッド */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

/* 技法カード */
.tech-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-smooth);
  position: relative;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.tech-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.tech-card.is-selected {
  border-color: var(--gold-primary);
  background: var(--bg-card-selected);
  box-shadow: var(--border-gold-glow), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card-category-badge {
  font-size: 0.65rem;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
}

.card-select-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-family: var(--font-display);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tech-card.is-selected .card-select-btn {
  background: var(--gold-primary);
  color: #000;
  border-color: var(--gold-primary);
  font-weight: 700;
}

.card-title-group {
  margin-bottom: 0.75rem;
}

.card-name-en {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.card-name-ja {
  font-size: 0.85rem;
  color: var(--gold-primary);
  font-weight: 500;
}

.card-emotions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.emotion-tag {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.card-film-examples {
  background: rgba(0, 0, 0, 0.25);
  border-left: 2px solid var(--gold-glow);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.card-film-examples strong {
  color: var(--text-gold);
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.card-actions .btn {
  flex: 1;
  justify-content: center;
}

/* 検索結果なし */
.no-results {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.no-results h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.no-results p {
  margin-bottom: 1.5rem;
}

/* 固定ボトム：プロンプトビルダー（スタジオコンソール） */
.prompt-builder-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(12, 15, 23, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(245, 197, 24, 0.35);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(245, 197, 24, 0.15);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.prompt-builder-dock.collapsed {
  transform: translateY(calc(100% - 46px));
}

.dock-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem 1.25rem;
}

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

.dock-title-group {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.dock-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--text-main);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--gold-primary);
  border-radius: 50%;
  animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--gold-primary); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.selection-badge {
  font-size: 0.75rem;
  background: rgba(245, 197, 24, 0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(245, 197, 24, 0.3);
  padding: 1px 8px;
  border-radius: 12px;
}

.dock-presets {
  display: flex;
  gap: 1rem;
}

.mode-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.mode-label input {
  accent-color: var(--gold-primary);
}

.dock-controls {
  display: flex;
  gap: 8px;
}

/* 選択された技法ピルタグバー */
.selected-pills-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0;
  min-height: 42px;
  align-items: center;
  margin-bottom: 0.75rem;
  scrollbar-width: thin;
}

.empty-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.technique-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 197, 24, 0.15);
  border: 1px solid var(--gold-primary);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-family: var(--font-display);
  white-space: nowrap;
  animation: pillFadeIn 0.2s ease;
}

@keyframes pillFadeIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.pill-remove-btn {
  background: none;
  border: none;
  color: var(--gold-primary);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 2px;
}

.pill-remove-btn:hover {
  color: var(--accent-red);
}

/* プロンプトクラフティングエリア */
.prompt-crafting-area {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
}

.subject-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subject-input-group label {
  font-size: 0.75rem;
  font-family: var(--font-display);
  color: var(--text-muted);
}

.subject-input-group input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-card);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
}

.subject-input-group input:focus {
  border-color: var(--gold-primary);
}

.final-prompt-box {
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(245, 197, 24, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  align-items: center;
}

.prompt-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-gold);
  line-height: 1.4;
  max-height: 60px;
  overflow-y: auto;
  word-break: break-all;
}

.btn-copy {
  padding: 10px 18px;
}

/* 詳細モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), var(--border-gold-glow);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.modal-header {
  padding: 1.75rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-category {
  font-size: 0.75rem;
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.modal-title-en {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--text-main);
  line-height: 1.2;
}

.modal-title-ja {
  font-size: 1.1rem;
  color: var(--gold-primary);
  font-weight: 600;
  margin-top: 4px;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-section h4 {
  font-size: 0.85rem;
  font-family: var(--font-display);
  color: var(--text-gold);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.modal-section p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-examples {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--gold-primary);
  font-size: 0.85rem;
  color: var(--text-main);
}

.modal-code-box {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-code-box code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  word-break: break-all;
}

.modal-mistake-box {
  background: rgba(255, 71, 87, 0.08);
  border: 1px solid rgba(255, 71, 87, 0.25);
  padding: 12px 14px;
  border-radius: 8px;
}

.modal-mistake-box h4 {
  color: var(--accent-red);
}

.modal-footer {
  padding: 1rem 1.75rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: calc(var(--dock-height) + 20px);
  right: 24px;
  z-index: 90;
  background: rgba(18, 23, 34, 0.95);
  border: 1px solid var(--gold-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 197, 24, 0.3);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(16px);
  transform: translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.toast-icon {
  background: var(--gold-primary);
  color: #000;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}

/* レスポンシブ対応 */
@media (max-width: 900px) {
  :root {
    --dock-height: 300px;
  }
  .prompt-crafting-area {
    grid-template-columns: 1fr;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
}
