:root {
  color-scheme: light;
  --ink: #151a17;
  --muted: #68716b;
  --line: #dfe5e0;
  --surface: #ffffff;
  --wash: #f4f7f4;
  --green: #148552;
  --green-dark: #0c633c;
  --green-pale: #e8f5ed;
  --yellow: #f0bb35;
  --red: #b83b3b;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--wash); letter-spacing: 0; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.topbar {
  height: 68px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: white; background: var(--ink); border-radius: 6px; font-size: 14px; }
.secure-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-pale); }

main { min-height: calc(100vh - 132px); }
.workspace { width: min(100% - 32px, 1040px); margin: 0 auto; padding: clamp(54px, 8vw, 94px) 0 48px; }
.intro { max-width: 650px; }
.eyebrow { margin: 0 0 12px; color: var(--green-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 0; max-width: 620px; font-size: 48px; line-height: 1.08; font-weight: 760; text-wrap: balance; }
.lede { margin: 20px 0 0; max-width: 580px; color: var(--muted); font-size: 17px; line-height: 1.75; }

.redeem-panel { margin-top: 42px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
label, .data-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
input { width: 100%; height: 52px; padding: 0 16px; color: var(--ink); background: #fbfcfb; border: 1px solid #cbd3cd; border-radius: 6px; outline: none; text-transform: uppercase; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 133, 82, .12); }
input::placeholder { color: var(--muted); text-transform: none; }
.primary-button, .secondary-button { min-height: 52px; padding: 0 24px; border: 0; border-radius: 6px; font-weight: 750; }
.primary-button { color: white; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { background: #8db7a1; }
.secondary-button { min-width: 126px; color: var(--ink); background: white; border: 1px solid #bac4bd; }
.secondary-button:hover:not(:disabled) { border-color: var(--ink); }
.secondary-button:active:not(:disabled) { background: #edf1ee; }
.secondary-button:disabled { color: #9aa29d; background: #f1f3f1; }
.primary-button:focus-visible, .secondary-button:focus-visible, .text-button:focus-visible, .brand:focus-visible { outline: 3px solid rgba(20, 133, 82, .28); outline-offset: 3px; }
.field-error { min-height: 20px; margin: 8px 0 0; color: var(--red); font-size: 13px; }
.trust-line { display: flex; flex-wrap: wrap; gap: 12px 28px; padding-top: 18px; border-top: 1px solid #edf0ed; color: var(--muted); font-size: 12px; }
.trust-line span::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 8px; border-radius: 50%; background: var(--green); vertical-align: 2px; }

.activation { margin-top: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.activation-head { padding: 24px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.section-context { margin: 0 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
h2 { margin: 0; font-size: 20px; }
.state-badge { min-width: 114px; padding: 8px 11px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; color: var(--green-dark); background: var(--green-pale); font-size: 12px; font-weight: 750; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.5s infinite; }
.state-badge.completed { color: white; background: var(--green); }
.state-badge.error { color: var(--red); background: #fbebeb; }

.activation-grid { display: grid; grid-template-columns: 1.2fr .8fr; }
.number-block, .code-block { min-height: 176px; padding: 28px; }
.number-block { border-right: 1px solid var(--line); }
.copy-line { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.copy-line strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 31px; overflow-wrap: anywhere; }
.text-button { padding: 7px 10px; color: var(--green-dark); background: transparent; border: 1px solid #b9d7c6; border-radius: 5px; font-size: 12px; font-weight: 750; }
.text-button.light { color: white; border-color: rgba(255,255,255,.5); }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.code-block { color: white; background: var(--ink); }
.code-block .data-label { color: #aeb7b1; }
.code-waiting { min-height: 75px; display: flex; align-items: center; gap: 13px; color: #dbe1dd; }
.scanner { width: 34px; height: 34px; border: 2px solid #536059; border-top-color: var(--yellow); border-radius: 50%; animation: spin 1s linear infinite; flex: 0 0 auto; }
.code-ready { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.code-ready strong { color: #fff; font-family: "SFMono-Regular", Consolas, monospace; font-size: 42px; overflow-wrap: anywhere; }

.progress-area { padding: 20px 28px 24px; border-top: 1px solid var(--line); }
.progress-copy { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.progress-copy strong { color: var(--ink); font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.progress-track { height: 6px; overflow: hidden; border-radius: 3px; background: #e7ebe8; }
.progress-track span { display: block; width: 100%; height: 100%; background: var(--green); transition: width 1s linear; }
.message-box { margin: 0 28px 22px; padding: 16px; background: #f3f6f4; border: 1px solid #d7e8dc; border-radius: 6px; }
.message-box p { margin: 0; color: #3d4741; line-height: 1.6; overflow-wrap: anywhere; }
.activation-actions { min-height: 82px; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #fafbfa; border-top: 1px solid var(--line); }
.activation-actions p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.rules-strip { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #d7ddd8; border-bottom: 1px solid #d7ddd8; }
.rules-strip div { padding: 22px 20px; display: grid; gap: 4px; }
.rules-strip div + div { border-left: 1px solid #d7ddd8; }
.rules-strip strong { font-size: 20px; }
.rules-strip span { color: var(--muted); font-size: 12px; }

footer { min-height: 64px; padding: 20px; display: grid; place-items: center; color: #8b938e; background: var(--ink); text-align: center; font-size: 12px; }
footer p { margin: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(360px, calc(100vw - 40px)); padding: 12px 16px; color: white; background: var(--ink); border-radius: 6px; box-shadow: 0 12px 36px rgba(0,0,0,.2); font-size: 13px; z-index: 10; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 700px) {
  .workspace { width: min(100% - 24px, 1040px); padding-top: 42px; }
  h1 { font-size: 36px; }
  .redeem-panel { padding: 20px; }
  .input-row { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .trust-line { display: grid; gap: 9px; }
  .activation-head { align-items: flex-start; gap: 14px; }
  .state-badge { min-width: auto; }
  .activation-grid { grid-template-columns: 1fr; }
  .number-block { border-right: 0; border-bottom: 1px solid var(--line); }
  .number-block, .code-block { min-height: 150px; padding: 22px; }
  .copy-line strong { font-size: 24px; }
  .code-ready strong { font-size: 34px; }
  .activation-actions { align-items: stretch; flex-direction: column; }
  .secondary-button { width: 100%; }
  .rules-strip { grid-template-columns: 1fr; }
  .rules-strip div { grid-template-columns: 94px 1fr; align-items: center; padding: 14px 8px; }
  .rules-strip div + div { border-left: 0; border-top: 1px solid #d7ddd8; }
}

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