:root {
  --blue: #1e3a8a;
  --blue-2: #2563eb;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --spot-line: #bfdbfe;
  --algo-bg: rgba(59, 130, 246, 0.15);
  --sys-bg: rgba(16, 185, 129, 0.15);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.resume-document {
  min-height: 100vh;
  padding: 24px 0;
}

.page {
  width: 210mm;
  height: 297mm;
  margin: 0 auto;
  background: #fff;
  display: grid;
  grid-template-columns: 65mm 1fr;
  box-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.15);
  overflow: hidden;
  border-radius: 2px;
}

.left {
  background: linear-gradient(180deg, var(--blue) 0%, #172554 100%);
  color: #f8fafc;
  padding: 8mm 6mm 6mm;
}

.right {
  padding: 7.5mm 9mm 6mm;
}

.avatar-wrap {
  width: 30mm;
  height: 30mm;
  margin: 0 auto 3mm;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.name {
  text-align: center;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 1.5mm;
}

.intent {
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255,255,255,0.85);
  margin-bottom: 4mm;
  font-weight: 400;
}

.side-block { margin-bottom: 4mm; }

.side-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 2mm;
  padding-bottom: 1.5mm;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  text-transform: uppercase;
}

.contact-item,
.tag-item,
.skill-item {
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.9);
}

.contact-item + .contact-item,
.skill-item + .skill-item {
  margin-top: 1.2mm;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5mm;
}

.tag-list + .tag-list { margin-top: 1.5mm; }

.tag-item {
  padding: 0.5mm 2mm;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  line-height: 1.35;
  color: #fff;
  font-size: 12px;
}

.tag-item.algo { background: var(--algo-bg); }
.tag-item.system { background: var(--sys-bg); }

.main-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #0f172a;
  margin-bottom: 1.5mm;
}

.section { margin-top: 2.5mm; }

.section-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #1e293b;
  padding-bottom: 1mm;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5mm;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 24px;
  height: 2px;
  background: var(--blue-2);
}

.award-section-title {
  display: flex;
  align-items: center;
  gap: 2mm;
  border-bottom: none;
  border-left: 3px solid var(--blue-2);
  padding: 1.2mm 2.5mm;
  margin-bottom: 1.5mm;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0%, transparent 100%);
  border-radius: 0 4px 4px 0;
  position: relative;
}

.award-section-title::after {
  display: none;
}

.award-title-text {
  letter-spacing: 0.5px;
  font-size: 14.5px;
  font-weight: 600;
  color: #1e293b;
}

.compact-section {
  margin-top: 2mm;
}

.edu-card {
  display: flex;
  justify-content: space-between;
  gap: 8mm;
  margin-bottom: 0.5mm;
}

.edu-school {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.edu-detail,
.edu-date {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.timeline-item {
  position: relative;
  padding-left: 5.5mm;
  margin-bottom: 2mm;
  break-inside: avoid;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0.5mm;
  top: 1.8mm;
  width: 2mm;
  height: 2mm;
  border-radius: 50%;
  background: var(--blue-2);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.timeline-item::after {
  content: "";
  position: absolute;
  left: 1.45mm;
  top: 4.5mm;
  bottom: -2mm;
  width: 1px;
  background: var(--line);
}

.timeline-item:last-child::after { display: none; }

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 6mm;
  align-items: baseline;
  margin-bottom: 0.5mm;
}

.item-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.item-meta {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}

.item-sub {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.4;
  margin-bottom: 1.2mm;
  font-weight: 500;
}

.bullets {
  margin: 0;
  padding-left: 4.5mm;
  list-style-type: none;
}

.bullets li {
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 0.8mm;
  color: #334155;
  position: relative;
}

.bullets li::before {
  content: "•";
  position: absolute;
  left: -3.5mm;
  color: var(--muted);
  font-size: 14px;
}

.compact-bullets li {
  margin-bottom: 0.3mm;
}

.spotlight-item {
  margin-bottom: 0;
}

.spotlight-shell {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 6px;
  padding: 2.5mm 3.5mm;
  margin-top: 1.5mm;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.spotlight-summary {
  font-size: 12.5px;
  line-height: 1.45;
  color: #334155;
  margin-bottom: 1.5mm;
  padding: 1.5mm 2mm;
  border-radius: 4px;
  background: #fff;
  border-left: 3px solid var(--blue-2);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.project-segment + .project-segment {
  margin-top: 1.5mm;
}

.segment-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.8mm;
}

.feature-list {
  margin: 0;
  padding-left: 4.5mm;
  list-style-type: none;
}

.feature-list.compact li {
  font-size: 12.5px;
  line-height: 1.45;
  color: #475569;
  margin-bottom: 0.8mm;
  position: relative;
}

.feature-list.compact li::before {
  content: "◦";
  position: absolute;
  left: -3.5mm;
  color: var(--muted);
  font-size: 14px;
}

.project-link-bar {
  display: flex;
  align-items: center;
  gap: 2mm;
  margin-top: 1.5mm;
  padding: 1.2mm 2mm;
  border-radius: 4px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

.project-link-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-2);
  white-space: nowrap;
}

.project-link {
  font-size: 12px;
  color: var(--blue-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.project-link:hover {
  border-bottom-color: var(--blue-2);
}

.project-link-cred {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
  background: #fff;
  padding: 0.5mm 1.5mm;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
}

.award-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2mm;
  margin-top: 0.5mm;
}

.award-chip {
  font-size: 12px;
  line-height: 1.35;
  color: #334155;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 4px;
  padding: 0.8mm 1.5mm;
  transition: all 0.2s ease;
}

.award-chip:hover {
  background: #fff;
  border-color: var(--spot-line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

@media screen and (max-width: 820px) {
  body.resume-document { padding: 0; background: #fff; }

  .page {
    width: 100%;
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    box-shadow: none;
  }

  .left, .right { padding: 20px; }
}

@page { size: A4; margin: 0; }

@media print {
  html,
  body {
    width: auto;
    height: auto;
    background: #fff;
  }

  body.resume-document {
    min-height: 0;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .page {
    position: static;
    width: 210mm;
    height: 296.5mm;
    margin: 0;
    box-shadow: none;
    overflow: hidden;
    page-break-after: avoid;
    break-after: avoid;
  }
}
