:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #69736d;
  --line: #dfe5e1;
  --surface: #ffffff;
  --canvas: #f2f5f3;
  --green: #176a43;
  --green-dark: #0f4e31;
  --green-soft: #e8f4ed;
  --yellow: #f3b83f;
  --yellow-soft: #fff5d8;
  --danger: #b3433d;
  --shadow: 0 14px 34px rgba(20, 35, 27, 0.1);
}

* { box-sizing: border-box; letter-spacing: 0; }
html { background: var(--canvas); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.share-app {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--canvas);
  box-shadow: 0 0 40px rgba(22, 37, 29, 0.08);
}

.hero { position: relative; height: 304px; overflow: hidden; color: #fff; background: #33483d; }
.hero-media, .hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-media { object-fit: cover; }
.hero-shade { background: rgba(12, 25, 17, 0.42); }
.hero-topbar, .campaign-grid { position: relative; z-index: 1; }
.hero-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 18px 0;
}
.brand { display: flex; min-height: 40px; align-items: center; }
.brand-logo { display: block; width: min(22vw, 114.4px); min-width: 74.8px; height: auto; object-fit: contain; }
.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
}
.icon-button svg { width: 20px; height: 20px; }
.icon-button-light { color: #fff; border-color: rgba(255, 255, 255, 0.48); background: rgba(19, 31, 24, 0.4); }
.campaign-grid {
  position: absolute;
  right: 18px;
  bottom: 22px;
  left: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
  align-items: end;
}
.campaign-copy, .package-panel { min-width: 0; }
.campaign-copy h1 { margin: 0; font-size: 22px; line-height: 1.25; }
.campaign-copy strong { display: block; margin-top: 9px; color: #ffd84a; font-size: 14px; line-height: 1.45; }
.campaign-copy p { margin: 5px 0 0; font-size: 12px; line-height: 1.55; }
.package-panel { padding-left: 13px; border-left: 1px solid rgba(255, 255, 255, 0.46); }
.package-panel h2 { margin: 0 0 8px; font-size: 13px; line-height: 1.4; }
.package-options { display: grid; gap: 6px; }
.package-options span {
  display: flex;
  min-height: 30px;
  padding: 5px 7px;
  align-items: center;
  color: #fff;
  background: rgba(13, 25, 18, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}
.content { padding: 0 14px 28px; }
.process-row {
  display: flex;
  min-height: 56px;
  margin: 0 -14px 14px;
  padding: 0 14px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.process-row span { color: #47524c; font-size: 12px; line-height: 1.45; text-align: center; }
.process-row svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--green); }

.coupon-card { min-height: 472px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.coupon-heading, .sheet-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 12px; font-weight: 700; }
.coupon-heading h2, .sheet-heading h2, .empty-state h2 { margin: 0; font-size: 19px; line-height: 1.35; }
.status-badge {
  display: inline-flex;
  min-height: 28px;
  flex: 0 0 auto;
  padding: 5px 10px;
  align-items: center;
  color: #5d4a18;
  background: var(--yellow-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-badge.is-used { color: var(--green-dark); background: var(--green-soft); }

.loading-state, .empty-state { display: flex; min-height: 380px; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.loading-state p, .empty-state p { margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.qr-placeholder {
  width: min(248px, 72vw);
  aspect-ratio: 1;
  background: #e8ece9;
  border: 1px solid var(--line);
  border-radius: 6px;
  animation: soften 1.2s ease-in-out infinite alternate;
}
@keyframes soften { from { opacity: 0.58; } to { opacity: 1; } }
.coupon-content { padding-top: 18px; }
.qr-stage {
  display: grid;
  width: min(264px, 76vw);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 8px;
  place-items: center;
  background: #fff;
  border: 1px solid #cfd7d2;
  border-radius: 7px;
}
.qr-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.coupon-number {
  display: flex;
  min-height: 44px;
  margin: 14px 0;
  padding: 0 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f5f7f6;
  border: 1px dashed #cbd4ce;
  border-radius: 6px;
}
.coupon-number span { color: var(--muted); font-size: 13px; }
.coupon-number strong { min-width: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; text-align: right; }

.primary-button, .secondary-button, .native-share-button {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 7px;
  font-weight: 700;
  cursor: pointer;
}
.primary-button { color: #fff; background: var(--green); border: 1px solid var(--green); }
.primary-button:disabled { color: #dce7e0; background: #6e8a7a; border-color: #6e8a7a; cursor: wait; }
.secondary-button, .native-share-button { margin-top: 10px; color: var(--green-dark); background: #fff; border: 1px solid #aebdb4; }
.primary-button svg, .secondary-button svg, .native-share-button svg { width: 19px; height: 19px; }
.policy-note { display: flex; margin: 12px 0 0; align-items: flex-start; justify-content: center; gap: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
.policy-note svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; }

.state-icon { display: grid; width: 54px; height: 54px; margin-bottom: 16px; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 50%; }
.state-icon svg { width: 26px; height: 26px; }
.state-icon-error { color: var(--danger); background: #faecea; }
.empty-state .secondary-button { width: auto; min-width: 160px; margin-top: 22px; }
.service-strip { display: grid; margin-top: 14px; padding: 16px 4px; grid-template-columns: 21px minmax(0, 1fr); align-items: flex-start; column-gap: 12px; row-gap: 12px; border-top: 1px solid var(--line); }
.service-strip > svg { width: 21px; height: 21px; grid-row: 1 / span 2; color: var(--green); }
.service-strip > div { width: 100%; min-width: 0; grid-column: 2; }
.service-strip strong, .service-strip span { display: block; }
.service-strip strong { margin-bottom: 3px; font-size: 13px; }
.service-strip span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.page-footer { display: flex; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: center; gap: 3px 8px; color: #737d77; font-size: 11px; line-height: 1.5; text-align: center; }
.page-footer strong { width: 100%; color: #4f5a53; font-size: 12px; }

.sheet, .qr-modal { position: fixed; z-index: 50; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop, .modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(8, 15, 11, 0.56); }
.sheet-panel, .qr-modal-panel { position: relative; z-index: 1; width: min(100%, 520px); padding: 12px 18px calc(22px + env(safe-area-inset-bottom)); background: #fff; border-radius: 8px 8px 0 0; }
.sheet-handle { width: 36px; height: 4px; margin: 0 auto 18px; background: #c9d0cc; border-radius: 2px; }
.native-share-button { margin: 18px 0 12px; color: #fff; background: var(--green); border-color: var(--green); }
.share-channels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; padding-top: 12px; border-top: 1px solid var(--line); }
.share-channel, .bdsharebuttonbox .share-channel {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 68px;
  margin: 0;
  padding: 7px 2px;
  float: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #3f4943;
  background: #f5f7f6 !important;
  background-image: none !important;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  text-decoration: none;
  text-indent: 0;
}
.share-channel svg { width: 20px; height: 20px; color: var(--green); }
.qr-modal { align-items: center; padding: 18px; }
.qr-modal-panel { width: min(100%, 380px); padding: 20px; border-radius: 8px; text-align: center; }
.qr-modal-panel > img { display: block; width: min(280px, 76vw); aspect-ratio: 1; margin: 22px auto 12px; object-fit: contain; border: 1px solid var(--line); }
.qr-modal-panel > p { margin: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.toast {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 20px;
  width: fit-content;
  max-width: calc(100% - 40px);
  margin: auto;
  padding: 11px 16px;
  color: #fff;
  background: rgba(22, 31, 26, 0.94);
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow);
}
.is-hidden { display: none !important; }

@media (min-width: 700px) {
  .share-app { margin-top: 24px; margin-bottom: 24px; border-radius: 8px; overflow: hidden; }
  .hero { height: 310px; }
}
@media (max-width: 360px) {
  .content { padding-right: 10px; padding-left: 10px; }
  .hero { height: 316px; }
  .campaign-grid { right: 12px; left: 12px; gap: 10px; }
  .campaign-copy h1 { font-size: 20px; }
  .campaign-copy strong { font-size: 13px; }
  .campaign-copy p, .package-options span { font-size: 10px; }
  .package-panel { padding-left: 9px; }
  .process-row { margin-right: -10px; margin-left: -10px; padding-right: 8px; padding-left: 8px; }
  .process-row span { font-size: 11px; }
  .coupon-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
