:root {
  color: #182128;
  background: #eef2f4;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-synthesis: none;
  --ink: #182128;
  --muted: #65727a;
  --line: #d9e0e4;
  --paper: #ffffff;
  --accent: #ffcf20;
  --blue: #1e648a;
  --green: #13734b;
  --red: #b43a32;
  --amber: #9c5c00;
  --shadow: 0 18px 50px rgba(31, 44, 51, 0.09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 207, 32, 0.22), transparent 26rem),
    linear-gradient(180deg, #f7f9fa 0, #eef2f4 50rem);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.52; }

.page-shell {
  width: min(720px, calc(100% - 28px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 5px 24px;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 17px;
  background: var(--accent);
  color: #1c1908;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 9px 24px rgba(181, 139, 0, 0.22);
}

h1, h2, h3, p { margin-top: 0; }
.hero h1 { margin-bottom: 4px; font-size: clamp(25px, 6vw, 34px); }
.subtitle { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow { margin-bottom: 5px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: 0.1em; }

.card,
.help-card {
  border: 1px solid rgba(194, 204, 210, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.redeem-card, .result-card { padding: 28px; }
.result-card, .help-card { margin-top: 18px; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 30px;
}

.steps span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7a878e;
  font-size: 12px;
  font-weight: 700;
}

.steps b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #e9eef0;
  color: #68757c;
}

.steps .is-active { color: var(--ink); }
.steps .is-active b { background: var(--accent); color: #211d08; }

.redeem-card h2, .result-card h2 { margin-bottom: 8px; font-size: clamp(22px, 5vw, 28px); }
.helper { margin-bottom: 24px; color: var(--muted); line-height: 1.65; }

.code-form { display: grid; gap: 10px; }
.code-form label { color: #33414a; font-size: 14px; font-weight: 800; }

input {
  width: 100%;
  height: 54px;
  padding: 0 15px;
  border: 1px solid #cbd5da;
  border-radius: 13px;
  background: #fbfcfc;
  color: var(--ink);
  outline: none;
}

#codeInput {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input:focus {
  border-color: #28749e;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(40, 116, 158, 0.13);
}

.primary-button,
.secondary-button,
.danger-button,
.copy-button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button { background: var(--accent); color: #201c08; }
.secondary-button, .copy-button { border: 1px solid #ccd6db; background: #fff; color: #2e3c44; }
.danger-button { background: #bc3d34; color: #fff; }
.full-button { width: 100%; margin-top: 20px; }

.status-panel {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid #dce3e7;
  border-radius: 15px;
  background: #f7f9fa;
}

.status-icon,
.success-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: #e6ecef;
  color: #52626b;
  font-size: 21px;
  font-weight: 900;
}

.status-panel h3 { margin-bottom: 5px; font-size: 17px; }
.status-panel p { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.status-copy { flex: 1; min-width: 0; }
.status-panel.is-loading .status-icon { background: #dcecf6; color: var(--blue); }
.status-panel.is-unused { border-color: #efd39c; background: #fffbf2; }
.status-panel.is-unused .status-icon { background: #ffe8b9; color: var(--amber); }
.status-panel.is-active { border-color: #b9dfcd; background: #f4fbf7; }
.status-panel.is-active .status-icon { background: #d9f0e4; color: var(--green); }
.status-panel.is-error { border-color: #edc4c1; background: #fff6f5; }
.status-panel.is-error .status-icon { background: #f6dcda; color: var(--red); }
.inline-action { width: 100%; margin-top: 15px; }

.success-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.success-heading h2 { margin-bottom: 0; }
.success-icon { background: #d9f0e4; color: var(--green); }

.install-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 17px;
  padding: 15px;
  border-radius: 13px;
  background: #eef6fb;
}

.install-tip a { color: #176a99; font-weight: 800; }
.link-list { display: grid; gap: 14px; }

.link-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.field-label { margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.field-value { overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: 13px; line-height: 1.55; }
.button-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 13px; }
.open-button { display: grid; place-items: center; }
.app-title { margin: 13px 0 0; color: var(--muted); }

.invite-panel,
.resolve-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  padding: 14px;
  border-radius: 12px;
  background: #f3f6f7;
}

.invite-panel span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.invite-panel strong { font-family: Consolas, monospace; font-size: 22px; letter-spacing: 0.07em; }
.resolve-panel p { margin: 0; color: var(--muted); font-size: 13px; }
.activation-time { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

.help-card { padding: 22px 25px; }
.help-card h2 { margin-bottom: 12px; font-size: 19px; }
.help-card ol { margin: 0; padding-left: 21px; color: var(--muted); line-height: 1.9; }

footer { display: flex; justify-content: center; gap: 18px; padding: 22px 0 0; color: #829097; font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  max-width: calc(100% - 36px);
  padding: 13px 17px;
  border-radius: 12px;
  background: #1f2a31;
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 24, 29, 0.24);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

dialog {
  width: min(460px, calc(100% - 28px));
  padding: 27px;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(16, 24, 29, 0.34);
}

dialog::backdrop { background: rgba(22, 31, 36, 0.6); backdrop-filter: blur(3px); }
.dialog-icon { display: grid; width: 44px; height: 44px; margin-bottom: 16px; place-items: center; border-radius: 13px; background: #ffe5b4; color: #995800; font-size: 24px; font-weight: 900; }
dialog h2 { margin-bottom: 9px; }
dialog p { color: var(--muted); line-height: 1.6; }
.dialog-summary { margin: 18px 0; padding: 14px; border-radius: 12px; background: #f3f6f7; }
.dialog-summary span, .dialog-summary strong { display: block; }
.dialog-summary span { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.dialog-summary strong { font-family: Consolas, monospace; }
.confirm-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; color: #38464e; font-size: 14px; line-height: 1.5; }
.confirm-check input { width: 19px; height: 19px; flex: 0 0 auto; margin: 1px 0 0; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 540px) {
  .page-shell { width: min(100% - 18px, 720px); padding-top: 18px; }
  .redeem-card, .result-card { padding: 20px 17px; border-radius: 18px; }
  .steps span { align-items: flex-start; flex-direction: column; gap: 4px; }
  .steps b { width: 22px; height: 22px; }
  .install-tip, .invite-panel, .resolve-panel { align-items: stretch; flex-direction: column; }
  .button-row { grid-template-columns: 1fr; }
  .copy-button { width: 100%; }
  footer { align-items: center; flex-direction: column; gap: 5px; }
}

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