/* 通用样式：移动端优先，微信内置浏览器友好 */
:root {
  --blue: #1a73e8;
  --blue-light: #e8f1fe;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --line: #eef0f3;
  --bg: #ffffff;
  --bg-2: #f5f6f7;
  --radius: 10px;
  --hl: #2f7bff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--blue); text-decoration: none; }

.hidden { display: none !important; }

/* 播放页整体：顶栏 + 播放器钉住不动，只有下面的内容区自己滚，
   这样跟随字幕滚动时视频永远在视野里 */
.page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.topbar, .player-wrap, .tabs { flex: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar .title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* ---------- 播放器 ---------- */
.player-wrap { position: relative; background: #000; }
.player-wrap video { display: block; width: 100%; max-height: 42vh; background: #000; }
.player-wrap.is-audio video { height: 180px; }

.player-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 3;
}
.pill {
  border: 1px solid rgba(255, 255, 255, .55);
  color: #fff;
  background: rgba(0, 0, 0, .35);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  backdrop-filter: blur(2px);
}
.pill.off { color: rgba(255, 255, 255, .45); border-color: rgba(255, 255, 255, .25); }

.cap-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 76px;
  text-align: center;
  padding: 0 12px;
  pointer-events: none;
  z-index: 2;
}
.cap-line {
  display: inline-block;
  max-width: 96%;
  color: #fff;
  font-size: 17px;
  line-height: 1.5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 8px rgba(0, 0, 0, .7);
}
.cap-line.dim { color: rgba(255, 255, 255, .55); font-size: 15px; }

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, 0));
  z-index: 3;
}
.controls .row { display: flex; align-items: center; gap: 12px; color: #fff; }
.time { font-size: 15px; color: rgba(255, 255, 255, .9); font-variant-numeric: tabular-nums; }
.btn-play {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .18); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.btn-full {
  margin-left: auto;
  background: rgba(255, 255, 255, .22);
  color: #fff; border-radius: 6px; padding: 6px 10px; font-size: 13px; line-height: 1.15;
}
.seek {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  margin-top: 4px;
  touch-action: none;
}
.seek .track { position: absolute; left: 0; right: 0; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
.seek .buffered { position: absolute; left: 0; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .45); width: 0; }
.seek .fill { position: absolute; left: 0; height: 6px; border-radius: 3px; background: var(--hl); width: 0; }
.seek .knob {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--hl); box-shadow: 0 0 0 3px rgba(47, 123, 255, .25); left: 0; transform: translateX(-8px);
}
.big-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 2;
}
.big-play span {
  width: 62px; height: 62px; border-radius: 50%; background: rgba(255, 255, 255, .9);
  display: flex; align-items: center; justify-content: center; font-size: 24px; color: #222; padding-left: 5px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 5;
}
.tab {
  padding: 12px 0 10px;
  font-size: 16px;
  color: var(--text-2);
  position: relative;
  white-space: nowrap;
}
.tab.active { color: var(--blue); font-weight: 600; }
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  border-radius: 2px; background: var(--blue);
}
.tabs .grow { flex: 1; }
.icon-btn { color: var(--text-2); font-size: 18px; padding: 6px; }

.pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px 24px;
}


/* ---------- 文字记录 ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 10px; }
.searchbar input {
  flex: 1; border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 18px; padding: 8px 14px; outline: none;
}
.seg-group { margin-bottom: 18px; }
.seg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.spk-name { color: var(--text-2); font-size: 15px; }
.spk-time { color: var(--text-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.seg-body { font-size: 17px; line-height: 1.85; letter-spacing: .2px; }
.sent { cursor: pointer; border-radius: 3px; }
.sent.active { background: var(--hl); color: #fff; }
.sent mark { background: #ffe08a; color: inherit; border-radius: 2px; padding: 0 1px; }
.empty { text-align: center; color: var(--text-3); padding: 48px 20px; font-size: 15px; }

/* ---------- AI ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2);
  border-radius: 8px; padding: 7px 14px; font-size: 14px; white-space: nowrap;
}
.chip.active { color: var(--blue); background: #fff; border-color: var(--blue); }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 8px; flex-wrap: wrap; }
.action {
  display: flex; align-items: center; gap: 6px; background: var(--bg-2);
  border-radius: 18px; padding: 6px 14px; font-size: 14px; color: var(--text-2);
}
.action .dot { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.md { font-size: 16px; line-height: 1.85; }
.md h1, .md h2, .md h3 { font-size: 17px; margin: 18px 0 8px; }
.md p { margin: 10px 0; }
.md ul, .md ol { padding-left: 22px; margin: 8px 0; }
.md li { margin: 4px 0; }
.md blockquote {
  margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--blue);
  background: var(--bg-2); border-radius: 0 6px 6px 0; color: var(--text-2);
}
.md code { background: var(--bg-2); padding: 1px 5px; border-radius: 4px; font-size: 14px; }
.md strong { font-weight: 600; }

/* ---------- 问答 ---------- */
.chat-list { min-height: 40vh; }
.msg { margin: 14px 0; display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 12px; background: var(--bg-2); }
.msg.user .bubble { background: var(--blue); color: #fff; }
.reasoning {
  font-size: 14px; color: var(--text-3); border-left: 2px solid var(--line);
  padding-left: 10px; margin-bottom: 8px; white-space: pre-wrap;
}
.composer {
  flex: none; background: var(--bg);
  border-top: 1px solid var(--line); padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.composer .line { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px;
  resize: none; max-height: 100px; outline: none; background: var(--bg-2);
}
.send-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none;
}
.send-btn:disabled { opacity: .45; }
.opt-row { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.opt {
  border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px;
  font-size: 13px; color: var(--text-2); background: var(--bg-2);
}
.opt.active { color: var(--blue); border-color: var(--blue); background: #fff; }

/* ---------- 通用小组件 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .82); color: #fff; padding: 9px 18px; border-radius: 20px;
  font-size: 14px; z-index: 999; max-width: 80%; text-align: center;
}
.loading { display: flex; align-items: center; gap: 8px; color: var(--text-3); padding: 20px 0; font-size: 14px; }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-card { padding: 22px 16px; text-align: center; color: var(--text-2); }
.bar { height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; margin: 12px 0 8px; }
.bar > div { height: 100%; background: var(--blue); transition: width .4s; }

.mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 24px;
}
.dialog { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 360px; }
.dialog h3 { margin: 0 0 12px; font-size: 17px; }
.dialog input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  outline: none; margin-bottom: 14px;
}
.dialog .btns { display: flex; gap: 10px; justify-content: flex-end; }
.btn-primary { background: var(--blue); color: #fff; border-radius: 8px; padding: 8px 18px; }
.btn-plain { background: var(--bg-2); color: var(--text-2); border-radius: 8px; padding: 8px 18px; }

@media (min-width: 820px) {
  body { background: var(--bg-2); }
  .page { max-width: 780px; margin: 0 auto; background: var(--bg); box-shadow: 0 0 24px rgba(0, 0, 0, .06); }
  .player-wrap video { max-height: 46vh; }
}
