:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #e0e8f0;
  background: #0b1b2e;
  --surface: #10243f;
  --border: #2a5080;
  --accent: #4fc3f7;
  --muted: #9ab0c7;
  --input: #0b1b2e;
}
* { box-sizing: border-box; }
body { margin: 0; }
header {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px;
  min-height: 64px; padding: 19px max(20px, calc((100% - 960px) / 2));
  border-bottom: 1px solid #1b3a5e;
  background: linear-gradient(135deg, #0d2a4a, #0a1f38);
  font-size: 14px; color: var(--muted);
}
header a { color: var(--accent); font-weight: 700; font-size: 17px; text-decoration: none; }
main { width: min(100% - 36px, 560px); margin: clamp(30px, 8vh, 82px) auto; }
h1 { margin: 0 0 8px; line-height: 1.25; font-size: clamp(23px, 6vw, 30px); }
p, dl { line-height: 1.6; }
.intro { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
form, .result {
  display: grid; gap: 17px; padding: clamp(16px, 4vw, 24px);
  border: 1px solid #1d3c61; border-radius: 10px; background: var(--surface);
}
label { display: grid; gap: 8px; min-width: 0; font-size: 14px; font-weight: 600; }
input, textarea, button { font: inherit; color: inherit; }
input, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--input); font-size: 16px; font-weight: 400;
}
input:read-only { color: var(--muted); }
textarea, #machine, #cdkey { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
textarea { resize: vertical; line-height: 1.45; overflow-wrap: anywhere; }
::placeholder { color: var(--muted); font-family: system-ui, sans-serif; font-size: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button {
  width: fit-content; min-height: 42px; padding: 8px 15px; border: 1px solid var(--border);
  border-radius: 6px; background: #132b4a; cursor: pointer; font-weight: 650;
}
button.primary { background: #1565c0; border-color: #1565c0; color: #fff; }
button:hover { filter: brightness(1.15); }
.result { margin-block: 16px; }
.result p, .result dl, .alert { margin: 0; }
dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 12px; font-size: 14px; }
dt, .result p, .totals { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.result .success { color: #b7e1c3; font-weight: 700; }
.alert { color: #ffc3c8; border-inline-start: 3px solid #f1949f; padding-inline-start: 10px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; font-size: 14px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.public {
  color-scheme: light;
  color: #102c29;
  background: #f7faf9;
  min-height: 100dvh;
  --public-border: #cedbd7;
  --public-muted: #4b6561;
  --public-action: #086b60;
  --public-focus: #08786b;
}
.public-header {
  background: #fff;
  min-height: 66px;
  border-color: #e2eae7;
  padding: 14px max(22px, calc((100% - 920px) / 2));
}
.public-header a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #193431;
  font-size: 14px;
  letter-spacing: .025em;
}
.public-header img { display: block; border-radius: 9px; }
.public main { width: min(100% - 44px, 420px); margin: clamp(33px, 7vh, 68px) auto 42px; }
.public-heading { margin-bottom: 26px; }
.public-heading h1 {
  margin: 0 0 9px;
  color: #102c29;
  font-size: clamp(29px, 8vw, 38px);
  letter-spacing: -.045em;
}
.public-heading p { margin: 0; color: var(--public-muted); font-size: 14px; }
.public :focus-visible { outline-color: var(--public-focus); }

.public .redeem-form, .redeem-result {
  display: grid;
  gap: 20px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.device-ticket {
  min-width: 0;
  padding: 17px 18px 19px;
  border: 1px solid #21534c;
  border-radius: 15px;
  color: #f4fffb;
  background: #123a34;
}
.device-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
  color: #c3ded6;
  font-size: 12px;
  font-weight: 600;
}
.verified-device { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.verified-device i { width: 6px; height: 6px; border-radius: 50%; background: #82dfc0; }
.device-ticket code {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 300px);
  gap: 8px;
  font: 600 clamp(14px, 4.3vw, 18px) / 1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .05em;
}
.public label { gap: 7px; }
.public input:not([type='hidden']), .public textarea {
  min-height: 52px;
  border: 1px solid var(--public-border);
  border-radius: 10px;
  background: #fff;
}
.public input::placeholder, .public textarea::placeholder { color: #627872; }
.public #cdkey::placeholder { font: inherit; }
.public button.primary {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--public-action);
  border-radius: 10px;
  background: var(--public-action);
  color: #fff;
  font-size: 15px;
  letter-spacing: .025em;
}
.public button.primary:hover { background: #07574e; filter: none; }
.public button.primary:active { background: #06453e; }
.public .alert {
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: #fbeaea;
  color: #8b2828;
  font-size: 13px;
}
.success-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 13px;
  border-radius: 50%;
  color: var(--public-action);
  background: #dcefe8;
}
.success-mark::after {
  content: '';
  display: block;
  width: 8px;
  height: 14px;
  border: solid currentColor;
  border-width: 0 2.5px 2.5px 0;
  transform: translateY(-2px) rotate(45deg);
}
.license-facts {
  display: grid;
  grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr);
  gap: 12px;
  margin: 0;
  padding: 16px 17px;
  border: 1px solid var(--public-border);
  border-radius: 13px;
  background: #fff;
}
.license-facts div + div { border-inline-start: 1px solid #e3eae7; padding-inline-start: 13px; }
.license-facts dt { margin-bottom: 5px; color: var(--public-muted); font-size: 12px; }
.license-facts dt span { display: inline-block; margin-inline-start: 3px; }
.license-facts dd { color: #163530; font-size: 14px; font-variant-numeric: tabular-nums; }
.license-facts dd strong { font-size: 18px; }
.copy-control [role='status']:not(:empty) { display: block; margin-top: 8px; color: var(--public-muted); font-size: 13px; }
.code-disclosure summary {
  width: fit-content;
  min-height: 42px;
  padding-block: 10px;
  color: var(--public-action);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}
.code-disclosure textarea { display: block; margin-top: 4px; font-size: 14px; }
.result-device { margin: 0 0 8px; color: var(--public-muted); font-size: 13px; }
.result-device code { display: block; overflow-wrap: anywhere; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
