:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  font-size: 15px;
  color: #0f172a;
  background: #f7faff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --muted: #64748b;
  --border: #dbe4f0;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #f7faff, #eef2ff 48%, #f5fbff); }
main { max-width: 1040px; margin: auto; padding: 0 24px 48px; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
.header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 750; letter-spacing: 1.5px; font-size: 18px; }
.brand span { color: var(--primary); }
.badge { color: #475569; font-size: 12px; background: #ffffffc7; border: 1px solid #dbe4f0; padding: 7px 12px; border-radius: 20px; }
.layout { max-width: 720px; margin: auto; }
.intro { text-align: center; padding: 26px 0 28px; }
h1 { font-size: 34px; line-height: 1.4; font-weight: 750; margin: 0 0 8px; }
.lead { color: var(--muted); line-height: 1.7; margin: 0; }
.panel { min-width: 0; padding: 32px; border: 1px solid #ffffffb3; border-radius: 22px; background: linear-gradient(145deg, #fff, #fbfdff); box-shadow: 0 20px 45px #0f172a1a; }
.view-switch { display: flex; gap: 6px; width: fit-content; padding: 4px; background: #eef3fb; border-radius: 12px; margin-bottom: 26px; }
.view-switch button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; padding: 10px 22px; color: #475569; font-size: 14px; font-weight: 600; }
.view-switch button[aria-pressed="true"] { color: var(--primary); background: #fff; box-shadow: 0 2px 6px #0f172a0a; }
.view-switch button:hover { color: var(--primary); }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; padding: 0 0 24px; margin: 0 0 28px; border-bottom: 1px solid var(--border); }
.steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }
.steps li + li::before { content: ""; position: absolute; top: 14px; right: calc(50% + 22px); width: calc(100% - 44px); height: 1px; background: var(--border); }
.step-number { z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; background: #edf2fa; color: #64748b; border-radius: 50%; font-size: 13px; font-weight: 600; }
.steps li[aria-current="step"] { color: var(--primary); font-weight: 600; }
.steps li[aria-current="step"] .step-number { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px #eff6ff; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h2 { margin: 0; font-size: 24px; line-height: 1.4; font-weight: 700; }
label { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 550; line-height: 1.5; }
input:not([type="checkbox"]), textarea { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; color: #0f172a; background: #fff; }
textarea::placeholder { color: #64748b; }
input:not([type="checkbox"]):focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px #2563eb14; }
textarea[aria-invalid="true"] { border-color: #b91c1c; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.65; }
.code-row { display: flex; gap: 12px; }
.code-row input { min-width: 0; flex: 1; }
.primary, .secondary, .text-button { min-height: 44px; border-radius: 9px; font-size: 14px; }
.primary { display: flex; align-items: center; justify-content: center; width: 100%; border: 1px solid var(--primary); padding: 13px 20px; background: var(--primary); color: #fff; font-weight: 600; }
.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.code-row .primary { width: auto; white-space: nowrap; }
.secondary { border: 1px solid var(--border); padding: 11px 16px; background: #fff; color: #334155; font-weight: 500; }
.secondary:hover { background: #f3f7fd; border-color: #b8cae4; }
.text-button { padding: 10px 8px; border: 0; background: transparent; color: var(--primary); white-space: nowrap; }
.text-button:hover { background: #eff6ff; }
.field-hint { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 12px 0 20px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 22px; margin-bottom: 8px; }
.label-row label { margin: 0; }
.session-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.session-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--primary); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.session-link:hover { color: var(--primary-hover); }
.consent { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; margin: 20px 0; color: #475569; font-weight: 400; font-size: 13px; line-height: 1.8; cursor: pointer; }
.consent input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.demo { color: #854d0e; font-size: 13px; line-height: 1.7; border: 1px solid #fde68a; background: #fffbeb; border-radius: 9px; padding: 12px; margin-bottom: 20px; }
.error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; padding: 12px; border-radius: 9px; font-size: 13px; line-height: 1.7; }
.result { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--border); }
.result-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.result-head h3 { flex: 1; min-width: 0; margin: 0; font-size: 18px; line-height: 1.6; }
dl { margin: 20px 0; }
dl div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; font-size: 13px; line-height: 1.7; }
dt { color: var(--muted); white-space: nowrap; }
dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.warning { padding: 12px; color: #854d0e; background: #fffbeb; border-radius: 9px; font-size: 13px; line-height: 1.7; }
#update-form { margin-top: 20px; padding-top: 4px; }
#redeem-confirm { width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 28px; border: 1px solid var(--border); border-radius: 20px; color: #0f172a; background: #fff; box-shadow: 0 24px 80px #0f172a33; overflow: auto; }
#redeem-confirm::backdrop { background: #0f172a66; backdrop-filter: blur(3px); }
#redeem-confirm h2 { font-size: 23px; }
#redeem-confirm dl { margin: 22px 0; }
#redeem-confirm dl div { padding: 12px 0; font-size: 14px; }
#redeem-confirm dl div + div { border-top: 1px solid var(--border); }
.dialog-actions { display: flex; gap: 12px; margin-top: 24px; }
.dialog-actions button { flex: 1; min-width: 0; padding: 12px 16px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
@media (max-width: 600px) {
  main { padding: 0 16px 32px; }
  .header { min-height: 64px; }
  .intro { padding: 20px 0 24px; }
  h1 { font-size: 28px; }
  .lead { font-size: 14px; }
  .panel { padding: 24px; border-radius: 18px; }
  .view-switch { margin-bottom: 24px; }
  .view-switch button { padding-inline: 18px; }
  .steps { margin-bottom: 24px; }
  .steps li { font-size: 12px; }
  .panel-heading { gap: 8px; margin-bottom: 20px; }
  h2 { font-size: 21px; }
  .code-row { flex-direction: column; }
  .code-row .primary { width: 100%; }
}
@media (max-width: 400px) {
  .panel { padding: 20px; }
  .steps li { gap: 7px; }
  .panel-heading { flex-wrap: wrap; }
  #redeem-confirm { padding: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, a, input, textarea { transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease; }
  #redeem-confirm[open] { animation: confirm-enter .18s ease-out; }
  @keyframes confirm-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}
