:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #131820;
  --ink-2: #3d4655;
  --muted: #737e8f;
  --line: #e4e8f0;
  --brand: #2563eb;
  --brand-press: #1d4ed8;
  --ok: #15a06a;
  --err: #dc2f2f;
  --radius: 16px;
}

* { box-sizing: border-box; }

/* hidden 属性必须能压过 .preview / .done 上的 display，否则弹层会一直显示 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 18px calc(40px + env(safe-area-inset-bottom));
}

/* ---------- 头部 ---------- */
.head { padding: 6px 4px 20px; }

.kicker {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--brand);
  text-transform: uppercase;
}

.head h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

/* ---------- 表单卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 18px 18px;
  box-shadow: 0 1px 2px rgba(19, 24, 32, .04), 0 8px 24px -12px rgba(19, 24, 32, .12);
}

.field { margin-bottom: 18px; }

.label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12.5px;
  margin-left: 8px;
}

input[type="text"],
input[type="tel"],
select {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcfe;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

input[type="text"],
input[type="tel"] {
  appearance: none;
}

/* 下拉框保留系统箭头：手机上点开是原生选择器，比自绘的好用 */
select {
  padding-right: 34px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}

/* 还没选时用灰色，和输入框的 placeholder 一致 */
select:invalid { color: #a9b2c1; }

input[type="text"]:focus,
input[type="tel"]:focus,
select:focus {
  background-color: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, .13);
}

input::placeholder { color: #a9b2c1; }

.field.invalid input[type="text"],
.field.invalid input[type="tel"],
.field.invalid select { border-color: var(--err); background-color: #fffafa; }

/* ---------- 班级候选下拉（自绘，不用 datalist：微信内置浏览器不支持） ---------- */
.combo { position: relative; }

.combo-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #7d8798;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s;
}

.combo-btn:active { background: #eef3fd; color: var(--brand); }
.combo-btn[hidden] { display: none; }
.combo.has-suggest input { padding-right: 50px; }

.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  padding: 5px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(19, 24, 32, .16);
  max-height: 250px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.suggest[hidden] { display: none; }

.suggest-item {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-family: inherit;
  font-size: 15.5px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.suggest-item:active { background: #eef3fd; }
.suggest-item + .suggest-item { margin-top: 2px; }

.err {
  margin: 7px 2px 0;
  font-size: 13px;
  color: var(--err);
  min-height: 0;
  display: none;
}

.err.show { display: block; }

/* ---------- 照片选择 ---------- */
.picker {
  width: 100%;
  border: 1.5px dashed #cbd4e2;
  border-radius: 14px;
  background: #fbfcfe;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink-2);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.picker:active, .picker:hover { border-color: var(--brand); background: #f5f8ff; }
.picker svg { color: var(--brand); margin-bottom: 4px; }
.picker-main { font-size: 15px; font-weight: 600; }
.picker-sub { font-size: 12.5px; color: var(--muted); }

.preview {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
}

.preview img {
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  object-fit: cover;
  border-radius: 10px;
  background: #eef1f6;
}

.preview-side { min-width: 0; flex: 1; }
.preview-name {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-meta { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }

.link {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}

/* ---------- 信息收集说明（折叠） ---------- */
.notice-more {
  margin: 2px 2px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfe;
  font-size: 13px;
  color: var(--ink-2);
}

.notice-more summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  list-style: none;
}

/* Safari / 微信 WebView 会把默认三角画出来，统一去掉换成自己的 */
.notice-more summary::-webkit-details-marker { display: none; }

.notice-more summary::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s;
}

.notice-more[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }

.notice-body {
  padding: 0 13px 12px;
}

.notice-body dl { margin: 0; padding-top: 10px; border-top: 1px dashed var(--line); }

.notice-body dt {
  margin-top: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.notice-body dt:first-child { margin-top: 0; }

.notice-body dd {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

/* ---------- 同意与提交 ---------- */
.agree {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 4px 2px 0;
  cursor: pointer;
}

.agree input {
  width: 19px;
  height: 19px;
  margin: 1px 0 0;
  flex: 0 0 19px;
  accent-color: var(--brand);
}

.agree.invalid span { color: var(--err); }

.btn {
  width: 100%;
  height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 13px;
  background: var(--brand);
  color: #fff;
  font-family: inherit;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .15s, transform .06s;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8);
}

.btn:active { transform: scale(.995); background: var(--brand-press); }
.btn[disabled] { background: #9db4e4; box-shadow: none; cursor: default; }

.btn.ghost {
  background: #fff;
  color: var(--ink-2);
  border: 1.5px solid var(--line);
  box-shadow: none;
  margin-top: 20px;
}

.tip {
  margin: 14px 4px 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12.5px;
  color: #929bab;
}

/* ---------- 底部二维码（方便用手机打开） ---------- */
.qr {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.qr-box {
  flex: 0 0 auto;
  padding: 6px;
  line-height: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.qr-box img {
  display: block;
  width: 160px;
  height: 160px;
}

.qr-txt {
  min-width: 0;
}

.qr-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.qr-desc {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.qr-url {
  margin: 0;
  font-size: 12.5px;
  word-break: break-all;
}

.qr-url a {
  color: var(--brand);
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- 成功页 ---------- */
.done {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 40;
  animation: fade .22s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.done-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 24px 26px;
  text-align: center;
  box-shadow: 0 18px 50px -20px rgba(19, 24, 32, .28);
}

.check {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #e9f8f0;
  color: var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
}

.done-card h2 { margin: 0 0 10px; font-size: 21px; }
.done-line { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); }
.done-note { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.65; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  max-width: min(88vw, 420px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #1d2430;
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #b3231f; }

@media (max-width: 380px) {
  .head h1 { font-size: 24px; }
  .card { padding: 18px 14px 16px; }
}

/* ---------- 人脸检查结果 ---------- */
.face-badge {
  margin: 6px 0 0;
  font-size: 12.5px;
  font-weight: 600;
}

.face-badge.ok { color: #16794a; }
.face-badge.warn { color: #a8641a; }

.face-fail {
  margin-top: 12px;
  padding: 14px;
  background: #fff7f7;
  border: 1px solid #f2c9c7;
  border-radius: 12px;
}

.face-fail-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: #b3231f;
}

.face-fail-msg {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #5c5450;
}

.face-fail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.face-btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}

.face-btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.face-btn:active { transform: translateY(1px); }

.face-fail-note {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #9a8f8a;
}

/* ---------- 取景组件入口 ---------- */
.vf-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 13px 14px;
  font-family: inherit;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.vf-entry:active { transform: translateY(1px); }

.vf-entry > svg { flex: 0 0 auto; color: var(--brand); }

.vf-entry-text { display: flex; flex-direction: column; gap: 2px; }
.vf-entry-main { font-size: 14.5px; font-weight: 600; }
.vf-entry-sub { font-size: 12px; color: var(--muted); }

/* ---------- 全屏取景 ---------- */
.vf {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: #0b0d12;
  color: #fff;
}

.vf[hidden] { display: none !important; }

body.vf-on { overflow: hidden; }

.vf-top {
  flex: 0 0 auto;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  text-align: right;
}

.vf-close {
  min-height: 34px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 0;
  border-radius: 17px;
  cursor: pointer;
}

.vf-stage {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}

.vf-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.vf-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 用超大 box-shadow 把椭圆外面压暗，不需要额外的遮罩图 */
.vf-oval {
  width: min(68vw, 290px);
  height: min(88vw, 380px);
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55);
  transition: border-color .18s;
}

.vf[data-state="ok"] .vf-oval { border-color: #4ade80; }
.vf[data-state="far"] .vf-oval,
.vf[data-state="multi"] .vf-oval { border-color: #fbbf24; }

.vf-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 20px 0;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: #e9eef7;
}

.vf[data-state="ok"] .vf-hint { color: #86efac; }
.vf[data-state="far"] .vf-hint,
.vf[data-state="multi"] .vf-hint { color: #fcd34d; }

.vf-bottom {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.vf-shutter {
  width: 68px;
  height: 68px;
  padding: 0;
  background: #fff;
  border: 4px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .9) inset;
  cursor: pointer;
}

.vf-shutter[disabled] { opacity: .4; cursor: not-allowed; }
.vf-shutter:active:not([disabled]) { transform: scale(.95); }

/* 从相册选择（默认不显示） */
.pick-alt {
  display: block;
  margin: 12px auto 0;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
