/* ============================================================
   相亲报名表单 · 样式
   设计基准：375px 移动端优先，≥768px 桌面居中卡片
   ============================================================ */

:root {
  --red: #c2182b;
  --red-deep: #8c0d1b;
  --blue: #2a5fd0;
  --blue-deep: #1b46a5;
  --ink: #1f2329;
  --text: #333a42;
  --muted: #8a919b;
  --placeholder: #b3b9c2;
  --line: #e4e7ec;
  --line-soft: #eef0f4;
  --bg: #f5f6f8;
  --danger: #d92d20;
  --radius: 12px;
  --shadow-card: 0 18px 48px rgba(31, 35, 41, 0.09), 0 2px 8px rgba(31, 35, 41, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-poster: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif SC", "SimSun", Georgia, serif;
}

* { box-sizing: border-box; }

/* 关键：覆盖 flex/grid 等 display 规则，保证 hidden 属性生效 */
[hidden] { display: none !important; }


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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- 页面骨架 ---------------- */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------------- 海报 ---------------- */
.poster {
  position: relative;
  width: 100%;
  background: var(--red-deep);
  overflow: hidden;
  animation: fadeIn 0.6s ease both;
}

.poster__svg {
  display: block;
  width: 100%;
  height: auto;
}

.poster__title {
  font-family: var(--font-poster);
  font-size: 116px;
  font-weight: 900;
  letter-spacing: 6px;
}

.poster__sub {
  font-family: var(--font);
  font-size: 29px;
  font-weight: 600;
  letter-spacing: 3px;
}

.poster__subHL {
  font-family: var(--font);
  font-size: 29px;
  font-weight: 800;
  letter-spacing: 3px;
}

.poster__tag {
  font-family: var(--font);
  font-size: 25px;
  letter-spacing: 5px;
  fill: rgba(255, 255, 255, 0.72);
}

.poster__couple {
  animation: floatY 5s ease-in-out infinite;
  transform-origin: center;
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------- 表单卡片 ---------------- */
.card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: #fff;
  padding: 22px 20px 26px;
  border-radius: 18px 18px 0 0;
  margin-top: -14px;
  box-shadow: 0 -6px 24px rgba(31, 35, 41, 0.06);
  animation: rise 0.5s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card__head { margin-bottom: 18px; }

.card__title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.4px;
}

.card__desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.card__stat {
  margin: 10px 0 0;
  display: inline-block;
  padding: 5px 11px;
  font-size: 12.5px;
  color: #a8505a;
  background: #fdf2f3;
  border: 1px solid #f8dfe2;
  border-radius: 999px;
}

.card__stat b {
  color: var(--red);
  font-weight: 700;
  padding: 0 2px;
}

/* ---------------- 表单 ---------------- */
.form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* 动态字段栅格：半行字段两两并排，整行字段独占一行 */
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 14px;
}

.field--full { grid-column: 1 / -1; }
.field--half { grid-column: span 1; }

.label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.2px;
}

.req {
  color: var(--red);
  font-style: normal;
  margin-left: 2px;
}

.opt {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--placeholder);
}

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 16px; /* 16px 防 iOS 自动放大 */
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder { color: var(--placeholder); }

.input:hover { border-color: #d2d7de; }

.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(42, 95, 208, 0.14);
}

.input--area {
  height: auto;
  min-height: 84px;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

/* 数字输入去掉上下箭头 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.field.is-error .input {
  border-color: var(--danger);
  background: #fffafa;
}

.field.is-error .input:focus {
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.err {
  margin: 0;
  min-height: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--danger);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.16s ease, max-height 0.16s ease;
}

.field.is-error .err { opacity: 1; max-height: 40px; }

/* 性别分段选择 */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  height: 48px;
  background: #f4f5f7;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.segmented__item { position: relative; display: block; }

.segmented__item input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented__item span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 15px;
  color: #5b636e;
  border-radius: 9px;
  transition: all 0.18s ease;
  user-select: none;
}

.segmented__item input:checked + span {
  background: #fff;
  color: var(--blue-deep);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(31, 35, 41, 0.12);
}

.segmented__item input:focus-visible + span {
  box-shadow: 0 0 0 2px rgba(42, 95, 208, 0.35);
}

.field.is-error .segmented { background: #fdf3f3; }

/* 多选 / 选项较多时的单选：标签胶囊 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0;
}

.chip {
  position: relative;
  display: inline-flex;
}

.chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  font-size: 14.5px;
  color: #5b636e;
  background: #f4f5f7;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: all 0.16s ease;
  user-select: none;
}

.chip input:checked + span {
  color: var(--blue-deep);
  font-weight: 600;
  background: #eaf1fe;
  border-color: #b9d0f8;
}

.chip input:focus-visible + span { box-shadow: 0 0 0 2px rgba(42, 95, 208, 0.35); }

/* 下拉框 */
.select {
  padding-right: 38px;
  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'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%239aa1ab'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

.field.is-error .chips .chip span { background: #fdf3f3; }

/* 蜜罐字段：绝对不可见但可被机器人填写 */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------------- 按钮 ---------------- */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  margin-top: 6px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(180deg, #3a72e0 0%, var(--blue) 55%, var(--blue-deep) 100%);
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(42, 95, 208, 0.28);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover { box-shadow: 0 10px 24px rgba(42, 95, 208, 0.34); }
.btn:active { transform: scale(0.985); box-shadow: 0 4px 12px rgba(42, 95, 208, 0.26); }
.btn:focus-visible { outline: 2px solid var(--blue-deep); outline-offset: 3px; }

.btn[disabled] { opacity: 0.72; cursor: not-allowed; box-shadow: none; }

.btn__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn__spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.btn--ghost {
  margin-top: 22px;
  color: var(--blue);
  background: #f4f7fe;
  border: 1px solid #dbe5fb;
  box-shadow: none;
  font-size: 15px;
  height: 46px;
}

.btn--ghost:hover { background: #ebf1fd; box-shadow: none; }

.privacy {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--placeholder);
  text-align: center;
}

/* ---------------- 成功态 ---------------- */
.success {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 6px 40px;
  animation: rise 0.45s ease both;
}

.success__icon { animation: pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success__title {
  margin: 16px 0 8px;
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
}

.success__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.success__tip {
  margin: 12px 0 0;
  padding: 6px 14px;
  font-size: 13px;
  color: #a8505a;
  background: #fdf2f3;
  border: 1px solid #f8dfe2;
  border-radius: 999px;
}

/* 加载失败提示 */
.load-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 0;
  font-size: 14px;
  color: var(--danger);
  text-align: center;
}

/* ---------------- 底部署名 ---------------- */
.foot {
  padding: 18px 20px 26px;
  font-size: 13px;
  color: #a7adb6;
  text-align: left;
}

.foot__link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.foot__link:hover { color: var(--red); border-bottom-color: currentColor; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 60;
  max-width: min(88vw, 420px);
  padding: 11px 18px;
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
  background: rgba(28, 32, 38, 0.92);
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: rgba(178, 32, 32, 0.95); }

/* ---------------- 桌面端 ---------------- */
@media (min-width: 768px) {
  body {
    background:
      radial-gradient(900px 500px at 12% 0%, #fdeef0 0%, rgba(253, 238, 240, 0) 62%),
      radial-gradient(800px 460px at 92% 8%, #eef3fd 0%, rgba(238, 243, 253, 0) 60%),
      #f4f5f8;
    background-attachment: fixed;
  }

  .page {
    padding: 40px 20px 28px;
    align-items: center;
  }

  .poster {
    width: 100%;
    max-width: 560px;
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-card);
  }

  .card {
    width: 100%;
    max-width: 560px;
    flex: 0 0 auto;
    margin-top: 0;
    padding: 28px 32px 30px;
    border-radius: 0 0 22px 22px;
    box-shadow: var(--shadow-card);
    animation: none;
  }

  .card__title { font-size: 20px; }

  .foot {
    width: 100%;
    max-width: 560px;
    padding: 16px 4px 0;
    text-align: center;
  }

  .field--half { min-width: 0; }
}

@media (min-width: 1024px) {
  .page { padding-top: 48px; }
  .poster { max-width: 600px; }
  .card { max-width: 600px; }
  .foot { max-width: 600px; }
}

/* ---------------- 小屏微调 ---------------- */
@media (max-width: 340px) {
  .fields { grid-template-columns: 1fr; }
  .field--half { grid-column: 1 / -1; }
  .card { padding: 18px 14px 22px; }
}

/* ---------------- 动效偏好 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------- 打印 ---------------- */
@media print {
  .poster, .btn, .toast { display: none !important; }
  .card { box-shadow: none; }
}
