/* ============================================================
   票根发券系统 · 用户端样式（移动优先）
   ============================================================ */
:root {
  --brand: #b7202e;
  --brand-dark: #8e1b26;
  --brand-light: #d4444f;
  --gold: #c9a15a;
  --ink: #1b1e23;
  --ink-2: #5a616b;
  --ink-3: #8c939e;
  --line: #e8e4de;
  --bg: #f7f5f2;
  --surface: #ffffff;
  --ok: #157a45;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(27, 30, 35, .06), 0 2px 8px rgba(27, 30, 35, .04);
  --shadow-md: 0 4px 12px rgba(27, 30, 35, .07), 0 12px 32px rgba(27, 30, 35, .06);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 40px; }

/* ---------- 顶部 Banner ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 42px 22px 58px;
  color: #fff;
  background:
    radial-gradient(140% 90% at 78% -10%, rgba(255, 214, 148, .28) 0%, rgba(255, 214, 148, 0) 46%),
    linear-gradient(148deg, #c9403f 0%, #b7202e 42%, #851821 100%);
}

.hero::before {
  content: "";
  position: absolute;
  right: -70px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 0 0 22px rgba(255, 255, 255, .05);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 14px;
  background: radial-gradient(circle at 7px 14px, var(--bg) 7px, transparent 7.5px) repeat-x;
  background-size: 14px 14px;
}

.hero-inner { position: relative; max-width: 560px; margin: 0 auto; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .06em;
  color: #ffe9c9;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 233, 201, .28);
}

.hero h1 {
  margin: 14px 0 8px;
  font-size: 25px;
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: -.01em;
}

.hero p {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, .82);
  max-width: 30em;
}

/* ---------- 流程条 ---------- */
.steps {
  display: flex;
  align-items: flex-start;
  margin-top: 22px;
  gap: 0;
}

.step { flex: 1; text-align: center; position: relative; }
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 11px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 1px;
  background: rgba(255, 255, 255, .28);
}
.step-dot {
  width: 23px;
  height: 23px;
  margin: 0 auto 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .38);
}
.step.on .step-dot { background: #fff; color: var(--brand); border-color: #fff; }
.step-label { font-size: 11.5px; color: rgba(255, 255, 255, .74); line-height: 1.3; }
.step.on .step-label { color: #fff; }

/* ---------- 主体 ---------- */
.wrap {
  position: relative;
  max-width: 560px;
  margin: -34px auto 0;
  padding: 0 16px;
  z-index: 2;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px 20px;
  margin-bottom: 14px;
  border: 1px solid rgba(232, 228, 222, .8);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.card-title::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--brand);
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.field-label .req { color: var(--brand); margin-left: 3px; }
.field-hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font-size: 15.5px;
  color: var(--ink);
  background: #fbfaf9;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input::placeholder { color: #b6bbc3; }
.input:focus {
  background: #fff;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(183, 32, 46, .1);
}
.input.err { border-color: #e0555f; background: #fff8f8; }
.input[type="tel"] { letter-spacing: .02em; }

/* 票根类型：分段选择 */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg label { position: relative; display: block; }
.seg input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.seg span {
  display: grid;
  place-items: center;
  height: 47px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfaf9;
  font-size: 14.5px;
  color: var(--ink-2);
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.seg input:checked + span {
  border-color: var(--brand);
  background: #fdf3f3;
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(183, 32, 46, .07);
}
.seg input:focus-visible + span { outline: 2px solid rgba(183, 32, 46, .28); outline-offset: 2px; }

.input[type="date"] {
  padding-right: 10px;
  color: var(--ink);
}
.input[type="date"]:invalid { color: #b6bbc3; }

/* ---------- 上传区 ---------- */
.drop {
  position: relative;
  display: block;
  width: 100%;
  min-height: 178px;
  border: 1.5px dashed #d8d2c9;
  border-radius: 12px;
  background: #fbfaf8;
  cursor: pointer;
  transition: border-color .16s, background .16s;
  overflow: hidden;
}
.drop:active { background: #f6f3ef; }
.drop.err { border-color: #e0555f; background: #fff8f8; }
.drop.has-img { border-style: solid; border-color: var(--line); background: #111; }

.drop-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}
.drop-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.drop-icon svg { width: 23px; height: 23px; stroke: var(--brand); }
.drop-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.drop-sub { font-size: 12px; color: var(--ink-3); }

.preview {
  display: none;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #111;
}
.drop.has-img .preview { display: block; }
.drop.has-img .drop-empty { display: none; }

.preview-bar {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 10px;
  gap: 8px;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0));
}
.drop.has-img .preview-bar { display: flex; }
.mini-btn {
  border: none;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
  cursor: pointer;
  font-family: inherit;
}
.mini-btn.danger { background: rgba(183, 32, 46, .82); }

/* ---------- 协议 ---------- */
.agree {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 4px 0 18px;
  cursor: pointer;
}
.agree input {
  appearance: none;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  border: 1.5px solid #c9c4bc;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: .15s;
}
.agree input:checked { background: var(--brand); border-color: var(--brand); }
.agree input:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(42deg);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 50px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-light), var(--brand) 55%, var(--brand-dark));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(183, 32, 46, .26);
  transition: transform .12s, box-shadow .16s, opacity .16s;
}
.btn:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(183, 32, 46, .22); }
.btn:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn.ghost {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
  font-weight: 550;
}
.btn svg { width: 18px; height: 18px; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 成功页 ---------- */
.done { text-align: center; padding: 30px 20px 24px; }
.done-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaf7f0;
  border: 1px solid #c9ecda;
  animation: pop .42s cubic-bezier(.2, 1.5, .5, 1);
}
.done-icon svg { width: 30px; height: 30px; stroke: var(--ok); stroke-width: 2.4; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.done h2 { margin: 0 0 6px; font-size: 19px; }
.done p { margin: 0 0 18px; font-size: 13.5px; color: var(--ink-2); }

.ticket-no {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  margin-bottom: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--brand-dark);
  background: #fdf5f4;
  border: 1px dashed #efc9cb;
  border-radius: 10px;
}

.notice {
  text-align: left;
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.65;
  color: #6b4a13;
  background: #fdf7ea;
  border: 1px solid #f2e3c2;
}

/* ---------- 规则 ---------- */
.rules h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}
.rules-body {
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-2);
  white-space: pre-line;
}
.rules-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------- 查询入口 ---------- */
.query-entry { text-align: center; padding: 6px 0 10px; }
.link-btn {
  border: none;
  background: none;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(183, 32, 46, .3);
}

/* ---------- 底部抽屉 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, .46);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s;
  z-index: 40;
}
.mask.on { opacity: 1; visibility: visible; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  overflow-y: auto;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  transform: translateY(102%);
  transition: transform .28s cubic-bezier(.32, .72, .28, 1);
  z-index: 41;
}
.sheet.on { transform: translateY(0); }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.close-x {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #ecebe8;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.q-result { margin-top: 16px; display: grid; gap: 10px; }

.rec {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 15px;
}
.rec-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.rec-no {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.rec-meta { font-size: 12px; color: var(--ink-3); }
.rec-reason {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #96202b;
  background: #fdf1f2;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.pending { color: #9a6000; background: #fff4e0; }
.badge.approved { color: #1a5fb4; background: #e9f2ff; }
.badge.rejected { color: #a5202c; background: #fdeaea; }
.badge.issued { color: #12703f; background: #e6f6ed; }

.empty {
  padding: 34px 10px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-3);
}
.empty-ico { font-size: 26px; opacity: .5; display: block; margin-bottom: 8px; }

.hidden { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translate(-50%, -16px);
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #fff;
  background: rgba(27, 30, 35, .92);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: .24s;
  z-index: 90;
}
.toast.on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast.bad { background: #98202c; }
.toast.good { background: #16713f; }

@media (min-width: 640px) {
  .hero { padding: 52px 24px 66px; }
  .hero h1 { font-size: 29px; }
  .card { padding: 26px 24px; }
  .sheet {
    left: 50%;
    bottom: 40px;
    width: 520px;
    transform: translate(-50%, 120%);
    border-radius: 18px;
  }
  .sheet.on { transform: translate(-50%, 0); }
}

/* ================= 入口选择弹窗 ================= */
.entry-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(26, 20, 18, .52);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.entry-mask.on { display: flex; }
.entry-card {
  width: 100%;
  max-width: 400px;
  padding: 24px 20px 20px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .26);
  animation: entryIn .26s cubic-bezier(.2, .8, .3, 1);
}
@keyframes entryIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.entry-badge {
  display: inline-block;
  padding: 3px 10px;
  margin-bottom: 12px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--brand);
  background: rgba(183, 32, 46, .08);
}
.entry-card h2 {
  margin: 0 0 6px;
  font-size: 19px;
  letter-spacing: -.01em;
  color: var(--ink);
}
.entry-card > p {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--ink-3);
}
.entry-btn {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 13px 16px;
  text-align: left;
  line-height: 1.4;
}
.entry-btn + .entry-btn { margin-top: 10px; }
.entry-btn .eb-title { font-size: 14.5px; font-weight: 650; }
.entry-btn .eb-sub { font-size: 12px; font-weight: 400; opacity: .78; }

/* 回访卡片 */
.back-tip {
  margin: -6px 0 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
}
.back .link-btn { display: block; margin: 10px auto 0; }
