:root {
  --page: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --border-soft: #e5e7eb;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #059669;
  --danger: #dc2626;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
  font-family: "Segoe UI", "Microsoft YaHei UI", Arial, sans-serif;
  color: var(--text);
  background: var(--page);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

.activation-shell {
  min-height: 100vh;
  padding: 32px 16px;
}

.activation-panel {
  width: min(100%, 672px);
  min-height: 600px;
  margin: 0 auto;
  padding: 32px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.page-header {
  margin-bottom: 38px;
  text-align: center;
}

.key-mark {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #eff6ff;
}

.key-head {
  position: absolute;
  top: 20px;
  left: 18px;
  width: 17px;
  height: 17px;
  border: 4px solid var(--primary);
  border-radius: 50%;
}

.key-stem {
  position: absolute;
  top: 31px;
  left: 32px;
  width: 19px;
  height: 4px;
  transform: rotate(-40deg);
  transform-origin: left center;
  border-radius: 2px;
  background: var(--primary);
}

.key-stem::before,
.key-stem::after {
  position: absolute;
  right: 2px;
  width: 4px;
  height: 8px;
  content: "";
  background: var(--primary);
}

.key-stem::before {
  top: -5px;
}

.key-stem::after {
  top: 2px;
  right: 7px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.25;
}

.page-header p,
.section-copy,
.ready-hint,
.product-result {
  color: var(--muted);
}

.page-header p {
  margin-bottom: 0;
  font-size: 16px;
}

.steps {
  display: grid;
  grid-template-columns: 90px 1fr 90px 1fr 90px;
  align-items: start;
  margin-bottom: 40px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--muted);
  text-align: center;
}

.step span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  transition: background 180ms ease, color 180ms ease;
}

.step p {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.35;
}

.step.is-active {
  color: var(--primary);
}

.step.is-active span {
  background: var(--primary);
  color: #ffffff;
}

.step-line {
  position: relative;
  height: 4px;
  margin-top: 14px;
  overflow: hidden;
  background: #e5e7eb;
}

.step-line i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--primary);
  transition: width 350ms ease;
}

.step-line i.is-complete {
  width: 100%;
}

.step-content {
  animation: fade-in 180ms ease-out;
}

.step-content.is-hidden {
  display: none;
}

#product-selection.is-hidden {
  display: none;
}

h2 {
  margin-bottom: 12px;
  font-size: 20px;
  line-height: 1.4;
}

.section-copy {
  margin-bottom: 24px;
  line-height: 1.65;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  height: 44px;
  margin-bottom: 16px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

select:disabled {
  background: #f3f4f6;
  color: var(--muted);
}

input::placeholder {
  color: #9ca3af;
}

.product-preview {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  min-height: 112px;
  align-items: center;
  gap: 18px;
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface-muted);
}

.product-preview img {
  display: block;
  width: 76px;
  height: 92px;
  object-fit: contain;
}

.product-preview figcaption {
  overflow: hidden;
  color: #374151;
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.28);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-primary {
  width: 100%;
  background: var(--primary);
  color: #ffffff;
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary {
  width: 100%;
  border-color: var(--border);
  background: #f9fafb;
  color: #374151;
}

.button-secondary:hover:not(:disabled) {
  background: #f3f4f6;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lock-icon {
  position: relative;
  width: 14px;
  height: 12px;
  margin-right: 9px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.lock-icon::before {
  position: absolute;
  bottom: 8px;
  left: 1px;
  width: 8px;
  height: 7px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  content: "";
}

.message {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 14px;
}

.message:empty {
  min-height: 0;
  margin: 0;
}

.message.is-success {
  color: var(--success);
}

.message.is-error {
  color: var(--danger);
}

.ready-hint {
  margin: 4px 0 0;
  font-size: 12px;
}

.code-frame {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface-muted);
}

#unlock-code {
  display: grid;
  min-height: 66px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #f1f5f9;
  border-radius: 5px;
  background: #ffffff;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.product-result {
  min-height: 20px;
  margin-bottom: 16px;
  text-align: center;
  font-size: 13px;
}

#copy-button {
  margin-bottom: 12px;
}

@keyframes fade-in {
  from {
    transform: translateY(3px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 560px) {
  .activation-shell {
    padding: 16px 10px;
  }

  .activation-panel {
    min-height: calc(100vh - 32px);
    padding: 24px 18px;
  }

  .page-header {
    margin-bottom: 30px;
  }

  h1 {
    font-size: 25px;
  }

  .page-header p {
    font-size: 14px;
  }

  .steps {
    grid-template-columns: 74px 1fr 74px 1fr 74px;
    margin-bottom: 34px;
  }

  .step p {
    font-size: 12px;
  }

  .step-line {
    margin-right: 4px;
    margin-left: 4px;
  }

  .section-copy {
    font-size: 14px;
  }

  .product-preview {
    grid-template-columns: 72px minmax(0, 1fr);
    min-height: 96px;
    gap: 14px;
    padding: 10px 12px;
  }

  .product-preview img {
    width: 62px;
    height: 76px;
  }
}

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