/* =========================================================
   账号 / 学习记录 / 讨论版
   与 style.css 共用设计变量，只补新增组件
   ========================================================= */

/* ---------- 无障碍辅助 ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 导航账号入口 ---------- */
.nav-account { display: flex; align-items: center; gap: 16px; font-size: 14.5px; font-weight: 700; }
.nav-account a { color: var(--text-2); }
.nav-account a:hover { color: var(--primary); }
.nav-account .nav-account-link { color: var(--primary); }
.nav-account .nav-logout { color: var(--muted); font-weight: 500; }
.nav-login { color: var(--text-2); }
.nav-register {
  padding: 8px 16px;
  border: 1.5px solid #BFDBFE;
  border-radius: 9px;
  color: var(--primary) !important;
}
.nav-register:hover { background: var(--primary-soft); }
.menu-account { display: none; }

/* ---------- 通用页面头 ---------- */
.page-head { margin-bottom: 34px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 900; margin-bottom: 10px; }
.page-head p { color: var(--muted); max-width: 720px; }
.narrow { max-width: 860px; }

/* ---------- 表单 ---------- */
.auth-shell { max-width: 460px; margin: 0 auto; }
.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 30px 28px;
}
.auth-card h1 { font-size: 24px; margin-bottom: 8px; }
.auth-card .sub { color: var(--muted); font-size: 14.5px; margin-bottom: 24px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13.5px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; }
.field input,
.field select,
.field textarea,
.lw-input,
.lw-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.lw-input:focus,
.lw-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field .hint { display: block; font-size: 12.5px; color: var(--muted-2); margin-top: 5px; font-weight: 400; }
.field-row { display: flex; gap: 12px; align-items: flex-end; }
.field-row .field { flex: 1; }

.captcha-row { display: flex; align-items: center; gap: 12px; }
.captcha-q {
  flex: 1;
  padding: 11px 14px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .06em;
  text-align: center;
  user-select: none;
}
.captcha-refresh { font-size: 13px; color: var(--primary); white-space: nowrap; }

.btn-block { width: 100%; justify-content: center; }
.form-msg { min-height: 20px; font-size: 13.5px; margin-top: 12px; }
.form-msg.ok { color: #047857; }
.form-msg.err { color: #B91C1C; }
.auth-foot { margin-top: 18px; font-size: 14px; color: var(--muted); text-align: center; }
.auth-foot a { font-weight: 700; }

/* ---------- 个人中心 ---------- */
.account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.account-who { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 54px; height: 54px; border-radius: 16px;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  color: #fff; font-weight: 900; font-size: 22px;
  display: grid; place-items: center;
}
.account-who h1 { font-size: 23px; }
.account-who .who-meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.stat-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  background: #fff;
}
.stat-box b { display: block; font-size: 24px; font-weight: 900; color: var(--primary); line-height: 1.3; }
.stat-box span { font-size: 13px; color: var(--muted); }

.progress-track { height: 8px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progress-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2563EB, #7C3AED); border-radius: 99px; transition: width .5s ease; }
.progress-text { font-size: 13.5px; color: var(--muted); }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-bottom: 22px;
}
.panel > h2 { font-size: 17px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { font-size: 17px; }
.panel-head select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-2);
  background: #fff;
  max-width: 260px;
}

.lesson-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-soft);
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row-title { font-weight: 700; font-size: 14.5px; color: var(--text); }
.lesson-row-title:hover { color: var(--primary); }
.lesson-row-meta { font-size: 12.5px; color: var(--muted-2); margin-top: 3px; }
.lesson-row-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.score-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12.5px;
  font-weight: 800;
}
.score-times, .score-none { font-size: 12px; color: var(--muted-2); }

.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bg-soft);
  font-size: 13.5px;
}
.recent-row:last-child { border-bottom: none; }
.recent-title { flex: 1; color: var(--text); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-time { color: var(--muted-2); font-size: 12.5px; white-space: nowrap; }

.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pending { background: #FFFBEB; color: #92400E; }
.status-published { background: #ECFDF5; color: #065F46; }
.status-rejected, .status-deleted { background: #FEE2E2; color: #991B1B; }

/* ---------- 讨论区 ---------- */
.community-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.thread-row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--bg-soft);
  color: inherit;
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover .thread-row-title { color: var(--primary); }
.thread-row-main { min-width: 0; }
.thread-row-title { font-size: 15.5px; font-weight: 800; margin-bottom: 5px; transition: color .18s; }
.thread-row-meta { font-size: 12.5px; color: var(--muted-2); }
.thread-row-right { text-align: right; white-space: nowrap; }
.reply-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
}
.thread-row-time { display: block; font-size: 12px; color: var(--muted-2); margin-top: 6px; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; padding-top: 20px; }
.pager-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  border-radius: 9px;
  padding: 7px 16px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.pager-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-info { font-size: 13px; color: var(--muted); }
.stack-form { display: flex; flex-direction: column; gap: 12px; }

/* ---------- 帖子详情 ---------- */
.thread-detail { margin-bottom: 24px; }
.thread-detail h1 { font-size: clamp(22px, 3vw, 30px); margin-bottom: 10px; }
.thread-meta { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.thread-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px 24px;
}
.thread-status { margin-top: 14px; font-size: 13.5px; }
.thread-status.pending { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; padding: 10px 14px; border-radius: 10px; }
.reply-item { border-top: 1px solid var(--bg-soft); padding: 14px 0; }
.reply-item:first-child { border-top: none; }
.reply-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13.5px; }
.reply-time { color: var(--muted-2); font-size: 12.5px; }
.reply-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.8; color: var(--text-2); }
.back-link { display: inline-block; margin-bottom: 16px; font-size: 13.5px; font-weight: 700; }

/* ---------- 课时页注入组件 ---------- */
.lw { margin-top: 36px; }
.lw-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.lw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.lw-head h2 { font-size: 16.5px; font-weight: 900; }
.lw-badge { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--bg-soft); color: var(--muted); }
.lw-badge.ok { background: #ECFDF5; color: #065F46; }
.lw-desc { font-size: 14px; color: var(--muted); line-height: 1.75; }
.lw-done { font-size: 13px; color: #047857; margin-top: 6px; }
.lw-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.lw-actions .btn { padding: 10px 22px; font-size: 14px; }
.lw-note { font-size: 13px; color: var(--muted); margin-top: 10px; min-height: 18px; }
.lw-note.ok { color: #047857; }
.lw-note.err { color: #B91C1C; }
.lw-muted { font-size: 13.5px; color: var(--muted-2); }
.lw-more { font-size: 13px; font-weight: 700; }
.lw-threads { margin-top: 6px; }
.lw-thread { display: block; padding: 10px 0; border-bottom: 1px solid var(--bg-soft); color: inherit; }
.lw-thread:last-child { border-bottom: none; }
.lw-thread:hover .lw-thread-title { color: var(--primary); }
.lw-thread-title { display: block; font-size: 14px; font-weight: 700; transition: color .18s; }
.lw-thread-meta { display: block; font-size: 12px; color: var(--muted-2); margin-top: 3px; }
.lw-form-slot { margin-top: 14px; }
.lw-toggle {
  border: 1px dashed #BFDBFE;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 10px;
  padding: 9px 16px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}
.lw-toggle:hover { background: #DBEAFE; }
.lw-form { display: flex; flex-direction: column; gap: 11px; }
.lw-form[hidden] { display: none !important; }
.lw-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); }
.lw-label .lw-input, .lw-label .lw-textarea { margin-top: 6px; }
.lw-inline-link { font-weight: 700; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .community-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-account { display: none; }
  .menu-account { display: block; }
  /* 登录后移动端菜单会多出"讨论区 / 我的学习 / 退出"，放宽抽屉高度 */
  .menu.open { max-height: 480px; }
  .auth-card { padding: 24px 20px; }
  .lesson-row { align-items: flex-start; }
  .account-head { align-items: flex-start; }
}
