:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #5d6b82;
  --line: #dfe7f1;
  --navy: #101827;
  --blue: #4f7df3;
  --orange: #f47b20;
  --green: #35b87f;
  --shadow: 0 14px 36px rgba(20, 36, 64, 0.08);
  --radius: 8px;
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 24px;
  --fs-title: 32px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-size: var(--fs-md);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #e8eef6;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.topbar__inner,
.page-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar__inner {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 700;
}

.brand__mark {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: url(../assets/logo.png) center / cover no-repeat;
  color: transparent;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(91, 130, 230, 0.24);
}

.brand__mark--small {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 13px;
}

.brand__name {
  color: #1f2937;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: stretch;
  gap: 22px;
  height: 100%;
}

.nav__item {
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: #66758d;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.nav__item--active {
  border-bottom-color: #70a7e9;
  color: #1f3554;
}

.page-shell {
  flex: 1;
  padding: 30px 0 112px;
}

.profile-panel {
  min-height: 128px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(430px, auto);
  align-items: center;
  gap: 22px;
  padding: 28px;
  border: 1px solid #e6edf5;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pageFadeUp .55s cubic-bezier(.2, .8, .2, 1) both;
}

.student-avatar {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 4px solid #eef4ff;
  border-radius: 50%;
  outline: 3px solid #6d73ff;
  background: linear-gradient(135deg, #26384d, #1a202c 60%, #3d5a7d);
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
}

.profile-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
}

.student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.student-meta span,
.summary-chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f0f5fb;
  color: #526277;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.profile-panel__side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
}

.profile-panel__summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.summary-chip--accent {
  background: #fff4e8;
  color: #9a551f;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 30px 0 18px;
  animation: pageFadeUp .55s cubic-bezier(.2, .8, .2, 1) .08s both;
}

.section-heading__eyebrow {
  margin: 0 0 7px;
  color: #7c8ba1;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.qr-card {
  width: fit-content;
  max-width: 320px;
  min-height: 82px;
  display: grid;
  grid-template-columns: 60px auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e5edf6;
  border-radius: var(--radius);
  background: var(--surface);
}

.qr-card__canvas {
  width: 60px;
  height: 60px;
  image-rendering: pixelated;
}

.qr-card__copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.qr-card__title {
  font-size: var(--fs-sm);
  font-weight: 900;
  white-space: nowrap;
}

.qr-card__hint {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.subject-empty {
  grid-column: 1 / -1;
  padding: 40px 28px;
  border: 1px dashed #cdd8e8;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  color: #52627c;
}
.subject-empty h3 { margin: 0 0 8px; font-size: var(--fs-lg); color: #26364c; }
.subject-empty p { margin: 0 auto; max-width: 460px; font-size: var(--fs-sm); line-height: 1.7; }

.subject-card {
  min-height: 328px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border: 1px solid #e2eaf4;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(20, 36, 64, 0.06);
  animation: pageFadeUp .55s cubic-bezier(.2, .8, .2, 1) both;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.subject-card:nth-child(1) { animation-delay: .12s; }
.subject-card:nth-child(2) { animation-delay: .18s; }
.subject-card:nth-child(3) { animation-delay: .24s; }
.subject-card:hover {
  transform: translateY(-3px);
  border-color: #cddcf1;
  box-shadow: 0 16px 34px rgba(20, 36, 64, 0.10);
}

@keyframes pageFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

.subject-card__top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.subject-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--subject-color);
  background: var(--subject-soft);
  font-size: 17px;
  font-weight: 900;
}

.subject-card h3 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
}

.priority-badge {
  min-width: 82px;
  padding: 5px 9px;
  border: 1px solid rgba(244, 123, 32, 0.25);
  border-radius: 999px;
  background: #fff5ed;
  color: #a14d13;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.metric {
  display: grid;
  gap: 8px;
}

.metric__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #53657b;
  font-size: 13px;
  font-weight: 800;
}

.metric__value {
  color: var(--ink);
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  /* 底槽用各学科自己的浅色（物理→浅橙、数学→浅蓝、化学→浅绿）。 */
  background: var(--subject-soft, #edf3f8);
}

.progress__bar {
  display: block;
  width: var(--mastery);
  height: 100%;
  border-radius: inherit;
  background: var(--subject-color);
}

.core-problem {
  min-height: 74px;
  padding: 14px;
  border: 1px solid #ecf1f6;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #4d5f75;
  font-size: 13px;
  line-height: 1.65;
}

.core-problem strong {
  color: #334155;
}

/* FB-064：能力画像（分维度雷达 + 重点关注），替代抽象的掌握度% + 核心问题。 */
.subject-portrait { display: grid; gap: 12px; }
.subject-portrait__loading { min-height: 132px; display: grid; place-items: center; color: #9aa8ba; font-size: 12.5px; }
.subject-radar { display: flex; align-items: center; gap: 12px; }
.subject-radar__chart { flex: 0 0 172px; }
.subject-radar__svg { width: 172px; height: auto; display: block; }
.subject-radar__legend { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sr-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.sr-n { color: #53657b; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-n i { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.sr-v { font-weight: 800; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.sr-v--weak { color: #dc2626; } .sr-v--mid { color: #d97706; } .sr-v--good { color: #16a34a; }
.subject-focus { padding: 12px 14px; border: 1px solid #ecf1f6; border-radius: var(--radius); background: var(--surface-soft); }
.subject-focus__t { font-size: 12.5px; font-weight: 800; color: #334155; margin-bottom: 8px; }
.subject-focus ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.subject-focus li { display: flex; gap: 8px; font-size: 12.5px; color: #4d5f75; line-height: 1.5; }
.subject-focus li .sf-k { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 6px; background: color-mix(in srgb, var(--subject-color) 16%, white); color: var(--subject-color); font-size: 11px; font-weight: 900; display: grid; place-items: center; margin-top: 1px; }
.subject-focus li b { color: #334155; }

.trend {
  height: 48px;
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  align-items: end;
  gap: 4px;
}

.trend__bar {
  min-height: 8px;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--subject-color) 28%, white);
}

.trend__bar:last-child {
  background: var(--subject-color);
}

.card-meta {
  color: #738196;
  font-size: 12px;
  font-weight: 700;
}

.card-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-button {
  height: 38px;
  border: 1px solid #dce6f1;
  border-radius: var(--radius);
  background: #ffffff;
  color: #31425c;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.action-button--primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.action-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--subject-color) 36%, white);
  outline-offset: 2px;
}

.action-helper {
  margin: -8px 0 0;
  color: #718096;
  font-size: 11px;
  line-height: 1.55;
}

/* —— 教师端「班级学情看板」——（复用学科卡片的视觉语言：主色/浅色/图标） */
.cohort-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 320px;
  padding: 24px;
  border: 1px solid #e2eaf4;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(20, 36, 64, 0.06);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.cohort-card:hover,
.cohort-card:focus-visible {
  border-color: color-mix(in srgb, var(--subject-color) 32%, #e2eaf4);
  box-shadow: 0 16px 34px rgba(20, 36, 64, 0.1);
  transform: translateY(-2px);
}

.cohort-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--subject-color) 24%, white);
  outline-offset: 2px;
}

.cohort-card__top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.cohort-card__top h3 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
}

.cohort-card__cta {
  color: var(--subject-color);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.cohort-card__mean {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cohort-card__value {
  color: var(--subject-color);
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
}

.cohort-card__value em {
  margin-left: 2px;
  font-size: 20px;
  font-style: normal;
  font-weight: 800;
}

.cohort-card__label {
  color: #53657b;
  font-size: 13px;
  font-weight: 700;
}

.cohort-dist {
  display: grid;
  gap: 10px;
}

.cohort-dist__bar {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--subject-soft, #edf3f8);
}

.cohort-dist__seg {
  height: 100%;
}

/* 从弱到强的分布配色（红→橙→黄→浅绿→绿） */
.cohort-dist__seg--b0 { background: #e2585a; }
.cohort-dist__seg--b1 { background: #f0913e; }
.cohort-dist__seg--b2 { background: #e8c14b; }
.cohort-dist__seg--b3 { background: #6fbf87; }
.cohort-dist__seg--b4 { background: #35b87f; }

.cohort-dist__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.cohort-dist__key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #6a7789;
  font-size: 11.5px;
  font-weight: 700;
}

.cohort-dist__key b {
  color: #2f3f56;
}

.cohort-dist__dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.cohort-card__actions {
  margin-top: auto;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.24);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .profile-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .profile-panel__side {
    grid-column: 1 / -1;
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: row-reverse;
  }

  .profile-panel__summary {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .qr-card {
    width: 100%;
    max-width: 420px;
  }

  .subject-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar__inner,
  .page-shell {
    width: min(100% - 28px, 1120px);
  }

  .topbar__inner {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 10px 0;
  }

  .nav {
    height: 34px;
  }

  .profile-panel {
    padding: 20px;
  }

  .profile-panel__side {
    flex-direction: column-reverse;
  }

  .profile-panel__summary {
    align-items: flex-start;
  }

  .student-avatar {
    width: 58px;
    height: 58px;
  }

  .subject-card {
    padding: 20px;
  }

  .subject-card__top {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .priority-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

}
