/* Learner H5 visual system — aligned with docs/ui-design-spec.md (blue Design System).
   本文件是 styles.css 之后的覆盖层，只调整视觉令牌与少量布局细节，不改动任何业务逻辑。 */
:root {
  /* 主色与浅底 */
  --primary: #2b6ce5;
  --primary-dark: #174ec2;
  --primary-soft: #e8f0fe;
  --primary-soft-2: #edf4ff;
  /* 中性色 */
  --ink: #1a2333;
  --muted: #6b7a90;
  --faint: #9aa5b8;
  --line: #e8edf3;
  --pale: #eff3fa;
  /* 状态色 */
  --success: #22a06b;
  --success-soft: #e6f7ef;
  --success-ink: #1a7a54;
  --warning-soft: #fef3c7;
  --warning-ink: #a35a04;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgb(0 0 0 / 4%), 0 4px 12px rgb(0 0 0 / 4%);
  /* 兼容别名：exams.css 等文件仍引用 --blue / --mint */
  --blue: var(--primary);
  --blue-dark: var(--primary-dark);
  --mint: var(--success);
  color-scheme: light;
}
body { background: var(--pale); color: var(--ink); font-size: 14px; }
/* 预览徽章下移到顶栏之下，避免压住右上角的用户名与头像 */
body.demo-preview::after { position: fixed; z-index: 1000; top: 82px; right: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; background: #fff; color: var(--muted); content: '本地预览 · 示例内容'; font-size: 11px; pointer-events: none; }
.topbar { border-color: var(--line); background: #fff; box-shadow: none; }
.brand-mark, .login-mark, .modal-mark { background: var(--primary); box-shadow: none; }
.main-content { width: min(100%, 1220px); padding-right: 28px; padding-left: 28px; }
.welcome-row h1, .page-title-row h1, .lesson-main h1, .text-lesson-wrap h1 { color: var(--ink); font-size: 24px; }
.stat-card, .course-card, .list-course, .task-card, .exam-card, .task-detail-card, .exam-detail-card, .profile-card, .profile-links, .result-card, .exam-paper-card, .exam-question { border: 1px solid var(--line); border-radius: 10px; background-color: #fff; box-shadow: var(--shadow); }
.stat-card, .course-card, .list-course, .task-card, .exam-card, .task-detail-card, .exam-paper-card { padding: 18px; }
.stat-icon { border-radius: 9px; background: var(--primary-soft) !important; color: var(--primary) !important; }
.stat-card b, .profile-stats b { color: var(--ink); font-size: 23px; font-weight: 650; }
.section-heading h2, .task-card h2, .exam-card h2 { color: var(--ink); font-size: 17px; font-weight: 600; }
.section-heading, .page-title-row { margin-bottom: 16px; }
.course-art, .list-cover { border-radius: 10px; background: var(--primary-soft) !important; color: var(--primary) !important; }
.course-art .play-glyph, .book-glyph { background: #fff; color: var(--blue); }
.progress-track { background: #edf0f4; }
.progress-track i { background: var(--blue); }
.progress-track i.mint-fill { background: var(--mint); }
.tag { border-radius: 4px; }
.tag-blue { background: var(--primary-soft); color: var(--primary-dark); }
.tag-violet { background: #f1f4f9; color: #5c6b85; }
.tag-orange { background: var(--warning-soft); color: var(--warning-ink); }
.tag-green, .status-done { background: var(--success-soft); color: var(--success-ink); }
.status-review { background: var(--warning-soft); color: var(--warning-ink); }
.status-learning { background: var(--primary-soft); color: var(--primary-dark); }
.status-pill { border-radius: 16px; }
.button { min-height: 44px; padding: 0 16px; border-radius: 10px; font-size: 14px; font-weight: 500; transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease; }
.button-primary { border-color: var(--blue); background: var(--blue); box-shadow: none; color: #fff; }
.button-primary:hover:not(:disabled) { border-color: var(--blue-dark); background: var(--blue-dark); box-shadow: none; }
.button-ghost, .button-white { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.button-ghost:hover, .button-white:hover { border-color: #c9d9f5; background: #f7faff; }
.button-danger { background: var(--danger); color: #fff; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:focus-visible, .nav-item:focus-visible, .desktop-nav button:focus-visible, .filter-chip:focus-visible, .answer-option:focus-visible, .login-field input:focus-visible { outline: 2px solid rgb(43 108 229 / 55%); outline-offset: 2px; }
.login-field input { min-height: 42px; border-color: var(--line); border-radius: 6px; font-size: 14px; }
.login-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(43 108 229 / 12%); }
.count-chip, .filter-chip { border-radius: 6px; }
.filter-chip.selected { border-color: #c9d9f5; background: var(--primary-soft); color: var(--primary-dark); }
.task-instructions, .exam-note { border: 1px solid var(--line); border-radius: 10px; background: #f5f8fe; }
.video-frame { border-radius: 9px; background: #202a38; }
.video-glow { display: none; }
.lesson-note, .completion-tip, .ip-note { border-radius: 10px; background: #f5f8fe; }
.bottom-nav { border-color: var(--line); background: #fff; box-shadow: 0 4px 18px rgb(16 42 84 / 10%); }
.nav-item { min-height: 56px; }
.nav-item.active { color: var(--blue); }
.nav-symbol { font-size: 19px; }
.toast { border-radius: 8px; font-size: 13px; }
.link-icon.blue, .link-icon.mint { background: var(--primary-soft); color: var(--primary-dark); }
.exam-open { border-top-color: var(--primary); }
.exam-onsite { border-top-color: var(--faint); }
.answer-option { color: var(--primary-dark); }
.answer-option.selected { border-color: var(--primary); background: var(--primary-soft); }
.answer-option input { accent-color: var(--blue); }
.ip-note { background: #f5f8fe; color: #5c6b85; }
.timeline-item.done i, .timeline-item.current i { background: var(--primary); }
.timeline-item.current i { box-shadow: 0 0 0 4px var(--primary-soft); }
.result-icon.waiting { background: var(--primary-soft); color: var(--primary-dark); }
.result-icon.passed, .success-banner { background: var(--success-soft); color: var(--success-ink); }
.exam-facts span { background: #f1f4f9; color: #5c6b85; }
.reading-page .scroll-hint { color: var(--muted); }
.text-lesson-wrap > .button:disabled { background: #e2e8f0; color: var(--faint); }
.login-field input:focus-visible { outline-color: var(--blue); }
#view-home.active { display: grid; gap: 16px; }
#view-home > .hero-card { order: 1; }
#view-home > .welcome-row { order: 2; }
#view-home > .home-shortcuts { order: 3; }
#view-home > .stat-grid { order: 4; }
#view-home > .section-heading { order: 5; margin: 2px 0 -5px; }
#view-home > .content-grid { order: 6; }
#view-home > .next-task-card { order: 7; }
#view-home > .home-exam-link { order: 8; }
.home-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.home-shortcut { display: flex; min-width: 0; min-height: 76px; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease; }
.home-shortcut:hover { border-color: #c9d9f5; background: #fcfdff; transform: translateY(-1px); }
.home-shortcut:active { transform: translateY(1px); }
.shortcut-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary-dark); font-size: 18px; }
.home-shortcut b, .home-shortcut small { display: block; }
.home-shortcut b { font-size: 14px; }
.home-shortcut small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.home-shortcut .shortcut-arrow { margin-left: auto; color: var(--faint); }
.home-exam-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.home-exam-link:hover { border-color: #c9d9f5; }
.exam-link-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.home-exam-link b, .home-exam-link small { display: block; }
.home-exam-link b { font-size: 14px; }
.home-exam-link small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.home-exam-arrow { margin-left: auto; color: var(--faint); }

@media (max-width: 900px) {
  .desktop-nav, .top-context, .avatar { display: none; }
  .bottom-nav { height: 64px; position: fixed; z-index: 6; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); left: 12px; display: flex; justify-content: space-around; align-items: center; padding: 0 7px; border: 1px solid var(--line); border-radius: 32px; background: #fff; box-shadow: 0 4px 18px rgb(16 42 84 / 10%); }
  .nav-item { min-height: 56px; }
  .nav-item.active { border-radius: 22px; background: var(--primary-soft); color: var(--primary-dark); }
  .nav-symbol { font-size: 19px; }
  .main-content { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
}
body:not(.demo-preview) .streak-pill { display: none; }

/* 桌面端：任务详情「提交审核」与答题交卷不再拉满整行，改为常规宽度并右对齐；
   ≤760px 的手机端仍保持全宽，方便手指点按。 */
@media (min-width: 761px) {
  #view-task-detail .task-detail-card > .button.full-button,
  #exam-answer-form > .button.full-button { display: flex; width: fit-content; margin-left: auto; }
}

@media (max-width: 760px) {
  .main-content { padding-right: 16px; padding-left: 16px; }
  .content-grid, .course-list, .task-list, .exam-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 12px 10px; }
  .hero-card, .course-card, .list-course, .task-card, .exam-card, .task-detail-card, .exam-paper-card { padding: 16px; }
  .stat-card small, .course-info small, .list-course small, .task-meta, .exam-meta, .nav-item small { font-size: 12px; }
  .stat-card b, .profile-stats b { font-size: 21px; }
  .profile-card, .profile-links { padding: 15px; }
  .welcome-row { align-items: flex-start; gap: 10px; }
  .welcome-row h1 { font-size: 22px; }
  .streak-pill { font-size: 12px; }
  #view-home.active { gap: 12px; }
  #view-home > .stat-grid { gap: 7px; }
  .stat-icon { display: none; }
  .stat-card b em { font-size: 10px; }
  .home-shortcuts { gap: 9px; }
  .home-shortcut { min-height: 72px; gap: 8px; padding: 10px; }
  .home-shortcut b { font-size: 13px; }
  .home-shortcut small { font-size: 11px; }
  .shortcut-icon { width: 36px; height: 36px; }
  .bottom-nav { padding-bottom: 0; }
  .nav-item { min-width: 0; flex: 1; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.demo-preview::after { top: 66px; font-size: 10px; }
}
@media (max-width: 360px) {
  .home-shortcuts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Unframed content groups: rely on spacing and rhythm instead of card outlines. */
.stat-card, .course-card, .list-course, .task-card, .exam-card,
.task-detail-card, .exam-detail-card, .result-card, .exam-paper-card,
.exam-question, .profile-card, .profile-links {
  border-color: transparent;
  background-color: transparent;
  box-shadow: none;
}
.stat-grid { gap: 0; }
.stat-card:not(:last-child) { border-right: 1px solid var(--line); }
.content-grid, .course-list, .task-list, .exam-list { gap: 18px; }
.list-course + .list-course { border-top: 1px solid var(--line); }
.profile-links button { border-bottom-color: var(--line); }
.home-shortcut { border-color: transparent; background: transparent; box-shadow: none; }
.home-shortcut:hover { border-color: transparent; background: var(--primary-soft-2); }
.exam-question + .exam-question { border-top: 1px solid var(--line); }

/* The home shortcuts and progress figures should read as open content, not tiles. */
#view-home .home-shortcut,
#view-home .stat-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#view-home .stat-grid {
  gap: 0;
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
#view-home .stat-card {
  justify-content: center;
  padding-right: 6px;
  padding-left: 6px;
  text-align: center;
}
#view-home .stat-card > span:last-child { text-align: center; }
#view-home .home-shortcut .shortcut-arrow { display: none; }
#view-home > .course-completion-congrats {
  order: 4;
  margin: 0;
  color: var(--success-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  animation: course-completion-pop 280ms ease-out;
}
#view-home > .course-completion-congrats[hidden] { display: none !important; }
@keyframes course-completion-pop {
  from { opacity: 0; transform: translateY(5px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#view-study .list-course > .status-pill {
  min-width: 76px;
  min-height: 32px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
#view-study .list-course > .status-pill.status-learning {
  border-color: #b9d0f7;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
#view-study .list-course > .status-pill.status-done {
  border-color: #a7dcc4;
  background: var(--success-soft);
  color: var(--success-ink);
}

.course-art, .list-cover { position:relative; overflow:hidden; }
.course-cover-image { position:absolute; inset:0; display:block; width:100%; height:100%; border-radius:inherit; object-fit:cover; }
.course-cover-image[hidden] { display:none; }
.cover-fallback { position:absolute; inset:0; display:grid; place-items:center; color:var(--primary-dark); font-size:24px; }
.cover-fallback svg { width:28px; height:28px; }
.cover-fallback[hidden] { display:none; }

/* A single inline-SVG language keeps navigation, actions, and status cues consistent. */
[data-icon] > svg, .nav-symbol svg, .shortcut-icon svg, .stat-icon svg,
.exam-link-icon svg, .task-badge svg, .result-icon svg, .upload-icon svg,
.link-icon svg, .arrow-circle svg, .heading-icon svg, .filter-chip svg,
.count-chip svg, .tag svg, .task-meta svg, .exam-meta svg, .deadline-dot svg,
.timeline-item svg, .inline-icon, .list-cover > span > svg {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}
.nav-symbol svg { width: 21px; height: 21px; }
.desktop-nav button { display: inline-flex; align-items: center; gap: 7px; }
.desktop-nav .nav-symbol svg { width: 18px; height: 18px; }
.shortcut-icon svg, .stat-icon svg { width: 22px; height: 22px; }
.task-badge svg { width: 20px; height: 20px; }
.exam-link-icon svg { width: 21px; height: 21px; }
.arrow-circle svg { width: 17px; height: 17px; }
.filter-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.filter-chip svg, .count-chip svg, .tag svg { width: 15px; height: 15px; vertical-align: -2px; }
.task-meta svg, .exam-meta svg, .deadline-dot svg, .timeline-item svg { width: 15px; height: 15px; vertical-align: -3px; }
.inline-icon { display: inline-block; width: 15px; height: 15px; vertical-align: -3px; }
.heading-icon { display: inline-flex; margin-right: 8px; color: var(--primary); vertical-align: -3px; }
.heading-icon svg { width: 24px; height: 24px; }
.upload-icon svg { width: 22px; height: 22px; }
.result-icon svg { width: 27px; height: 27px; }
.list-cover > span { display: grid; width: 100%; height: 100%; place-items: center; color: var(--primary-dark); }
.list-cover > span > svg { width: 31px; height: 31px; }
.profile-links .link-icon svg { width: 20px; height: 20px; }
.profile-links .shortcut-arrow { margin-left: auto; color: var(--faint); }
.profile-links .shortcut-arrow::after { content: '›'; font-size: 20px; line-height: 1; }
.home-exam-arrow::after { content: '›'; font-size: 20px; line-height: 1; }
.course-card .arrow-circle svg { color: var(--primary-dark); }
#view-me .profile-links {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
#view-me .profile-links button {
  gap: 10px;
  padding: 13px 8px;
  background: transparent;
}
#view-me .profile-links .profile-link-label { color: #4e5d77; }

@media (max-width: 760px) {
  .nav-symbol svg { width: 21px; height: 21px; }
  .shortcut-icon svg { width: 21px; height: 21px; }
  .heading-icon svg { width: 22px; height: 22px; }
}
