/* ========== 基础重置与变量 ========== */
:root {
  /* 高档配色方案 - 深邃蓝灰 + 暖金点缀 */
  --primary: #2D3748;
  --primary-dark: #1A202C;
  --primary-light: #EDF2F7;
  --primary-gradient: linear-gradient(135deg, #2D3748 0%, #4A5568 100%);
  
  --accent: #D69E2E;
  --accent-dark: #B7791F;
  --accent-light: #FEF3C7;
  
  --green: #38A169;
  --green-dark: #2F855A;
  --green-light: #C6F6D5;
  
  --red: #E53E3E;
  --red-dark: #C53030;
  --red-light: #FED7D7;
  
  --blue: #3182CE;
  --blue-light: #BEE3F8;
  
  /* 灰度系统 */
  --gray-50: #FAFAFA;
  --gray-100: #F7FAFC;
  --gray-200: #EDF2F7;
  --gray-300: #E2E8F0;
  --gray-400: #CBD5E0;
  --gray-500: #A0AEC0;
  --gray-600: #718096;
  --gray-700: #4A5568;
  --gray-800: #2D3748;
  --gray-900: #1A202C;
  
  --text: #1A202C;
  --text-light: #4A5568;
  --text-muted: #718096;
  
  --white: #FFFFFF;
  --bg-main: #F7FAFC;
  
  /* 圆角 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-xl: 0 16px 40px rgba(0,0,0,0.1);
  
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

img {
  pointer-events: none;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg-main);
  color: var(--text);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overscroll-behavior: none;
  min-height: 100vh;
}

/* ========== 页面切换 ========== */
.page {
  display: none;
  min-height: 100vh;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page.active {
  display: block;
  opacity: 1;
}

.page-inner {
  max-width: 480px;
  margin: 0 auto;
}

/* ========== 通用按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(45, 55, 72, 0.2);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(45, 55, 72, 0.3);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary);
  border: 1.5px solid var(--gray-300);
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--gray-50);
}

.btn-large {
  display: flex;
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover {
  background: var(--red-dark);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.2s;
}

.btn-back:hover {
  color: var(--primary);
}

/* ========== 首页 ========== */
#page-home .page-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 40px 20px;
}

.app-logo {
  width: 88px;
  height: 88px;
  background: var(--primary);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(45, 55, 72, 0.15);
  position: relative;
}

.app-logo::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 25px;
  border: 2px solid var(--accent);
  opacity: 0.6;
}

.app-title {
  font-size: 28px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.app-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 48px;
  font-weight: 400;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.home-secondary {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.home-secondary .btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
}

.home-footer {
  margin-top: 40px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 2px;
}

/* ========== 页面头部 ========== */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.page-header h2 {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.progress-text {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

/* 顶部学期选择器 */
.grade-select-header {
  padding: 8px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--gray-50);
  cursor: pointer;
  transition: all 0.2s;
}

.grade-select-header:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 158, 46, 0.1);
}

/* ========== 设置页 ========== */
.settings-step {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.settings-step h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-row label {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}

.setting-row select,
.setting-row input {
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  min-width: 140px;
  transition: border-color 0.2s;
}

.setting-row select:focus,
.setting-row input:focus {
  outline: none;
  border-color: var(--primary);
}

/* 词库分区标签 */
.vocab-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.vocab-section-label:first-child {
  margin-top: 0;
}

/* 单元列表 */
.unit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  border: 1.5px solid transparent;
}

.unit-item:hover {
  background: var(--white);
  border-color: var(--gray-300);
}

.unit-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.unit-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.unit-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--gray-200);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

/* 紧凑列表样式 */
.compact-list {
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.compact-list::-webkit-scrollbar {
  width: 4px;
}

.compact-list::-webkit-scrollbar-track {
  background: transparent;
}

.compact-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 2px;
}

.compact-list .unit-item {
  padding: 10px 12px;
}

/* ========== 预览页 ========== */
.preview-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.preview-section h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.preview-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-word {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--gray-200);
}

.preview-word .pinyin {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== 听写页 ========== */
.dictation-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 20px;
}

.dictation-word {
  font-size: 68px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: 4px;
}

.dictation-pinyin {
  font-size: 22px;
  color: var(--text-light);
  margin-bottom: 32px;
  font-weight: 400;
}

.dictation-progress {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.dictation-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.dictation-actions .btn {
  min-width: 100px;
}

/* ========== 结果页 ========== */
.result-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
}

.result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
}

.result-icon.success {
  background: var(--green-light);
}

.result-icon.warning {
  background: var(--accent-light);
}

.result-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.result-subtitle {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 24px;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 24px;
}

.result-stat {
  text-align: center;
}

.result-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.result-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ========== 答案页 ========== */
.answer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.answer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.answer-item.wrong {
  background: var(--red-light);
  border: 1px solid #FEB2B2;
}

.answer-index {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  flex-shrink: 0;
}

.answer-item.wrong .answer-index {
  background: var(--red);
  color: white;
}

.answer-text {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.answer-pinyin {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== 词库管理页 ========== */
.vocab-manage-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.vocab-manage-header h2 {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

.vocab-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--gray-100);
  border-radius: var(--radius);
}

.vocab-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.vocab-tab.active {
  background: var(--white);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vocab-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s;
  border: 1.5px solid transparent;
}

.vocab-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
}

.vocab-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.vocab-card-icon.chinese {
  background: var(--primary);
  color: white;
}

.vocab-card-icon.english {
  background: var(--blue);
  color: white;
}

.vocab-card-content {
  flex: 1;
  min-width: 0;
}

.vocab-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vocab-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.vocab-card-actions {
  display: flex;
  gap: 8px;
}

.vocab-card-actions .btn {
  padding: 6px 12px;
  font-size: 13px;
}

/* ========== 词库编辑页 ========== */
.vocab-edit-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.vocab-edit-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.vocab-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 15px;
  transition: border-color 0.2s;
}

.vocab-input:focus {
  outline: none;
  border-color: var(--primary);
}

.vocab-import-text {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 150px;
  transition: border-color 0.2s;
}

.vocab-import-text:focus {
  outline: none;
  border-color: var(--primary);
}

.word-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.word-preview-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--gray-200);
}

.word-preview-item .pinyin {
  font-size: 11px;
  color: var(--text-muted);
}

/* ========== 错题本 ========== */
.wronglist-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.wronglist-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.wronglist-stat {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.wronglist-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
}

.wronglist-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========== 历史记录 ========== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-item-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.history-item-subject {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.history-item-subject.chinese {
  background: var(--primary-light);
  color: var(--primary);
}

.history-item-subject.english {
  background: var(--blue-light);
  color: var(--blue);
}

.history-item-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-light);
}

/* ========== 后台管理样式 ========== */
.admin-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-actions .btn {
  padding: 10px 16px;
  font-size: 13px;
}

.admin-lesson-list {
  max-height: 400px;
  overflow-y: auto;
}

.admin-lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1.5px solid transparent;
}

.admin-lesson-item:hover {
  background: var(--white);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.admin-lesson-item .lesson-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.admin-lesson-item .lesson-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--gray-200);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.admin-lesson-item .lesson-type {
  font-size: 11px;
  color: var(--accent-dark);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* 后台词语输入 */
.admin-word-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-word-list {
  max-height: 400px;
  overflow-y: auto;
}

.admin-word-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition: all 0.15s;
}

.admin-word-item:hover {
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.admin-word-item .word-index {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  width: 22px;
  text-align: center;
}

.admin-word-item .word-text {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
  min-width: 60px;
}

.admin-word-item .word-pinyin {
  font-size: 13px;
  color: var(--text-light);
  flex: 1;
}

.admin-word-item .btn-remove {
  width: 26px;
  height: 26px;
  border: none;
  background: var(--gray-200);
  color: var(--gray-500);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.admin-word-item .btn-remove:hover {
  background: var(--red-light);
  color: var(--red);
}

/* 数学知识点配置 */
.math-knowledge-config {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.knowledge-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  transition: background 0.15s;
}

.knowledge-option:hover {
  background: var(--gray-100);
}

.knowledge-option label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.knowledge-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.knowledge-count {
  width: 60px;
  padding: 6px 10px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
}

.knowledge-count:focus {
  outline: none;
  border-color: var(--primary);
}

.math-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.math-preview-item {
  padding: 12px 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  border-left: 3px solid var(--accent);
}

.math-preview-item .answer {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 44px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
}

.empty-hint {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ========== 设置汇总 ========== */
.setting-summary {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 16px;
  border: 1px solid var(--gray-200);
}

.setting-summary-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 8px;
}

.setting-summary-content {
  font-size: 13px;
  color: var(--text);
  line-height: 1.8;
}

/* ========== 动画 ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.25s ease;
}

/* ========== 响应式 ========== */
@media (max-width: 400px) {
  .app-title {
    font-size: 24px;
  }
  
  .dictation-word {
    font-size: 52px;
  }
  
  .btn-large {
    padding: 14px 20px;
    font-size: 15px;
  }
}

/* ========== 打印优化 ========== */
@media print {
  body {
    background: white;
  }
  
  .btn, .page-header {
    display: none;
  }
}

/* ========== 练习纸样式 ========== */
.practice-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.practice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

/* 词语卡片 - 多列流式布局（紧凑排版，一行6-8个词） */
.word-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2cm 0.3cm;
  align-items: baseline;
}

.word-card {
  display: flex;
  align-items: baseline;
  gap: 0.05cm;
  padding: 0.05cm 0;
  white-space: nowrap;
}

.word-card-full {
  width: 100%;
  padding: 0.1cm 0;
}

.word-num {
  font-size: 11pt;
  color: #333;
  font-weight: 500;
  flex-shrink: 0;
  width: 0.4cm;
}

.line-blank {
  display: inline-block;
  vertical-align: baseline;
  border-bottom: 1px solid #333;
  height: 0.6cm;
}

.line-full {
  width: 4cm;
  min-width: 1.5cm;
}

.phrase-item .line-blank {
  flex: 1;
}

.poem-block {
  margin: 8px 0;
  padding: 8px 0;
}

.poem-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  font-style: normal;
}

.poem-item {
  padding-left: 32px;
}

/* 答案页文字样式 */
.answer-text {
  display: inline-block;
  font-size: 16px;
  font-weight: 600;
  color: #e74c3c;
  border-bottom: 1px solid #333;
  padding-bottom: 2px;
  min-height: 24px;
  line-height: 24px;
}

.answer-hint {
  font-size: 12px;
  color: #888;
  margin-left: 6px;
}

/* ========== 结束按钮和确认弹窗 ========== */
.dictation-stop-area {
  display: flex;
  justify-content: center;
  padding: 20px 0 30px;
}

.btn-stop {
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 600;
  color: #e74c3c;
  background: #fff;
  border: 2px solid #e74c3c;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-stop:active {
  background: #e74c3c;
  color: white;
}

/* 弹窗遮罩 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: white;
  border-radius: 16px;
  padding: 28px 24px;
  width: 300px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: #888;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 100px;
}

/* ========== 练习纸排版 ========== */
/* 预览页：页眉固定，下方水平滑动翻页 */
#page-preview {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#page-preview .page-header {
  flex-shrink: 0;
}

/* 水平滑动翻页容器 */
.preview-pager {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* 每张A4纸 */
.preview-page {
  flex-shrink: 0;
  width: 19.5cm;
  height: 27cm;
  background: white;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  box-sizing: border-box;
  padding: 0.8cm 1cm;
  overflow: hidden;
  position: relative;
  scroll-snap-align: center;
  transform-origin: top left;
}

/* 翻页指示器 */
.preview-dots {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 12px;
}

.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  transition: background 0.2s;
}

.preview-dot.active {
  background: #333;
}

/* 练习纸标题 */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #333;
}

.preview-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  letter-spacing: 4px;
}

.preview-date {
  font-size: 13px;
  color: #666;
}

/* 分区 */
.practice-section {
  margin-bottom: 10px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px dashed #ccc;
}

/* 数学区域 */
.math-section .math-problems {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.math-problem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 16px;
}

.math-problem .word-num {
  min-width: 28px;
}

.math-problem .vertical-text {
  font-family: monospace;
  font-size: 16px;
  line-height: 1.3;
  margin: 0;
}

.answer-line {
  flex: 1;
  min-width: 60px;
}

/* 口算题紧凑横排 */
.oral-problem {
  display: inline-flex;
  width: auto;
  margin-right: 16px;
}

/* 听写页补充样式 */
.progress-bar-container {
  width: 100%;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.dictation-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
}

.timer-display {
  font-size: 48px;
  font-weight: 300;
  color: var(--text-light);
  margin-top: 16px;
}

.dictation-extras {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 16px;
}

/* 结果页补充 */
.result-complete-area {
  text-align: center;
  padding: 40px 20px;
}

.result-info {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 24px;
}

/* 答案页样式 */
.poem-header-preview {
  display: block;
  margin: 12px 0 6px;
  font-weight: 600;
}

.poem-line-preview {
  padding-left: 24px;
}

.poem-text {
  font-style: italic;
}

.word-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.word-py {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 8px;
}

/* ========== 打印优化 ========== */
@media print {
  body { background: white; margin: 0; padding: 0; }
  .btn, .page-header, .dictation-extras, .dictation-main, .result-actions, .result-complete-area { display: none !important; }
  .preview-scaler { overflow: visible; }
  .preview-paper { box-shadow: none; margin: 0; padding: 0; width: 19.5cm; height: 27cm; transform: none !important; overflow: visible; }
  .word-grid { gap: 0.3cm 0.5cm; }
  .word-card { padding: 0.1cm 0; }
}
