:root {
  --ink: #1e1a17;
  --muted: #7e746d;
  --cream: #f8f3eb;
  --paper: #fffdf9;
  --peach: #e98769;
  --peach-dark: #c85e43;
  --peach-soft: #f8ded2;
  --line: rgba(64, 44, 34, 0.12);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--cream);
  color: var(--ink);
}

body.has-modal { overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
[hidden] { display: none !important; }

.page-shell {
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  background: var(--cream);
}

.qr-section {
  position: relative;
  height: 70svh;
  min-height: 480px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(22px, env(safe-area-inset-top)) 22px 18px;
  background:
    radial-gradient(circle at 8% 3%, rgba(255,255,255,.96), transparent 34%),
    linear-gradient(145deg, #fffdf9 0%, #f8f0e7 100%);
  border-bottom: 1px solid var(--line);
}

.qr-section::after {
  content: "";
  position: absolute;
  right: -60px;
  top: 110px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(233, 135, 105, 0.18);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(233, 135, 105, 0.04), 0 0 0 58px rgba(233, 135, 105, 0.025);
  pointer-events: none;
}

.brand-row {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9px;
  line-height: 1;
  letter-spacing: .18em;
  color: var(--peach-dark);
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(23px, 7vw, 31px);
  font-weight: 600;
  letter-spacing: .04em;
}

.env-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.env-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7bcb4;
}

.env-pill.is-wechat i { background: #27ad67; box-shadow: 0 0 0 3px rgba(39, 173, 103, .12); }

.qr-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 12px 0 8px;
}

.ambient {
  position: absolute;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(233, 135, 105, .28);
  transform: rotate(45deg);
  pointer-events: none;
}

.ambient-one { left: max(0px, calc(50% - 190px)); top: 24%; }
.ambient-two { right: max(2px, calc(50% - 176px)); bottom: 19%; width: 28px; height: 28px; }

.qr-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(64vw, 292px, 35svh);
  aspect-ratio: 1;
  margin: 0;
  padding: 13px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(70, 48, 34, .13), inset 0 0 0 1px rgba(75, 52, 36, .05);
}

.qr-card.is-image-qr {
  aspect-ratio: 1280 / 1769;
  padding: 8px;
  border-radius: 24px;
}

.merchant-qr {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 17px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: default;
}

.demo-badge {
  position: absolute;
  right: 17px;
  top: 17px;
  padding: 4px 7px;
  border-radius: 99px;
  background: rgba(30, 26, 23, .86);
  color: white;
  font-size: 9px;
  letter-spacing: .08em;
}

.corner {
  position: absolute;
  z-index: 2;
  width: 27px;
  height: 27px;
  border-color: var(--peach);
  pointer-events: none;
}

.corner-tl { left: -7px; top: -7px; border-left: 2px solid var(--peach); border-top: 2px solid var(--peach); border-radius: 11px 0 0; }
.corner-tr { right: -7px; top: -7px; border-right: 2px solid var(--peach); border-top: 2px solid var(--peach); border-radius: 0 11px 0 0; }
.corner-bl { left: -7px; bottom: -7px; border-left: 2px solid var(--peach); border-bottom: 2px solid var(--peach); border-radius: 0 0 0 11px; }
.corner-br { right: -7px; bottom: -7px; border-right: 2px solid var(--peach); border-bottom: 2px solid var(--peach); border-radius: 0 0 11px; }

.scan-hint {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  text-align: left;
}

.press-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--peach-soft);
  color: var(--peach-dark);
  font-size: 20px;
}

.scan-hint strong { display: block; font-size: 13px; letter-spacing: .02em; }
.scan-hint p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }

.appreciation-section {
  height: 30svh;
  min-height: 220px;
  padding: 20px 22px calc(20px + env(safe-area-inset-bottom));
  background: #fffdf9;
}

.appreciation-section > * { max-width: 560px; margin-left: auto; margin-right: auto; }

.appreciation-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.appreciation-copy .eyebrow { order: 2; white-space: nowrap; color: #ac9b91; }

h2 {
  margin-bottom: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .04em;
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.amount-button {
  min-width: 0;
  height: 78px;
  display: grid;
  place-content: center;
  padding: 10px 4px;
  border: 1px solid rgba(233, 135, 105, .28);
  border-radius: 17px;
  background: linear-gradient(180deg, #fff 0%, #fff8f4 100%);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 7px 18px rgba(112, 73, 53, .06);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
  -webkit-tap-highlight-color: transparent;
}

.appreciation-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    max(20px, env(safe-area-inset-top))
    22px
    max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, .13), transparent 30%),
    rgba(25, 20, 17, .94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: appreciation-in .2s ease-out;
}

.appreciation-dialog {
  position: relative;
  width: min(100%, 460px);
  min-height: min(680px, calc(100svh - 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 66px 24px 28px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 12% 0%, rgba(248, 222, 210, .72), transparent 36%),
    var(--paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .28);
  text-align: center;
}

.appreciation-close {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.appreciation-close:focus-visible {
  outline: 3px solid rgba(233, 135, 105, .32);
  outline-offset: 2px;
}

.appreciation-dialog-copy .eyebrow { margin-bottom: 10px; }
.appreciation-dialog-copy h2 { font-size: clamp(26px, 7.5vw, 34px); }
.appreciation-dialog-copy > p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.appreciation-qr-card {
  width: min(82vw, 356px, 48svh);
  aspect-ratio: 1;
  margin: 32px 0 0;
  padding: 13px;
  border: 1px solid rgba(70, 48, 34, .08);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(70, 48, 34, .14);
}

.appreciation-qr {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-touch-callout: default;
}

.appreciation-press-hint {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .06em;
}

.amount-button:active { transform: scale(.96); background: var(--peach-soft); border-color: var(--peach); }
.amount-button:focus-visible { outline: 3px solid rgba(233, 135, 105, .28); outline-offset: 2px; }
.amount-button span { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 700; color: var(--peach-dark); }
.amount-button small { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; white-space: nowrap; }

.notice-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(27, 21, 18, .32);
  backdrop-filter: blur(3px);
}

.notice-sheet {
  width: min(100%, 620px);
  padding: 12px 24px calc(22px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 50px rgba(34, 24, 19, .12);
  animation: sheet-up .24s ease-out;
}

.notice-grip { display: block; width: 36px; height: 4px; margin: 0 auto 22px; border-radius: 99px; background: #ddd2cc; }
.notice-sheet h2 { font-size: 24px; }
.notice-sheet > p:not(.eyebrow) { margin: 12px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.notice-sheet button { width: 100%; height: 48px; border: 0; border-radius: 15px; background: var(--ink); color: white; font-weight: 600; cursor: pointer; }

@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes appreciation-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }

@media (max-height: 680px) {
  .appreciation-dialog { min-height: calc(100svh - 28px); padding-top: 58px; padding-bottom: 20px; }
  .appreciation-qr-card { width: min(72vw, 310px, 43svh); margin-top: 20px; }
  .appreciation-press-hint { margin-top: 12px; }
}

@media (max-height: 700px) {
  .qr-section { min-height: 420px; padding-top: 18px; }
  .qr-card { width: min(53vw, 230px, 32svh); }
  .appreciation-section { min-height: 190px; padding-top: 14px; }
  .appreciation-copy { margin-bottom: 10px; }
  .amount-button { height: 70px; }
}

@media (min-width: 760px) {
  .page-shell { max-width: 620px; min-height: 100svh; margin: 0 auto; box-shadow: 0 0 80px rgba(65, 44, 32, .08); }
}

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