:root {
  --brand: #0b3c6b;
  --brand-2: #12558f;
  --accent: #ff7a1a;
  --ink: #16202c;
  --muted: #5c6b7a;
  --line: #e3e9f0;
  --soft: #f5f8fb;
  --ok: #1a7a3c;
  --err: #b3261e;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: #fff;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

a { color: var(--brand); text-decoration: none; }
h1, h2 { margin: 0 0 8px; line-height: 1.35; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 13px; color: var(--muted); }
.hint { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin: 2px 0 10px; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 15px; color: var(--brand); }
.who { font-size: 13px; color: var(--muted); white-space: nowrap; }
.who a { color: var(--brand); }

/* progress */
.progress { position: sticky; top: 57px; z-index: 19; height: 4px; background: var(--soft); }
.progress .bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .3s; }

/* layout */
main { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }

.step-head .step-no { font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: .05em; }
.step-head { margin-bottom: 18px; }
.step-head h2 { margin-top: 2px; }

/* intro */
.intro { padding: 18px 0 8px; }
.intro p { font-size: 15.5px; color: var(--muted); margin: 0 0 20px; }
.intro .btn { width: 100%; }

/* fields */
.field { margin-bottom: 24px; }
.field > .label { font-weight: 600; font-size: 15.5px; margin-bottom: 4px; }
.req { font-style: normal; font-size: 12px; color: var(--accent); font-weight: 600; }

/* 补充项：与主问题明显区分 */
.field-extra {
  margin-top: -12px;
  margin-bottom: 24px;
  margin-left: 2px;
  padding-left: 14px;
  border-left: 3px solid #dbe7f3;
}
.field-extra.in { animation: extraIn .25s ease both; }
@keyframes extraIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.tag-extra {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1;
  color: #6b7f93;
  background: #eef3f8;
  border-radius: 4px;
  padding: 3px 7px;
  margin-bottom: 7px;
  letter-spacing: .08em;
}
.field-extra > .label {
  font-size: 14.5px;
  font-weight: 500;
  color: #4a5a6b;
  margin-bottom: 3px;
}
.field-extra .hint { font-size: 12.5px; }
.field-extra input,
.field-extra textarea {
  background: #fafcfe;
  border-color: #e8eef5;
  font-size: 15px;
}
.field-extra .btn-upload { background: #fafcfe; }

input[type=text], input[type=tel], input[type=email], input[type=password], select, textarea {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11,60,107,.08);
}
textarea { resize: vertical; min-height: 96px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235c6b7a' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* options */
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: .15s;
}
.opt:active { background: var(--soft); }
.opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex: 0 0 auto; }
.opt span { font-size: 15.5px; }
.opt:has(input:checked) { border-color: var(--brand); background: #f3f8fd; }

/* note */
.note { background: var(--soft); border-radius: 10px; padding: 14px 16px; font-size: 15px; color: var(--ink); }

/* upload */
.upload { border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; }
.ratio { display: inline-block; font-size: 12.5px; color: var(--accent); background: #fff4ea; border-radius: 999px; padding: 3px 10px; margin-bottom: 10px; font-weight: 600; }
.btn-upload {
  width: 100%; padding: 13px; font-size: 15.5px; font-family: inherit;
  color: var(--brand); background: var(--soft); border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer;
}
.btn-upload:active { background: #e9f1f9; }
.filelist { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.fileitem {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; background: var(--soft); border-radius: 8px; padding: 8px 10px;
}
.fileitem a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.del { border: 0; background: transparent; color: var(--err); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.upload-state { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 20px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 22px; font-size: 16px; font-family: inherit; font-weight: 600;
  border-radius: 12px; border: 1.5px solid transparent; cursor: pointer;
  transition: .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:active { background: var(--brand-2); }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-block { width: 100%; margin-top: 18px; }

/* navbar */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.navbar .btn { flex: 0 0 auto; min-width: 96px; }
.navbar .btn-primary { flex: 1; }
.savestate { flex: 1; text-align: center; font-size: 12.5px; color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--soft); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 30px 24px; box-shadow: 0 16px 48px rgba(16,42,74,.08); }
.login-brand { font-weight: 800; color: var(--brand); letter-spacing: .04em; font-size: 14px; margin-bottom: 6px; }
.login-card h1 { font-size: 21px; margin-bottom: 18px; }
.login-card .label { display: block; font-size: 13.5px; color: var(--muted); margin: 14px 0 6px; }
.login-card input { margin-bottom: 4px; }
.alert { background: #fdecec; color: var(--err); border-radius: 10px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; }

/* done */
.done-wrap { min-height: 70vh; display: grid; place-items: center; padding: 24px; }
.done-card { text-align: center; max-width: 420px; }
.done-ico {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
  background: #e9f7ee; color: var(--ok); font-size: 30px; line-height: 64px; font-weight: 700;
}
.done-note { font-size: 19px; font-weight: 600; margin: 10px 0 6px; }
.done-sub { color: var(--muted); font-size: 14.5px; }

/* admin */
.admin { max-width: 900px; }
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.exports { display: flex; gap: 8px; flex-wrap: wrap; }
.exports .btn { padding: 9px 14px; font-size: 14px; }
.admin-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.admin-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tag { font-size: 12px; background: var(--soft); color: var(--muted); border-radius: 999px; padding: 2px 10px; margin-left: 6px; }
.tag.ok { background: #e9f7ee; color: var(--ok); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 12px 0; font-size: 14px; }
.admin-grid .k { color: var(--muted); margin-right: 6px; }
details { margin-top: 10px; }
summary { cursor: pointer; font-size: 14px; color: var(--brand); padding: 6px 0; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.kv th, .kv td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.kv th { width: 38%; color: var(--muted); font-weight: 500; }

@media (max-width: 480px) {
  .navbar .btn { min-width: 0; padding: 13px 16px; font-size: 15px; }
  .savestate { font-size: 12px; }
}

/* 选择题下方：两个不同语义的按钮 */
.field-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  font-size: 14px;
  font-family: inherit;
  border-radius: 999px;
  cursor: pointer;
  transition: .18s;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}
.tool-extra {
  border: 1.5px dashed #bfd3e6;
  color: var(--brand);
}
.tool-extra:hover, .tool-extra.on {
  border-color: var(--brand);
  background: #f3f8fd;
}
.tool-decide {
  border: 1.5px solid var(--line);
  background: var(--soft);
  color: #6b7f93;
  font-size: 13.5px;
}
.tool-decide:hover {
  border-color: #c9d6e3;
}
.tool-decide.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.field-extra-choice {
  margin-top: 12px;
  margin-bottom: 0;
}

.fileitem .thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
  background: #eef3f8;
}
.fileitem .del {
  font-size: 20px;
  padding: 6px 10px;
  border-radius: 8px;
}
.fileitem .del:active { background: #fdecec; }

.tool-hide {
  border: 1.5px solid var(--line);
  background: #fff;
  color: #8a97a5;
  font-size: 13.5px;
}
.tool-hide:hover {
  border-color: #dfe6ee;
}
.tool-hide.on {
  background: #fff4f4;
  border-color: #f2cfcf;
  color: #b3261e;
}
@media (max-width: 480px) {
  .tool-btn { font-size: 13px; padding: 8px 12px; }
}

/* 提交确认弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 25, 45, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-mask[hidden] { display: none; }
.modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}
.modal-card h3 { font-size: 18px; margin: 0 0 10px; }
.modal-card p { font-size: 14.5px; color: var(--muted); margin: 0 0 10px; line-height: 1.7; }
.modal-tip {
  background: var(--soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: #4a5a6b;
}
.modal-btns { display: flex; gap: 10px; margin-top: 20px; }
.modal-btns .btn { flex: 1; padding: 12px; font-size: 15px; }

.done-reopen {
  margin-top: 30px;
  padding: 10px 20px;
  font-size: 14px;
  color: #7b8b9c;
  border-color: var(--line);
  background: #fff;
}
.done-reopen:hover { color: var(--brand); border-color: #c9d6e3; }
