:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #0f766e;
  --accent-soft: #f0fdfa;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --danger: #dc2626;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-bottom: 64px;
}

.sticky-player {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.player-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.brand h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
}

.brand .subtitle {
  font-size: 12px;
  color: var(--muted);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

button:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
button.primary:hover:not(:disabled) { background: var(--primary-dark); }

button.upload-btn {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  border-color: #0f766e;
  color: #fff;
  font-weight: 600;
}
button.upload-btn:hover:not(:disabled) { filter: brightness(1.06); }

button.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}

button.key-btn {
  background: var(--amber-soft);
  border-color: #fcd34d;
  color: #b45309;
  font-weight: 600;
}
button.key-btn:hover { background: #fef3c7; border-color: #f59e0b; }
button.key-btn.playing { background: #f59e0b; border-color: #d97706; color: #fff; }

button.teal-btn {
  background: var(--accent-soft);
  border-color: #99f6e4;
  color: var(--accent);
  font-weight: 600;
}
button.teal-btn:hover { background: #ccfbf1; }
button.teal-btn.playing { background: var(--accent); border-color: var(--accent); color: #fff; }

button.playing {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.speed-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.speed-group button {
  border: none;
  border-radius: 0;
  border-right: 1px solid var(--border);
  padding: 6px 9px;
  font-size: 12px;
}
.speed-group button:last-child { border-right: none; }
.speed-group button.active { background: var(--primary); color: #fff; }

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
}

.now-playing-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  min-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  border-radius: 999px;
  transition: width 0.08s linear;
}
.time-text {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 86px;
  text-align: right;
}

.container {
  max-width: 1140px;
  margin: 22px auto 0;
  padding: 0 20px;
}

.full-audio-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.full-audio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.full-audio-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #1e3a8a;
}
.full-audio-card audio { width: 100%; height: 40px; outline: none; }

.quick-nav {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.quick-nav-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.nav-groups { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.nav-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-group-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
}
.q-pill {
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}
.q-pill.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 14px;
}
.section-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.badge.teal { background: var(--accent-soft); color: var(--accent); }

.grid-a {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(490px, 1fr));
  gap: 14px;
}
@media (max-width: 560px) { .grid-a { grid-template-columns: 1fr; } }

.q-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.q-card.active-card, .pq-item.active-card {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.q-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.q-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.q-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.topic-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
}
.q-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.transcript-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}
.transcript-box.visible { display: block; }
.dialogue-line { margin: 4px 0; }
.speaker { font-weight: 700; color: var(--primary-dark); margin-right: 4px; }
.q-line {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
  font-weight: 600;
  color: #1e293b;
}
.tip-line {
  margin-top: 6px;
  font-size: 12.5px;
  color: #0f766e;
  background: #f0fdfa;
  padding: 5px 9px;
  border-radius: 6px;
}
mark.clue {
  background: #fef08a;
  color: #854d0e;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
}

.passage-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.passage-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.passage-top h3 { margin: 0 0 4px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.passage-desc { font-size: 13px; color: var(--muted); }
.passage-controls { display: flex; flex-wrap: wrap; gap: 8px; }

.sentences-wrap {
  margin-top: 16px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: none;
}
.sentences-wrap.visible { display: block; }
.sentences-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.sentence-item {
  padding: 7px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 14.5px;
  border: 1px solid transparent;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sentence-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.sentence-item.playing-sent { background: #dbeafe; border-color: #3b82f6; color: #1e3a8a; font-weight: 500; }
.sentence-item.is-key { background: #fffbeb; border-color: #fde68a; }
.sentence-item.is-key.playing-sent { background: #fef3c7; border-color: #f59e0b; }
.sent-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 40px;
  flex-shrink: 0;
}
.key-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f59e0b;
  color: #fff;
  margin-right: 6px;
}

.passage-questions { margin-top: 16px; display: grid; gap: 12px; }
.pq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}
.pq-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.pq-qtext { font-size: 15px; font-weight: 600; margin-top: 8px; }
.pq-clue {
  margin-top: 8px;
  font-size: 13px;
  color: #92400e;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 7px 10px;
  border-radius: 0 6px 6px 0;
  display: none;
}
.pq-clue.visible { display: block; }

/* Fine-tune toolbar */
.tweak-bar {
  display: none;
  margin-top: 10px;
  padding: 8px 10px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 12px;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
body.tweak-mode .tweak-bar { display: flex; }
.tweak-bar button { padding: 3px 8px; font-size: 11.5px; }

/* Empty State */
.empty-state {
  background: var(--card);
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  padding: 56px 24px;
  text-align: center;
  margin-top: 24px;
}
.empty-state h2 { margin: 8px 0; font-size: 20px; }
.empty-state p { color: var(--muted); max-width: 520px; margin: 0 auto 20px; font-size: 14px; }

/* Upload Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 560px;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-header h3 { margin: 0; font-size: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.dropzone {
  border: 2px dashed #93c5fd;
  background: #f8fbff;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dropzone:hover, .dropzone.dragover { background: #eff6ff; border-color: var(--primary); }
.dropzone input { display: none; }

.step-log {
  margin-top: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  display: none;
}
.step-log.visible { display: block; }
.step-progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}
.step-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0f766e, #2563eb);
  transition: width 0.25s ease;
}
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; }
.kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
