/* ===== 奥博教育 · 古诗词典雅版样式 ===== */
:root {
  --red: #c22f1e;
  --red-dark: #87190f;
  --red-deep: #420f0b;
  --gold: #b37e2c;
  --paper: #faf6ee;
  --paper-card: #ffffff;
  --paper-soft: #f4eee1;
  --ink: #2b2622;
  --ink-deep: #161210;
  --muted: #756a60;
  --line: #e8ded2;
  --line-strong: #d5c4b1;
  --shadow-sm: 0 4px 14px rgba(60, 35, 20, 0.05);
  --shadow-md: 0 12px 36px rgba(60, 35, 20, 0.09);
  --radius: 8px;
  --container: 1120px;
  --font-serif: "Noto Serif TC", "Noto Serif SC", "Songti SC", "Source Han Serif TC", "Source Han Serif SC", "PMingLiU", "SimSun", serif;
  --font-sans: "Noto Sans TC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body-font-size: 19px;
}

/* 深色模式 */
[data-theme="dark"] {
  --paper: #1c1917;
  --paper-card: #25221e;
  --paper-soft: #2b2723;
  --ink: #e8e2d8;
  --ink-deep: #f7f4ee;
  --muted: #a69b8f;
  --line: #38322c;
  --line-strong: #4d443c;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.6);
}

/* 字号层级 */
body.font-sm { --body-font-size: 16px; }
body.font-md { --body-font-size: 19px; }
body.font-lg { --body-font-size: 22px; }
body.font-xl { --body-font-size: 26px; }

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  background: var(--paper);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.8;
  transition: background-color 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
h1, h2, h3, p { margin-top: 0; }

.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 1000;
  padding: 10px 16px; background: #fff; color: var(--red);
  border: 2px solid var(--red); transition: top .2s;
}
.skip-link:focus { top: 16px; }
a:focus-visible, button:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== 顶部导航栏 ===== */
.poetry-header {
  position: sticky; inset: 0 0 auto; z-index: 90;
  background: rgba(250, 246, 238, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="dark"] .poetry-header {
  background: rgba(28, 25, 23, 0.94);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  width: min(calc(100% - 36px), var(--container));
  margin-inline: auto;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { height: 34px; width: auto; }

.header-right {
  display: flex; align-items: center; gap: 14px;
}

/* 繁简切换分段器 */
.script-switch {
  display: inline-flex;
  padding: 2px;
  background: var(--paper-soft);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
}
.switch-btn {
  padding: 3px 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.switch-btn.active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 2px 6px rgba(194, 47, 30, 0.3);
}

/* 字号与主题控制 */
.tool-controls {
  display: inline-flex; align-items: center; gap: 4px;
}
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
}
.icon-btn:hover {
  border-color: var(--gold);
  color: var(--red);
}

.header-nav { display: flex; gap: 18px; font-size: 14px; font-weight: 700; }
.header-nav a { position: relative; white-space: nowrap; color: var(--ink); }
.header-nav a:hover { color: var(--red); }

/* ===== 面包屑导航 ===== */
.breadcrumb ol {
  display: flex; flex-wrap: wrap; gap: 6px;
  list-style: none; padding: 0; margin: 0 0 24px;
  font-size: 14px; color: var(--muted);
}
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--line-strong); }
.breadcrumb a { color: var(--muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb li[aria-current="page"] { color: var(--ink); font-weight: 700; }

/* ===== 核心内容容器 ===== */
.poetry-main {
  width: min(calc(100% - 36px), var(--container));
  margin-inline: auto;
  padding: 28px 0 96px;
  min-height: 72vh;
}

/* ===== 按钮通用 ===== */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 9px 18px;
  border-radius: 6px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform .15s, background .15s, border-color .15s;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--red); color: #fff; }
.button-primary:hover { background: var(--red-dark); }
.button-secondary {
  background: var(--paper-card); color: var(--ink);
  border-color: var(--line);
}
.button-secondary:hover { border-color: var(--gold); background: var(--paper-soft); }
.button-secondary[aria-pressed="true"] {
  background: var(--paper-soft); border-color: var(--gold); color: var(--red);
}

/* ===== 首页 Hub Hero ===== */
.hub-hero {
  padding: 44px 0 36px;
  text-align: center;
}
.section-label {
  margin: 0 0 10px;
  font-size: 14px; font-weight: 800;
  color: var(--red); letter-spacing: 1px;
}
.hub-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5.5vw, 50px);
  color: var(--ink-deep);
  line-height: 1.25;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
.intro-copy {
  max-width: 680px;
  margin: 0 auto 30px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

/* 搜索框 */
.search-box { max-width: 560px; margin: 0 auto; }
.search-box label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 15px; text-align: left; }
.search-row { display: flex; gap: 8px; }
.search-box input {
  flex: 1; min-width: 0;
  padding: 12px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--paper-card);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(194, 47, 30, 0.15);
}

/* 搜索结果 */
.search-results { margin-top: 36px; }
.search-results h2 {
  font-family: var(--font-serif);
  font-size: 24px; color: var(--ink-deep); margin-bottom: 16px;
}

/* ===== 每日一诗卡片 ===== */
.daily { padding: 32px 0 20px; }
.daily-card {
  max-width: 700px;
  margin: 0 auto;
  padding: 36px 32px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.daily-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.daily-link { display: block; }
.daily-link strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 28px;
  color: var(--ink-deep);
  margin-bottom: 6px;
  transition: color .15s;
}
.daily-link:hover strong { color: var(--red); }
.daily-link .meta {
  display: block;
  font-size: 15px; color: var(--muted);
  margin-bottom: 18px;
}
.daily-lines {
  display: grid; gap: 6px;
  font-family: var(--font-serif);
  font-size: 20px; line-height: 1.9;
  color: var(--ink);
}

/* ===== 列表与卡片网格 ===== */
.hub-section { padding: 36px 0; }
.hub-section h2 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3.8vw, 34px);
  color: var(--ink-deep);
  margin-bottom: 8px;
}
.section-copy { color: var(--muted); margin-bottom: 22px; font-size: 15px; }

.poem-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 8px;
}
.poem-list a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  padding: 16px 20px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.poem-list a:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.poem-list strong {
  font-family: var(--font-serif);
  font-size: 18px; color: var(--ink-deep);
}
.poem-list .meta {
  font-size: 14px; color: var(--muted);
  align-self: center;
}
.poem-list .line {
  grid-column: 1 / -1;
  font-family: var(--font-serif);
  font-size: 15px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.poem-grid {
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

/* 诗集卡片 */
.collection-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.collection-grid a {
  display: grid; gap: 6px;
  padding: 26px 24px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.collection-grid a:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.collection-era {
  font-size: 13px; color: var(--gold); font-weight: 800; letter-spacing: 1px;
}
.collection-grid strong {
  font-family: var(--font-serif);
  font-size: 24px; color: var(--ink-deep);
}
.collection-count { font-size: 14px; color: var(--muted); font-weight: 700; }
.collection-intro { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ===== 诗集目录页 ===== */
.page-head { padding: 24px 0 20px; }
.page-head h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 46px);
  color: var(--ink-deep);
  margin-bottom: 8px;
}
.group-nav {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 30px;
}
.group-nav a {
  padding: 6px 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 14px; font-weight: 700;
  color: var(--ink);
  transition: all .15s;
}
.group-nav a:hover {
  background: var(--paper-soft);
  border-color: var(--gold);
  color: var(--red);
}
.poem-group-list { margin-bottom: 36px; }
.poem-group-list h2 {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--font-serif);
  font-size: 22px; color: var(--ink-deep);
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.poem-group-list h2 span { font-size: 14px; color: var(--muted); font-family: var(--font-sans); }

/* ===== 诗词详情页 (核心沉浸区) ===== */
.poem {
  max-width: 740px;
  margin: 0 auto;
  padding: 32px 0 40px;
}
.poem-head {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}
.poem-group { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.poem-head h1 {
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 44px);
  color: var(--ink-deep);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.poem-subtitle { font-size: 17px; color: var(--muted); margin-bottom: 6px; }
.poem-author { font-size: 16px; color: var(--muted); font-weight: 700; }
.poem-intro {
  font-size: 15px; color: var(--muted);
  font-style: italic; max-width: 580px;
  margin: 0 auto 28px; text-align: center;
}

/* 诗词正文 */
.poem-body {
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--body-font-size);
  line-height: 2.1;
  letter-spacing: 1px;
}
.poem-body p { margin: 0; }
.stanza { margin-bottom: 24px; }
.stanza:last-child { margin-bottom: 0; }

/* 长诗与蒙学排版 */
.poem-long .poem-body {
  text-align: left;
  line-height: 2.0;
}
.poem-section { margin-bottom: 30px; }
.poem-section h2 {
  font-family: var(--font-serif);
  font-size: 19px; color: var(--red);
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px dashed var(--line-strong);
}

/* 诗句高亮（朗读时同步） */
.poem-body p.is-reading {
  color: var(--red);
  text-shadow: 0 0 1px rgba(194, 47, 30, 0.4);
  transform: scale(1.02);
  transition: all 0.2s ease;
}

/* 详情页快捷操作按钮 */
.poem-actions {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 12px; margin-top: 36px;
}
.action-status {
  text-align: center; font-size: 14px; color: var(--muted);
  min-height: 22px; margin-top: 8px;
}

/* 校注区 */
.poem-notes {
  margin-top: 36px;
  padding: 22px 26px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.poem-notes h2 {
  font-family: var(--font-serif);
  font-size: 17px; color: var(--red-dark);
  margin-bottom: 10px;
}
.poem-notes ul { padding-left: 20px; margin: 0; }
.poem-notes li { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 5px; }

/* 上下一首翻页 */
.poem-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  margin-top: 48px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}
.pager-prev, .pager-next {
  display: grid; gap: 3px;
  padding: 14px 18px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all .15s;
}
.pager-prev:hover, .pager-next:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.pager-prev span, .pager-next span { font-size: 13px; color: var(--muted); }
.pager-prev strong, .pager-next strong {
  font-family: var(--font-serif);
  font-size: 16px; color: var(--ink-deep);
}
.pager-next { text-align: right; }
.pager-index {
  display: flex; align-items: center;
  font-size: 14px; color: var(--red); font-weight: 700;
  padding: 0 10px;
}

/* ===== 底部悬浮朗读控制条 (Audio Dock) ===== */
.audio-dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: rgba(250, 246, 238, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(40, 20, 10, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  transition: transform 0.25s ease;
}
[data-theme="dark"] .audio-dock {
  background: rgba(28, 25, 23, 0.96);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}
.audio-dock-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.dock-left, .dock-right { display: flex; align-items: center; gap: 8px; }

/* 播放主按钮 */
.dock-play-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 96px; height: 38px;
  padding: 0 16px;
  background: var(--red); color: #fff;
  border: 0; border-radius: 20px;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.dock-play-btn:hover { background: var(--red-dark); transform: scale(1.02); }
.dock-play-btn .play-icon { font-size: 12px; }

/* 粤普切换开关 */
.voice-switch {
  display: inline-flex;
  padding: 2px;
  background: var(--paper-soft);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
}
.voice-btn {
  padding: 2px 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px; font-weight: 700;
  border-radius: 14px; cursor: pointer;
}
.voice-btn.active {
  background: var(--gold);
  color: #fff;
}

/* 语速下拉 */
.speed-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--ink);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* 循环按钮 */
.dock-loop-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--muted);
  border-radius: 6px;
  font-size: 14px; cursor: pointer;
}
.dock-loop-btn[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--red);
  background: var(--paper-soft);
}

.dock-status-msg {
  font-size: 13px; color: var(--muted);
  max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Toast 提示浮层 */
.toast-notice {
  position: fixed;
  top: 80px; left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(30, 20, 15, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.toast-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 页脚 ===== */
.poetry-footer {
  padding: 36px 0;
  background: #241c18;
  color: #c9bcaf;
  font-size: 14px;
}
.footer-inner {
  width: min(calc(100% - 36px), var(--container));
  margin-inline: auto;
  display: grid; gap: 8px;
}
.footer-inner a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* ===== 移动端响应式适配 ===== */
@media (max-width: 768px) {
  .header-inner { height: 56px; }
  .brand img { height: 28px; }
  .header-nav { display: none; } /* 移动端隐藏冗余链接，专注功能 */
  .poetry-main { padding: 18px 0 80px; }
  .hub-hero { padding: 24px 0 20px; }
  .daily-card { padding: 24px 18px; }
  .daily-link strong { font-size: 24px; }
  .daily-lines { font-size: 18px; line-height: 1.8; }
  .poem-grid { grid-template-columns: 1fr; }
  .collection-grid { grid-template-columns: 1fr; }
  .poem { padding: 16px 0 32px; }
  .poem-head h1 { font-size: 28px; }
  .poem-pager { grid-template-columns: 1fr; }
  .pager-index { justify-content: center; }
  .search-row { flex-direction: column; }
  .search-box input { width: 100%; }
  .dock-status-msg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
