* { box-sizing: border-box; }
/* 默认深夜版；白昼版样式见文末 html[data-theme="light"] 一节 */
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #e8e8e8;
  background: #121212;
  line-height: 1.7;
}
main { max-width: 720px; margin: 0 auto; padding: 32px 20px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 8px; }
.sub { color: #aaa; margin: 0 0 16px; }
#theme-toggle { font-size: 18px; padding: 6px 12px; border-radius: 999px; flex-shrink: 0; }
/* 阶段状态跟踪灯：未开始/跳过灰色、进行中橙色脉冲、完成绿色、失败红色 */
.track { display: flex; gap: 16px; margin: 0 0 14px; font-size: 14px; }
.track-item { display: flex; align-items: center; gap: 6px; color: #888; }
.track-item .dot { width: 10px; height: 10px; border-radius: 50%; background: #888; flex-shrink: 0; }
.track-item[data-state="running"] { color: #f59e0b; font-weight: 600; }
.track-item[data-state="running"] .dot { background: #f59e0b; animation: track-pulse 1s ease-in-out infinite; }
.track-item[data-state="done"] { color: #22c55e; }
.track-item[data-state="done"] .dot { background: #22c55e; }
.track-item[data-state="error"] { color: #ef4444; }
.track-item[data-state="error"] .dot { background: #ef4444; }
@keyframes track-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
textarea {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  line-height: 1.7;
  border: 1px solid #444;
  border-radius: 6px;
  resize: vertical;
  background: #1e1e1e;
  color: #e8e8e8;
}
.detect { min-height: 24px; color: #aaa; font-size: 14px; margin: 6px 0; }
.upload-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.upload-hint { color: #888; font-size: 13px; }
.image-preview { margin: 8px 0; display: flex; align-items: flex-start; gap: 10px; }
.image-preview[hidden] { display: none; }
.image-preview img { max-width: 100%; max-height: 320px; border: 1px solid #444; border-radius: 6px; }
#history .kind {
  font-size: 12px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid #444; color: #aaa; flex-shrink: 0;
}
#history .kind.question { color: #f59e0b; border-color: #f59e0b; }
button {
  padding: 9px 20px;
  font-size: 15px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #222;
  color: #e8e8e8;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: #e8e8e8; color: #111; border-color: #e8e8e8; }
.progress { min-height: 24px; color: #aaa; font-size: 14px; margin-top: 8px; }
.error { color: #e57373; font-size: 14px; min-height: 20px; }
.results { margin-top: 24px; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid #333; margin-bottom: 12px; }
.tab { border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 4px; color: #aaa; }
.tab.active { color: #fff; border-bottom-color: #fff; font-weight: 600; }
.pane {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 15px;
  margin: 0;
  padding: 16px;
  background: #1e1e1e;
  border-radius: 6px;
}
.actions { display: flex; gap: 10px; margin-top: 14px; }
.hint { color: #888; font-size: 13px; margin: 0 0 8px; }
#history { list-style: none; padding: 0; margin: 0; }
#history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 14px;
}
#history .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#history .time { color: #888; font-size: 12px; }
#history button { padding: 4px 10px; font-size: 13px; }
#history .dots { display: flex; gap: 4px; flex-shrink: 0; }
#history .dots .dot { width: 8px; height: 8px; border-radius: 50%; background: #888; }
#history .dots .dot.done { background: #22c55e; }
#history .dots .dot.error { background: #ef4444; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal[hidden] { display: none; }
.modal-box { background: #222; padding: 24px; border-radius: 8px; width: 320px; max-width: 90vw; }
.modal-box h2 { margin-top: 0; }
.modal-box input {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  border: 1px solid #444;
  border-radius: 6px;
  margin-bottom: 14px;
  background: #1e1e1e;
  color: #e8e8e8;
}
.modal-actions { display: flex; gap: 10px; }

/* 白昼版 */
html[data-theme="light"] body { color: #111; background: #fff; }
html[data-theme="light"] .sub { color: #666; }
html[data-theme="light"] .track-item { color: #888; }
html[data-theme="light"] textarea { border-color: #ccc; background: #fff; color: #111; }
html[data-theme="light"] .detect { color: #666; }
html[data-theme="light"] button { border-color: #ccc; background: #fff; color: #111; }
html[data-theme="light"] button.primary { background: #111; color: #fff; border-color: #111; }
html[data-theme="light"] .progress { color: #666; }
html[data-theme="light"] .error { color: #c0392b; }
html[data-theme="light"] .tabs { border-bottom-color: #ddd; }
html[data-theme="light"] .tab { color: #666; }
html[data-theme="light"] .tab.active { color: #111; border-bottom-color: #111; }
html[data-theme="light"] .pane { background: #f7f7f7; }
html[data-theme="light"] #history li { border-bottom-color: #eee; }
html[data-theme="light"] .upload-hint { color: #999; }
html[data-theme="light"] .image-preview img { border-color: #ccc; }
html[data-theme="light"] #history .kind { border-color: #ccc; color: #666; }
html[data-theme="light"] #history .kind.question { color: #b45309; border-color: #d97706; }
html[data-theme="light"] .modal { background: rgba(0, 0, 0, 0.4); }
html[data-theme="light"] .modal-box { background: #fff; }
html[data-theme="light"] .modal-box input { border-color: #ccc; background: #fff; color: #111; }
