:root {
  --bg: #f6f5f1;
  --surface: #fffefb;
  --ink: #16181b;
  --ink-2: #3a4047;
  --muted: #646a72;
  --line: #e4e1d9;
  --line-2: #cfcbc0;
  --dot: #d6d2c6;
  --accent: #0b7285;
  --panel: #121519;
  --panel-line: #2a3037;
  --panel-ink: #dde2e7;
  --panel-muted: #8b949e;
  --panel-accent: #5ccfdd;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono", Menlo, monospace;
}

/* 深色：默认跟系统；点过顶栏按钮就按 data-theme 走（存在 localStorage），两个方向都要能盖过系统设置 */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d0f12;
    --surface: #13161a;
    --ink: #e8eaed;
    --ink-2: #c2c7cd;
    --muted: #8a929b;
    --line: #22272d;
    --line-2: #333a42;
    --dot: #22272d;
    --accent: #45c3d4;
    --panel: #0a0c0e;
    --panel-line: #262c32;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f12;
  --surface: #13161a;
  --ink: #e8eaed;
  --ink-2: #c2c7cd;
  --muted: #8a929b;
  --line: #22272d;
  --line-2: #333a42;
  --dot: #22272d;
  --accent: #45c3d4;
  --panel: #0a0c0e;
  --panel-line: #262c32;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { text-wrap: pretty; }
.mono { font-family: var(--mono); }
/* 带连字符的英文词（mid-training、LLM-as-Judge）浏览器会在连字符处断行 */
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--bg);
}
.skip:focus { left: 12px; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 40px);
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand {
  font-weight: 700;
  letter-spacing: .06em;
  text-decoration: none;
}
.nav { display: flex; gap: clamp(10px, 3vw, 28px); }
.nav a {
  padding: 8px 0;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover { color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.theme-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 479px) {
  /* 手机上顶栏放不下六个导航加整句按钮，按钮只留“深色/浅色”两个字 */
  .theme-btn { padding: 0 9px; }
  .theme-btn .tb-long { display: none; }
}

/* 首屏 */
.hero {
  position: relative;
  padding: clamp(48px, 8vw, 104px) 0 clamp(40px, 5vw, 64px);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 88%);
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
  pointer-events: none;
}
.hero .wrap { position: relative; }

.hero-grid { display: grid; gap: 36px; }
@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 48px;
    align-items: end;
  }
}

.highlights dl { margin: 0; padding: 4px 16px; }
.highlights dl div {
  display: grid;
  grid-template-columns: 5.2em minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 11px 0;
}
.highlights dl div + div { border-top: 1px solid var(--panel-line); }
.highlights dt {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.highlights dd {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--panel-muted);
  text-wrap: balance;
}

.eyebrow {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .04em;
  color: var(--muted);
}
.eyebrow span { white-space: nowrap; }
.hero h1 {
  margin: 14px 0 6px;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 1.08;
  letter-spacing: .04em;
}
.role {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 600;
  color: var(--ink-2);
}
.slash {
  margin: 0 .5em;
  font-weight: 400;
  color: var(--line-2);
}
.lede {
  max-width: 40em;
  margin: 22px 0 0;
  font-size: 17px;
  color: var(--ink-2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.orgs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 24px;
  margin: clamp(40px, 6vw, 64px) 0 0;
  padding: 0;
  list-style: none;
}
.orgs li {
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.org { display: block; font-weight: 600; }
.org-role { display: block; font-size: 14px; color: var(--ink-2); }
.when { display: block; font-size: 12.5px; color: var(--muted); }

/* 分节 */
.section { padding: clamp(44px, 6vw, 72px) 0; }
.hero + .section { padding-top: clamp(16px, 2.5vw, 32px); }
.section + .section { border-top: 1px solid var(--line); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-bottom: 28px;
}
.section-no { font-size: 13px; color: var(--accent); }
.section-head h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.3;
}
.section-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
}

/* 项目 */
.project {
  display: grid;
  gap: 24px;
  margin-bottom: 28px;
  padding: clamp(16px, 2.4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.project:last-child { margin-bottom: 0; }

@media (min-width: 960px) {
  .project {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
  }
  .project:nth-of-type(even) .project-media { order: 2; }
}

.panel {
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--panel-ink);
}
.panel-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--panel-line);
  font-size: 11.5px;
  color: var(--panel-muted);
}
.panel-bar span:first-child::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--panel-accent);
  vertical-align: 1px;
}

/* 流程示意 */
.flow {
  margin: 0;
  padding: 18px 18px 6px;
  list-style: none;
  font-size: 13.5px;
}
.flow li {
  position: relative;
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 12px;
  padding: 0 0 14px 20px;
  line-height: 1.6;
}
.flow li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 7px;
  height: 7px;
  border: 1px solid var(--panel-accent);
  border-radius: 50%;
  background: var(--panel);
}
.flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 3px;
  top: calc(.55em + 9px);
  bottom: 1px;
  width: 1px;
  background: var(--panel-line);
}
.flow .k { font-family: var(--mono); color: var(--panel-accent); }
.flow .v { color: var(--panel-ink); }

/* 预注册判定表 */
.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.5;
}
.ledger th {
  padding: 12px 14px 6px;
  font-size: 11.5px;
  font-weight: 400;
  text-align: left;
  color: var(--panel-muted);
}
.ledger td {
  padding: 9px 14px;
  border-top: 1px solid var(--panel-line);
  color: var(--panel-ink);
}
.ledger td:first-child { width: 4em; font-size: 12px; color: var(--panel-muted); }
.ledger th:last-child, .ledger td:last-child { text-align: right; white-space: nowrap; }
/* 颜色只给图标，文字保持正文色；红绿色弱的人靠 ✓ ✕ – 区分 */
.verdict i {
  display: inline-block;
  width: 1.2em;
  margin-right: 4px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
}
.verdict.good i { color: #0ca30c; }
.verdict.bad i { color: #d03b3b; }
.verdict.none i { color: var(--panel-muted); }

.panel-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--panel-line);
}
.panel-metrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
}
.panel-metrics div + div { border-left: 1px solid var(--panel-line); }
.panel-metrics dt { font-size: 11.5px; color: var(--panel-muted); }
.panel-metrics dd {
  margin: 0;
  font-size: clamp(19px, 2.2vw, 23px);
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  white-space: nowrap;
}
.panel-metrics small {
  margin-left: 3px;
  font-size: 12px;
  font-weight: 400;
  color: var(--panel-muted);
}
.panel-metrics dd.delta {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--panel-muted);
  white-space: normal;
}

.project-meta {
  display: flex;
  gap: 12px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.project-meta span:first-child { color: var(--accent); }
.project h3 {
  margin: 8px 0 10px;
  font-size: clamp(21px, 2.2vw, 25px);
  line-height: 1.35;
  text-wrap: balance;
}
.project-lede {
  margin: 0 0 16px;
  color: var(--ink-2);
}

.points {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.points li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 16px;
  font-size: 15px;
  color: var(--ink-2);
}
.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: 5px;
  height: 5px;
  background: var(--accent);
}
.points b {
  margin-right: .6em;
  font-weight: 600;
  color: var(--ink);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 1px 8px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0;
}
.links a {
  font-size: 14.5px;
  color: var(--accent);
  text-decoration: none;
}
.links a::after { content: " ↗"; }
.links a.internal::after { content: " →"; }
.links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* 讲解视频：先放封面，点了才换成 B 站播放器 */
.project-media { display: grid; gap: 16px; }
.video-cover {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
}
/* 面板 overflow: hidden，外描边会被裁掉，改成内描边 */
.video-cover:focus-visible { outline-offset: -3px; }
.video-cover img { width: 100%; transition: opacity .15s; }
.video-cover:hover img { opacity: .85; }
.video-play {
  position: absolute;
  right: 4%;
  bottom: 6%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px 0 12px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 17px;
  background: rgba(10, 12, 14, .8);
  color: #fff;
  font: 600 13px/1 var(--sans);
  transition: border-color .15s, color .15s;
}
.video-play::before {
  content: "";
  border-left: 10px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.video-cover:hover .video-play { border-color: var(--panel-accent); color: var(--panel-accent); }
.video-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}
@media (max-width: 959px) {
  /* 单列时视频挪到正文后面，卡片开头不连着两块深色面板 */
  .project-media { display: contents; }
  .project-body { order: 1; }
  .project .video { order: 2; }
}

/* 实习与教育 */
.timeline { margin: 0; padding: 0; list-style: none; }
.exp {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 28px;
}
.exp-when {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding-top: 3px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.exp-when span:first-child::after { content: " –"; }
.exp-when span.solo::after { content: none; }
.exp-main {
  position: relative;
  padding: 0 0 36px 28px;
  border-left: 1px solid var(--line-2);
}
.exp-main::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 9px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}
.timeline .exp:last-child .exp-main,
.edu .exp-main { padding-bottom: 0; }
.exp h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.4;
}
.exp-role {
  margin: 4px 0 10px;
  font-size: 15px;
  color: var(--ink-2);
}
.exp-role .mono {
  display: inline-block;
  margin-left: 10px;
  padding: 0 7px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.exp-sum {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--ink-2);
}
.edu .exp-sum:last-child { margin-bottom: 0; }
.exp-main > p, .exp-main .points, .skills dd { max-width: 46em; }

/* 实践经历 */
.extras {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.extras li { padding-top: 14px; border-top: 1px solid var(--line-2); }
.extras h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.extras li > :last-child { margin-bottom: 0; }
@media (min-width: 960px) {
  .extras { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
}

/* 技能 */
.skills { margin: 0; border-top: 1px solid var(--line); }
.skills div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--ink-2); }

/* 联系 */
.contact-mail { margin: 0; }
.contact-mail a {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  word-break: break-all;
}
.contact .actions { margin-top: 24px; }

.footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 22px;
  padding-bottom: 36px;
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 719px) {
  .orgs { grid-template-columns: 1fr; gap: 14px; }
  .exp { grid-template-columns: 1fr; gap: 4px; }
  .exp-when { flex-direction: row; gap: .4em; }
  .exp-main { padding-left: 0; border-left: 0; }
  .exp-main::before { display: none; }
  .timeline .exp + .exp { margin-top: 8px; padding-top: 28px; border-top: 1px solid var(--line); }
  .skills div { grid-template-columns: 1fr; gap: 2px; }
  .flow li { grid-template-columns: 4.8em minmax(0, 1fr); gap: 8px; }
  .panel-metrics div { padding: 10px; }
  .ledger { font-size: 13px; }
  .ledger th, .ledger td { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 479px) {
  /* 三格并排会把说明挤成三四行，改成一行一格：左边数值，右边名称和说明，排法同首屏 highlights */
  .panel-metrics { grid-template-columns: minmax(0, 1fr); }
  .panel-metrics div {
    display: grid;
    grid-template-columns: 6em minmax(0, 1fr);
    grid-template-areas: "v k" "v d";
    gap: 2px 12px;
    align-items: baseline;
    padding: 10px 14px;
  }
  .panel-metrics div + div { border-left: 0; border-top: 1px solid var(--panel-line); }
  .panel-metrics dt { grid-area: k; }
  .panel-metrics dd { grid-area: v; }
  .panel-metrics dd.delta { grid-area: d; }
  /* 判定列不换行，最长的判定会把整列撑宽、主比较挤成两行，所以窄屏把它拆成两行 */
  .verdict .nb { display: block; }
  .ledger th, .ledger td { padding-left: 8px; padding-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
