/* 英语单词游戏 - 通用公共CSS
/* 英语单词游戏 - 基础样式变量 */
:root {
  /* 颜色变量 */
  --primary-color: #4CAF50; /* 用于主要按钮边框、游戏标题 */
  --primary-hover: #45a049; /* 用于主要按钮悬停状态 */
  --danger-color: #f44336; /* 用于危险按钮边框（清空排行榜） */
  
  /* 背景色 */
  --bg-primary: #000000; /* 页面背景色 */
  
  /* 文本色 */
  --text-primary: #ffffff; /* 主要文本颜色 */
  --text-secondary: #ecf0f1; /* 次要文本颜色（关卡标题） */
  
  /* 边框 */
  --border-color: #3d3d3d; /* 主要边框颜色（游戏容器、屏幕） */
  --border-light: #4a4a4a; /* 次要边框颜色（次要按钮） */
  --border-radius: 8px; /* 基础圆角 */
  --border-radius-large: 12px; /* 大圆角（游戏头部、统计信息） */
  --border-radius-xl: 16px; /* 超大圆角（屏幕容器） */
}

/* 基础元素样式重置 - 用于所有页面元素 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 页面基础样式 - 用于整个html和body */
html, body {
  height: 100%;
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 18px; /* 增加基础字体大小，有助于整体文本放大 */
}

/* 链接样式重置 - 用于关卡链接按钮 */
a {
  text-decoration: none;
  color: inherit;
}

/* 按钮样式重置 - 用于所有交互按钮 */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* 输入框样式重置 - 用于拼写输入框 */
input {
  font-family: inherit;
  outline: none;
}

/* 表格样式重置 - 用于排行榜表格 */
table {
  border-collapse: collapse;
  width: 100%;
}

/* 隐藏类 - 用于控制元素显示/隐藏（在index.html的多处使用） */
.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* 游戏容器布局 - 用于整个游戏页面布局 */
.game-container {
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  max-width: 1200px;
  margin: 0 auto;
}

/* 游戏头部 - 用于显示游戏标题 */
.game-header {
  width: 100%;
  max-width: 1200px;
  margin-bottom: 30px;
  padding: 20px;
  background-color: transparent;
  border-radius: var(--border-radius-large);
  text-align: center;
  border: 2px solid var(--border-color);
}

/* 游戏标题样式 - 用于主标题"英语单词游戏" */
.game-title {
  font-size: 3.5rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-weight: bold;
  text-align: center;
}

/* 关卡标题样式 - 用于游戏屏幕中的关卡标题 */
.level-title {
  font-size: 2rem;
  color: var(--text-secondary);
  font-weight: bold;
  text-align: center;
}

/* 屏幕容器 - 用于开始、游戏、结果和排行榜屏幕 */
.screen {
  width: 100%;
  max-width: 1000px;
  background-color: transparent;
  border-radius: var(--border-radius-xl);
  padding: 40px;
  border: 2px solid var(--border-color);
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  display: none;
}

/* 激活的屏幕 - 用于显示当前活动的屏幕 */
.active {
  display: flex !important;
}

/* 按钮基础样式 - 用于所有按钮 */
.btn {
  padding: 15px 30px;
  font-size: 1.2rem;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: bold;
  background-color: transparent !important;
  color: #ffffff !important;
}

/* 主要按钮 - 用于全选、查看排行榜、检查答案等主要操作 */
.btn-primary {
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: var(--primary-hover);
}

/* 次要按钮 - 用于清除选择、上一题、下一题等次要操作 */
.btn-secondary {
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: var(--border-color);
}

/* 危险按钮 - 用于清空排行榜等危险操作 */
.btn-danger {
  border-color: var(--danger-color);
}

.btn-danger:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: #d32f2f;
}

/* 游戏统计信息样式 - 用于显示关卡信息和进度 */
.stats-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  border-radius: 12px;
}

.level-info h2 {
  margin: 0;
  color: #f39c12;
  font-size: 2rem;
}

/* 选择提示样式 - 用于显示选择提示信息 */
.selection-tip {
  background-color: #ff9800;
  color: white;
  padding: 12px 20px;
  border-radius: var(--border-radius);
  margin: 10px 0 20px;
  text-align: center;
  font-weight: 500;
}

.selection-tip.hidden {
  display: none;
}

/* 禁用状态样式 - 用于所有禁用的元素 */
.disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* 关卡按钮禁用样式 - 用于关卡选择按钮 */
.level-btn.disabled {
  border-color: #666 !important;
  color: #999 !important;
  background-color: transparent !important;
}

/* 按钮禁用状态样式 */
.btn:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  border-color: #666;
}

/* 年级选择按钮样式 */
.grade-btn {
  padding: 15px 25px;
  font-size: 1.2rem;
  border-radius: 8px;
  border: 2px solid var(--border-light);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  background-color: transparent;
  color: var(--text-primary);
  margin: 0 10px 10px 0;
  font-weight: bold;
}

/* 年级选择按钮悬停状态 */
.grade-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

/* 年级选择按钮选中状态 */
.grade-btn.selected {
  border-color: var(--primary-color);
  background-color: rgba(76, 175, 80, 0.2);
  color: var(--primary-color);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* 学期选择按钮样式 */
.term-btn {
  padding: 12px 20px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: 2px solid var(--border-light);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  background-color: transparent;
  color: var(--text-primary);
  margin: 0 10px 10px 0;
  font-weight: bold;
}

/* 学期选择按钮悬停状态 */
.term-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

/* 学期选择按钮选中状态 */
.term-btn.selected {
  border-color: var(--primary-color);
  background-color: rgba(76, 175, 80, 0.2);
  color: var(--primary-color);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* 单元选择复选框容器样式 - 统一风格与交互体验 */
.unit-checkbox {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-radius: 8px;
  border: 2px solid var(--border-light);
  transition: all 0.3s ease;
  background-color: transparent;
  cursor: pointer;
  min-width: 100px;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  aspect-ratio: 1 / 1;
  position: relative;
}

/* 单元选择复选框容器悬停状态 */
.unit-checkbox:hover {
  border-color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.05);
}

/* 单元选择复选框样式 - 隐藏视觉显示但保留全区域点击功能 */
.unit-checkbox input[type="checkbox"] {
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  opacity: 0; /* 隐藏复选框视觉显示 */
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* 单元选择复选框选中状态下的标签样式 */
.unit-checkbox input[type="checkbox"]:checked + label {
  color: var(--primary-color);
  font-weight: bold;
}

/* 由于复选框已隐藏，移除其选中状态样式 */

/* 单元选择复选框选中状态下的容器样式 */
.unit-checkbox:has(input[type="checkbox"]:checked) {
  border-color: var(--primary-color);
  background-color: rgba(76, 175, 80, 0.1);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}

/* 单元选择复选框标签样式 */
.unit-checkbox label {
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  margin: 0;
  text-align: center;
  position: relative;
  z-index: 2; /* 确保标签在复选框上方显示 */
  pointer-events: none; /* 防止标签阻止点击事件传递到复选框 */
}

/* 单元选择容器水平布局 */
#units-selection {
  margin: 20px 0;
}

/* 单元选择网格布局 - 这是app.js中动态创建的容器 */
.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  width: 100%;
}

/* 单元选择操作按钮容器样式 - 兼容新旧类名 */
.unit-selection-actions,
.unit-actions {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  justify-content: center;
  flex-wrap: wrap;
}

/* 关卡选择网格布局样式 */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin: 20px 0;
  width: 100%;
}

/* 关卡按钮基础样式 */
.level-btn {
  display: block;
  padding: 20px;
  border-radius: 12px;
  border: 2px solid var(--border-light);
  background-color: transparent;
  color: var(--text-primary);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

/* 关卡按钮悬停状态 */
.level-btn:not(.disabled):hover {
  border-color: var(--primary-color);
  background-color: rgba(76, 175, 80, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

/* 关卡按钮激活状态 */
.level-btn:not(.disabled):active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

/* 关卡按钮文字样式 */
.level-btn span {
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--primary-color);
}

/* 关卡按钮描述样式 */
.level-btn p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
  opacity: 0.85;
}

/* 关卡按钮禁用状态样式 */
.level-btn.disabled {
  border-color: #666 !important;
  color: #999 !important;
  background-color: transparent !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  opacity: 0.5 !important;
}

/* 关卡按钮禁用状态下的文字颜色 */
.level-btn.disabled span,
.level-btn.disabled p {
  color: #999 !important;
}

/* 单元选择统计信息样式 */
.selection-stats {
  text-align: center;
  margin: 15px 0 25px;
  font-size: 1rem;
  color: var(--text-secondary);
  padding: 10px 15px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
}

/* 模态框基础样式 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 模态框遮罩层样式 */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
}

/* 模态框内容容器样式 */
.modal-content {
  position: relative;
  background-color: rgba(0, 0, 0, 0.85);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  max-width: 45%;
  width: 45%;
  max-height: 80vh;
  overflow: hidden;
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

/* 模态框头部样式 */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

/* 模态框头部标题样式 */
.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary-color);
}

/* 模态框关闭按钮样式 */
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--primary-color);
}

/* 模态框主体样式 */
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* 错误单词容器样式 */
.wrong-words-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  justify-content: center;
  text-align: center;
  width: 100%;
}

/* 无错误单词提示样式 */
.no-wrong-words {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 20px;
}

/* 主菜单操作按钮容器样式 */
.main-menu-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px auto;
  max-width: 1200px;
  padding: 0 20px;
}

/* 错误单词列表项样式 */
.wrong-word-item {
  background-color: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* 英文单词和中文意思在一行显示的容器 */
.wrong-word-item .word-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* 英文单词样式 */
.wrong-word-item .wrong-word {
  font-size: 1.2rem;
  color: var(--primary-color);
  font-weight: bold;
  margin-right: 10px;
}

/* 英文单词后面添加冒号分隔 */
.wrong-word-item .wrong-word::after {
  content: ':';
}

.wrong-word-item .word-meaning {
  font-size: 1rem;
  color: var(--text-primary);
  display: inline-block;
}

/* 错误匹配信息样式 */
.wrong-word-item .wrong-answer {
  font-size: 0.9rem;
  color: var(--danger-color);
  margin-left: 15px;
  font-style: italic;
  display: inline-block;
}

/* 自定义滚动条样式 - 保持绿色主题 */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
  transition: background 0.3s ease;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}