/* ============================================
   全部语音讲解 - 全屏抽屉
   ============================================ */

*[hidden] { display: none !important; }
body.drawer-open { overflow: hidden; }

.voice-drawer {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  justify-content: center;
  background: rgba(17, 24, 39, 0.3);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.voice-drawer.show { opacity: 1; }
.voice-drawer-panel {
  width: 100%;
  max-width: 430px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--background);
  transform: translateY(100%);
  transition: transform 0.28s ease;
}
.voice-drawer.show .voice-drawer-panel { transform: translateY(0); }

/* ===== 顶部栏 ===== */
.voices-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 12px;
  background: var(--background);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, background 0.15s;
}
.nav-icon-btn:active { transform: scale(0.94); }
.nav-icon-btn:hover { background: var(--primary); }
.nav-icon-btn svg { width: 20px; height: 20px; }
.voices-nav-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.voices-nav-spacer { width: 38px; flex: 0 0 38px; }

/* ===== 内容区 ===== */
.voices-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px calc(28px + env(safe-area-inset-bottom, 0px));
}
.voice-drawer :focus-visible {
  outline: 2px solid #7C3AED;
  outline-offset: 2px;
}
/* ===== 语音卡片 ===== */
.voices-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.voice-card {
  padding: 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.voice-card[data-status="ready"][data-play-status="playing"] {
  border-color: #A7F3D0;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.12);
}
.voice-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
}
.voice-index {
  padding: 2px 9px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #047857;
  font-size: 11px;
  font-weight: 700;
}
.voice-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--background);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10.5px;
}
.voice-top-spacer { flex: 1; }
.voice-card-question {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-muted);
}
.voice-card-text { margin-top: 8px; }
.voice-card-text p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.voice-card-text p:last-child { margin-bottom: 0; }
.voice-card-text.is-placeholder p {
  font-size: 13px;
  color: var(--text-muted);
}

.voice-play {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #34D399, #059669);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.24);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, background 0.15s;
}
.voice-play:active:not(:disabled) { transform: scale(0.92); }
.voice-play svg { width: 18px; height: 18px; }
.voice-play .i-pause { display: none; }
.voice-play[data-play-status="playing"] .i-play { display: none; }
.voice-play[data-play-status="playing"] .i-pause { display: block; }
.voice-play:disabled {
  background: #D1FAE5;
  box-shadow: none;
  cursor: default;
}
.voice-card[data-status="generating"] .voice-play .i-play,
.voice-card[data-status="generating"] .voice-play .i-pause {
  display: none;
}
.voice-card[data-status="generating"] .voice-play:disabled {
  background: linear-gradient(135deg, #6EE7B7, #10B981);
  opacity: 0.9;
}
.voice-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: voice-spin 0.8s linear infinite;
}
.voice-card[data-status="generating"] .voice-spinner { display: block; }
.voice-card[data-status="failed"] .voice-play { display: none; }

/* ===== 进度（流式：已缓冲 + 已播放，可回跳） ===== */
.voice-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #F3F1F9;
}
.voice-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: #EEEDF5;
  touch-action: none;
  outline-offset: 6px;
  cursor: default;
}
.voice-card[data-status="ready"] .voice-track { cursor: pointer; }
.voice-card[data-status="ready"] .voice-track[aria-disabled="true"] { cursor: default; }
.voice-track::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  bottom: -10px;
}
.voice-buffer,
.voice-fill {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  border-radius: 999px;
}
.voice-buffer {
  background: #A7F3D0;
  transition: width 0.3s linear;
}
.voice-fill {
  background: linear-gradient(90deg, #34D399, #059669);
  transition: width 0.2s linear;
}
.voice-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #059669;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.25);
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.voice-card[data-play-status="playing"] .voice-thumb,
.voice-card[data-play-status="paused"] .voice-thumb,
.voice-card[data-play-status="ended"] .voice-thumb,
.voice-card.is-seeking .voice-thumb {
  opacity: 1;
}
.voice-card.is-seeking .voice-thumb {
  width: 15px;
  height: 15px;
  margin-left: -7.5px;
}
.voice-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.voice-card[data-status="generating"] .voice-progress,
.voice-card[data-status="failed"] .voice-progress {
  display: none;
}

.voices-note {
  margin: 18px 4px 0;
  font-size: 11px;
  text-align: center;
  color: var(--text-placeholder);
}

@keyframes voice-spin {
  to { transform: rotate(360deg); }
}
