/* ===== 网页朗读器 · 样式（浅色主题，纯静态，无外部依赖） ===== */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --line: #e4e8ef;
  --line-strong: #d3dae5;
  --text: #1f2937;
  --text-2: #5b6675;
  --text-3: #8a94a6;
  --brand: #2563eb;
  --brand-soft: #e8f0fe;
  --brand-dark: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --hl: #fff3c4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
  --dock-h: 92px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 13px; color: var(--text); }

/* ---------- 顶栏 ---------- */
.topbar {
  flex: 0 0 auto;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  box-shadow: 0 1px 0 rgba(16, 24, 40, .03);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot {
  width: 26px; height: 26px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #38bdf8);
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
  flex: 0 0 auto;
}
.brand-text h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: .3px; }
.brand-text p { margin: 0; font-size: 12px; color: var(--text-3); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.chip-idle { background: #f1f5f9; color: var(--text-2); border-color: var(--line); }
.chip-muted { background: #eef2f7; color: var(--text-3); border-color: var(--line); }
.chip-playing { background: #e7f7ee; color: var(--ok); border-color: #bce7cb; }
.chip-paused  { background: #fef4e2; color: var(--warn); border-color: #f6dfb4; }
.chip-done    { background: var(--brand-soft); color: var(--brand-dark); border-color: #cddffd; }
.chip-error   { background: #fdeaea; color: var(--danger); border-color: #f7c9c9; }

.ghost-btn {
  background: #fff; border: 1px solid var(--line-strong); color: var(--text-2);
  border-radius: 8px; padding: 6px 12px; font-size: 12px;
}
.ghost-btn:hover { background: #f6f8fb; color: var(--text); }

/* ---------- 布局 ---------- */
.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 300px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-head {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel-head.sub-head { border-top: 1px solid var(--line); margin-top: 4px; }
.panel-head h2 { font-size: 13px; margin: 0; font-weight: 650; color: var(--text); letter-spacing: .4px; }
.head-tools { display: flex; align-items: center; gap: 6px; }
.hint { font-size: 12px; color: var(--text-3); }

/* ---------- 左栏：内容源 ---------- */
.col-source { padding-bottom: 10px; overflow-y: auto; }
.tabs { display: flex; gap: 6px; padding: 12px 14px 8px; }
.tab {
  flex: 1; padding: 7px 0; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text-2); font-size: 13px;
}
.tab.active { background: var(--brand-soft); border-color: #cddffd; color: var(--brand-dark); font-weight: 600; }
.tabpane { display: none; padding: 0 14px; flex-direction: column; gap: 8px; }
.tabpane.active { display: flex; }

textarea#textArea {
  width: 100%; min-height: 230px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
  line-height: 1.7; background: #fff; outline: none;
}
textarea#textArea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

.text-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong);
  border-radius: 9px; background: #fff; outline: none;
}
.text-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.text-input.small { font-size: 12px; }

.row-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-btn {
  border: 1px solid var(--line-strong); background: #fff; color: var(--text-2);
  border-radius: 8px; padding: 5px 10px; font-size: 12px;
}
.mini-btn:hover { background: #f2f5fa; color: var(--text); }
.primary-btn {
  border: 0; background: var(--brand); color: #fff; border-radius: 9px;
  padding: 9px 14px; font-size: 13px; font-weight: 600;
}
.primary-btn:hover { background: var(--brand-dark); }
.primary-btn:disabled { background: #b9c4d4; cursor: not-allowed; }
.primary-btn.block { width: 100%; }

.proxy-box {
  border: 1px dashed var(--line-strong); border-radius: 10px;
  padding: 10px; background: var(--panel-2); display: flex; flex-direction: column; gap: 8px;
}
.tip { font-size: 12px; color: var(--text-3); margin: 2px 0 0; line-height: 1.55; }
.tip b { color: var(--text-2); }
.msg { font-size: 12px; border-radius: 8px; padding: 8px 10px; display: none; line-height: 1.6; }
.msg.show { display: block; }
.msg.ok { background: #e9f8ef; color: #157f3f; border: 1px solid #c2ebd2; }
.msg.err { background: #fdeaea; color: #b42318; border: 1px solid #f7c9c9; }
.msg.info { background: #f1f5f9; color: var(--text-2); border: 1px solid var(--line); }

.switch-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.switch-line input { accent-color: var(--brand); }
.symbol-row { display: flex; flex-direction: column; gap: 3px; margin: 1px 0 2px 24px; }
.symbol-row .text-input { font-size: 13px; padding: 6px 9px; }
.symbol-hint { font-size: 11px; color: var(--text-3); line-height: 1.4; }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: 12px; padding: 22px 14px;
  text-align: center; background: var(--panel-2); transition: .15s;
}
.dropzone.hot { border-color: var(--brand); background: var(--brand-soft); }
.dz-icon { font-size: 30px; line-height: 1; }
.dz-main { margin: 8px 0 2px; font-size: 13px; }
.dz-sub { margin: 0 0 10px; font-size: 12px; color: var(--text-3); }
.file-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li {
  font-size: 12.5px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel-2); display: flex; justify-content: space-between; gap: 8px;
}
.file-list li .del { color: var(--danger); border: 0; background: none; font-size: 12px; }

/* ---------- 中栏：正文 ---------- */
.col-doc { padding: 0; }
.doc-title {
  flex: 0 0 auto; padding: 12px 22px; font-size: 16px; font-weight: 650;
  border-bottom: 1px solid var(--line); color: var(--text);
}
.doc-body {
  flex: 1 1 auto; overflow-y: auto; padding: 18px 26px 40px;
  font-size: 16px; line-height: 2; color: #24303f;
}
.doc-body p { margin: 0 0 16px; }
.empty-hint { color: var(--text-3); font-size: 14px; text-align: center; padding: 40px 0; }
.sentence { border-radius: 6px; padding: 1px 3px; transition: background .18s; }
.sentence.active { background: var(--hl); box-shadow: 0 0 0 3px var(--hl); }
.sentence.done { color: #6b7686; }

/* ---------- 右栏：控制台 ---------- */
.col-console { overflow-y: auto; padding-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; padding: 2px 14px 8px; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; padding: 8px 14px; }
.field.inline .field-label { white-space: nowrap; margin: 0; }
.field.inline select { flex: 1; min-width: 0; }
.field-label { font-size: 12px; color: var(--text-2); display: flex; justify-content: space-between; }
.field-label b { color: var(--brand-dark); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--brand); }
.chapter-list { padding: 0 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 220px; }
.chapter-list button {
  text-align: left; border: 1px solid transparent; background: none; color: var(--text-2);
  padding: 6px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
}
.chapter-list button:hover { background: #f2f5fa; color: var(--text); }
.chapter-list button.active { background: var(--brand-soft); color: var(--brand-dark); border-color: #cddffd; }

/* ---------- 底部播放条 ---------- */
.dock {
  flex: 0 0 auto; height: var(--dock-h);
  background: var(--panel); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 18px;
  box-shadow: 0 -2px 12px rgba(16, 24, 40, .05);
}
.dock-main { flex: 1 1 auto; display: flex; align-items: center; gap: 18px; min-width: 0; }
.ctrl-group { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.round-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: #fff; color: var(--text-2); font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.round-btn:hover { background: #f2f5fa; color: var(--text); }
.round-btn.play { background: var(--brand); border-color: var(--brand); color: #fff; width: 46px; height: 46px; font-size: 17px; }
.round-btn.play:hover { background: var(--brand-dark); }

.progress-wrap { flex: 1 1 auto; min-width: 0; }
.progress-bar { height: 6px; background: #e9edf3; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #60a5fa); border-radius: 999px; transition: width .2s; }
.progress-meta { display: flex; align-items: center; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.progress-meta #counter { color: var(--text-2); flex: 0 0 auto; }
.cur-sentence { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
#timer { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.dock-side { display: flex; gap: 8px; flex: 0 0 auto; }

/* ---------- 提示条 / 弹窗 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 12px);
  background: #1f2937; color: #fff; font-size: 13px; padding: 9px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 50; max-width: 70vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .38); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal.hidden { display: none; }
.modal-card {
  background: #fff; border-radius: 14px; padding: 20px 22px; width: 420px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
}
.modal-card h3 { margin: 0 0 12px; font-size: 15px; }
.kv-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: 84px 1fr; gap: 7px 12px; font-size: 13px; }
.kv-list li { display: contents; }
.kv-list b { font-family: ui-monospace, Consolas, monospace; color: var(--brand-dark); }
.kv-list span { color: var(--text-2); }
.modal-foot { display: flex; flex-direction: column; gap: 10px; }
.modal-foot .primary-btn { align-self: flex-end; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6dce6; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #bcc5d3; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; overflow: visible; }
  .panel { min-height: 320px; }
  .col-doc { min-height: 60vh; }
  .dock { position: sticky; bottom: 0; z-index: 20; flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .progress-wrap { order: 3; width: 100%; flex: 1 1 100%; }
}
