:root {
  --brand: #2f6bff;
  --brand-dark: #1f4fd0;
  --brand-soft: #eaf0ff;
  --text: #17203a;
  --text-sub: #6b7793;
  --line: #e6eaf3;
  --bg: #f3f5fb;
  --ok: #14a06a;
  --warn: #e8730c;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(23, 32, 58, 0.09);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性优先于任何 display 声明（.lightbox 等设置为 flex 的元素需要） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}

/* -------------------------------- 头部 -------------------------------- */
.hero {
  padding: 36px 4px 22px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hero h1 {
  margin: 12px 0 8px;
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: 0.5px;
}

.hero-sub {
  margin: 0;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.7;
}

/* -------------------------------- 卡片 -------------------------------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.field { display: block; margin-bottom: 18px; }

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #3c4767;
  margin-bottom: 8px;
}

.field-label em { color: #e04545; font-style: normal; }

.field input {
  width: 100%;
  padding: 13px 15px;
  font-size: 16px;
  color: var(--text);
  background: #f7f9fe;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .18s, background .18s;
}

.field input:focus { border-color: var(--brand); background: #fff; }
.field input::placeholder { color: #a8b1c6; }

/* -------------------------------- 上传位 -------------------------------- */
.uploads { display: grid; gap: 14px; }

.upload {
  border: 1.5px dashed #ccd6ec;
  border-radius: 14px;
  background: #fafbff;
  padding: 14px;
  transition: border-color .18s, background .18s;
}

.upload.filled { border-style: solid; border-color: var(--brand); background: #fff; }
.upload.dragover { border-color: var(--brand); background: var(--brand-soft); }

.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.upload-title { font-size: 15px; font-weight: 600; }
.upload-title span { color: #e04545; }

.upload-state {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eef1f8;
  color: var(--text-sub);
  white-space: nowrap;
}

.upload-state.ok { background: #e4f7ee; color: var(--ok); }
.upload-state.loading { background: var(--brand-soft); color: var(--brand); }
.upload-state.err { background: #fdecec; color: #d93636; }

.picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.picker:active { transform: scale(.995); }
.picker .plus { font-size: 22px; line-height: 1; }

.preview { position: relative; }

.preview img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #f2f4f9;
  border-radius: 12px;
  cursor: zoom-in;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-sub);
}

.preview-bar b { color: #4a5578; font-weight: 600; }

.preview-bar > span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-bar > span:last-child { flex: none; display: flex; gap: 8px; white-space: nowrap; }

.mini {
  border: none;
  background: #f1f3f9;
  color: #48526f;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
}

.mini.danger { background: #fdecec; color: #d93636; }

input[type="file"] { display: none; }

/* -------------------------------- 按钮 -------------------------------- */
.submit {
  position: relative;
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #3f7bff, #1f4fd0);
  border: none;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(47, 107, 255, .3);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}

.submit:active { transform: translateY(1px); box-shadow: 0 6px 14px rgba(47, 107, 255, .28); }
.submit[disabled] { opacity: .6; box-shadow: none; cursor: not-allowed; }

.spinner {
  display: none;
  width: 17px;
  height: 17px;
  margin-left: 9px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.submit.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #8c96ae;
  text-align: center;
  line-height: 1.6;
}

.ghost {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  border: none;
  border-radius: 12px;
  cursor: pointer;
}

/* -------------------------------- 结果 -------------------------------- */
.result-card { text-align: center; }

.result-icon {
  width: 60px;
  height: 60px;
  margin: 4px auto 12px;
  border-radius: 50%;
  background: #e4f7ee;
  color: var(--ok);
  font-size: 30px;
  line-height: 60px;
  font-weight: 700;
}

.result-card.fail .result-icon { background: #fdecec; color: #d93636; }
.result-card.fail .result-title { color: #d93636; }

.result-title { margin: 0 0 6px; font-size: 20px; }
.result-sub { margin: 0 0 14px; font-size: 14px; color: var(--text-sub); }

.result-list { list-style: none; margin: 0 0 16px; padding: 0; text-align: left; }

.result-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 11px;
  background: #f7f9fe;
  font-size: 14px;
}

.result-list li b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #e4f7ee; color: var(--ok); white-space: nowrap; }
.pill.no { background: #fdf0e4; color: var(--warn); }

.foot { text-align: center; font-size: 12.5px; color: #9aa4bb; padding: 6px 12px 0; line-height: 1.7; }

/* -------------------------------- 大图 -------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(10, 15, 30, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  max-width: 84vw;
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(23, 32, 58, .93);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 200;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
