:root {
  --brand: #f85226;
  --brand-deep: #d93d16;
  --brand-soft: #fff3ed;
  --brand-border: #ffd6c5;
  --gold-soft: #fff7dc;
  --page: #f7f8fa;
  --surface: #ffffff;
  --text: #172033;
  --text-secondary: #667085;
  --text-weak: #8a94a6;
  --border: #e7eaf0;
  --warning: #8b4a00;
  --warning-soft: #fff4d8;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --shadow: 0 12px 30px rgba(119, 52, 24, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(248, 82, 38, 0.12), transparent 30%),
    linear-gradient(180deg, #fff9f4 0%, var(--page) 56%, var(--page) 100%);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(248, 82, 38, 0.4);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.wechat-tip {
  width: 100%;
  padding: max(9px, env(safe-area-inset-top)) 16px 9px;
  color: #7b3d00;
  background: var(--warning-soft);
  border-bottom: 1px solid #f4d79a;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.page {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
}

.brand {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  box-shadow: 0 7px 16px rgba(248, 82, 38, 0.18);
}

.brand-name {
  min-width: 0;
  flex: 1;
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 750;
}

.official-badge {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 650;
  white-space: nowrap;
}

.hero {
  margin-top: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid rgba(248, 82, 38, 0.13);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero-intro {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.reward-visual {
  width: 84px;
  height: 76px;
  display: block;
  object-fit: contain;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  color: var(--brand-deep);
  background: linear-gradient(135deg, var(--brand-soft), var(--gold-soft));
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 650;
}

.hero-title {
  margin: 7px 0 0;
  color: #28140d;
  font-size: clamp(23px, 7vw, 27px);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero-desc {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.actions {
  margin-top: 12px;
  display: grid;
  gap: 9px;
}

.hero-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-actions #primaryButton {
  grid-column: 1 / -1;
}

.hero-actions.single-secondary #secondaryButton {
  grid-column: 1 / -1;
}

.hero-actions.actions-stacked {
  grid-template-columns: 1fr;
}

.hero-actions.actions-stacked #primaryButton {
  grid-column: auto;
}

.button {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
  cursor: pointer;
}

.button-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.button:disabled {
  cursor: default;
  opacity: 0.58;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, #ff6a32, var(--brand-deep));
  border: 1px solid transparent;
  box-shadow: 0 9px 20px rgba(217, 61, 22, 0.22);
}

.button-secondary {
  color: var(--brand-deep);
  background: var(--surface);
  border: 1px solid #f4ae94;
}

.button-quiet {
  min-height: 44px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 14px;
}

.copy-button {
  box-shadow: none;
}

.copy-button img {
  width: 18px;
  height: 18px;
}

.reward-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.reward-item {
  min-width: 0;
  min-height: 39px;
  padding: 6px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #6b3a2c;
  background: #fff9f5;
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
}

.reward-item img {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.flow-card {
  margin-top: 10px;
  padding: 12px 10px 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.flow-title {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 750;
  text-align: center;
}

.flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}

.flow-step {
  position: relative;
  min-width: 0;
}

.flow-step > .flow-chevron {
  position: absolute;
  top: 11px;
  right: -18px;
  width: 18px;
  height: 18px;
}

.flow-icon-wrap {
  width: 34px;
  height: 34px;
  margin: 0 auto 5px;
  position: relative;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  border-radius: 11px;
}

.flow-icon {
  width: 18px;
  height: 18px;
}

.flow-order {
  position: absolute;
  top: -4px;
  right: -5px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 9px;
  line-height: 1;
  font-weight: 750;
}

.footnote {
  margin: 9px auto 0;
  color: var(--text-weak);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.invalid .hero-title {
  color: var(--danger);
}

.invalid .reward-visual {
  opacity: 0.68;
  filter: grayscale(0.35);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.44);
  backdrop-filter: blur(3px);
}

.sheet {
  width: min(100%, 440px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 22px 22px 18px 18px;
  box-shadow: 0 22px 60px rgba(23, 32, 51, 0.24);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: -8px auto 17px;
  border-radius: 999px;
  background: #d5d9e0;
}

.sheet-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.35;
  font-weight: 750;
  text-align: center;
}

.sheet-desc {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.copy-failure {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.copy-failure {
  color: var(--danger);
  background: var(--danger-soft);
}

.guide-overlay {
  align-items: flex-start;
  padding-top: max(18px, env(safe-area-inset-top));
}

.guide-panel {
  width: min(100%, 440px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.97);
  border-radius: 20px;
  box-shadow: 0 22px 60px rgba(23, 32, 51, 0.22);
}

.guide-arrow {
  width: 34px;
  height: 34px;
  display: block;
  margin-left: auto;
}

.guide-title {
  margin: 5px 0 14px;
  font-size: 20px;
  line-height: 1.35;
  text-align: center;
}

.guide-step {
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 11px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
}

.guide-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 80;
  width: max-content;
  max-width: calc(100vw - 40px);
  padding: 11px 15px;
  color: #fff;
  background: rgba(23, 32, 51, 0.92);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.2);
}

@media (max-width: 339px) {
  .hero-actions {
    grid-template-columns: 1fr;
  }

  .hero-intro {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .reward-visual {
    width: 72px;
  }

  .reward-item {
    flex-direction: column;
  }
}

@media (min-width: 520px) {
  .page {
    padding-top: 24px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .copy-button {
    transition:
      transform 0.16s ease,
      opacity 0.16s ease,
      background-color 0.16s ease;
  }

  .button:active,
  .copy-button:active {
    transform: scale(0.985);
  }
}
