/* 結果画面用 */
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 600; }
/* 校正カードの種別バッジ。行は flex なので、指摘文が長いと1文字幅まで縮み
   「校」「正」が縦に並ぶ。**`.chip` 全体には付けない** —— 修正案（→ …）や
   ガイドライン名のチップは長文が入るので、縮まないと枠の外へはみ出す。 */
.chip.proof-kind-chip { flex-shrink: 0; white-space: nowrap; }
/* × 原文 → ○ 修正。収まらないときは → の手前で折り返して縦に積む。 */
.proof-variant { display: flex; flex-wrap: wrap; align-items: center; column-gap: 2px; row-gap: 2px; flex: 1; min-width: 0; }
/* 指摘カードの見出し（チップ＋タイトル ／ 参照元・対応・リスク）。
   折り返すのは**塊の区切り**だけ。左の塊を `min-width: 0` で縮めると右の塊が
   同じ行に居座り、チップとタイトルが1文字幅まで潰れて縦に並ぶ。
   左の塊に基準幅を持たせ、足りなければ右の塊を次の行へ送る。 */
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }
.card-head-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; flex: 1 1 14em; min-width: 0; }
.card-head-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; margin-left: auto; }
.card-head .chip { flex-shrink: 0; white-space: nowrap; }
.card-head-title { font-size: 13px; font-weight: 700; line-height: 1.5; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.chip-blue   { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.chip-green  { background: var(--tone-ok-bg); color: var(--tone-ok-fg); }
.chip-orange { background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.chip-red    { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.chip-purple { background: var(--tone-category-bg); color: var(--tone-category-fg); }
.chip-gray   { background: var(--tone-neutral-bg); color: var(--tone-neutral-fg); }
.preferred  { color: #047857; font-weight: 600; }
.deprecated { color: #be123c; font-weight: 600; }
body[data-theme="dark"] .preferred  { color: #5ee8c0; }
body[data-theme="dark"] .deprecated { color: #ff8a9f; }
/* 同表記異音語の読み条件プレフィックス */
.cond-reading {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(0,0,0,.04);
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 2px;
  white-space: nowrap;
}
.cond-reading strong { color: var(--text); font-weight: 600; }
body[data-theme="dark"] .cond-reading { background: rgba(255,255,255,.06); }
.action-hint { font-size: 12px; padding: 4px 10px; border-radius: 8px; background: rgba(234,88,12,.08); color: #c2410c; margin-top: 6px; display: inline-block; }
body[data-theme="dark"] .action-hint { background: rgba(255,160,80,.12); color: #ffa050; }
.result-card { background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--stroke); border-radius: 14px; padding: 14px 16px; transition: border-color .12s; cursor: pointer; }
.result-card:hover { border-color: rgba(79,140,255,.30); }
.result-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--stroke); margin-bottom: 12px; }
.result-tab { padding: 8px 14px; font-size: 13px; font-weight: 500; border: none; background: transparent; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--text-muted); transition: all .12s; }
.result-tab:hover { color: var(--text); }
.result-tab.active { color: var(--pri); border-bottom-color: var(--pri); font-weight: 600; }
.result-tab .tc { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 700; background: var(--chip-bg); margin-left: 4px; }
.result-tab.active .tc { background: rgba(59,122,237,.15); color: var(--pri); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--pri); cursor: pointer; margin-bottom: 12px; background: none; border: none; }
.back-link:hover { text-decoration: underline; }

/* 結果画面レイアウト */
.results-layout { display: flex; flex-direction: column; height: 100%; }
.results-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.results-left {
  flex: 0 0 45%;
  min-width: 240px;
  max-width: 75%;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.results-divider {
  flex: 0 0 5px;
  cursor: col-resize;
  background: var(--stroke);
  position: relative;
  z-index: 5;
  transition: background .15s;
}
.results-divider:hover,
.results-divider.dragging {
  background: var(--pri);
}
.results-divider::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -4px; right: -4px;
}
.results-right {
  flex: 1 1 0%;
  min-width: 300px;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
body.resizing-cols { cursor: col-resize; user-select: none; }
body.resizing-cols .results-left,
body.resizing-cols .results-right { pointer-events: none; }

/* Locate button on result cards */
.locate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s, border-color .15s, background .15s;
}
.locate-btn:hover {
  color: var(--pri);
  border-color: var(--pri);
  background: rgba(59,122,237,.08);
}

/* Locate highlight mark injected into corrected text */
.locate-mark {
  background: rgba(59,122,237,.45);
  color: var(--text);
  border-radius: 3px;
  padding: 1px 2px;
  outline: 2px solid var(--pri);
  outline-offset: 1px;
  animation: locatePulse 1.6s ease-in-out 2;
}
@keyframes locatePulse {
  0%, 100% { outline-color: var(--pri); background: rgba(59,122,237,.45); }
  50%      { outline-color: transparent; background: rgba(59,122,237,.2); }
}

/* 添付した原稿ファイルのバー（左ペインの先頭）。押すと原本ビューアが開く。
   「校正テキスト」の見出しより上に置く（本文より前に「何を読ませたか」が来る）。 */
.script-file-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.script-file-bar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* 入力画面の添付チップ（#683）。**押すと2ペインビューアが開く。**
   ファイル本文は入力欄に入らなくなったので、中身にたどり着く導線はここだけ。
   押せることが見た目から分かるように、元資料のチップと同じ形にする。 */
.script-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--chip-bg);
  border: 1px solid var(--stroke);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.script-attach-chip:hover { background: var(--chip-bg-hover); }

/* 原稿ファイルから**文字を読み取れなかった**ときの断り書き（#683）。
   読み取れた場合は出さない —— 添付チップが同じファイル名と文字数を出すので
   丸ごと重複だった（`_renderScriptFileNotice` のコメント）。 */
.script-file-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--chip-bg);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.script-file-notice.hidden { display: none; }
.script-file-notice-btn {
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--pri);
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.script-file-notice-btn:hover { background: var(--chip-bg-hover); }

/* 見出し + 凡例 + 絞り込みチップ。**折り返しを許す。**
   左ペインは 500px 程度しか無く、チップが増えた（#609）ぶん `nowrap` のままだと
   ラベルが語の途中で改行されて読めなくなる（実ブラウザで確認した）。 */
.corrected-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.corrected-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.corrected-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  /* **チップの中で折り返さない。** 折り返すと「要注意ワー / ド」のように
     語の途中で割れて読めない（#609 の実ブラウザ確認）。行が足りなければ
     チップ単位で `.corrected-stats` 側が折り返す。 */
  white-space: nowrap;
}
.stat-chip-warn { background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.stat-chip-ok   { background: var(--tone-ok-bg); color: var(--tone-ok-fg); }
.stat-chip-danger { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
/* 「調べていない範囲がある」（#760）。**警告（オレンジ）にも OK（緑）にもしない。**
   指摘ではないのでオレンジは強すぎ、緑にすると「確認済み」と読まれる。 */
.stat-chip-muted { background: var(--tone-neutral-bg); color: var(--tone-neutral-fg); }
/* 校正テキストの凡例チップ。本文のハイライト（.highlight / .highlight-applied）と
   同じ色にする。凡例だけ別の色（stat-chip-warn のオレンジ等）だと、どのハイライトの
   説明なのかが読み取れない。 */
.legend-applied   { background: rgba(31,170,134,.14); color: var(--ok); }
.legend-unapplied { background: #fff799; color: #7a5d00; }
body[data-theme="dark"] .legend-applied   { background: rgba(31,170,134,.28); color: #5ee8c0; }
body[data-theme="dark"] .legend-unapplied { background: rgba(250,204,21,.25); color: #fef08a; }
/* 薄い破線・点線のチャネルの凡例（#671）。**本文と同じ見え方にする** ——
   背景を持たせると、背景の無い印の説明が背景付きのチップになり、色見本として
   機能しない（上のコメントの「凡例だけ別の色だと読み取れない」と同じ理由）。
   下線の色・種類は `.highlight.highlight-verified` / `.highlight-hint` と揃える。 */
.legend-verified { background: transparent; color: var(--ok); border-bottom: 1px dashed rgba(31,170,134,.55); border-radius: 0; }
.legend-hint     { background: transparent; color: var(--pri); border-bottom: 1px dotted rgba(59,122,237,.65); border-radius: 0; }
/* 未確認（#760）。本文の `.highlight-unverified` と同じ灰の点線にする。 */
.legend-unverified { background: transparent; color: var(--tone-neutral-fg); border-bottom: 1px dotted rgba(107,114,128,.7); border-radius: 0; }
body[data-theme="dark"] .legend-verified { color: #5ee8c0; border-bottom-color: rgba(94,232,192,.55); }
body[data-theme="dark"] .legend-hint     { color: #93bbff; border-bottom-color: rgba(147,187,255,.7); }
body[data-theme="dark"] .legend-unverified { border-bottom-color: rgba(156,163,175,.7); }
.corrected-text {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  border-radius: 12px;
  background: var(--chip-bg);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}
.corrected-text .highlight-warn {
  background: rgba(234,88,12,.12);
  border-bottom: 2px solid #ea580c;
  padding: 1px 2px;
  border-radius: 3px;
  cursor: pointer;
  transition: background .12s;
}
.corrected-text .highlight-warn:hover { background: rgba(234,88,12,.22); }
body[data-theme="dark"] .corrected-text .highlight-warn { background: rgba(255,160,80,.15); border-bottom-color: #ffa050; }
body[data-theme="dark"] .corrected-text .highlight-warn:hover { background: rgba(255,160,80,.25); }
.corrected-text .highlight-ok {
  background: rgba(31,170,134,.1);
  border-bottom: 2px solid var(--ok);
  padding: 1px 2px;
  border-radius: 3px;
}
/* .original-toggle removed — replaced by corrected-header style */
.original-text {
  margin-top: 6px;
  padding: 12px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--stroke);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}

/* 結果タブ（3タブ：原稿・台本チェック / 用語検索 / 日テレEYE検索） */
.res-tabs-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--chip-bg);
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
}
.res-tab {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .18s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 9px;
  position: relative;
  white-space: nowrap;
  flex: 1;
  justify-content: center;
}
.res-tab:hover { color: var(--text-secondary); background: var(--chip-bg-hover); }
.res-tab.active {
  color: var(--text);
  font-weight: 600;
  background: var(--panel-solid);
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
}
body[data-theme="dark"] .res-tab.active {
  box-shadow: 0 1px 3px rgba(0,0,0,.24), 0 2px 8px rgba(0,0,0,.16);
}
.res-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  background: var(--chip-bg);
  transition: all .18s ease;
}
.res-tab.active .tab-count {
  background: linear-gradient(135deg, var(--pri-fill), var(--pri2-fill));
  color: #fff;
}
.tab-elapsed {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tab-elapsed:empty { display: none; }
.tab-status {
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
  color: var(--text-muted);
}
/* 結果の状態（#933）。色だけに頼らず、文言とアイコン（✓ / ! / 回転する輪）でも見分ける。
   色は対応表（app.css の `--tone-*`。#957）の組。 */
body {
  --run-checking-fg: var(--tone-info-fg);
  --run-checking-bg: var(--tone-info-bg);
  --run-complete-fg: var(--tone-ok-fg);
  --run-complete-bg: var(--tone-ok-bg);
  --run-interrupted-fg: var(--tone-danger-fg);
  --run-interrupted-bg: var(--tone-danger-bg);
  --run-awaiting-fg: var(--tone-warn-fg);
  --run-awaiting-bg: var(--tone-warn-bg);
}
.tab-status[data-status] {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.tab-status[data-status]::before {
  flex: none;
  width: 12px;
  height: 12px;
  font-size: 9px;
  line-height: 12px;
  text-align: center;
  border-radius: 50%;
  box-sizing: border-box;
}
.tab-status[data-status="checking"] { color: var(--run-checking-fg); background: var(--run-checking-bg); }
.tab-status[data-status="complete"] { color: var(--run-complete-fg); background: var(--run-complete-bg); }
.tab-status[data-status="interrupted"] { color: var(--run-interrupted-fg); background: var(--run-interrupted-bg); }
.tab-status[data-status="awaiting"] { color: var(--run-awaiting-fg); background: var(--run-awaiting-bg); }
.tab-status[data-status="complete"]::before,
.tab-status[data-status="interrupted"]::before {
  color: var(--panel-solid);
  font-weight: 900;
}
.tab-status[data-status="complete"]::before { content: "✓"; background: var(--run-complete-fg); }
.tab-status[data-status="interrupted"]::before { content: "!"; background: var(--run-interrupted-fg); }
.tab-status[data-status="checking"]::before,
.tab-status[data-status="awaiting"]::before {
  content: "";
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 1s linear infinite;
}
.tab-status[data-status="awaiting"]::before { animation-duration: 2.4s; }
@media (prefers-reduced-motion: reduce) {
  .tab-status[data-status]::before { animation: none; }
}
/* 実行状態の注意書き（#933）。見出しのピルと同じ色の意味で塗る。 */
.run-state-box { border: 1px solid var(--run-state-fg); background: var(--run-state-bg); }
.run-state-box[data-status="interrupted"] { --run-state-fg: var(--run-interrupted-fg); --run-state-bg: var(--run-interrupted-bg); }
.run-state-box[data-status="awaiting"] { --run-state-fg: var(--run-awaiting-fg); --run-state-bg: var(--run-awaiting-bg); }
.run-state-btn { border: 1px solid var(--run-state-fg); color: var(--run-state-fg); }
.res-tab.checking,
.res-tab.active.checking {
  background: linear-gradient(90deg, var(--chip-bg) 25%, var(--chip-bg-hover) 50%, var(--chip-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}
.res-tab-panel { display: none; }
.res-tab-panel.active { display: block; }

/* 結果セクション（アコーディオン） */
.res-section {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: 10px;
  overflow: hidden;
}
.res-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background .12s;
}
.res-section-header:hover { background: var(--card-hover); }
.res-section-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.res-section-icon svg { width: 14px; height: 14px; }
.res-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.res-section-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--text-muted);
}
.res-section-badge.has-issues { background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.res-section-badge.all-ok { background: var(--tone-ok-bg); color: var(--tone-ok-fg); }
.res-section-chevron {
  width: 16px; height: 16px;
  color: var(--text-muted);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.res-section.open .res-section-chevron { transform: rotate(180deg); }
.res-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.res-section-body-inner {
  padding: 0 14px 14px;
}
/* 複数のセクションを括る見出し（校閲 → 事実確認）。開閉はしない。 */
.res-group { margin: 4px 0 10px; }
.res-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 2px;
}
.res-subgroup {
  border-left: 2px solid var(--stroke);
  padding-left: 10px;
  margin-bottom: 10px;
}
.res-subgroup-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 6px;
}
.sub-source {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 10px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--stroke);
}
.sub-source:first-child { margin-top: 0; }
/* 用語カードを「入力のどの語で引けたか」でまとめる見出し（#621）。
   `.sub-source`（＝資料の種別）より一段内側に見えること。同じ見た目にすると
   「新聞用語集」と「聞いた」が同列に並んで階層が読めなくなる。
   **グループが1つしかないときは出さない**（検索欄の再掲にしかならない。
   出し分けは app.js の `_renderTermGroups`）。 */
.term-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  margin-top: 8px;
  margin-bottom: 4px;
  padding-left: 2px;
  color: var(--text-secondary);
}
.term-group-word {
  font-weight: 700;
  color: var(--text);
}
/* グループ見出しの読み。**語のすぐ隣に置く。** 文章で検索すると
   きっかけの語ごとにグループができるので、語と読みが同じ行に並んでいないと
   「どの語の読みなのか」を目で追う必要がある（利用者からの指摘）。 */
.term-group-reading {
  color: var(--text-muted);
  font-weight: 400;
}
.term-group-count {
  color: var(--text-muted);
}
.results-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.summary-count {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  margin-right: 4px;
}
.summary-divider {
  width: 1px;
  height: 20px;
  background: var(--stroke);
}
.summary-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--chip-bg);
}
.summary-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 下部継続入力バー */
.continue-bar {
  padding: 12px 20px;
  border-top: 1px solid var(--stroke);
  background: transparent;
  flex-shrink: 0;
}
.continue-bar .input-box {
  max-width: 100%;
}
.continue-bar .input-box textarea {
  padding: 10px 16px 4px;
  min-height: 32px;
  font-size: 13px;
}
.continue-bar .input-toolbar {
  padding: 2px 8px 6px;
}

/* 短い入力の用語結果 */
.term-hero {
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  margin-bottom: 12px;
}
.term-hero-word {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}
.term-hero-reading {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.term-hero-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.term-rule-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 画面切替 */
[data-view] { display: none; }
[data-view].active { display: flex; }

