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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

/* ===== アプリ全体 ===== */
.app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== ヘッダー ===== */
.app-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #a0c4ff;
  text-align: center;
  padding: 8px 0;
}

/* ===== シナリオ選択 ===== */
.scenario-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #16213e;
  border-radius: 8px;
  padding: 8px 12px;
}

.scenario-bar label {
  font-size: 0.9rem;
  white-space: nowrap;
}

#scenario {
  flex: 1;
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #334;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ===== ビデオコンテナ ===== */
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #334;
}

#preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1); /* ミラー表示 */
}

.camera-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  gap: 16px;
  padding: 24px;
  text-align: center;
  font-size: 0.95rem;
}

/* ===== 状態バー ===== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #16213e;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.status-label,
.volume-label {
  white-space: nowrap;
  color: #888;
}

.status-value {
  font-weight: 600;
  min-width: 80px;
  color: #e0e0e0;
}

/* 録画中は赤く点滅 */
.status-value.recording {
  color: #ff4d4d;
  animation: blink 1s step-start infinite;
}

/* 再生中は緑 */
.status-value.playing {
  color: #4dff88;
}

/* 待機中は水色 */
.status-value.waiting {
  color: #a0c4ff;
}

@keyframes blink {
  50% { opacity: 0.4; }
}

.volume-meter {
  flex: 1;
  height: 8px;
  background: #0f3460;
  border-radius: 4px;
  overflow: hidden;
}

.volume-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4dff88, #ffdd57, #ff4d4d);
  border-radius: 4px;
  transition: width 0.08s linear;
}

.volume-db {
  font-size: 0.8rem;
  color: #888;
  min-width: 48px;
  text-align: right;
}

/* ===== 操作ボタン ===== */
.controls {
  display: flex;
  justify-content: center;
}

.btn {
  padding: 10px 28px;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

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

.btn:not(:disabled):active {
  transform: scale(0.97);
}

.btn-primary {
  background: #0f3460;
  color: #a0c4ff;
  border: 2px solid #a0c4ff;
}

.btn-primary:not(:disabled):hover {
  background: #1a4a8a;
}

/* ===== AI 提案エリア ===== */
.suggestions {
  background: #16213e;
  border-radius: 10px;
  padding: 12px;
}

.suggestions-title {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 8px;
}

.suggestion-item {
  background: #0f3460;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid #a0c4ff;
}

.suggestion-item:last-child {
  margin-bottom: 0;
}

.suggestion-en {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e0e0;
}

.suggestion-ja {
  font-size: 0.8rem;
  color: #aaa;
  margin-top: 2px;
}

.suggestion-error {
  font-size: 0.85rem;
  color: #ff8888;
  padding: 4px 0;
}

/* ===== 設定パネル ===== */
.settings-panel {
  background: #16213e;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

.settings-panel summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #888;
  user-select: none;
  list-style: none;
}

.settings-panel summary::before {
  content: '▶ ';
  font-size: 0.75rem;
}

.settings-panel[open] summary::before {
  content: '▼ ';
}

.settings-content {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
}

.settings-content label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-content input[type="number"] {
  width: 64px;
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #334;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.9rem;
}

.settings-content fieldset {
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-content fieldset legend {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 4px;
}

.settings-content fieldset label {
  gap: 6px;
  cursor: pointer;
}

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