:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --text: #1D1D1F;
  --muted: #86868B;
  --primary: #007AFF;
  --accent: #007AFF;
  --success: #34C759;
  --border: #D2D2D7;
  --accent-soft: #EAF3FF;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .38; cursor: not-allowed; }
button:focus-visible, select:focus-visible, input:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid rgba(0, 122, 255, .3);
  outline-offset: 2px;
}

/* 全局导航 */
.global-navbar .nav-container { max-width: 1440px; }
.global-navbar .nav-links { margin: 0; padding: 0; list-style: none; }
.global-navbar .nav-links li { list-style: none; }

/* 左侧材料栏 */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 14px 14px;
  border: 1px solid rgba(0, 0, 0, .04);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .03);
}
.sidebar-head {
  flex-shrink: 0;
  padding: 0 8px 15px;
  border-bottom: 1px solid var(--border);
}
.sidebar-kicker { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-title { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.sidebar-sub { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.materials {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 13px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.nav-group { display: flex; flex-direction: column; gap: 7px; }
.nav-label { margin: 0; padding: 0 10px; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.nav-items { display: flex; flex-direction: column; gap: 4px; }
.chip {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  color: var(--text);
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.chip:hover { color: var(--accent); background: var(--accent-soft); }
.chip.is-selected { color: #FFF; background: var(--accent); }
.sidebar-foot { flex-shrink: 0; margin: 0; padding: 11px 8px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

/* 原文展示区 */
.stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 18px;
  padding: 16px 24px;
}
.paper {
  width: 100%;
  min-width: 0;
  max-width: 1360px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 26px 46px 0;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .03);
}
.paper-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.paper-kicker { margin: 0 0 6px; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.paper-head h2 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.paper-meta { margin: 0 0 3px; color: var(--muted); font-size: 15px; white-space: nowrap; }
.transcript-scroll { flex: 1; overflow-y: auto; padding: 22px 0 34px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.turn { max-width: 1080px; }
.turn + .turn { margin-top: 28px; }
.speaker { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.speaker--man { color: var(--accent); }
.speaker--woman { color: #9A5B00; }
.segment-text {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(26px, 2.35vw, 36px);
  line-height: 1.6;
  letter-spacing: -.012em;
}
.sentence {
  padding: 2px 4px;
  margin: 0 -4px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.sentence:hover { background: var(--bg); }
.sentence.is-active { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }

/* 底部播放器 */
.player {
  padding: 9px 28px 11px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.error-banner { display: none; max-width: 1360px; margin: 0 auto 8px; padding: 8px 13px; border-radius: 10px; color: #C22B21; background: #FFF0EF; font-size: 13px; }
.error-banner.is-visible { display: block; }
.player-bar {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(160px, .9fr) minmax(460px, 1.8fr) auto;
  align-items: center;
  gap: 24px;
}
.now-playing { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--border); }
.status-dot.is-playing { background: var(--success); }
.status-dot.is-loading { background: var(--accent); }
.now-copy { min-width: 0; }
.now-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; }
.now-detail { margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }

.transport-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.button:active { transform: scale(.98); }
.button.ghost { color: var(--text); background: var(--bg); }
.button.ghost:hover { color: var(--accent); background: var(--accent-soft); }
.button.primary { min-width: 88px; color: #FFF; background: var(--accent); }
.button.primary:hover { background: #006EE6; }
.progress-row { display: grid; grid-template-columns: 40px minmax(80px, 1fr) 40px; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.progress-row span:last-child { text-align: right; }
#progressInput { width: 100%; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }

.rate { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.rate select { height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); font-size: 13px; }

@media (max-width: 1080px) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding: 12px 14px; }
  .sidebar { flex-direction: row; align-items: center; gap: 14px; padding: 10px 12px; overflow-x: auto; }
  .sidebar-head { flex-shrink: 0; padding: 0 14px 0 4px; border-right: 1px solid var(--border); border-bottom: 0; }
  .sidebar-kicker, .sidebar-sub, .sidebar-foot { display: none; }
  .sidebar-title { font-size: 16px; white-space: nowrap; }
  .materials { flex-direction: row; gap: 14px; padding: 0; overflow: visible; }
  .nav-group { flex-direction: row; align-items: center; gap: 8px; flex-shrink: 0; }
  .nav-label { padding: 0; }
  .nav-items { flex-direction: row; }
  .chip { width: auto; }
  .paper { padding: 18px 22px 0; border-radius: 16px; }
  .player-bar { grid-template-columns: 1fr auto; gap: 12px; }
  .now-playing { display: none; }
  .transport { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .sidebar-title { display: none; }
  .sidebar-head { display: none; }
  .paper-head h2 { font-size: 22px; }
  .paper-meta { display: none; }
  .segment-text { font-size: 21px; }
  .transport-row { gap: 6px; }
  .button { padding: 0 11px; font-size: 13px; }
  .button.primary { min-width: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
