/* 深色模式：<html class="dark"> 时把页面里用到的 Tailwind 颜色换成深色版（不用改每个模板）。
   主题在「设置」里选：跟随电脑（默认，电脑晚上切到深色就跟着变）／浅色／深色 */
html.dark { color-scheme: dark; }
html.dark body { background-color: #0f172a; color: #e5e7eb; }

/* 底色 */
html.dark .bg-gray-50 { background-color: #0f172a; }
html.dark .bg-white { background-color: #1e293b; }
html.dark .bg-gray-100 { background-color: #334155; }
html.dark .bg-gray-200 { background-color: #475569; }
html.dark .bg-indigo-50, html.dark .bg-indigo-50\/60 { background-color: rgba(99, 102, 241, .16); }
html.dark .bg-indigo-100 { background-color: rgba(99, 102, 241, .28); }
html.dark .bg-indigo-200 { background-color: rgba(99, 102, 241, .38); }
html.dark .bg-green-50 { background-color: rgba(34, 197, 94, .13); }
html.dark .bg-green-100 { background-color: rgba(34, 197, 94, .24); }
html.dark .bg-red-50 { background-color: rgba(239, 68, 68, .14); }
html.dark .bg-red-100 { background-color: rgba(239, 68, 68, .25); }
html.dark .bg-amber-50 { background-color: rgba(245, 158, 11, .13); }
html.dark .bg-amber-100 { background-color: rgba(245, 158, 11, .25); }

/* 鼠标移上去 */
html.dark .hover\:bg-gray-50:hover, html.dark .hover\:bg-white:hover { background-color: #334155; }
html.dark .hover\:bg-gray-100:hover { background-color: #475569; }
html.dark .hover\:bg-indigo-50:hover { background-color: rgba(99, 102, 241, .22); }
html.dark .hover\:bg-red-50:hover { background-color: rgba(239, 68, 68, .2); }
html.dark .hover\:text-gray-700:hover, html.dark .hover\:text-gray-600:hover { color: #f1f5f9; }

/* 文字 */
html.dark .text-gray-900 { color: #f8fafc; }
html.dark .text-gray-800 { color: #f1f5f9; }
html.dark .text-gray-700 { color: #e2e8f0; }
html.dark .text-gray-600 { color: #cbd5e1; }
html.dark .text-gray-500 { color: #94a3b8; }
html.dark .text-gray-400 { color: #7c8aa0; }
html.dark .text-gray-300 { color: #526075; }
html.dark .text-green-600, html.dark .text-green-700, html.dark .text-green-800 { color: #4ade80; }
html.dark .text-red-500, html.dark .text-red-600, html.dark .text-red-800 { color: #f87171; }
html.dark .text-indigo-500 { color: #818cf8; }
html.dark .text-indigo-600, html.dark .text-indigo-700 { color: #a5b4fc; }
html.dark .text-amber-500, html.dark .text-amber-600, html.dark .text-amber-700 { color: #fbbf24; }
html.dark .hover\:text-indigo-700:hover { color: #c7d2fe; }

/* 边框：先给没写颜色的边框一个深色，再把有颜色的边框放回来（同样的优先级，后写的赢） */
html.dark .border, html.dark .border-2, html.dark .border-t, html.dark .border-b, html.dark .border-gray-200,
html.dark .divide-y > * + * { border-color: #334155; }
html.dark .border-gray-300 { border-color: #475569; }
html.dark .border-transparent { border-color: transparent; }
html.dark .border-indigo-200 { border-color: rgba(129, 140, 248, .4); }
html.dark .border-indigo-400 { border-color: #818cf8; }
html.dark .border-indigo-500, html.dark .border-indigo-600 { border-color: #6366f1; }
html.dark .border-green-300, html.dark .border-green-400 { border-color: rgba(74, 222, 128, .55); }
html.dark .border-green-500 { border-color: #22c55e; }
html.dark .border-red-300, html.dark .border-red-400 { border-color: rgba(248, 113, 113, .6); }
html.dark .border-red-500 { border-color: #ef4444; }
html.dark .border-amber-300 { border-color: rgba(251, 191, 36, .55); }
html.dark .hover\:border-gray-300:hover { border-color: #64748b; }
html.dark .hover\:border-indigo-200:hover, html.dark .hover\:border-indigo-300:hover, html.dark .hover\:border-indigo-400:hover { border-color: #818cf8; }

/* 输入框・下拉框・选项小圆片 */
html.dark input:not([type=checkbox]):not([type=radio]), html.dark select, html.dark textarea { background-color: #0f172a; color: #f1f5f9; }
html.dark .chip span { background: #1e293b; border-color: #475569; color: #cbd5e1; }
html.dark .chip input:checked + span { background: #4F46E5; border-color: #4F46E5; color: #fff; }
html.dark .shadow, html.dark .shadow-lg, html.dark .shadow-xl { box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
html.dark img { filter: brightness(.88); }

/* 单词页答完后的对错高亮（!important 的类） */
html.dark .\!bg-green-50 { background-color: rgba(34, 197, 94, .18) !important; }
html.dark .\!bg-red-50 { background-color: rgba(239, 68, 68, .18) !important; }
html.dark .\!border-green-500 { border-color: #22c55e !important; }
html.dark .\!border-red-500 { border-color: #ef4444 !important; }

/* 提示条（其他语言的「没有语音」等） */
html.dark .text-amber-800 { color: #fcd34d; }
html.dark .border-amber-200 { border-color: rgba(251, 191, 36, .35); }
html.dark .text-rose-600, html.dark .text-sky-600 { filter: brightness(1.3); }
