/* AGI Playground · LinkedIn Card B5
   底图像素 1498×2127；槽位按空白线框 + 成品稿实测 */

:root {
  --badge-w: 176mm;
  --badge-h: 250mm;
  --badge-font: "Helvetica Neue", Helvetica, Arial, "PingFang SC", sans-serif;
  --badge-ink: #111111;
  --badge-muted: #8a8a8a;
  --badge-yellow: #ffb800;
}

.badge-page {
  min-height: 100vh;
  background: #e8e8ed;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #e5e5ea;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-preview,
.print-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 64px;
}

.badge-card {
  position: relative;
  width: var(--badge-w);
  height: var(--badge-h);
  overflow: hidden;
  font-family: var(--badge-font);
  color: var(--badge-ink);
  -webkit-font-smoothing: antialiased;
  box-shadow: 0 12mm 32mm rgba(0, 0, 0, 0.14);
}

.badge-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--badge-bg-url);
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.badge-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* 头像：左栏上方 */
.o-photo {
  position: absolute;
  top: 14%;
  left: 7.5%;
  width: 20%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #1a1a1a;
  box-shadow: 0 1.2mm 4mm rgba(0, 0, 0, 0.18);
  z-index: 2;
}

.o-photo img,
.o-initials {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.o-initials {
  display: grid;
  place-items: center;
  font-size: 16pt;
  font-weight: 700;
  color: #fff;
  background: #1a1a1a;
}

/* 无照片：品牌黄实心底 + 大号首字母 */
.badge-card.no-photo .o-photo {
  background: transparent;
  box-shadow: 0 1mm 3mm rgba(0, 0, 0, 0.1);
}

.badge-card.no-photo .o-initials {
  font-size: 48pt;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #111111;
  background: var(--badge-yellow);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* 空白手写牌：黄底铺满 + 文字 ":)"（冒号+括号，不旋转） */
.badge-card.is-blank.no-photo .o-photo {
  background: var(--badge-yellow);
  box-shadow: 0 1mm 3mm rgba(0, 0, 0, 0.1);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.badge-card.is-blank .o-initials.o-smile-text {
  width: 100%;
  height: 100%;
  font-size: 36pt;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #111111;
  background: var(--badge-yellow);
  transform: none;
}

/* 空白牌 Education 位：LinkedIn 手写提示 */
.badge-card.is-blank .o-blank-linkedin span {
  color: #b0b0b0;
  font-size: 12pt;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

/* 姓名 / 职位 / 粉丝 — 有无照片统一字号与位置 */
.o-name {
  position: absolute;
  top: 28%;
  left: 7.2%;
  max-width: 86%;
  z-index: 4;
  margin: 0;
  padding: 0 0.8mm 0;
  font-size: 46pt;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(
    180deg,
    transparent 0 52%,
    var(--badge-yellow) 52% 100%
  );
}

.o-headline {
  position: absolute;
  top: 37.4%;
  left: 7.2%;
  width: 88%;
  right: auto;
  z-index: 4;
  margin: 0;
  font-size: 22pt;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.o-stats {
  position: absolute;
  top: 42.2%;
  left: 7.2%;
  width: 80%;
  right: auto;
  z-index: 4;
  margin: 0;
  font-size: 18pt;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  color: #111111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.o-qr {
  position: absolute;
  top: 7.2%;
  left: 68.2%;
  width: 24.8%;
  aspect-ratio: 1 / 1;
  z-index: 3;
  display: block;
  object-fit: fill;
  padding: 0;
  margin: 0;
  border: 0;
  background: #fff;
}

/* 表格右栏内容：标签宽约到 30%，内容从 31% 起 */
.o-experience,
.o-education,
.o-about,
.o-priority {
  position: absolute;
  left: 31%;
  right: 5.5%;
  z-index: 4;
  box-sizing: border-box;
  overflow: hidden;
  color: #111111;
}

.o-experience,
.o-education {
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 12.5pt;
  font-weight: 700;
  line-height: 1.2;
}

.o-experience > span,
.o-education > span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.o-experience {
  top: 48.1%;
  height: 5.6%;
}

.o-education {
  top: 53.9%;
  height: 5.6%;
}

.o-about {
  top: 59.7%;
  height: 13.2%;
  padding: 1.2mm 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.o-about-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  max-height: calc(1.35em * 4);
  overflow: hidden;
  font-size: 11.5pt;
  font-weight: 400;
  line-height: 1.35;
  text-overflow: ellipsis;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.o-priority {
  top: 73.1%;
  height: 13.1%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 1.2mm 0;
  overflow: hidden;
}

.o-priority ul {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  max-height: calc(1.35em * 4);
  font-size: 12pt;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
}

.o-priority li {
  margin: 0 0 0.45mm;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.o-priority li::before {
  content: "·  ";
  font-weight: 700;
}

/* 第 5 行及以后不展示；超过 4 条时由数据层在第 4 条文案末尾加 ... */
.o-priority li:nth-child(n + 5) {
  display: none;
}

.o-priority li:last-child {
  margin-bottom: 0;
}

/* debug / print */

.badge-debug {
  display: flex;
  flex-wrap: wrap;
  gap: 4mm;
  padding: 3mm 7mm;
  font-size: 7.5pt;
  color: #86868b;
  background: #f5f5f7;
  border-top: 1px solid #e5e5ea;
}

.unmatched-hint {
  color: #bf4800;
}

.print-tips {
  max-width: 560px;
  margin: 0 auto 20px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e5ea;
  font-size: 13px;
  color: #6e6e73;
  text-align: center;
  line-height: 1.55;
}

.print-tips strong {
  color: #1d1d1f;
  font-weight: 600;
}

.empty-state {
  padding: 48px;
  text-align: center;
  color: #86868b;
}

.print-sheet {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0 32px;
}

.print-item {
  width: var(--badge-w);
  height: var(--badge-h);
}

@media print {
  @page {
    size: B5 portrait;
    margin: 0;
  }

  html,
  body {
    width: var(--badge-w);
    background: #fff !important;
  }

  .no-print,
  .screen-only,
  .badge-debug {
    display: none !important;
  }

  .badge-page {
    background: #fff !important;
  }

  .badge-preview,
  .print-page {
    padding: 0;
    width: var(--badge-w);
  }

  .print-sheet {
    width: var(--badge-w);
    height: var(--badge-h);
    padding: 0;
    page-break-after: always;
    break-after: page;
  }

  .print-sheet:last-child {
    page-break-after: auto;
  }

  .print-item {
    width: var(--badge-w);
    height: var(--badge-h);
    overflow: hidden;
  }

  .badge-card {
    box-shadow: none !important;
    break-inside: avoid;
  }

  .badge-bg,
  .o-name,
  .badge-card.no-photo .o-initials,
  .badge-card.is-blank.no-photo .o-photo,
  .badge-card.is-blank .o-initials.o-smile-text {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
