:root {
  color: #173028;
  background: #f4f7f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f4f7f5;
  touch-action: manipulation;
}

button,
img {
  display: block;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
}

.page-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px 16px;
  place-items: center;
}

.scan-panel {
  width: min(100%, 430px);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dce7df;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(26, 63, 44, 0.1);
}

.verified-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 18px;
  color: #146c3c;
  background: #dff5e6;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.verified-mark {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  color: #ffffff;
  background: #1b9854;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 800;
}

.content {
  display: grid;
  justify-items: center;
  padding: 42px 30px 36px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: #4e735e;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  max-width: 100%;
  margin: 0;
  color: #172a20;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
}

.subtitle {
  min-height: 22px;
  margin: 12px 0 28px;
  color: #718277;
  font-size: 14px;
  line-height: 1.55;
}

.subtitle strong {
  color: #238c50;
  font-variant-numeric: tabular-nums;
}

.reward-panel {
  width: min(100%, 320px);
  margin: -8px 0 24px;
  padding: 14px 16px;
  color: #805716;
  background: #fff8e6;
  border: 1px solid #f0d99a;
  border-radius: 6px;
}

.reward-title {
  margin: 0 0 10px;
  color: #9b6410;
  font-size: 15px;
  font-weight: 700;
}

.reward-sold-out {
  color: #7b3f2a;
  background: #fff1ec;
  border-color: #f0c3b4;
}

.reward-sold-out .reward-title {
  margin-bottom: 0;
  color: #a34d32;
}

.reward-sold-out .reward-note {
  color: #9b6b5c;
}

.reward-code-row {
  display: grid;
  gap: 9px;
}

#reward-code {
  display: block;
  padding: 9px 10px;
  overflow-wrap: anywhere;
  color: #5c3e0d;
  background: #ffffff;
  border: 1px dashed #d3ae55;
  border-radius: 4px;
  font: 700 15px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  user-select: text;
}

.copy-reward-button {
  min-height: 36px;
  padding: 7px 12px;
  color: #ffffff;
  background: #c88718;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.reward-note,
.copy-reward-message {
  margin: 9px 0 0;
  color: #9a7b45;
  font-size: 12px;
  line-height: 1.5;
}

.copy-reward-message {
  min-height: 18px;
  margin-bottom: 0;
  color: #ae7413;
}

.qr-frame {
  position: relative;
  display: grid;
  width: min(100%, 270px);
  min-height: 270px;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d8e5dc;
  border-radius: 4px;
}

.qr-area {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.qr-bottom-text {
  max-width: 270px;
  margin: -2px 0 0;
  color: #89968e;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  word-break: break-word;
}

.qr-frame .brand-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: block;
  width: 15%;
  height: 15%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  background: #ffffff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.loading-state {
  display: grid;
  gap: 14px;
  justify-items: center;
  color: #6d7e72;
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d8eadf;
  border-top-color: #1b9854;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.retry-button {
  margin-top: 24px;
  padding: 10px 18px;
  color: #ffffff;
  background: #167b43;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
}

.retry-button:focus-visible {
  outline: 3px solid #8ecda6;
  outline-offset: 3px;
}

footer {
  padding: 18px 24px;
  color: #77877d;
  border-top: 1px solid #edf2ee;
  font-size: 13px;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 380px) {
  .content {
    padding: 34px 20px 28px;
  }

  .qr-frame {
    width: min(100%, 244px);
    min-height: 244px;
  }
}
