:root {
  color-scheme: light;
  --bg: #f6fbff;
  --grid: rgba(30, 118, 205, 0.08);
  --card: #ffffff;
  --text: #07192f;
  --muted: #66758a;
  --line: #d5e3f2;
  --line-strong: #99bce8;
  --blue: #236bd8;
  --blue-dark: #164da8;
  --cyan: #10a7ba;
  --soft-blue: #eaf3ff;
  --soft-cyan: #e8fbfc;
  --danger: #c74444;
  --shadow: 0 24px 70px rgba(30, 95, 160, 0.13);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(60, 133, 230, 0.22), transparent 24rem),
    radial-gradient(circle at 82% 18%, rgba(16, 167, 186, 0.16), transparent 26rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 247, 255, 0.92) 48%, rgba(246, 253, 255, 0.98)),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(255, 255, 255, 0.72) 28% 38%, transparent 38%),
    linear-gradient(155deg, transparent 0 61%, rgba(35, 107, 216, 0.07) 61% 71%, transparent 71%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.74) 52%, transparent 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(820px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px 0 36px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 44px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(35, 107, 216, 0.22);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 18px 34px rgba(35, 107, 216, 0.2);
}

.brand-mark svg {
  width: 29px;
  height: 29px;
  overflow: visible;
  fill: none;
  stroke: #fff;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark circle {
  stroke-width: 2.6;
}

.brand strong {
  display: block;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 850;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.outline-button,
.secondary-button,
.link-button,
.primary-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 760;
  letter-spacing: 0;
  text-decoration: none;
}

.outline-button {
  border: 1px solid #b9d2f4;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(35, 107, 216, 0.08);
}

.outline-button:hover,
.secondary-button:hover,
.link-button:hover {
  background: var(--soft-blue);
}

.primary-button {
  width: 100%;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 12px 28px rgba(35, 107, 216, 0.18);
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--blue-dark), #0d8fa0);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.primary-button.is-complete:disabled {
  opacity: 1;
  cursor: default;
  background: linear-gradient(135deg, #13866f, #19a36d);
  box-shadow: 0 12px 28px rgba(19, 134, 111, 0.18);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--blue-dark);
  background: #fff;
}

.link-button {
  min-height: 34px;
  padding: 0;
  color: var(--blue-dark);
  background: transparent;
}

.back-button {
  min-height: 40px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.88);
  font-weight: 760;
  box-shadow: 0 14px 32px rgba(35, 107, 216, 0.08);
}

.back-button:hover {
  background: var(--soft-blue);
}

.hero {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 54px 0 34px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.06;
  font-weight: 920;
  letter-spacing: 0;
  color: #07192f;
  text-wrap: balance;
}

.hero h1::first-letter {
  color: var(--blue);
}

.hero p {
  margin: 16px auto 0;
  color: #4f6178;
  font-size: 16px;
  line-height: 1.8;
  max-width: 580px;
}

.system-badge {
  width: max-content;
  margin: 0 auto 18px;
  border: 1px solid rgba(35, 107, 216, 0.18);
  border-radius: 999px;
  padding: 8px 18px;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 26px rgba(35, 107, 216, 0.08);
  font-size: 17px;
  font-weight: 850;
}

.steps {
  width: min(560px, 100%);
  margin: 0 auto 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  position: relative;
}

.steps::before {
  content: "";
  position: absolute;
  left: 16.5%;
  right: 16.5%;
  top: 18px;
  height: 3px;
  background: #dfeaf6;
}

.step {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #8c99aa;
}

.step span {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: #fff;
  color: #758397;
  font-weight: 850;
}

.step strong {
  font-size: 13px;
  line-height: 1.2;
}

.step.is-active,
.step.is-done {
  color: var(--text);
}

.step.is-active span,
.step.is-done span {
  border-color: transparent;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.exchange-card,
.order-panel,
.account-panel {
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.exchange-card {
  min-height: 222px;
  overflow: hidden;
}

.pane {
  display: none;
  padding: 24px 18px 20px;
}

.pane.is-active {
  display: grid;
  gap: 16px;
}

.pane-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pane-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--blue-dark);
  background: var(--soft-cyan);
  font-weight: 850;
}

.warn-icon {
  color: #c46a00;
  background: #fff4df;
}

h2,
p {
  margin: 0;
}

.pane-heading h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
}

.pane-heading p,
.inline-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.large-input,
.session-input,
.order-input {
  width: 100%;
  border: 1px solid #c6d9ec;
  border-radius: 8px;
  outline: none;
  background: rgba(250, 253, 255, 0.92);
  color: var(--text);
}

.large-input {
  height: 54px;
  padding: 0 16px;
  font-size: 16px;
}

.session-input {
  min-height: 134px;
  resize: vertical;
  padding: 14px 16px;
  font: 14px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.order-input {
  min-height: 158px;
  resize: vertical;
  padding: 16px;
  font-size: 16px;
  line-height: 1.6;
}

.large-input:focus,
.session-input:focus,
.order-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(35, 107, 216, 0.1);
}

.split-actions {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
}

.help-box {
  border: 1px solid #c4daf8;
  border-radius: 8px;
  padding: 14px 16px 14px 46px;
  color: var(--blue-dark);
  background: #eaf3ff;
  position: relative;
}

.help-box::before {
  content: "i";
  position: absolute;
  left: 15px;
  top: 16px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--blue);
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
}

.help-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-dark);
  font-size: 15px;
}

.help-box ol {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
}

.help-box a {
  color: var(--blue-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inline-note.is-error {
  color: var(--danger);
  font-weight: 760;
}

.account-panel {
  margin-top: 14px;
  border-top-width: 1px;
  box-shadow: 0 18px 44px rgba(30, 95, 160, 0.08);
}

.account-panel dl {
  margin: 0;
  padding: 0 18px;
}

.account-panel div {
  min-height: 44px;
  border-bottom: 1px solid #e7eef6;
  display: grid;
  grid-template-columns: minmax(110px, 0.36fr) 1fr;
  align-items: center;
  gap: 16px;
}

.account-panel div:last-child {
  border-bottom: 0;
}

.account-panel dt,
.account-panel dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.account-panel dt {
  color: var(--text);
  font-weight: 760;
}

.account-panel dd {
  color: #42566d;
  text-align: right;
  word-break: break-word;
}

.confirm-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}

.confirm-list div {
  min-height: 44px;
  border-bottom: 1px solid #e7eef6;
  display: grid;
  grid-template-columns: minmax(110px, 0.36fr) 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
}

.confirm-list div:last-child {
  border-bottom: 0;
}

.confirm-list span {
  color: var(--text);
  font-size: 15px;
}

.confirm-list strong {
  color: #42566d;
  text-align: right;
  font-size: 15px;
  font-weight: 520;
  word-break: break-word;
}

.warning-box {
  min-height: 46px;
  border: 1px solid #f3b7b7;
  border-radius: 8px;
  padding: 12px 16px 12px 42px;
  display: flex;
  align-items: center;
  color: #c74444;
  background: #fff0f0;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

.warning-box::before {
  content: "!";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 1.8px solid #e15353;
  border-radius: 999px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
}

.warning-box.is-success {
  border-color: #b8e5d2;
  color: #106e59;
  background: #ecfbf5;
}

.warning-box.is-success::before {
  content: "✓";
  border-color: #19a36d;
  color: #13866f;
}

.center-link {
  width: max-content;
  margin: 4px auto 0;
  font-weight: 800;
}

.order-panel,
.tutorial-panel {
  margin-top: 18px;
  padding: 18px;
}

.order-row {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 12px;
  margin-top: 16px;
}

.order-results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.order-result-card {
  border: 1px solid #d6e4f4;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.86);
}

.order-result-card.is-error {
  border-color: #f3b7b7;
}

.order-result-head {
  min-height: 46px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f5f9ff;
}

.order-result-head strong {
  font-size: 14px;
  word-break: break-word;
}

.order-badge {
  min-width: 68px;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--blue-dark);
  background: #eaf3ff;
  text-align: center;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.order-badge.success,
.order-badge.activated {
  color: #0e7a54;
  background: #e5f8f0;
}

.order-badge.failed,
.order-badge.error {
  color: var(--danger);
  background: #fff0f0;
}

.order-badge.processing {
  color: #916300;
  background: #fff4d6;
}

.order-badge.unused,
.order-badge.empty {
  color: #6a7788;
  background: #eef3f8;
}

.order-result-card dl {
  margin: 0;
  padding: 0 14px;
}

.order-result-card dl div {
  min-height: 40px;
  border-top: 1px solid #edf2f7;
  display: grid;
  grid-template-columns: minmax(88px, 0.28fr) 1fr;
  align-items: center;
  gap: 12px;
}

.order-result-card dt,
.order-result-card dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.order-result-card dt {
  color: var(--muted);
}

.order-result-card dd {
  color: #304860;
  text-align: right;
  word-break: break-word;
}

.tutorial-placeholder {
  min-height: 168px;
  margin-top: 16px;
  border: 1px dashed #b9d2f4;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(234, 243, 255, 0.78), rgba(255, 255, 255, 0.88));
  text-align: center;
}

.tutorial-placeholder strong {
  color: var(--text);
  font-size: 17px;
}

.tutorial-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  background: #081422;
}

.status-area {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 18px;
}

.status-pill {
  min-height: 34px;
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--blue-dark);
  background: rgba(234, 243, 255, 0.9);
  font-size: 13px;
  font-weight: 760;
}

.status-pill.busy {
  color: #916300;
  background: #fff4d6;
}

.status-pill.error {
  color: var(--danger);
  background: #fff0f0;
}

.status-pill.success {
  color: #106e59;
  background: #ecfbf5;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(7, 25, 47, 0.38);
  backdrop-filter: blur(4px);
}

.redeem-modal {
  width: min(520px, calc(100vw - 32px));
  border-radius: 14px;
  padding: 32px 30px 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(7, 25, 47, 0.24);
  text-align: center;
}

.modal-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 900;
}

.modal-icon.is-processing {
  color: var(--blue-dark);
  background: #eaf3ff;
}

.modal-icon.is-success {
  color: #0e7a54;
  background: #e5f8f0;
}

.modal-icon.is-failed {
  color: var(--danger);
  background: #fff0f0;
}

.redeem-modal h2 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 900;
}

.redeem-modal p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.modal-progress {
  height: 8px;
  margin-top: 28px;
  border-radius: 999px;
  overflow: hidden;
  background: #e6edf5;
}

.modal-progress div {
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #21a36e);
  transition: width 0.28s ease;
}

.modal-progress-meta {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  color: #42566d;
  font-size: 15px;
  font-weight: 760;
}

.modal-details {
  margin: 24px 0 0;
  border: 1px solid #e2eaf3;
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
}

.modal-details div {
  min-height: 48px;
  border-bottom: 1px solid #edf2f7;
  display: grid;
  grid-template-columns: minmax(96px, 0.34fr) 1fr;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
}

.modal-details div:last-child {
  border-bottom: 0;
}

.modal-details dt,
.modal-details dd {
  margin: 0;
  font-size: 15px;
}

.modal-details dt {
  color: var(--muted);
}

.modal-details dd {
  color: var(--text);
  text-align: right;
  font-weight: 760;
  word-break: break-word;
}

.modal-close {
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
  border: 0;
  border-top: 1px solid #edf2f7;
  color: var(--blue-dark);
  background: transparent;
  font-size: 18px;
  font-weight: 850;
}

pre {
  min-height: 180px;
  max-height: 34vh;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #081422;
  color: #dceeff;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

footer {
  margin-top: 36px;
  color: #7d8da0;
  text-align: center;
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100vw - 22px, 560px);
    padding-top: 22px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .header-actions .outline-button {
    width: 100%;
  }

  .hero {
    padding: 38px 0 30px;
  }

  .steps {
    gap: 4px;
  }

  .steps::before {
    left: 17%;
    right: 17%;
  }

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

  .pane,
  .order-panel,
  .account-panel {
    padding: 18px 14px;
  }

  .split-actions,
  .order-row {
    grid-template-columns: 1fr;
  }

  .account-panel dl {
    padding: 0;
  }

  .account-panel div {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
  }

  .account-panel dd {
    text-align: left;
  }

  .confirm-list div {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 14px;
  }

  .confirm-list strong {
    text-align: left;
  }

  .order-result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .order-result-card dl div {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 8px 0;
  }

  .order-result-card dd {
    text-align: left;
  }
}
