:root {
  --primary: #5b5cf6;
  --primary-dark: #4849df;
  --button-dark: #111827;
  --ink: #18181b;
  --muted: #6b7280;
  --soft: #f6f7fb;
  --line: #e6e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 24px 70px rgba(17, 24, 39, .10);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(91, 92, 246, .10), transparent 38%),
    linear-gradient(180deg, #fbfbff 0%, #ffffff 54%, #f7f8fc 100%);
  color: var(--ink);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  min-height: 100vh;
}

.nav {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(230, 232, 240, .85);
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark,
.lock {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #111827, var(--primary));
  box-shadow: 0 10px 26px rgba(91, 92, 246, .28);
  font-size: 12px;
  font-weight: 950;
}

.brand-mark {
  width: 48px;
  height: 34px;
  border-radius: 10px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-links .query-nav {
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(91, 92, 246, .22);
  font-weight: 850;
}

.nav-links .query-nav:hover {
  color: #fff;
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 86px 24px 34px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid #ececff;
  border-radius: 999px;
  color: #4f46e5;
  background: rgba(91, 92, 246, .06);
  font-size: 13px;
  font-weight: 700;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(16, 185, 129, .10);
}

.hero h1,
.query-hero h1 {
  max-width: 820px;
  margin: 28px auto 18px;
  font-size: clamp(38px, 5.6vw, 64px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero p,
.query-hero p {
  max-width: 650px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.72;
}

.main-grid {
  max-width: 1180px;
  margin: 34px auto 90px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 34px;
  align-items: start;
}

.panel {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.info-panel {
  padding: 28px;
  text-align: left;
}

.section-kicker {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.info-panel h2 {
  margin-top: 10px;
  font-size: clamp(30px, 3.8vw, 46px);
  line-height: 1.12;
  color: #000;
  font-weight: 950;
  letter-spacing: 0;
}

.info-panel > p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.75;
}

.steps {
  margin-top: 26px;
  display: grid;
  gap: 14px;
}

.step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbff;
}

.step-num {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--button-dark);
  font-weight: 950;
}

.step h3 {
  font-size: 17px;
  color: #000;
}

.step p {
  margin-top: 6px;
  color: #374151;
  font-size: 14px;
  line-height: 1.66;
}

.redeem-card {
  position: sticky;
  top: 92px;
  overflow: hidden;
}

.redeem-head,
.panel-head {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f8f8ff);
}

.redeem-title,
.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lock {
  width: 52px;
  height: 42px;
  border-radius: 12px;
}

.redeem-title h2,
.panel-title h2 {
  font-size: 21px;
  letter-spacing: 0;
}

.redeem-head p,
.panel-title p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.panel-title p {
  margin-top: 4px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 18px 24px 0;
}

.progress span {
  height: 4px;
  border-radius: 99px;
  background: #e8e9f3;
}

.progress span.active {
  background: var(--primary);
}

.redeem-body,
.panel-body {
  position: relative;
  padding: 24px;
}

.form-panel {
  display: none;
}

.form-panel.active {
  display: block;
  animation: lift .22s ease;
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field {
  margin-top: 18px;
}

.field:first-child {
  margin-top: 0;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #374151;
  margin-bottom: 8px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #dfe3ed;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: .16s ease;
}

.field input {
  height: 48px;
  padding: 0 15px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0;
}

.field textarea {
  min-height: 138px;
  padding: 14px 15px;
  resize: vertical;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91, 92, 246, .10);
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.help-row {
  display: flex;
  gap: 10px;
  margin: 14px 0 18px;
  flex-wrap: wrap;
}

.mini-link {
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #cfd3df;
  background: #fff;
  color: #111827;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.mini-link:hover {
  color: var(--primary);
  border-color: #d7d8ff;
}

.btn {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  background: var(--button-dark);
  font-size: 15px;
  font-weight: 760;
  cursor: pointer;
  transition: .18s ease;
  box-shadow: 0 14px 34px rgba(17, 24, 39, .24);
}

.btn:hover {
  background: #000;
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: .62;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  color: #111827;
  background: #fff;
  border: 1px solid #cfd3df;
  box-shadow: none;
}

.btn-ghost:hover {
  border-color: #cfd3df;
  background: #fff;
  transform: translateY(-1px);
}

.full {
  width: 100%;
}

.back {
  margin-top: 10px;
}

.result {
  text-align: center;
  padding: 12px 0 8px;
}

.result-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--success);
}

.result-icon svg {
  width: 34px;
  height: 34px;
}

.result h3 {
  font-size: 24px;
}

.result p {
  margin: 10px auto 22px;
  max-width: 320px;
  color: var(--muted);
  line-height: 1.7;
}

.loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #e1e4ef;
  border-top-color: var(--primary);
  animation: spin .72s linear infinite;
}

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

.toast {
  position: fixed;
  right: 24px;
  top: 86px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 16px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  font-weight: 700;
  font-size: 14px;
}

.toast.ok {
  background: #065f46;
}

.toast.err {
  background: #991b1b;
}

.toast.warn {
  background: #92400e;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 34px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  background: #fff;
}

.query-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 82px 0 90px;
}

.query-hero {
  text-align: center;
  margin-bottom: 34px;
}

.query-panel {
  width: min(620px, 100%);
  margin: 0 auto;
  overflow: hidden;
}

.query-panel .btn {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  background: var(--primary);
  box-shadow: 0 14px 34px rgba(91,92,246,.22);
  font-weight: 900;
}

.query-panel .btn:hover {
  background: var(--primary-dark);
}

.query-result {
  display: none;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbff;
}

.query-result.show {
  display: block;
}

.result-list {
  display: grid;
  gap: 12px;
}

.result-summary {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.status-line strong {
  font-size: 18px;
}

.pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.pill.active,
.pill.success,
.pill.used {
  color: #047857;
  background: #ecfdf5;
}

.pill.receipt_used,
.pill.receipt_invalid,
.pill.failed,
.pill.disabled,
.pill.invalid,
.pill.error {
  color: #b91c1c;
  background: #fef2f2;
}

.detail {
  margin-top: 14px;
  display: grid;
  gap: 9px;
  color: #374151;
  font-size: 14px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #edf0f6;
  padding-top: 9px;
}

.detail-row span:first-child {
  color: var(--muted);
}

.detail-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .redeem-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .nav {
    height: auto;
    min-height: 66px;
    padding: 10px 14px;
    gap: 10px;
    align-items: flex-start;
  }

  .brand {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .brand-mark {
    width: 44px;
    height: 32px;
  }

  .nav-links {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
  }

  .nav-links a:not(.query-nav) {
    display: none;
  }

  .query-page .nav-links a:not(.query-nav) {
    display: inline-flex;
  }

  .nav-links .query-nav {
    height: 34px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .hero {
    padding: 46px 16px 24px;
  }

  .hero h1,
  .query-hero h1 {
    font-size: 38px;
    line-height: 1.12;
  }

  .hero p,
  .query-hero p {
    font-size: 15px;
  }

  .main-grid {
    margin-top: 34px;
    padding: 0 14px;
    gap: 18px;
  }

  .info-panel,
  .redeem-head,
  .redeem-body,
  .panel-head,
  .panel-body {
    padding: 20px;
  }

  .panel {
    border-radius: 16px;
  }

  .step {
    grid-template-columns: 38px 1fr;
    gap: 12px;
    padding: 14px;
  }

  .step-num {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .redeem-title,
  .panel-title {
    align-items: flex-start;
  }

  .lock {
    flex: 0 0 auto;
    width: 48px;
    height: 40px;
  }

  .progress {
    padding: 16px 20px 0;
  }

  .field input {
    font-size: 14px;
  }

  .field textarea {
    font-size: 12px;
  }

  .help-row {
    gap: 8px;
  }

  .mini-link {
    flex: 1 1 130px;
    justify-content: center;
  }

  .toast {
    left: 14px;
    right: 14px;
    top: 78px;
    max-width: none;
  }

  .query-shell {
    width: min(100% - 28px, 960px);
    padding: 44px 0 70px;
  }

  .query-hero {
    margin-bottom: 24px;
  }

  .status-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .detail-row strong {
    max-width: 100%;
    text-align: left;
  }
}

@media (max-width: 420px) {
  .brand {
    gap: 8px;
    font-size: 15px;
  }

  .nav-links .query-nav {
    padding: 0 10px;
    font-size: 12px;
  }

  .hero h1,
  .query-hero h1 {
    font-size: 34px;
  }

  .info-panel h2 {
    font-size: 28px;
  }

  .hero-actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }
}
