:root {
  --ink: #152033;
  --muted: #667085;
  --line: #d9e2ee;
  --blue: #2563eb;
  --green: #139a67;
  --orange: #e27730;
  --bg: #f3f7fb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 84px;
  background: #fff;
}
.hero {
  min-height: 520px;
  display: grid;
  align-content: end;
  gap: 10px;
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(10,31,55,.08), rgba(10,31,55,.9)),
    linear-gradient(135deg, #138caa, #2563eb 48%, #132b4b);
  background-size: cover;
  background-position: center;
}
.badge {
  width: fit-content;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(255,255,255,.15);
  font-size: 12px;
  font-weight: 800;
}
h1, h2, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 18px; }
.hero p { color: rgba(255,255,255,.88); line-height: 1.6; }
.entry-chip {
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: #dff4ff;
  background: rgba(16,36,61,.48);
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.meta div {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.14);
}
.meta span { display: block; color: rgba(255,255,255,.72); font-size: 11px; }
.meta strong { display: block; margin-top: 5px; }
.panel {
  margin: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.empty-state {
  margin-top: 28px;
  padding: 22px;
}
.empty-state h2 {
  margin-bottom: 8px;
  color: var(--ink);
}
.empty-state p {
  color: var(--muted);
  line-height: 1.7;
}
.detail-section {
  margin: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.detail-section .story-heading {
  display: none;
}
.detail-images {
  display: grid;
  background: #fff;
}
.detail-img {
  display: block;
  width: 100%;
  height: auto;
}
.detail-placeholder {
  min-height: 760px;
  padding: 24px 18px 30px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(16,36,61,.1), rgba(16,36,61,.86)),
    linear-gradient(135deg, #0891b2, #2563eb 52%, #10243d);
}
.detail-hero-copy {
  min-height: 280px;
  display: grid;
  align-content: end;
  gap: 10px;
}
.detail-hero-copy span {
  width: fit-content;
  padding: 6px 9px;
  color: #075985;
  background: #e0f2fe;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.detail-hero-copy h2 {
  font-size: 28px;
  line-height: 1.2;
}
.detail-hero-copy p {
  color: rgba(255,255,255,.86);
  line-height: 1.65;
}
.detail-blocks {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}
.detail-blocks section {
  padding: 16px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.12);
}
.detail-blocks em {
  display: block;
  margin-bottom: 8px;
  color: #bae6fd;
  font-style: normal;
  font-weight: 900;
}
.detail-blocks h3 {
  margin: 0 0 8px;
  font-size: 19px;
}
.detail-blocks p {
  color: rgba(255,255,255,.82);
  font-size: 14px;
  line-height: 1.7;
}
.story-section {
  margin: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.story-heading {
  padding: 16px 14px 12px;
}
.story-heading span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  margin-bottom: 8px;
  color: #075985;
  background: #e0f2fe;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.story-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.story-heading.compact {
  padding-bottom: 8px;
}
.story-list {
  display: grid;
}
.story-card {
  border-top: 1px solid #eef2f7;
  background: #fff;
}
.story-image {
  min-height: 210px;
  display: grid;
  align-content: end;
  padding: 14px;
  color: #fff;
  background-size: cover;
  background-position: center;
}
.story-image strong {
  font-size: 20px;
  line-height: 1.25;
  text-shadow: 0 2px 12px rgba(0,0,0,.28);
}
.story-text {
  padding: 13px 14px 16px;
}
.story-text p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.story-cover {
  min-height: 190px;
  background-size: cover;
  background-position: center;
}
.referral-cover {
  background:
    linear-gradient(180deg, rgba(16,36,61,.08), rgba(16,36,61,.82)),
    radial-gradient(circle at 28% 28%, rgba(255,255,255,.6), transparent 16%),
    linear-gradient(135deg, #0f766e, #2563eb);
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  color: var(--muted);
  border-bottom: 1px solid #eef2f7;
}
.line strong { color: var(--ink); text-align: right; }
.line.total strong { color: var(--blue); font-size: 20px; }
.line.discount, .line.discount strong { color: var(--green); }
.list { display: grid; gap: 10px; margin-top: 12px; }
.item {
  padding: 12px;
  border: 1px solid #e5edf6;
  border-radius: 8px;
  background: #fbfdff;
}
.item strong { display: block; margin-bottom: 4px; }
.item p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.item .referral-person { color: var(--ink); font-weight: 700; }
.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.reward {
  padding: 10px 6px;
  text-align: center;
  border: 1px solid #dfe8f4;
  border-radius: 8px;
}
.reward strong { display: block; color: var(--orange); font-size: 18px; }
.reward small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.view { padding: 14px; }
.hidden { display: none !important; }
.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: #475467; font-size: 13px; font-weight: 800; }
.form-tip {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 13px;
}
.native-pay {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff, #eff6ff);
}
.native-pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.native-pay-head strong {
  font-size: 16px;
}
.native-pay-head span {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}
.native-pay-body {
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
}
#nativePayQr {
  width: min(220px, 100%);
  height: auto;
  max-width: 220px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px #dbeafe;
  background: #fff;
}
input, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 1px solid #d6e0eb;
  border-radius: 8px;
  font: inherit;
}
textarea { min-height: 86px; }
button {
  min-height: 44px;
  padding: 0 14px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}
button:disabled {
  cursor: not-allowed;
  opacity: .62;
}
.back {
  width: auto;
  min-height: 36px;
  margin-bottom: 14px;
  color: var(--ink);
  background: #eef2f7;
}
.bottom-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
}
#recoverEntryBtn {
  color: var(--ink);
  background: #eef2f7;
}
.share-url {
  margin-top: 10px;
  padding: 10px;
  overflow-wrap: anywhere;
  color: #dff4ff;
  background: #10243d;
  border-radius: 8px;
  font-size: 12px;
}
.share-actions {
  display: grid;
  margin-top: 12px;
}
.registration-poster {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.registration-poster img {
  display: block;
  width: 100%;
  height: auto;
}
.registration-poster-empty {
  display: grid;
  min-height: 260px;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}
.registration-poster-empty p,
.referral-progress-summary p {
  color: var(--muted);
  line-height: 1.6;
}
.registration-poster-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.referral-progress-summary {
  display: grid;
  gap: 8px;
}
.referral-progress-summary strong {
  color: var(--blue);
  font-size: 22px;
}
#referralProgressBtn {
  width: 100%;
  margin-top: 12px;
}
#simulateReferralBtn {
  width: 100%;
  margin-top: 10px;
}
.success { border-color: #abefc6; background: #effdf4; }
.contact-card {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 14px;
  align-items: center;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.contact-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.qr-box {
  width: 132px;
  aspect-ratio: 1;
  border: 8px solid #fff;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #10243d 10px, transparent 10px) 0 0 / 26px 26px,
    linear-gradient(#10243d 10px, transparent 10px) 0 0 / 26px 26px,
    #eef4f8;
  box-shadow: 0 0 0 1px var(--line);
}
.qr-box.has-image {
  background-size: cover;
  background-position: center;
}
.poster-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 18px 12px;
  background: rgba(16,36,61,.58);
}
.poster-sheet {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(16,36,61,.28);
}
.poster-close-button { position: absolute; top: 10px; right: 10px; width: 38px; min-height: 38px; padding: 0; border: 0; border-radius: 8px; color: var(--ink); background: #eef4f8; font-size: 26px; line-height: 1; cursor: pointer; }
.poster-picker-title { margin: 4px 46px 4px; color: var(--ink); font-size: 20px; text-align: center; }
.poster-picker-hint { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; }
.poster-picker { display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; align-items: center; gap: 8px; }
.poster-picker.single-poster { grid-template-columns: minmax(0, 1fr); }
.poster-picker.single-poster .poster-nav-button { display: none; }
.poster-preview-frame { min-width: 0; }
.poster-nav-button { width: 38px; min-height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fff; font-size: 30px; font-weight: 400; line-height: 1; cursor: pointer; }
.poster-nav-button:disabled { visibility: hidden; }
.poster-loading {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.poster-sheet img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-drag: none;
}
.poster-picker-status { display: grid; justify-items: center; gap: 8px; margin: 12px 0 2px; color: var(--muted); font-size: 14px; }
.poster-picker-dots { display: flex; justify-content: center; gap: 7px; min-height: 10px; }
.poster-picker-dot { width: 8px; min-height: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: #bdd0e3; cursor: pointer; }
.poster-picker-dot.active { background: var(--blue); }
.poster-save-tip {
  margin-top: 10px;
  padding: 10px 12px;
  color: #075985;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}
.poster-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.poster-actions > button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}
.poster-actions > button.secondary-btn {
  color: var(--ink);
  background: #eef2f7;
}
.copy-link-modal {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: end center;
  padding: 18px 12px;
  background: rgba(16,36,61,.58);
}
.copy-link-sheet {
  width: min(420px, 100%);
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(16,36,61,.28);
}
.copy-link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.copy-link-sheet > p {
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.copy-link-sheet textarea {
  display: block;
  width: 100%;
  min-height: 104px;
  padding: 10px;
  resize: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font: 14px/1.55 inherit;
  overflow-wrap: anywhere;
}
.secondary-btn {
  color: var(--ink);
  background: #eef2f7;
}
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: end center;
  padding: 18px 12px;
  background: rgba(16,36,61,.58);
}
.contact-sheet {
  width: min(420px, 100%);
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 56px rgba(16,36,61,.28);
}
.contact-sheet-head,
.contact-sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.contact-sheet-head strong {
  font-size: 18px;
}
.contact-sheet-body {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 16px 6px 14px;
  text-align: center;
}
.contact-copy span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #075985;
  background: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
}
.contact-copy h2 {
  margin-top: 10px;
  font-size: 22px;
}
.contact-copy p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.contact-modal-qr {
  width: min(220px, 70vw);
}
.contact-sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  display: none;
  padding: 10px 14px;
  color: #fff;
  background: #10243d;
  border-radius: 999px;
}
.toast.show { display: block; }
