.poem-detail {
  background: var(--dark-card);
  padding: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 30px;
}
.poem-detail h1 {
  font-size: 28px;
  color: var(--text-bright);
  text-align: center;
  margin-bottom: 10px;
}
.poem-detail .meta {
  text-align: center;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.poem-detail .meta a {
  color: var(--primary);
  margin-right: 12px;
  text-decoration: none;
}
.poem-detail .meta a:hover {
  color: var(--text-bright);
}
.poem-detail .meta .dynasty-tag,
.poem-detail .meta .category-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(184,160,128,0.1);
  border-radius: 4px;
  color: var(--primary);
  margin-right: 12px;
}

/* ===== 诗词配图 ===== */
.poem-image {
  text-align: center;
  margin: 0 0 30px;
  padding: 0;
}
.poem-image img {
  display: inline-block;
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  object-fit: cover;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: var(--dark-card);
}
.poem-image img:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.12);
}
html.dark .poem-image img {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
html.dark .poem-image img:hover {
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
}
/* ===== 诗词配图 end ===== */

/* ===== 正文 ===== */
.poem-detail .content {
  font-size: 18px;
  color: var(--text);
  line-height: 2.5;
  text-align: center;
}
.poem-detail .content p {
  margin-bottom: 10px;
  transition: background 0.3s ease, color 0.3s ease;
  border-radius: 6px;
  padding: 2px 8px;
}

/* 逐句朗读高亮 */
.poem-detail .content p.tts-active {
  background: rgba(184, 160, 128, 0.18);
  color: var(--text-bright);
  box-shadow: 0 0 0 1px rgba(184, 160, 128, 0.25);
}
html.dark .poem-detail .content p.tts-active {
  background: rgba(184, 160, 128, 0.12);
  color: #e8ddd0;
}

.poem-detail .download-bar {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.poem-detail .download-bar a {
  display: inline-block;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--dark);
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
}

/* ===== 语音朗读 ===== */
.tts-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
}

/* 主按钮 */
.tts-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--dark-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  white-space: nowrap;
}
.tts-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tts-btn i {
  font-size: 13px;
}

html.dark .tts-btn {
  background: #161210;
  border-color: #2a221a;
  color: #b0a898;
}
html.dark .tts-btn:hover {
  background: #b8a080;
  color: #0d0b09;
  border-color: #b8a080;
}

/* 朗读按钮特别醒目 */
#ttsPlay {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
#ttsPlay:hover {
  background: var(--accent);
  border-color: var(--accent);
}
html.dark #ttsPlay {
  background: #b8a080;
  color: #0d0b09;
  border-color: #b8a080;
}
html.dark #ttsPlay:hover {
  background: #c9a961;
  border-color: #c9a961;
}

/* 朗读中高亮 */
.tts-btn.speaking {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
html.dark .tts-btn.speaking {
  background: #b8a080;
  color: #0d0b09;
}

/* 音色下拉框 */
.tts-voice {
  display: inline-flex;
  align-items: center;
  padding: 0 6px 0 14px;
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  height: 36px;
  font-size: 13px;
}
.tts-voice select {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  padding: 0 4px;
  font-family: inherit;
  max-width: 130px;
}
.tts-voice select option {
  background: var(--dark-card);
  color: var(--text);
}
html.dark .tts-voice {
  background: #161210;
  border-color: #2a221a;
}
html.dark .tts-voice select {
  color: #b0a898;
}

/* 语速：小图标 + 点击弹层 */
.tts-speed-btn-wrap {
  position: relative;
  display: inline-flex;
}
.tts-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}
.tts-icon-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tts-icon-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
html.dark .tts-icon-btn {
  background: #161210;
  border-color: #2a221a;
  color: #b0a898;
}
html.dark .tts-icon-btn:hover,
html.dark .tts-icon-btn.active {
  background: #b8a080;
  color: #0d0b09;
  border-color: #b8a080;
}

/* 语速弹层 */
.tts-speed-popup {
  display: none;
  position: absolute;
  top: 46px;
  right: 0;
  padding: 12px 16px;
  background: var(--dark-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  min-width: 200px;
  text-align: center;
}
.tts-speed-popup.active {
  display: block;
}
html.dark .tts-speed-popup {
  background: #1e1a16;
  border-color: #2a221a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.tts-speed-popup-title {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
  text-align: left;
}
html.dark .tts-speed-popup-title {
  color: #8a7e70;
}

.tts-speed-popup input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  display: block;
}
.tts-speed-popup-val {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
html.dark .tts-speed-popup-val {
  color: #b0a898;
}

/* ===== 相关推荐 ===== */
.related-section {
  background: var(--dark-card);
  padding: 25px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.related-section h3 {
  font-size: 18px;
  color: var(--text-bright);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.related-section h3 i {
  color: var(--primary);
  margin-right: 8px;
}
.related-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.related-list a {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(184, 160, 128, 0.05);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.related-list a:hover {
  background: rgba(184, 160, 128, 0.15);
  color: var(--primary);
}

/* ===== 深色模式 ===== */
html.dark .poem-detail {
  background: #161210;
  border-color: #2a221a;
}
html.dark .poem-detail h1 {
  color: #e8ddd0;
}
html.dark .poem-detail .content {
  color: #b0a898;
}
html.dark .related-section {
  background: #161210;
  border-color: #2a221a;
}
html.dark .related-section h3 {
  color: #e8ddd0;
  border-bottom-color: #2a221a;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .poem-detail {
    padding: 20px;
  }
  .poem-detail h1 {
    font-size: 22px;
  }
  .poem-detail .content {
    font-size: 16px;
    line-height: 2.2;
  }
  .related-list {
    grid-template-columns: 1fr;
  }

  /* 移动端配图缩小 */
  .poem-image {
    margin: 0 0 20px;
  }
  .poem-image img {
    max-height: 280px;
    border-radius: 8px;
  }

  /* 移动端朗读按钮 */
  .tts-bar {
    gap: 6px;
    margin-top: 16px;
  }
  .tts-btn {
    padding: 7px 14px;
    font-size: 13px;
  }
  .tts-voice {
    height: 34px;
    padding: 0 4px 0 10px;
  }
  .tts-voice select {
    font-size: 12px;
    max-width: 110px;
  }
  .tts-icon-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
  .tts-speed-popup {
    top: 42px;
    min-width: 180px;
    padding: 10px 14px;
  }
}

@media (max-width: 480px) {
  .poem-image img {
    max-height: 220px;
  }
}