:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f2630;
  --text: #e6e9ef;
  --muted: #8b95a5;
  --accent: #5b9cff;
  --accent-2: #ffb65b;
  --line: #2a323d;
  --orig: #5b9cff;
  --mirror: #ff7b72;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--line);
}
header h1 { margin: 0; font-size: 22px; }
header .sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

main { padding: 16px 24px 40px; max-width: 1100px; margin: 0 auto; }

section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
section h2 { margin: 0 0 10px; font-size: 15px; }

.track-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.track-info { color: var(--muted); font-size: 12px; margin-left: auto; }

.waveform { background: var(--panel-2); border-radius: 8px; min-height: 96px; position: relative; }
.wave-overlay { position: absolute; inset: 0; pointer-events: none; border-radius: 8px; }

#track-original .waveform { box-shadow: inset 0 0 0 1px rgba(91,156,255,.25); }
#track-mirror   .waveform { box-shadow: inset 0 0 0 1px rgba(255,123,114,.25); }

/* 元音声 / ミラー音声の2トラックを大きく・色分けして目立たせる */
.track { border-left-width: 5px; padding-top: 18px; }
#track-original { border-left-color: var(--orig); }
#track-mirror   { border-left-color: var(--mirror); }
.track .track-head h2 {
  font-size: 20px; font-weight: 800; letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: 9px;
}
.track .track-head h2::before { content: ""; width: 12px; height: 12px; border-radius: 50%; flex: none; }
#track-original .track-head h2 { color: var(--orig); }
#track-original .track-head h2::before { background: var(--orig); box-shadow: 0 0 10px rgba(91,156,255,.6); }
#track-mirror .track-head h2 { color: var(--mirror); }
#track-mirror .track-head h2::before { background: var(--mirror); box-shadow: 0 0 10px rgba(255,123,114,.6); }

.track-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.gain-wrap { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.gain { width: 110px; }

button, .file-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}
button:hover, .file-btn:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
#record-btn.recording { background: #5a1f1f; border-color: var(--mirror); }

.hint, .pair-list:empty::before {
  color: var(--muted); font-size: 12px;
}
.pair-list:empty::before { content: "まだ区間がありません。"; }

.align-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.align-bar #auto-align { border-color: var(--accent-2); }
.align-status { color: var(--muted); font-size: 12px; }

.pair-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.pair-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 12px; background: var(--panel-2);
}
.pair-chip .pair-label { cursor: pointer; }
.pair-chip.selected { border-color: var(--accent); background: #1c2740; }
.pair-chip.unpaired { opacity: .7; }
.pair-mirror-select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 6px; font-size: 11px; cursor: pointer; max-width: 200px;
}
.pair-mirror-select:hover { border-color: var(--mirror); }
.orphan-note { flex-basis: 100%; color: var(--muted); font-size: 11px; margin-top: 2px; }

.pair-compare { margin: 6px 0 12px; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.pair-compare.hidden { display: none; }
.cmp-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.cmp-legend { display: inline-flex; align-items: center; gap: 4px; }
.cmp-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-left: 6px; vertical-align: middle; }
.cmp-legend i.o { background: var(--orig); }
.cmp-legend i.m { background: var(--mirror); }
.cmp-hint { color: var(--muted); font-size: 11px; margin-left: auto; }
.cmp-scores { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; font-size: 13px; }
.score-chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; }
.score-chip b { font-weight: 600; color: var(--muted); font-size: 11px; }
.score-chip small { font-size: 10px; color: var(--muted); }
.score-chip.good { border-color: #7dffd0; color: #7dffd0; }
.score-chip.mid { border-color: var(--accent-2); color: var(--accent-2); }
.score-chip.low { border-color: var(--mirror); color: var(--mirror); }

.cmp-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cmp-label { width: 64px; font-size: 11px; color: var(--muted); text-align: right; flex: none; }
.cmp-canvas { flex: 1; width: 100%; height: 80px; background: var(--bg); border-radius: 6px; }
.cmp-canvas.spec { height: 110px; }

.sync-controls, .analysis-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.voiced-only { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.voiced-only input { cursor: pointer; }
.enhance-wrap { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.enhance-sel { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; }
.rt-spectrum-wrap { margin: 10px 0; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.rt-spectrum { width: 100%; height: 90px; display: block; background: var(--bg); border-radius: 6px; }

.shortcuts { margin-top: 10px; }
.shortcuts kbd {
  background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-size: 11px; font-family: ui-monospace, monospace;
}

.feature-table-wrap { overflow-x: auto; margin-top: 12px; }
#feature-table { width: 100%; border-collapse: collapse; font-size: 12px; }
#feature-table th, #feature-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: right; white-space: nowrap; }
#feature-table th:first-child, #feature-table td:first-child,
#feature-table th:nth-child(2), #feature-table td:nth-child(2) { text-align: left; }
#feature-table .seg-head td { background: var(--panel-2); font-weight: 600; }
#feature-table .contour-diff { color: var(--muted); font-weight: 400; }
.diff-up { color: var(--accent-2); }
.diff-down { color: var(--mirror); }

/* 次に意識する点チェックリスト */
.checklist { margin-top: 14px; }
.checklist:empty { display: none; }
.checklist-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.check-seg { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.check-seg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.loop-btn { font-size: 12px; padding: 4px 10px; border-color: var(--accent-2); }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.check-row input { margin-top: 3px; }
.check-row input:checked + span { color: var(--muted); text-decoration: line-through; }

.ai-result {
  margin-top: 14px; padding: 14px; background: var(--panel-2);
  border-radius: 8px; font-size: 13px; white-space: pre-wrap;
  min-height: 40px; border: 1px solid var(--line);
}
.ai-result:empty::before { content: "ここにAIのインサイトが表示されます。"; color: var(--muted); }
/* Markdownレンダリング時 */
.ai-result.rendered { white-space: normal; line-height: 1.7; }
.ai-result.rendered h1, .ai-result.rendered h2, .ai-result.rendered h3 { margin: 12px 0 6px; font-size: 15px; }
.ai-result.rendered h3 { font-size: 14px; }
.ai-result.rendered p { margin: 6px 0; }
.ai-result.rendered ul, .ai-result.rendered ol { margin: 6px 0; padding-left: 22px; }
.ai-result.rendered li { margin: 2px 0; }
.ai-result.rendered code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ai-result.rendered pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow-x: auto; }
.ai-result.rendered pre code { background: none; padding: 0; }
.ai-result.rendered blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.ai-result.rendered a { color: var(--accent); }

.transcript-cols { display: flex; gap: 12px; flex-wrap: wrap; }
.transcript-col { flex: 1; min-width: 240px; }
.transcript-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tx-status { font-size: 12px; color: var(--muted); }
.tx-words { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 48px; font-size: 14px; }
.tx-words:empty::before { content: "「文字起こし」を押すと、ここに単語が並びます。"; color: var(--muted); font-size: 12px; }
.tx-line { display: block; line-height: 1.9; }
.tx-word { cursor: pointer; padding: 1px 3px; border-radius: 4px; }
.tx-word:hover { background: #1c2740; }
.tx-word.tx-current { background: var(--accent); color: #0e1116; }

.account-panel .account-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.account-input { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; min-width: 220px; }
.account-cta { border-color: var(--accent-2); color: var(--accent-2); font-weight: 700; }
.pro-badge { display: inline-block; font-size: 11px; font-weight: 800; color: #0e1116; background: var(--accent-2); border-radius: 999px; padding: 1px 8px; vertical-align: middle; margin-left: 6px; }
.max-badge { display: inline-block; font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(90deg, #a855f7, #6366f1); border-radius: 999px; padding: 1px 8px; vertical-align: middle; margin-left: 6px; }
.max-cta { border-color: #a855f7; color: #c4b5fd; font-weight: 700; }
.notif-badge { display: inline-block; min-width: 18px; text-align: center; font-size: 11px; font-weight: 800; color: #fff; background: #e5484d; border-radius: 999px; padding: 1px 6px; vertical-align: middle; margin-left: 4px; }

.review-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.review-head .review-open, .review-head .lib-restore { margin-left: auto; }
.review-status { font-size: 11px; color: var(--accent-2); border: 1px solid var(--accent-2); border-radius: 999px; padding: 1px 8px; }
.review-status.done { color: #0e1116; background: #7dffd0; border-color: #7dffd0; }
.review-feedback { margin-top: 8px; padding: 8px 10px; background: var(--bg); border-radius: 6px; font-size: 13px; line-height: 1.7; }
.review-body { margin-top: 10px; }
.review-players { display: flex; gap: 16px; flex-wrap: wrap; }
.review-players label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.review-input { width: 100%; min-height: 90px; margin: 8px 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical; }

.pick-cloud, #save-recording { border-color: var(--accent-2); }
/* Pro限定ボタンの無効状態（表示はするが押せない） */
button:disabled { cursor: not-allowed; opacity: .5; }
button.pro-locked { border-color: var(--line); color: var(--muted); }
.picker-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.picker-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(560px, 92vw); max-height: 80vh; overflow: auto; padding: 16px; }
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 15px; }
.picker-head button { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }

.storage-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.history-wrap { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.history-chart { width: 100%; height: 140px; display: block; }
.history-info { font-size: 12px; color: var(--muted); margin-top: 6px; }

footer { padding: 16px 24px 30px; color: var(--muted); text-align: center; }
