:root {
  color-scheme: light;
  --green-950: #123c30;
  --green-900: #174f3e;
  --green-800: #1d6b52;
  --green-100: #dcebe4;
  --ivory: #fffdf8;
  --paper: #f6f3ed;
  --ink: #18231f;
  --muted: #6e7873;
  --gold: #d4a654;
  --line: #deddd5;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -5%, rgba(29, 107, 82, .16), transparent 34%),
    linear-gradient(180deg, #edf4ef 0, var(--paper) 48%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(212, 166, 84, .55); outline-offset: 3px; }
.hidden { display: none !important; }

.page-glow {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
}
.glow-one {
  width: 320px;
  height: 320px;
  right: -210px;
  top: 120px;
  border: 1px solid rgba(29, 107, 82, .15);
  box-shadow: 0 0 0 54px rgba(29, 107, 82, .03), 0 0 0 108px rgba(29, 107, 82, .02);
}
.glow-two {
  width: 150px;
  height: 150px;
  left: -95px;
  bottom: 10%;
  background: rgba(212, 166, 84, .17);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
}

.brand-bar { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 46px; height: 46px; border-radius: 14px; box-shadow: 0 8px 24px rgba(18, 60, 48, .18); }
.brand div { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font: 600 20px "Songti SC", STSong, serif; letter-spacing: 2px; }
.brand span { color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.guest-chip { padding: 7px 11px; color: var(--green-800); border: 1px solid rgba(29, 107, 82, .22); border-radius: 999px; background: rgba(255, 253, 248, .6); font-size: 11px; font-weight: 700; }

.loading-view, .error-view { display: flex; min-height: 64vh; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.loading-view p { margin-top: 22px; color: var(--muted); font-size: 14px; }
.spinner { width: 54px; height: 54px; border: 5px solid var(--green-100); border-top-color: var(--green-800); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-copy { margin: 58px 4px 30px; }
.eyebrow { margin: 0 0 12px; color: var(--green-800); font-size: 11px; font-weight: 800; letter-spacing: 4px; }
.hero-copy h1, .result-heading h1, .error-view h1 { margin: 0; font: 600 42px/1.23 "Songti SC", STSong, serif; letter-spacing: 1px; }
.campaign-name { margin: 21px 0 5px; color: #35443d; font-size: 16px; font-weight: 700; }
.campaign-time { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }

.draw-card {
  padding: 32px 26px 26px;
  border: 1px solid rgba(126, 135, 130, .22);
  border-radius: 28px;
  background: rgba(255, 253, 248, .94);
  box-shadow: 0 24px 70px rgba(32, 56, 47, .1);
  text-align: center;
}
.draw-card h2 { margin: 20px 0 8px; font: 600 23px "Songti SC", STSong, serif; }
.draw-card > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.ticket-illustration { position: relative; display: grid; height: 116px; place-items: center; }
.mini-ticket {
  position: relative;
  display: grid;
  width: 170px;
  height: 88px;
  place-items: center;
  border-radius: 18px;
  color: var(--ivory);
  background: linear-gradient(135deg, #286f58, #164839);
  box-shadow: 0 18px 36px rgba(24, 72, 57, .24);
  transform: rotate(-6deg);
}
.mini-ticket::before, .mini-ticket::after { content: ""; position: absolute; width: 24px; height: 24px; top: 32px; border-radius: 50%; background: var(--ivory); }
.mini-ticket::before { left: -12px; }
.mini-ticket::after { right: -12px; }
.mini-ticket i { position: absolute; left: 45px; top: 0; height: 100%; border-left: 2px dashed rgba(255, 255, 255, .28); }
.mini-ticket b { font: 42px Georgia, serif; }
.spark { position: absolute; color: var(--gold); font-size: 28px; animation: shimmer 1.8s ease-in-out infinite alternate; }
.spark-one { right: 19%; top: 0; }
.spark-two { left: 20%; bottom: 4px; font-size: 18px; animation-delay: .5s; }
@keyframes shimmer { to { opacity: .45; transform: scale(.82) rotate(12deg); } }

.primary-button, .secondary-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
}
.primary-button { color: #fff; background: var(--green-800); box-shadow: 0 14px 28px rgba(29, 107, 82, .22); }
.primary-button i { font-style: normal; font-size: 22px; transition: transform .2s ease; }
.primary-button:hover i { transform: translateX(4px); }
.primary-button:disabled { cursor: wait; opacity: .68; }
.secondary-button { margin-top: 18px; color: var(--green-800); border: 1px solid #9bb9ac; background: transparent; }
.privacy-note { margin: 18px 0 0; color: #808985; font-size: 11px; text-align: center; }

.result-heading { margin: 55px 4px 28px; }
.result-heading h1 { font-size: 36px; }
.result-heading > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.coupon {
  position: relative;
  padding: 27px 26px 24px;
  color: #fff;
  border-radius: 26px;
  background: linear-gradient(140deg, #1b5e49, #2d7a60);
  box-shadow: 0 26px 65px rgba(27, 94, 73, .22);
  overflow: hidden;
}
.coupon::after { content: ""; position: absolute; width: 230px; height: 230px; right: -94px; top: -150px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%; box-shadow: 0 0 0 44px rgba(255, 255, 255, .025), 0 0 0 88px rgba(255, 255, 255, .017); }
.coupon.used, .coupon.expired { color: #eef0ef; background: linear-gradient(140deg, #68716d, #48524d); box-shadow: none; }
.coupon-topline { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13px; }
.coupon-topline > span:first-child { max-width: 68%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { padding: 7px 11px; color: #174c3c; border-radius: 999px; background: #d8edc9; font-size: 11px; font-weight: 800; }
.used .status-badge, .expired .status-badge { color: #535a57; background: #e0e2e1; }
.amount { position: relative; z-index: 1; display: flex; align-items: baseline; margin-top: 21px; font-family: Georgia, serif; }
.amount span { margin-right: 7px; font-size: 30px; }
.amount strong { font-size: 76px; font-weight: 500; line-height: 1; }
.coupon-label { position: relative; z-index: 1; margin: 11px 0 21px; color: #c9ddd5; font-size: 13px; }
.tear-line { position: relative; z-index: 1; display: flex; align-items: center; margin: 0 -38px 22px; }
.tear-line span { width: 24px; height: 45px; flex: 0 0 24px; border-radius: 50%; background: var(--paper); }
.tear-line i { flex: 1; border-top: 2px dashed rgba(255, 255, 255, .26); }
.code-block { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.code-block > span { color: #c9ddd5; font-size: 11px; }
.code-block strong { grid-row: 2; font: 800 24px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 1px; }
.code-block button { grid-row: 1 / 3; padding: 9px 12px; color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: transparent; cursor: pointer; font-size: 11px; }
.expiry { position: relative; z-index: 1; margin: 18px 0 0; color: #c9ddd5; font-size: 11px; }
.used-stamp { position: absolute; z-index: 2; right: 28px; bottom: 76px; display: none; padding: 8px 12px; border: 4px double rgba(255, 255, 255, .42); border-radius: 6px; color: rgba(255, 255, 255, .62); font-size: 23px; font-weight: 800; transform: rotate(-12deg); }
.used .used-stamp, .expired .used-stamp { display: block; }
.expired .used-stamp::before { content: "已过期"; }
.expired .used-stamp { font-size: 0; }
.expired .used-stamp::before { font-size: 23px; }

.text-button { display: block; margin: 18px auto 0; padding: 8px; color: var(--green-800); border: 0; background: transparent; cursor: pointer; font-size: 13px; }
.tips-card { margin-top: 28px; padding: 22px; border-left: 4px solid var(--gold); border-radius: 4px 18px 18px 4px; background: rgba(241, 237, 228, .85); }
.tips-card strong { font: 600 17px "Songti SC", STSong, serif; }
.tips-card p { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

.error-symbol { display: grid; width: 72px; height: 72px; place-items: center; margin-bottom: 24px; color: var(--green-800); border-radius: 50% 50% 50% 16px; background: var(--green-100); font: 600 30px Georgia, serif; }
.error-view h1 { font-size: 30px; }
.error-view p { margin: 14px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.error-view .secondary-button { max-width: 220px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(34px + env(safe-area-inset-bottom)); max-width: calc(100% - 44px); padding: 11px 18px; color: #fff; border-radius: 999px; background: rgba(18, 35, 29, .92); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .22s ease; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
footer { margin-top: 36px; color: #98a09c; font-size: 10px; letter-spacing: 1px; text-align: center; }

@media (max-width: 360px) {
  .shell { padding-inline: 16px; }
  .hero-copy h1 { font-size: 37px; }
  .amount strong { font-size: 68px; }
  .code-block strong { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
