/* ================== 基础重置 ================== */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

html, body { 
  height: 100%; 
  scroll-behavior: smooth;
}

:root { 
  --header-h: 72px;
  --primary-color: #012E4F;
  --accent-color: #1C90BA;
  --text-primary: #2D3748;
  --text-secondary: #4A5568;
  --bg-color: #F7FAFC;
  --surface-color: #FFFFFF;
  --border-color: #E2E8F0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 8px;
}

body {
  font-family: "微软雅黑", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================== 页眉优化 ================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 24px;
  background: var(--primary-color);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.page-header .brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.page-header .lesson-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header .lesson-switch label { 
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.page-header .lesson-switch select {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 8px 12px;
  outline: none;
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.page-header .lesson-switch select:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.page-header .lesson-switch select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(28, 144, 186, 0.2);
}

.page-header .lesson-switch select option {
  color: var(--text-primary);
  background: var(--surface-color);
  padding: 8px;
}

.page-header .logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  margin-right: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ================== 主体布局优化 ================== */
.container {
  max-width: 700px;
  margin: 40px auto;
  padding: 0 24px;
}

.layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--surface-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: visible;
}

/* 内容区域优化 */
#content {
  width: 100%;
  padding: 40px 32px;
}

/* ================== 正文排版优化 ================== */
.pane {
  overflow: visible;
  padding: 0;
  width: 100%;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin: 40px 0 10px 0;
  color: var(--primary-color);
  line-height: 1.3;
  position: relative;
  padding-bottom: 16px;
}

p {
  text-indent: 2em;
  margin: 0.5em 0;
  text-align: justify;
  color: var(--text-secondary);
  font-size: 17px;
}

/* ================== 图片优化 ================== */
img {
  display: block;
  margin: 32px auto;
  width: 75%;
  max-width: 600px;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

img:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

img.para-img {
  width: 65%;
  max-width: 500px;
}

img.cover {
  width: 80%;
  max-width: 650px;
}

/* ================== 生词表区域优化 ================== */
.vocab-section {
  margin-top: 48px;
  border-top: 3px solid var(--border-color);
  padding-top: 32px;
  width: 100%;
}

.vocab-section h3 {
  text-align: center;
  margin: 0 0 24px 0;
  font-size: 22px;
  color: var(--primary-color);
  font-weight: 600;
}

.vocab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin-top: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.vocab-table th, 
.vocab-table td {
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  text-align: center;
  transition: background-color 0.2s ease;
}

.vocab-table th { 
  background: #F8FAFC; 
  font-weight: 600;
  color: var(--primary-color);
}

.vocab-table tr:hover td {
  background: #F7FAFC;
}

.vocab-table th:nth-child(1),
.vocab-table td:nth-child(1),
.vocab-table th:nth-child(2),
.vocab-table td:nth-child(2) {
  white-space: nowrap;
}

.vocab-table th:nth-child(1), 
.vocab-table td:nth-child(1) { 
  min-width: 6em; 
  font-weight: 500;
}

.vocab-table th:nth-child(2), 
.vocab-table td:nth-child(2) { 
  min-width: 9em; 
}

.vocab-table th:nth-child(3), 
.vocab-table td:nth-child(3) {
  white-space: normal;
  word-break: break-word;
  text-align: left;
  line-height: 1.6;
}

/* ================== 正文中的生词样式（修复冲突） ================== */
.vocab-word {
  color: var(--accent-color);
  position: relative;
  cursor: pointer;
  border-bottom: 1px dashed var(--accent-color);
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 0 1px;
}

.vocab-word:hover {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: rgba(28, 144, 186, 0.05);
}

/* Tooltip 样式 */
.vocab-tooltip {
  visibility: hidden;
  background: #2D3748;
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 12px 16px;
  position: absolute;
  z-index: 1000;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  white-space: nowrap;
  min-width: max-content;
  max-width: 300px;
  line-height: 1.5;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.vocab-word:hover .vocab-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(4px);
}

/* 兼容老数据里的 .vocab 写法 */
.vocab { 
  color: var(--accent-color);
  position: relative;
  cursor: pointer;
  border-bottom: 1px dashed var(--accent-color);
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 0 1px;
}
.vocab:hover {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: rgba(28, 144, 186, 0.05);
}
/* tooltip 兼容 */
.vocab .vocab-tooltip {
  visibility: hidden;
  background: #2D3748;
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 12px 16px;
  position: absolute;
  z-index: 1000;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  white-space: nowrap;
  min-width: max-content;
  max-width: 300px;
  line-height: 1.5;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.vocab:hover .vocab-tooltip { 
  visibility: visible; 
  opacity: 1; 
  transform: translateX(-50%) translateY(4px); 
}

/* ================== 播放按钮优化 ================== */
.play-button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background-color: var(--accent-color);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-left: 12px;
  vertical-align: middle;
  transition: all 0.3s ease;
  font-size: 14px;
}

.play-button:hover {
  background: var(--primary-color);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(28, 144, 186, 0.3);
}

/* 分隔线样式 */
.content-divider {
  margin: 32px 0;
  border: 0;
  border-top: 2px solid var(--border-color);
  opacity: 0.6;
}

/* ================== 响应式优化 ================== */
@media (max-width: 900px) {
  body { 
    font-size: 15px; 
    line-height: 1.6;
  }
  
  .container {
    padding: 0 20px;
    max-width: 95%;
    margin: 24px auto;
  }
  
  #content {
    padding: 32px 20px;
  }
  
  h1 {
    font-size: 24px;
    margin-bottom: 24px;
  }
  
  p {
    font-size: 16px;
    text-indent: 1.5em;
  }
  
  img, img.para-img, img.cover {
    width: 95%;
    max-width: 100%;
    margin: 24px auto;
  }
  
  .page-header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  
  .page-header .brand {
    font-size: 18px;
  }
  
  .vocab-table {
    font-size: 14px;
  }
  
  .vocab-table th, 
  .vocab-table td {
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
    margin: 16px auto;
  }
  
  #content {
    padding: 24px 16px;
  }
  
  .page-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .page-header .lesson-switch {
    width: 100%;
    justify-content: center;
  }
  
  .vocab-section {
    margin-top: 32px;
    padding-top: 24px;
  }
}
