/* ============================================================
   听写页专属样式
   —— 功能沿用「自助听写」原版，配色映射到点读暖色系
   ============================================================ */

/* ===== 词源切换 ===== */
.seg {
  display: flex;
  gap: 5px;
  padding: 5px;
  background: var(--pg-soft);
  border: 1px solid var(--pg-soft2);
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.seg button {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 8px;
  min-height: 42px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}
.seg button:hover { color: var(--text-primary); }
.seg button.on {
  background: #FFFFFF;
  color: var(--pg-ink);
  box-shadow: 0 3px 10px rgba(93, 76, 130, 0.14);
}

/* ===== 自定义词表 ===== */
#wordInput {
  min-height: 104px;
  font-size: 15px;
}

/* ===== 词汇预览 ===== */
.word-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 2px 4px;
  min-height: 44px;
  max-height: 200px;
  overflow-y: auto;
}
.word-tag {
  display: inline-flex;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid var(--border-soft);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-secondary);
  transition: 0.2s;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(93, 76, 130, 0.06);
}
.word-tag.active {
  background: var(--pg-grad);
  border-color: transparent;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 5px 14px var(--pg-shadow);
  transform: translateY(-1px);
}
.word-tag.done {
  background: #F3F1EC;
  border-color: #E8E3D8;
  color: var(--text-muted);
  text-decoration: line-through;
}
.progress-text {
  display: inline-block;
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pg-ink);
  background: var(--pg-soft);
  border: 1px solid var(--pg-soft2);
  border-radius: var(--radius-pill);
  padding: 5px 15px;
}

/* ===== 状态栏 ===== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 16px;
  font-size: 14.5px;
  color: var(--text-secondary);
  background: var(--bg-field);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
}
.status-bar strong { color: var(--text-primary); font-weight: 600; }
.status-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #D9D2C4;
}
.status-bar.playing .status-dot {
  background: var(--accent-green);
  animation: dictPulse 1.6s infinite;
}
@keyframes dictPulse {
  0% { box-shadow: 0 0 0 0 rgba(60, 207, 91, 0.5); }
  70% { box-shadow: 0 0 0 9px rgba(60, 207, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(60, 207, 91, 0); }
}

/* ===== 语音设置网格 ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.setting-cell { min-width: 0; }
.setting-cell > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.setting-cell .dd { width: 100%; }
.setting-cell .range-row { min-height: 42px; }
.divider { border: none; border-top: 1px dashed var(--border-soft); margin: 18px 0 14px; }

/* ===== 历史记录 ===== */
.history-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.history-toolbar .btn { flex: 1; }
.history-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 420px;
  overflow-y: auto;
}
.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 22px 0;
}
.history-entry {
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: #FFFDF8;
  cursor: pointer;
  transition: 0.18s;
}
.history-entry:hover { border-color: var(--pg-accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(93, 76, 130, 0.1); }
.history-entry.status-completed { background: #F4FDF7; border-color: #C6EDD5; }
.history-entry.status-abnormal { background: #FFF7F5; border-color: #FFD5CB; }
.history-entry.status-manual { background: #FFFBF0; border-color: #FFE3B8; }
.history-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.history-time { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.history-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--pg-soft);
  color: var(--pg-ink);
  border: 1px solid var(--pg-soft2);
  white-space: nowrap;
}
.history-summary {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 历史详情弹窗 ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: rgba(58, 61, 92, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.overlay.open { display: flex; }
.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 660px;
  max-height: 86vh;
  overflow: hidden;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 30px 70px rgba(58, 61, 92, 0.32);
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  background: linear-gradient(135deg, #FFF6E9, #FFF0F3);
  border-bottom: 1px solid var(--border-soft);
}
.modal-header h2 { flex: 1; margin: 0; font-size: 17px; color: var(--text-primary); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-settings { font-size: 12.5px; color: var(--text-muted); }
.history-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.history-word { font-size: 13px; padding: 4px 11px; cursor: pointer; }
.history-word.active { background: var(--pg-grad); border-color: transparent; color: #FFFFFF; }
.history-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* 宽屏：语音设置排 3 列 */
@media (min-width: 1000px) {
  .settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .word-preview { max-height: 240px; }
}

@media (max-width: 640px) {
  .seg button { font-size: 13.5px; padding: 9px 6px; }
}

@media (max-width: 600px) {
  .settings-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .word-preview { max-height: 168px; }
  .modal-header { flex-wrap: wrap; }
  .modal-body { padding: 14px 15px; }
}
@media (max-width: 400px) {
  .settings-grid { grid-template-columns: 1fr; }
}
