:root {
  --theme: #f60;
  --theme-dark: #e05a00;
  --text-color: #1f1f1f;
  --text-light: #777;
  --border-color: #dcdfe6;
  --bg-color: #ffffff;
}

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

body {
  position: relative;
  background-color: var(--bg-color);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  padding: 24px 16px;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 940px;
  margin: 0 auto;
}

/* 标题 */
.page-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #f60;
  letter-spacing: 1px;
  margin: 12px 0 22px;
}

/* 表单示意图 */
.sample-card {
  padding: 10px;
  margin-bottom: 22px;
}

.sample-image {
  display: block;
  width: 100%;
  border-radius: 4px;
}

/* 查询表单 */
.verify-form {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  width: 100%;
}

.form-group input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 15px;
  color: #333;
  background: #fff;
  outline: none;
  transition: none;
}

.form-group input:focus,
.form-group input:hover {
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.form-group input::placeholder {
  color: #b5b5b5;
}

/* 验证码 */
.captcha-group {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.captcha-group input {
  flex: 1;
  min-width: 0;
}

.captcha-img {
  width: 128px;
  height: 48px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.captcha-img canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 查询按钮 */
.btn-query {
  width: 170px;
  height: 46px;
  margin: 26px auto 0;
  background: var(--theme);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 102, 0, 0.3);
  transition: background-color .2s ease;
}

.btn-query:hover {
  background: var(--theme-dark);
}

.btn-query:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* 状态提示 */
.status {
  display: none;
  margin: 18px auto 0;
  max-width: 460px;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.status.show {
  display: block;
}

.status.error {
  background: #fff1f0;
  color: #e64340;
  border: 1px solid #ffd6d3;
}

.status.loading {
  background: #fff8ed;
  color: var(--theme);
  border: 1px solid #ffe2c2;
}

/* 结果区域 */
.result {
  display: none;
  margin-top: 28px;
}

.result.show {
  display: block;
}

.pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.page-wrap {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.result-actions {
  text-align: center;
  margin: 26px 0 10px;
}

.btn-download {
  min-width: 170px;
  height: 46px;
  padding: 0 28px;
  background: var(--theme);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 102, 0, 0.3);
  transition: background-color .2s ease;
}

.btn-download:hover {
  background: var(--theme-dark);
}

.btn-download:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ---------- A4 文档页 ---------- */
.pdf-page {
  position: relative;
  width: 794px;
  height: 1123px;
  flex-shrink: 0;
  background: #fff;
  padding: 34px 46px 40px;
  overflow: hidden;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.1);
  font-family: "SimSun", "Songti SC", "Microsoft YaHei", serif;
  color: #111;
}

.pdf-page .verify-line {
  font-size: 10px;
  color: #444;
  border-bottom: 1px dashed #bbb;
  padding-bottom: 6px;
  margin-bottom: 18px;
  word-break: break-all;
  min-height: 70px;
  padding-left: 50px;
  padding-top: 8px;
}

/* 每页左上角二维码 */
.pdf-page .pdf-qrcode {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 70px;
  height: 70px;
  object-fit: contain;
  z-index: 3;
  pointer-events: none;
}

.pdf-page .doc-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 8px 0 26px;
  font-family: "SimHei", "Microsoft YaHei", sans-serif;
}

.pdf-page table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.pdf-page table th,
.pdf-page table td {
  border-top: 1px solid #333;
  border-left: 1px solid #333;
  padding: 16px 6px;
  line-height: 1.5;
  vertical-align: middle;
  word-break: break-all;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
}

/* 最右列加右边框 */
.pdf-page table th:last-child,
.pdf-page table td:last-child {
  border-right: 1px solid #333;
}

/* 最后一行加下边框 */
.pdf-page table tr:last-child th,
.pdf-page table tr:last-child td {
  border-bottom: 1px solid #333;
}

.pdf-page table th {
  background: #fafafa;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.pdf-page table td {
  text-align: center;
}

.pdf-page .table-gap {
  height: 18px;
}

.pdf-page .note-block {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.9;
}

.pdf-page .note-block .note-title {
  font-weight: 700;
}

.pdf-page .doc-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.pdf-page .signature {
  margin-top: 60px;
  text-align: right;
  font-size: 13px;
  line-height: 2.2;
  padding-right: 80px;
}

.pdf-page .narrative {
  font-size: 15px;
  line-height: 2.6;
  margin-top: 20px;
}

.pdf-page .narrative .blank {
  display: inline-block;
  min-width: 225px;
  border-bottom: 1px solid #333;
  text-align: center;
  padding: 0 6px;
  font-weight: 600;
}

/* 公章 —— 每页独立位置（相对页面 794×1123，按内容定位） */
.pdf-seal {
  position: absolute;
  width: 150px;
  height: 150px;
  object-fit: contain;
  opacity: .92;
  z-index: 3;
  pointer-events: none;
}

/* 第 1 页 失业保险：表格"参保机构"行右下 */
.seal-p1 {
  right: 90px;
  top: 270px;
}

/* 第 2 页 基本养老：文档底部"打印日期"右侧 */
.seal-p2 {
  right: 90px;
  bottom: 380px;
}

/* 第 3 页 城乡居民养老："社保经办机构(盖章):" 文字右侧 */
.seal-p3 {
  right: 100px;
  top: 360px;
}

/* 第 4 页 工伤保险："社保经办机构公章:" 文字右侧，日期上方 */
.seal-p4 {
  right: 100px;
  top: 666px;
}

/* 水印 */
.pdf-watermark {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.pdf-watermark span {
  position: absolute;
  width: 300px;
  color: rgba(80, 80, 80, 0.28);
  font-size: 13px;
  line-height: 1.8;
  font-family: "Microsoft YaHei", sans-serif;
  white-space: normal;
  transform: rotate(-28deg);
  user-select: none;
}

footer {
  font-size: 12px;
  margin-top: 30px;
  color: var(--text-light);
  display: flex;
  justify-content: center;
}

@media (max-width: 768px) {
  body {
    padding: 16px 12px 24px;
  }

  .page-title {
    font-size: 18px;
    margin: 6px 0 16px;
  }

  .sample-card {
    padding: 8px;
    margin-bottom: 18px;
  }

  .verify-form {
    max-width: 100%;
    gap: 14px;
  }

  /* 16px 可避免 iOS 聚焦输入框时自动放大页面 */
  .form-group input {
    height: 46px;
    font-size: 16px;
    padding: 0 14px;
  }

  .captcha-img {
    width: 104px;
    height: 46px;
  }

  .btn-query {
    width: 100%;
    max-width: 300px;
    height: 44px;
    margin-top: 20px;
    font-size: 16px;
  }

  .status {
    max-width: 100%;
    font-size: 13px;
    margin-top: 14px;
  }

  .result {
    margin-top: 20px;
  }

  .pages {
    gap: 16px;
  }

  .result-actions {
    margin: 18px 0 6px;
  }

  .btn-download {
    width: 100%;
    max-width: 300px;
    height: 44px;
    font-size: 15px;
  }

  footer {
    margin-top: 22px;
    font-size: 11px;
    padding: 0 8px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .page-title {
    font-size: 17px;
    letter-spacing: 0;
  }

  .captcha-group {
    gap: 8px;
  }

  .captcha-img {
    width: 92px;
  }

  .btn-query,
  .btn-download {
    max-width: none;
  }
}

/* ---------------- 提示弹窗 ---------------- */
.alert-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 0 24px;
}

.alert-mask.show {
  display: flex;
}

.alert-box {
  width: 100%;
  max-width: 300px;
  background: #fff;
  border-radius: 10px;
  padding: 26px 0 20px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  animation: alertIn .18s ease-out;
}

@keyframes alertIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.alert-msg {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 22px;
  word-break: break-all;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.alert-btn {
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  border: 0;
  background: transparent;
  outline: none;
}

.alert-btn:active {
  opacity: .85;
}