:root {
  color-scheme: light;
  --page: #f5f5f1;
  --surface: #ffffff;
  --surface-muted: #f1f2ed;
  --ink: #27251f;
  --muted: #66655f;
  --line: rgba(39, 37, 31, 0.14);
  --line-strong: rgba(39, 37, 31, 0.24);
  --brand: #ffd100;
  --brand-soft: #fff3ae;
  --coupon: #df3f46;
  --coupon-soft: #fff0f1;
  --blue: #326fce;
  --blue-soft: #edf3ff;
  --success: #18764d;
  --success-soft: #eaf6f0;
  --warning: #806000;
  --warning-soft: #fff6cc;
  --danger: #b82032;
  --danger-soft: #fff0f2;
  --radius: 8px;
  --shadow: 0 12px 30px rgba(55, 59, 86, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  text-rendering: optimizeLegibility;
}
button, input, a { font: inherit; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 209, 0, 0.42); color: var(--ink); }

.coupon-page {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 0 24px calc(28px + env(safe-area-inset-bottom));
}

.coupon-topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.coupon-brand {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.coupon-brand img { width: 122px; height: auto; }
.coupon-brand span { border-left: 1px solid var(--line-strong); padding-left: 12px; color: var(--muted); font-size: 13px; font-weight: 760; }
.trust-label { border: 1px solid rgba(80, 62, 0, 0.16); border-radius: 999px; padding: 7px 10px; background: var(--brand-soft); color: #5e4700; font-size: 12px; font-weight: 780; }

.bridge-notice {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  border: 1px solid rgba(50, 111, 206, 0.2);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--blue-soft);
  color: #285da7;
  font-size: 12px;
  line-height: 1.5;
}
.bridge-notice > span { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.bridge-notice[data-state="error"] { border-color: rgba(184, 32, 50, 0.2); background: var(--danger-soft); color: var(--danger); }
.bridge-notice[data-state="error"] > span { background: var(--danger); }

.offer-band {
  min-height: 214px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px 170px;
  align-items: center;
  gap: 22px;
  overflow: hidden;
  border: 1px solid rgba(100, 76, 0, 0.14);
  border-radius: var(--radius);
  padding: 30px 26px;
  background: var(--brand);
}
.offer-copy h1 { max-width: 12em; margin: 0; font-size: 40px; font-weight: 920; line-height: 1.16; letter-spacing: 0; text-wrap: balance; }
.offer-copy p { max-width: 42em; margin: 14px 0 0; color: rgba(39, 37, 31, 0.72); font-size: 13px; font-weight: 650; line-height: 1.6; }
.offer-memory {
  min-height: 132px;
  display: grid;
  align-content: center;
  border: 1px solid rgba(111, 14, 20, 0.2);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--coupon);
  color: #fff;
}
.offer-memory strong { display: flex; align-items: baseline; gap: 5px; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.offer-memory strong small, .offer-memory strong i { font-size: 12px; font-style: normal; font-weight: 850; }
.offer-memory > span { margin-top: 11px; color: #fff; font-size: 10px; font-weight: 720; line-height: 1.45; }
.offer-mascot { align-self: end; width: 184px; max-height: 194px; object-fit: contain; object-position: bottom center; transform: translate(8px, 18px); }

.coupon-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(350px, 0.86fr); gap: 14px; margin-top: 14px; align-items: start; }
.coupon-surface { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--surface); box-shadow: var(--shadow); }
.surface-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.surface-heading h2 { margin: 0; font-size: 21px; font-weight: 850; line-height: 1.3; letter-spacing: 0; }
.surface-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.status-label { flex: 0 0 auto; min-height: 30px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; background: var(--surface-muted); color: var(--muted); font-size: 10px; font-weight: 780; }
.status-label i { width: 7px; height: 7px; border-radius: 50%; background: #aaa79d; }
.status-label[data-state="waiting"] { border-color: rgba(128, 96, 0, 0.2); background: var(--warning-soft); color: var(--warning); }
.status-label[data-state="waiting"] i { background: var(--warning); animation: statusPulse 1.4s ease-in-out infinite; }
.status-label[data-state="ready"] { border-color: rgba(24, 118, 77, 0.18); background: var(--success-soft); color: var(--success); }
.status-label[data-state="ready"] i { background: var(--success); }
.status-label[data-state="error"] { border-color: rgba(184, 32, 50, 0.18); background: var(--danger-soft); color: var(--danger); }
.status-label[data-state="error"] i { background: var(--danger); }

.auth-intro { margin-top: 22px; }
.agreement-row { min-height: 48px; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 10px; color: var(--muted); font-size: 12px; line-height: 1.55; cursor: pointer; }
.agreement-row input { width: 18px; height: 18px; margin: 0; accent-color: #c69e00; }
.primary-action, .secondary-action, .claim-action, .quiet-action { min-height: 44px; border-radius: var(--radius); font-weight: 820; }
.primary-action, .claim-action { width: 100%; border: 0; background: var(--brand); color: var(--ink); }
.primary-action { margin-top: 10px; }
.claim-action { min-height: 52px; margin-top: 14px; }
.secondary-action { display: inline-flex; align-items: center; justify-content: center; width: 100%; border: 1px solid var(--line-strong); padding: 0 14px; background: var(--surface); color: var(--blue); text-decoration: none; }
.secondary-action[aria-disabled="true"] { pointer-events: none; color: #8e8d88; background: var(--surface-muted); }
.quiet-action { min-width: 44px; border: 0; padding: 0 10px; background: transparent; color: var(--blue); font-size: 12px; }
.primary-action:active, .claim-action:active, .secondary-action:active { transform: scale(0.98); }
.primary-action:disabled, .claim-action:disabled { color: #8e8d88; background: #e9e9e4; transform: none; }

.auth-methods { margin-top: 20px; animation: authReveal 300ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.auth-method-toolbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.auth-method-toolbar > strong { font-size: 14px; }
.auth-method-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.auth-methods[data-has-qr="true"] .auth-method-grid { grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1fr); }
.qr-method { display: grid; place-items: center; align-content: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface-muted); }
.qr-method img { width: 176px; height: 176px; object-fit: contain; background: #fff; }
.qr-method span { margin-top: 8px; color: var(--muted); font-size: 10px; }
.official-method { min-height: 204px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.auth-methods[data-has-qr="false"] .official-method { min-height: 154px; }
.official-method > strong { font-size: 15px; }
.official-method p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.official-method .secondary-action { margin-top: 16px; }

.authorized-summary { min-height: 82px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 22px; border: 1px solid rgba(24, 118, 77, 0.18); border-radius: var(--radius); padding: 14px; background: var(--success-soft); }
.authorized-summary strong, .authorized-summary small { display: block; }
.authorized-summary strong { font-size: 14px; }
.authorized-summary small { margin-top: 4px; color: var(--success); font-size: 10px; }
.authorized-mark { position: relative; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, 0.72); }
.authorized-mark::before { position: absolute; width: 18px; height: 9px; border-bottom: 3px solid var(--success); border-left: 3px solid var(--success); content: ""; transform: translate(14px, 15px) rotate(-45deg); }
.inline-status { margin: 14px 0 0; border-radius: var(--radius); padding: 11px 12px; background: var(--surface-muted); color: var(--muted); font-size: 11px; line-height: 1.55; }
.inline-status[data-state="waiting"] { background: var(--warning-soft); color: var(--warning); }
.inline-status[data-state="success"] { background: var(--success-soft); color: var(--success); }
.inline-status[data-state="error"] { background: var(--danger-soft); color: var(--danger); }

.target-ticket { min-height: 76px; display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 14px; margin-top: 20px; border: 1px solid rgba(223, 63, 70, 0.2); border-radius: var(--radius); padding: 12px; background: var(--coupon-soft); }
.target-ticket > span { display: grid; place-items: center; align-self: stretch; border-radius: 6px; background: var(--coupon); color: #fff; font-size: 17px; font-weight: 920; font-variant-numeric: tabular-nums; }
.target-ticket strong, .target-ticket small { display: block; }
.target-ticket strong { font-size: 13px; }
.target-ticket small { margin-top: 5px; color: #7b5558; font-size: 9px; line-height: 1.5; }
.result-panel { min-height: 166px; margin-top: 14px; }
.result-empty { min-height: 150px; display: grid; place-items: center; align-content: center; text-align: center; }
.result-empty strong { font-size: 13px; }
.result-empty small { margin-top: 6px; color: var(--muted); font-size: 10px; }
.result-state { min-height: 70px; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 11px; border-radius: var(--radius); padding: 12px; }
.result-state-mark { position: relative; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, 0.72); }
.result-state strong { font-size: 13px; }
.result-state p { margin: 4px 0 0; font-size: 10px; line-height: 1.5; }
.result-panel[data-state="success"] .result-state, .result-panel[data-state="today"] .result-state { background: var(--success-soft); color: var(--success); }
.result-panel[data-state="partial"] .result-state { background: var(--warning-soft); color: var(--warning); }
.result-panel[data-state="failure"] .result-state, .result-panel[data-state="expired"] .result-state { background: var(--danger-soft); color: var(--danger); }
.result-panel[data-state="success"] .result-state-mark::before, .result-panel[data-state="today"] .result-state-mark::before { position: absolute; width: 16px; height: 8px; border-bottom: 3px solid var(--success); border-left: 3px solid var(--success); content: ""; transform: translate(12px, 13px) rotate(-45deg); }
.result-panel[data-state="partial"] .result-state-mark::before { position: absolute; left: 20px; top: 8px; width: 3px; height: 18px; border-radius: 2px; background: var(--warning); box-shadow: 0 23px 0 -1px var(--warning); content: ""; }
.result-panel[data-state="failure"] .result-state-mark::before, .result-panel[data-state="failure"] .result-state-mark::after, .result-panel[data-state="expired"] .result-state-mark::before, .result-panel[data-state="expired"] .result-state-mark::after { position: absolute; left: 20px; top: 9px; width: 3px; height: 24px; border-radius: 2px; background: var(--danger); content: ""; }
.result-panel[data-state="failure"] .result-state-mark::before, .result-panel[data-state="expired"] .result-state-mark::before { transform: rotate(45deg); }
.result-panel[data-state="failure"] .result-state-mark::after, .result-panel[data-state="expired"] .result-state-mark::after { transform: rotate(-45deg); }

.coupon-results { display: grid; gap: 8px; margin-top: 10px; }
.coupon-item { min-height: 80px; display: grid; grid-template-columns: 78px minmax(0, 1fr); overflow: hidden; border: 1px solid rgba(223, 63, 70, 0.16); border-radius: var(--radius); background: var(--surface); }
.coupon-item[data-target="true"] { border-color: rgba(223, 63, 70, 0.42); box-shadow: 0 8px 20px rgba(223, 63, 70, 0.1); }
.coupon-amount { display: grid; place-items: center; align-content: center; border-right: 1px dashed rgba(223, 63, 70, 0.28); background: var(--coupon-soft); color: var(--coupon); }
.coupon-amount strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.coupon-amount small { margin-top: 2px; font-size: 8px; }
.coupon-copy { align-self: center; min-width: 0; padding: 11px 13px; }
.coupon-copy strong, .coupon-copy span, .coupon-copy small, .coupon-copy em { display: block; overflow-wrap: anywhere; }
.coupon-copy em { width: max-content; margin-bottom: 5px; border-radius: 999px; padding: 3px 6px; background: var(--coupon); color: #fff; font-size: 8px; font-style: normal; font-weight: 820; }
.coupon-copy strong { font-size: 11px; }
.coupon-copy span { margin-top: 4px; color: #715e43; font-size: 9px; }
.coupon-copy small { margin-top: 4px; color: var(--muted); font-size: 8px; }

.response-note { max-width: 72ch; margin: 18px auto 0; color: var(--muted); font-size: 11px; line-height: 1.65; text-align: center; }
.coupon-footer { min-height: 66px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.coupon-footer a { min-height: 44px; display: inline-flex; align-items: center; text-underline-offset: 3px; }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(50, 111, 206, 0.34); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .primary-action:hover, .claim-action:hover { filter: brightness(0.98); }
  .secondary-action:hover { border-color: var(--blue); }
  .quiet-action:hover { background: var(--blue-soft); }
}

@keyframes authReveal { from { opacity: 0; clip-path: inset(0 0 18% 0); transform: translateY(8px); } to { opacity: 1; clip-path: inset(0); transform: translateY(0); } }
@keyframes statusPulse { 50% { opacity: 0.4; transform: scale(0.82); } }

@media (max-width: 820px) {
  .coupon-page { padding-right: 16px; padding-left: 16px; }
  .offer-band { grid-template-columns: minmax(0, 1fr) 176px; }
  .offer-mascot { display: none; }
  .coupon-layout { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .coupon-page { padding-right: 12px; padding-left: 12px; }
  .coupon-topbar { min-height: 66px; }
  .coupon-brand { gap: 8px; }
  .coupon-brand img { width: 104px; }
  .coupon-brand span { padding-left: 8px; font-size: 11px; }
  .trust-label { padding: 6px 8px; font-size: 10px; }
  .offer-band { min-height: 0; grid-template-columns: 1fr; gap: 17px; padding: 22px 18px 18px; }
  .offer-copy h1 { max-width: none; font-size: 29px; }
  .offer-copy p { margin-top: 10px; font-size: 11px; }
  .offer-memory { min-height: 94px; padding: 14px 16px; }
  .offer-memory strong { font-size: 34px; }
  .coupon-surface { padding: 20px 16px; }
  .surface-heading h2 { font-size: 18px; }
  .surface-heading p { font-size: 11px; }
  .status-label { padding: 0 8px; font-size: 9px; }
  .auth-methods[data-has-qr="true"] .auth-method-grid { grid-template-columns: 1fr; }
  .qr-method { min-height: 224px; }
  .official-method, .auth-methods[data-has-qr="false"] .official-method { min-height: 150px; }
}

@media (max-width: 375px) {
  .coupon-brand span { display: none; }
  .offer-copy h1 { font-size: 27px; }
  .surface-heading { gap: 9px; }
  .status-label { max-width: 78px; white-space: normal; text-align: center; }
}

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