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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== 学生端首页 ===== */
.main-header {
  text-align: center;
  padding: 40px 0 30px;
}
.main-header h1 {
  font-size: 2rem;
  color: #1a1a2e;
}
.main-header .subtitle {
  color: #666;
  margin-top: 8px;
  font-size: 1rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.module-card {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 30px 24px;
  text-decoration: none;
  color: #333;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}
.module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.module-icon {
  display: inline-block;
  width: 56px;
  height: 56px;
  line-height: 56px;
  border-radius: 50%;
  background: #4a6cf7;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.module-card[data-module="scanning"] .module-icon { background: #27ae60; }
.module-card[data-module="thorough"] .module-icon { background: #e67e22; }
.module-card[data-module="critical"] .module-icon { background: #8e44ad; }

.module-card h2 { font-size: 1.3rem; margin-bottom: 6px; }
.module-card p { font-size: 0.9rem; color: #888; }

.main-footer {
  text-align: center;
  padding: 20px 0;
}
.teacher-link {
  color: #999;
  font-size: 0.85rem;
  text-decoration: none;
}
.teacher-link:hover { color: #4a6cf7; }

/* ===== 提交页 ===== */
.submit-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-top: 20px;
}
.submit-header h1 { font-size: 1.6rem; }

.back-btn {
  color: #4a6cf7;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.back-btn:hover { text-decoration: underline; }

.submit-form {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: #4a6cf7;
}
.form-group textarea {
  resize: vertical;
  line-height: 1.6;
}

/* ===== 按钮 ===== */
.btn-primary {
  background: #4a6cf7;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  color: #4a6cf7;
  border: 1px solid #4a6cf7;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s;
}
.btn-secondary:hover { background: #eef2ff; }

.btn-danger {
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-danger:hover { opacity: 0.9; }

/* ===== 教师端 ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 36px;
  width: 360px;
  text-align: center;
}
.login-box h2 { margin-bottom: 20px; }
.login-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 16px;
  outline: none;
}
.login-box input:focus { border-color: #4a6cf7; }
.login-error { color: #e74c3c; font-size: 0.85rem; margin-top: 8px; min-height: 20px; }

.teacher-header { margin-bottom: 20px; }
.teacher-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.teacher-top h1 { font-size: 1.5rem; }
.header-actions { display: flex; gap: 10px; }

.module-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e0e0e0;
  flex-wrap: wrap;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 0.95rem;
  color: #888;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: #4a6cf7; }
.tab-btn.active {
  color: #4a6cf7;
  border-bottom-color: #4a6cf7;
  font-weight: 600;
}

.panel-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
}
.record-count { color: #888; font-size: 0.9rem; }

.submission-list { margin-top: 8px; }

.submission-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.card-nickname {
  font-weight: 700;
  color: #4a6cf7;
  font-size: 0.95rem;
}
.card-time {
  color: #aaa;
  font-size: 0.8rem;
}
.btn-delete {
  margin-left: auto;
  background: none;
  border: 1px solid #e74c3c;
  color: #e74c3c;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-delete:hover {
  background: #e74c3c;
  color: #fff;
}
.card-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #444;
}

.empty-hint {
  text-align: center;
  color: #aaa;
  padding: 40px 0;
  font-size: 0.95rem;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 380px;
  text-align: center;
}
.modal-box p {
  margin-bottom: 20px;
  font-size: 1rem;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== 轻提示 toast ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 2000;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }

/* ===== 响应式（手机端适配） ===== */
@media (max-width: 600px) {
  .container { padding: 12px; }

  /* 首页 */
  .main-header { padding: 24px 0 18px; }
  .main-header h1 { font-size: 1.5rem; }
  .main-header .subtitle { font-size: 0.85rem; }
  .module-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 24px; }
  .module-card { padding: 22px 18px; }
  .module-card h2 { font-size: 1.15rem; }
  .module-card p { font-size: 0.85rem; }

  /* Key Words 卡片移动端 */
  .keywords-card { padding: 20px 24px; }
  .keywords-icon { width: 48px; height: 48px; line-height: 48px; font-size: 1rem; }
  .keywords-body h2 { font-size: 1.1rem; }
  .keywords-body p { font-size: 0.85rem; }
  .section-divider span { font-size: 0.8rem; }

  /* 提交页 */
  .submit-header { flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding-top: 12px; }
  .submit-header h1 { font-size: 1.25rem; }
  .submit-form { padding: 20px; }

  /* 教师端 */
  .teacher-top { flex-direction: column; align-items: flex-start; gap: 10px; }
  .teacher-top h1 { font-size: 1.2rem; }
  .module-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; padding: 8px 14px; font-size: 0.85rem; }

  /* 提交卡片 */
  .submission-card { padding: 14px 16px; }
  .card-header { gap: 8px; }
  .card-nickname { font-size: 0.9rem; }
  .card-content { font-size: 0.9rem; }

  /* 面板操作栏 */
  .panel-actions { flex-direction: column; align-items: flex-start; gap: 10px; margin: 14px 0; }
  .btn-danger, .btn-secondary { font-size: 0.85rem; padding: 7px 16px; }

  /* 单词输入页 */
  .kw-nickname-bar { padding: 14px 18px; }
  .kw-entry { padding: 16px 18px; }
  .kw-entry-header { flex-wrap: wrap; }
  .kw-form-group label { font-size: 0.85rem; }
  .kw-form-group input,
  .kw-form-group textarea { font-size: 16px; } /* 防止 iOS 缩放 */
  .kw-submit-btn { padding: 12px; font-size: 1rem; }

  /* 教师端单词卡片 */
  .kw-field { flex-direction: column; align-items: flex-start; gap: 4px; }
  .kw-field-label { width: auto; font-size: 0.75rem; }

  /* 登录弹窗 */
  .login-box { width: 90%; padding: 28px 22px; }
  .modal-box { width: 90%; padding: 22px; }

  /* 按钮字号 */
  .btn-primary { font-size: 1rem; padding: 10px 24px; }
}

/* ===== 首页 Key Words & Expressions 区域 ===== */
.keywords-section {
  margin-bottom: 40px;
  text-align: center;
}
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #d0d0d0;
}
.section-divider span {
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.keywords-card {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  background: #fff;
  border-radius: 12px;
  padding: 24px 40px;
  text-decoration: none;
  color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}
.keywords-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.keywords-icon {
  width: 56px;
  height: 56px;
  line-height: 56px;
  text-align: center;
  border-radius: 50%;
  background: #2c3e50;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}
.keywords-body h2 { font-size: 1.3rem; margin-bottom: 4px; }
.keywords-body p { font-size: 0.9rem; color: #888; }

/* ===== 学生端单词输入页 ===== */
.kw-nickname-bar {
  background: #fff;
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.kw-nickname-bar label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.kw-nickname-bar input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.kw-nickname-bar input:focus { border-color: #4a6cf7; }

.kw-entries { margin-bottom: 16px; }

.kw-entry {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.kw-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}
.kw-entry-num {
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.95rem;
}
.kw-remove-btn {
  background: none;
  border: 1px solid #e74c3c;
  color: #e74c3c;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.kw-remove-btn:hover {
  background: #e74c3c;
  color: #fff;
}

.kw-form-group { margin-bottom: 14px; }
.kw-form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #555;
}
.kw-form-group input,
.kw-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.kw-form-group input:focus,
.kw-form-group textarea:focus { border-color: #4a6cf7; }
.kw-form-group textarea {
  resize: vertical;
  line-height: 1.6;
}

.btn-add-word {
  display: block;
  width: 100%;
  background: #fff;
  color: #2c3e50;
  border: 2px dashed #bbb;
  border-radius: 12px;
  padding: 14px;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  margin-bottom: 20px;
}
.btn-add-word:hover {
  border-color: #4a6cf7;
  color: #4a6cf7;
}

.kw-submit-btn { display: block; width: 100%; padding: 14px; }

/* ===== 教师端 Key Words 卡片样式 ===== */
.kw-card .kw-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.kw-field {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.kw-field-label {
  flex-shrink: 0;
  width: 130px;
  font-size: 0.8rem;
  color: #999;
  font-weight: 600;
  padding-top: 2px;
}
.kw-field-value {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #444;
}
.kw-word-text {
  font-weight: 700;
  color: #2c3e50;
  font-size: 1.05rem;
}
