/* ── Dark mode: final text & highlights ── */
body[data-theme="dark"] #finalText {
  background-color: #1a1a2e;
  border-color: #374151;
  color: #e5e7eb;
}
body[data-theme="dark"] .line-row:hover {
  background-color: rgba(255,255,255,.04);
}
body[data-theme="dark"] .line-number {
  background-color: rgba(255,255,255,.03);
  border-right-color: #374151;
}
body[data-theme="dark"] .highlight {
  background-color: rgba(250, 204, 21, 0.25);
  border-bottom-color: rgba(250, 204, 21, 0.6);
  color: #fef08a;
}
body[data-theme="dark"] .highlight.highlight-applied {
  background-color: rgba(31, 170, 134, 0.28);
  border-bottom-color: rgba(31, 170, 134, 0.7);
  color: #5ee8c0;
}
body[data-theme="dark"] .hl-tooltip { background-color: #374151; }
body[data-theme="dark"] .hl-tooltip[data-placement="top"] .hl-tooltip__arrow { border-top-color: #374151; }
body[data-theme="dark"] .hl-tooltip[data-placement="bottom"] .hl-tooltip__arrow { border-bottom-color: #374151; }
body[data-theme="dark"] .highlight.highlight-ntv-eye {
  background-color: rgba(249, 115, 22, 0.3);
  border-bottom-color: rgba(249, 115, 22, 0.7);
  color: #fdba74;
}
body[data-theme="dark"] .highlight.highlight-ntv-eye:hover {
  background-color: rgba(249, 115, 22, 0.45);
}
body[data-theme="dark"] .line-row.flash-highlight {
  animation: flashPulseDark 2s ease-out !important;
}
@keyframes flashPulseDark {
  0%   { background-color: rgba(251, 146, 60, 0.5) !important; box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.5); }
  40%  { background-color: rgba(251, 146, 60, 0.15) !important; box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.2); }
  100% { background-color: transparent !important; box-shadow: none; }
}
body[data-theme="dark"] .highlight-ntv-eye.flash-highlight {
  animation: flashPulseNtvEyeDark 2s ease-out !important;
}
@keyframes flashPulseNtvEyeDark {
  0%   { background-color: rgba(251, 146, 60, 0.7) !important; }
  40%  { background-color: rgba(249, 115, 22, 0.35) !important; }
  100% { background-color: rgba(249, 115, 22, 0.3) !important; }
}
body[data-theme="dark"] .ntv-eye-jump-hint {
  color: #60a5fa;
}
body[data-theme="dark"] .ntv-eye-jump-hint:hover {
  color: #93bbfd;
}

/* ── Login overlay dark mode ── */
body[data-theme="dark"] #loginOverlay {
  background: linear-gradient(135deg, rgba(11,18,32,.95), rgba(20,26,44,.95)) !important;
}
body[data-theme="dark"] #loginOverlay > div {
  background: var(--panel) !important;
  border: 1px solid var(--stroke) !important;
}
body[data-theme="light"] #loginOverlay {
  background: linear-gradient(to bottom right, #eff6ff, #e0e7ff) !important;
}
body[data-theme="light"] #loginOverlay > div {
  background: #fff !important;
  border: 1px solid rgba(0,0,0,.1) !important;
}

/* ── Dark mode overrides for Tailwind utility classes used by result HTML ── */
body[data-theme="dark"] .bg-white,
body[data-theme="dark"] .bg-gray-50,
body[data-theme="dark"] .bg-gray-100 {
  background: var(--panel) !important;
}

body[data-theme="dark"] .bg-blue-50,
body[data-theme="dark"] .bg-green-50 {
  background: transparent !important;
}

body[data-theme="dark"] .border-gray-200,
body[data-theme="dark"] .border-gray-300,
body[data-theme="dark"] .border-blue-100,
body[data-theme="dark"] .border-blue-200,
body[data-theme="dark"] .border-green-100,
body[data-theme="dark"] .border-green-200 {
  border-color: var(--stroke) !important;
}

body[data-theme="dark"] .text-gray-900,
body[data-theme="dark"] .text-gray-800 {
  color: var(--text) !important;
}

body[data-theme="dark"] .text-gray-700,
body[data-theme="dark"] .text-gray-600 {
  color: var(--text-secondary) !important;
}

body[data-theme="dark"] .text-gray-500,
body[data-theme="dark"] .text-gray-400 {
  color: var(--text-muted) !important;
}

body[data-theme="dark"] .text-blue-600,
body[data-theme="dark"] .text-blue-700 {
  color: var(--pri) !important;
}

/* Dark mode history badges */
body[data-theme="dark"] .bg-blue-50.text-blue-800 {
  background: rgba(79, 140, 255, 0.2) !important;
  color: #7ab4ff !important;
}
body[data-theme="dark"] .bg-amber-50.text-amber-900 {
  background: rgba(255, 204, 102, 0.2) !important;
  color: #ffcc66 !important;
}
body[data-theme="dark"] .bg-red-50.text-red-800 {
  background: rgba(255, 92, 124, 0.2) !important;
  color: #ff8a9f !important;
}

/* 赤系背景（bg-red-50 単体 — 要注意ワード等） */
body[data-theme="dark"] .bg-red-50 {
  background: rgba(255, 92, 124, 0.15) !important;
}

/* 白背景カード（問題あり / 正常 等）— モーダル内は除外 */
body[data-theme="dark"] li.bg-white,
body[data-theme="dark"] div.space-y-2 > .bg-white {
  background: rgba(255, 255, 255, 0.07) !important;
}

/* 赤ボーダー */
body[data-theme="dark"] .border-red-100 {
  border-color: rgba(255, 92, 124, 0.30) !important;
}
body[data-theme="dark"] .border-red-200 {
  border-color: rgba(255, 92, 124, 0.40) !important;
}

/* 赤テキスト */
body[data-theme="dark"] .text-red-600 {
  color: #ff8a9f !important;
}
body[data-theme="dark"] .text-red-700 {
  color: #ff8a9f !important;
}
body[data-theme="dark"] .text-red-800 {
  color: #ff8a9f !important;
}

/* グレーテキスト (specific overrides) */
body[data-theme="dark"] .text-gray-900 {
  color: rgba(255, 255, 255, 0.92) !important;
}
body[data-theme="dark"] .text-gray-700 {
  color: rgba(255, 255, 255, 0.72) !important;
}
body[data-theme="dark"] .text-gray-600 {
  color: rgba(255, 255, 255, 0.65) !important;
}
body[data-theme="dark"] .text-gray-500 {
  color: rgba(255, 255, 255, 0.55) !important;
}
body[data-theme="dark"] .text-gray-400 {
  color: rgba(255, 255, 255, 0.45) !important;
}

/* グレーボーダー */
body[data-theme="dark"] .border-gray-100 {
  border-color: rgba(255, 255, 255, 0.10) !important;
}
body[data-theme="dark"] .border-gray-200 {
  border-color: rgba(255, 255, 255, 0.14) !important;
}
body[data-theme="dark"] .border-gray-300 {
  border-color: rgba(255, 255, 255, 0.18) !important;
}

/* 青系（修正不要 / 日テレ EYE） */
body[data-theme="dark"] .bg-blue-50 {
  background: rgba(79, 140, 255, 0.12) !important;
}
body[data-theme="dark"] .border-blue-100 {
  border-color: rgba(79, 140, 255, 0.25) !important;
}
body[data-theme="dark"] .border-blue-200 {
  border-color: rgba(79, 140, 255, 0.35) !important;
}
body[data-theme="dark"] .text-blue-600 {
  color: #7ab4ff !important;
}
body[data-theme="dark"] .text-blue-700 {
  color: #7ab4ff !important;
}

/* 緑系（正常） */
body[data-theme="dark"] .bg-green-50 {
  background: rgba(43, 212, 164, 0.12) !important;
}
body[data-theme="dark"] .border-green-100 {
  border-color: rgba(43, 212, 164, 0.25) !important;
}
body[data-theme="dark"] .text-green-600 {
  color: #5ee8c0 !important;
}
body[data-theme="dark"] .text-green-700 {
  color: #5ee8c0 !important;
}

/* アンバー系（事実誤認等） */
body[data-theme="dark"] .text-amber-600 {
  color: #ffcc66 !important;
}

/* オレンジ系 */
body[data-theme="dark"] .bg-orange-50 {
  background-color: rgba(249, 115, 22, 0.12) !important;
}
body[data-theme="dark"] .border-orange-200 {
  border-color: rgba(249, 115, 22, 0.3) !important;
}
body[data-theme="dark"] .text-orange-600 {
  color: #fb923c !important;
}

/* ── Glossary image frame dark mode ── */
body[data-theme="dark"] #glossaryImageFrame {
  background: #1a2236 !important;
}
body[data-theme="dark"] #glossaryImageFrame .bg-white,
body[data-theme="dark"] #glossaryImageFrame .bg-gray-50 {
  background: #1a2236 !important;
}
body[data-theme="dark"] #glossaryImageFrame .border-b {
  border-color: rgba(255, 255, 255, 0.14) !important;
}
body[data-theme="dark"] #glossaryImageFrame .text-gray-800 {
  color: rgba(255, 255, 255, 0.9) !important;
}
body[data-theme="dark"] #glossaryImageFrame button {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: rgba(255, 255, 255, 0.85) !important;
}
body[data-theme="dark"] #glossaryImageFrame button:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}
body[data-theme="dark"] #glossaryImageFrame input {
  background: rgba(0, 0, 0, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}
body[data-theme="dark"] #glossaryImageFrame img {
  border-color: rgba(255, 255, 255, 0.12) !important;
  background: transparent !important;
}

/* ── Dark mode for button[data-open-glossary-image] ── */
body[data-theme="dark"] button[data-open-glossary-image] {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: rgba(255, 255, 255, 0.72) !important;
}
body[data-theme="dark"] button[data-open-glossary-image]:hover {
  background: rgba(255, 255, 255, 0.14) !important;
}

/* ── Dark mode textarea and inputs ── */
body[data-theme="dark"] textarea,
body[data-theme="dark"] input[type="text"],
body[data-theme="dark"] select {
  background: var(--input-bg) !important;
  border-color: var(--stroke) !important;
  color: var(--text) !important;
}
body[data-theme="dark"] textarea::placeholder,
body[data-theme="dark"] input::placeholder {
  color: var(--text-muted) !important;
}

/* ── Dark mode buttons ── */
body[data-theme="dark"] .bg-blue-600 {
  background: linear-gradient(135deg, var(--pri-fill), var(--pri2-fill)) !important;
}
body[data-theme="dark"] .hover\:bg-blue-700:hover {
  background: linear-gradient(135deg, var(--pri-fill), var(--pri2-fill)) !important;
  opacity: 0.9;
}

/* ── Dark mode dropdown menus ── */
body[data-theme="dark"] #saveDropdownMenu,
body[data-theme="dark"] #inlineDlMenu,
body[data-theme="dark"] #finalTextDlMenu {
  background: #1a2035 !important;
  border-color: rgba(255,255,255,.15) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.5) !important;
}
body[data-theme="dark"] #saveDropdownMenu button,
body[data-theme="dark"] #inlineDlMenu button,
body[data-theme="dark"] #finalTextDlMenu button {
  color: var(--text) !important;
}
body[data-theme="dark"] #saveDropdownMenu button:hover,
body[data-theme="dark"] #inlineDlMenu button:hover,
body[data-theme="dark"] #finalTextDlMenu button:hover {
  background: rgba(79,140,255,.15) !important;
}
body[data-theme="light"] #saveDropdownMenu,
body[data-theme="light"] #inlineDlMenu,
body[data-theme="light"] #finalTextDlMenu {
  background: #fff !important;
  border-color: rgba(0,0,0,.12) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.15) !important;
}

