* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #222; }
.topnav { background: #2c3e50; padding: 14px 20px; display: flex; gap: 18px; }
.topnav a { color: #ecf0f1; text-decoration: none; font-size: 18px; }
.topnav a:hover, .topnav .brand { font-weight: bold; }
.container { max-width: 720px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 28px; margin-bottom: 18px; }
.card { display: block; background: #fff; border-radius: 14px; padding: 24px;
        margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
        text-decoration: none; color: #222; }
.card h2 { font-size: 22px; margin-bottom: 8px; }
.card p { font-size: 18px; color: #666; }
.btn { display: inline-block; background: #3498db; color: #fff; border: none;
       border-radius: 10px; padding: 14px 28px; font-size: 18px; cursor: pointer; }
.btn:active { background: #2980b9; }
.btn.success { background: #27ae60; }
.btn.danger { background: #e74c3c; }
input[type=text] { width: 100%; padding: 16px; font-size: 20px; border: 2px solid #ddd;
                   border-radius: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border: 1px solid #ddd; padding: 10px; text-align: left; font-size: 15px; }
th { background: #ecf0f1; }
.flashcard { background: #fff; border-radius: 14px; padding: 40px; text-align: center;
             box-shadow: 0 2px 12px rgba(0,0,0,.1); }
.word { font-size: 48px; font-weight: bold; margin-bottom: 12px; }
.phonetic { font-size: 22px; color: #888; margin-bottom: 24px; }
.meaning { font-size: 24px; line-height: 1.6; margin: 20px 0; color: #333; }
.nav { margin-top: 24px; display: flex; justify-content: center; gap: 16px; }
.progress { text-align: center; font-size: 20px; margin-bottom: 16px; color: #666; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { padding: 10px 20px; border: none; background: #ddd; border-radius: 8px; cursor: pointer; font-size: 16px; }
.tab.active { background: #3498db; color: #fff; }
.stat-grid { display: flex; gap: 12px; margin-bottom: 24px; }
.stat { flex: 1; background: #fff; border-radius: 10px; padding: 20px; text-align: center; }
.stat .num { font-size: 36px; font-weight: bold; }
.cal { display: flex; gap: 4px; align-items: flex-end; height: 80px; margin: 12px 0; }
.cal-col { flex: 1; text-align: center; }
.cal-bar { background: #3498db; margin: 0 auto; width: 60%; min-height: 2px; border-radius: 4px 4px 0 0; }
.cal-label { font-size: 11px; color: #888; }
.prompt-label { font-size: 16px; color: #888; margin-bottom: 12px; }

/* ---------- Admin Desktop Styles ---------- */
.admin-body { background: #f0f2f5; font-size: 14px; line-height: 1.6; }

.admin-nav {
  background: #2c3e50;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.admin-nav-brand { font-size: 18px; font-weight: bold; }
.admin-nav a { color: #ecf0f1; text-decoration: none; font-size: 14px; }
.admin-nav a:hover { text-decoration: underline; }

.admin-container { max-width: 1200px; margin: 24px auto; padding: 0 24px; }
.admin-container h1 { font-size: 24px; margin-bottom: 18px; }

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid #ddd;
}
.admin-tab {
  padding: 12px 24px;
  border: none;
  background: #e9ecef;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 15px;
  color: #555;
  transition: background .2s;
}
.admin-tab:hover { background: #dee2e6; }
.admin-tab.active { background: #3498db; color: #fff; }

.admin-section {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  margin-bottom: 24px;
}
.admin-section h2 { font-size: 20px; margin-bottom: 16px; }

.admin-btn {
  display: inline-block;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s;
}
.admin-btn:hover { background: #2980b9; }
.admin-btn.success { background: #27ae60; }
.admin-btn.success:hover { background: #219150; }
.admin-btn.danger { background: #e74c3c; }
.admin-btn.danger:hover { background: #c0392b; }
.admin-btn:disabled { background: #95a5a6; cursor: not-allowed; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}
.admin-table th, .admin-table td {
  border: 1px solid #ddd;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.admin-table th { background: #ecf0f1; font-weight: 600; }
.admin-table tr:nth-child(even) { background: #f9f9f9; }
.admin-table tr:hover { background: #f1f1f1; }
.admin-table td { word-wrap: break-word; }
.admin-table th:last-child,
.admin-table td:last-child { white-space: nowrap; width: 1%; }

/* 批次列表区域横向滚动，避免明细表格挤出屏幕 */
#batches-list { overflow-x: auto; }
#batches-list > .admin-table {
  min-width: 960px;
}

/* 嵌套在批次列表内的明细表格：固定布局，避免撑开外层 */
#batches-list .admin-table .admin-table {
  table-layout: fixed;
  width: 100%;
}
#batches-list .admin-table .admin-table th:nth-child(1),
#batches-list .admin-table .admin-table td:nth-child(1) { width: 11%; }
#batches-list .admin-table .admin-table th:nth-child(2),
#batches-list .admin-table .admin-table td:nth-child(2) { width: 13%; }
#batches-list .admin-table .admin-table th:nth-child(3),
#batches-list .admin-table .admin-table td:nth-child(3) { width: 13%; }
#batches-list .admin-table .admin-table th:nth-child(4),
#batches-list .admin-table .admin-table td:nth-child(4) { width: 32%; }
#batches-list .admin-table .admin-table th:nth-child(5),
#batches-list .admin-table .admin-table td:nth-child(5) { width: 10%; }
#batches-list .admin-table .admin-table th:nth-child(6),
#batches-list .admin-table .admin-table td:nth-child(6) { width: 7%; }
#batches-list .admin-table .admin-table th:nth-child(7),
#batches-list .admin-table .admin-table td:nth-child(7) { width: 9%; }
#batches-list .admin-table .admin-table td {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-all;
  overflow: hidden;
}
#batches-list .admin-table .admin-table input[type=text] {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font-size: 13px;
}

.admin-warning {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 14px;
}
.admin-warning.yellow { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.admin-warning.red { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.duplicate-within { background: #fff3cd !important; }
.duplicate-db { background: #f8d7da !important; }

.admin-body input[type=text],
.admin-body input[type=file],
.admin-body select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.admin-body input[type=text]:focus {
  border-color: #3498db;
  outline: none;
}

/* 导入校对表格：中文释义列加宽，避免被压缩 */
.import-edit-table th,
.import-edit-table td {
  vertical-align: top;
}

.import-edit-table th:nth-child(1),
.import-edit-table td:nth-child(1) { width: 60px; text-align: center; }

.import-edit-table th:nth-child(2),
.import-edit-table td:nth-child(2) { width: 16%; }

.import-edit-table th:nth-child(3),
.import-edit-table td:nth-child(3) { width: 16%; }

.import-edit-table th:nth-child(4),
.import-edit-table td:nth-child(4) { width: 16%; }

.import-edit-table th:nth-child(5),
.import-edit-table td:nth-child(5) { width: 52%; white-space: normal; }

.import-edit-table input[type=text],
.import-edit-table textarea {
  width: 100%;
  min-width: 60px;
  min-height: 48px;
  padding: 6px 8px;
  font-size: 14px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  line-height: 1.4;
}

.import-edit-table textarea {
  min-width: 200px;
  resize: vertical;
}

/* Ensure existing user-facing styles are not affected */


/* ============================================
   学生端响应式布局（适配手机/平板，无滚动条）
   ============================================ */

.student-body {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topnav {
  flex-shrink: 0;
  padding: 1.5vh 3vw;
  gap: 3vw;
  align-items: center;
}

.topnav a {
  font-size: clamp(16px, 2.5vw, 20px);
}

.student-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2vh 4vw;
}

.student-main h1 {
  font-size: clamp(22px, 4vh, 32px);
  margin-bottom: 2vh;
  flex-shrink: 0;
}

/* 首页 */
.index-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2vh;
  min-height: 0;
}

.index-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
  border-radius: 2vh;
  padding: 3vh 4vw;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  text-decoration: none;
  color: #222;
  min-height: 80px;
  transition: transform .1s;
}

.index-card.disabled {
  color: #999;
  background: #fafafa;
  pointer-events: none;
}

.index-card:active { transform: scale(0.98); }
.index-card h2 { font-size: clamp(20px, 4vh, 30px); margin-bottom: 1vh; }
.index-card p { font-size: clamp(14px, 2.5vh, 20px); color: #666; }

/* 学习/复习页 */
.study-container,
.review-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
}

.progress {
  flex-shrink: 0;
  font-size: clamp(14px, 2.5vh, 20px);
  margin-bottom: 2vh;
}

.flashcard {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 2vh;
  padding: 3vh 4vw;
  min-height: 0;
  overflow: hidden;
}

.word { font-size: clamp(24px, 6vh, 48px); font-weight: bold; margin-bottom: 1vh; }
.phonetic { font-size: clamp(14px, 2.5vh, 22px); color: #888; margin-bottom: 1.5vh; }
.meaning {
  font-size: clamp(15px, 2.8vh, 22px);
  line-height: 1.5;
  margin: 1vh 0 2vh;
  text-align: left;
  width: 100%;
  padding: 0 2vw;
  max-height: 55%;
  overflow-y: auto;
  word-break: break-word;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.meaning::-webkit-scrollbar { display: none; }

/* 释义分项：按分号拆分后每项一行 */
.meaning-line {
  margin-bottom: 0.6vh;
  padding-left: 1.5vw;
  text-indent: -1.5vw;
}

/* 长释义避免撑破卡片 */
.word {
  max-height: 45%;
  overflow-y: auto;
  word-break: break-word;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.word::-webkit-scrollbar { display: none; }

.prompt-label {
  font-size: clamp(13px, 2.2vh, 18px);
  color: #888;
  margin-bottom: 1.5vh;
  text-align: center;
}

input[type=text] {
  width: 100%;
  max-width: 80vw;
  padding: 1.8vh 3vw;
  font-size: clamp(16px, 3vh, 24px);
  border-radius: 1.5vh;
  text-align: center;
  flex-shrink: 0;
}

.btn {
  border-radius: 1.2vh;
  padding: 1.8vh 4vw;
  font-size: clamp(16px, 3vh, 22px);
  margin: 0.5vh;
  flex-shrink: 0;
}

.nav {
  margin-top: 1.5vh;
  gap: 3vw;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* 小屏微调 */
@media (max-width: 480px) {
  .topnav { padding: 1.5vh 4vw; }
  .student-main { padding: 1.5vh 4vw; }
  .index-card { padding: 2vh 4vw; }
  .meaning { font-size: clamp(14px, 2.6vh, 20px); }
}

/* 中屏平板（常见 7-9 寸） */
@media (min-width: 768px) {
  .flashcard {
    justify-content: space-between;
    padding: 4vh 5vw;
  }
  .word { font-size: clamp(32px, 7vh, 64px); }
  .phonetic { font-size: clamp(16px, 2.8vh, 26px); }
  .prompt-label { font-size: clamp(14px, 2.2vh, 22px); }
  .meaning { font-size: clamp(16px, 2.8vh, 24px); }
  input[type=text] { max-width: 55vw; }
  .btn { padding: 2vh 4vw; font-size: clamp(18px, 2.8vh, 24px); }
  .progress { font-size: clamp(14px, 2.5vh, 22px); }
  .student-main h1 { font-size: clamp(24px, 4vh, 36px); }
}

/* 大屏高分平板（10-12 寸，如 1200×1920） */
@media (min-width: 1200px) {
  .flashcard {
    justify-content: space-between;
    padding: 5vh 6vw;
  }
  .word { font-size: clamp(40px, 7vh, 96px); }
  .phonetic { font-size: clamp(20px, 3vh, 40px); }
  .prompt-label { font-size: clamp(16px, 2.2vh, 26px); }
  .meaning { font-size: clamp(20px, 3vh, 36px); }
  input[type=text] { max-width: 45vw; padding: 2vh 3vw; font-size: clamp(18px, 3vh, 32px); }
  .btn { padding: 2.5vh 5vw; font-size: clamp(20px, 3vh, 30px); }
  .progress { font-size: clamp(16px, 2.5vh, 24px); }
  .student-main h1 { font-size: clamp(28px, 4vh, 42px); }
}

/* 横屏平板微调 */
@media (min-aspect-ratio: 16/9) {
  .index-card { max-height: 24vh; }
  .word { font-size: clamp(24px, 10vh, 60px); }
  .meaning { font-size: clamp(14px, 3vh, 22px); }
}



.study-complete { text-align: center; margin-top: 20px; }
.study-complete #complete-btn { font-size: 20px; padding: 16px 40px; }
.study-complete #complete-status { display: inline-block; margin-left: 12px; font-size: 16px; color: #27ae60; }

/* 评估表单 */
.exam-form { max-width: 700px; }
.exam-field { margin-bottom: 18px; }
.exam-field label { display: block; font-weight: bold; margin-bottom: 6px; }
.exam-check { display: inline-block; margin: 4px 12px 4px 0; font-size: 15px; }
.stat-grid { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 80px; background: #fff; border-radius: 10px; padding: 16px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat .num { font-size: 32px; font-weight: bold; }

/* 打印：隐藏导航和按钮，只留报表内容 */
@media print {
  .topnav, .admin-nav, .admin-tabs, .no-print { display: none !important; }
  body { background: #fff; }
  .admin-section { box-shadow: none !important; border: 1px solid #ddd; }
  .stat { box-shadow: none !important; border: 1px solid #ddd; }
}

/* 评估列表页 */
.exam-section { margin-bottom: 28px; }
.exam-section h2 { font-size: 22px; margin-bottom: 12px; }
.exam-cards .index-card { display: block; margin-bottom: 14px; }
