:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --bg: #09090b;
  --surface: #111114;
  --surface-elevated: #17171c;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --gold: #c9a96e;
  --gold-hairline: rgba(201, 169, 110, 0.24);
  --gold-focus: rgba(201, 169, 110, 0.58);
  --gold-soft: rgba(201, 169, 110, 0.08);
  --text: #f5f5f7;
  --text-secondary: #8e8e93;
  --text-tertiary: #5a5a60;
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.12);
  --warn: #ffd60a;
  --warn-soft: rgba(255, 214, 10, 0.1);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

.studio-light {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px 280px at 50% -12%, rgba(255, 255, 255, 0.045), transparent 70%),
    var(--bg);
  pointer-events: none;
}

.hidden { display: none !important; }

.page {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 36px 22px 64px;
}

@media (min-width: 640px) {
  .page {
    max-width: 460px;
    padding: 56px 24px 72px;
  }
}

/* 1. Brand Header */
.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.monogram {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--gold-hairline);
  background: linear-gradient(180deg, rgba(201, 169, 110, 0.14), rgba(201, 169, 110, 0.03));
  color: var(--gold);
  display: grid;
  place-items: center;
}

.wordmark {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text);
}

.brand-amount {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: -0.02em;
}

/* 2. Editorial Hero */
.hero { margin-bottom: 26px; }

.hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

.hero-notice {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* 3. Sculpted Precision Panel */
.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 20px;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 169, 110, 0.55), transparent);
  animation: edgeGlint 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes edgeGlint {
  0%, 60% { left: -60%; }
  100% { left: 130%; }
}

.view { animation: viewIn 0.24s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Alerts */
.alert {
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.alert-error { background: var(--danger-soft); color: #ff8a80; border-color: rgba(255, 69, 58, 0.25); }
.alert-warn { background: var(--warn-soft); color: #ffe680; border-color: rgba(255, 214, 10, 0.25); }
.alert-info { background: var(--gold-soft); color: var(--text); border-color: var(--gold-hairline); }

/* Verified Code Strip */
.code-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  margin-bottom: 22px;
  gap: 12px;
}

.code-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  word-break: break-all;
}

.code-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.btn-text {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}

.btn-text:hover { color: var(--text); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: #d1d1d6;
  letter-spacing: 0.01em;
}

.paste-btn {
  border: none;
  background: transparent;
  color: var(--gold);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 4px;
}

.input-box {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--gold-hairline);
  background: #0b0b0e;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-box::placeholder {
  color: rgba(245, 245, 247, 0.11);
  opacity: 1;
}

.input-box:focus {
  border-color: var(--gold-focus);
  background: #0d0d11;
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.09);
}

.input-box[readonly] { opacity: 0.65; cursor: not-allowed; }

.input-code {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.input-otp {
  font-family: var(--font-mono);
  text-align: center;
  letter-spacing: 0.36em;
  font-size: 22px;
  font-weight: 700;
}

.pwd-wrap { position: relative; }
.pwd-wrap .input-box { padding-right: 44px; }

.eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px;
  display: grid;
  place-items: center;
}

.eye-btn:hover { color: var(--text); }

/* Flagship Buttons */
.btn-primary {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}

.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:active:not(:disabled) { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-danger {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: #d93025;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost-danger {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-ghost-danger:hover:not(:disabled) { background: var(--danger-soft); }

.code-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.code-result strong { color: var(--text); }

/* Step 3 Active View */
.order-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.meta-label { display: block; font-size: 11.5px; color: var(--text-secondary); margin-bottom: 2px; }
.meta-id { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.meta-val { font-family: var(--font-mono); font-size: 17px; font-weight: 600; color: var(--gold); }

.progress-wrap { margin-bottom: 18px; }

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
}

.progress-label { font-size: 13px; font-weight: 500; color: var(--text); }
.progress-pct { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--gold); }

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  position: relative;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9f814b, var(--gold), #e8d2a2);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 5px;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: barSweep 2.4s ease-in-out infinite;
}

@keyframes barSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-sub {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.action-panel {
  padding: 20px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
}

.wait-box { text-align: center; padding: 8px 4px; }

.spinner {
  width: 34px;
  height: 34px;
  border: 2.5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.target-acc {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 6px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-hairline);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: 10px;
  word-break: break-all;
}

.wait-box h3 { margin: 0 0 7px; font-size: 15.5px; font-weight: 600; }
.wait-box p { margin: 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.65; }

.method-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.method-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: #0b0b0e;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
}
.method-item:has(input:checked) { border-color: var(--gold-focus); background: var(--gold-soft); }
.otp-actions { display: flex; flex-direction: column; gap: 10px; }

.active-footer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.keep-open-tip { margin: 0; font-size: 12px; color: var(--text-tertiary); text-align: center; line-height: 1.55; }

/* Step 4 Terminal Receipt */
.result-hero { text-align: center; padding: 4px 0 18px; }

.result-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  font-size: 22px;
  font-weight: 700;
}

.result-icon.ok { background: var(--success-soft); color: var(--success); }
.result-icon.partial { background: var(--warn-soft); color: var(--warn); }
.result-icon.fail { background: var(--danger-soft); color: var(--danger); }

.result-hero h2 { margin: 0 0 8px; font-size: 19px; font-weight: 700; }
.result-hero p { margin: 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }

.credited-banner {
  display: inline-block;
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-hairline);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin: 8px 0 10px;
  word-break: break-all;
}

.credited-banner .acc { font-family: var(--font-mono); font-weight: 600; color: var(--gold); }
.credited-banner .amt { font-weight: 700; color: var(--success); margin-left: 2px; }

.receipt {
  margin: 0 0 18px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.receipt-row:last-child { border-bottom: none; }
.receipt-row dt { color: var(--text-secondary); flex-shrink: 0; }
.receipt-row dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }

/* Footnote */
.footnote {
  margin: 18px 0 0;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-tertiary);
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--surface-elevated);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  max-width: 360px;
  width: 100%;
  padding: 22px;
}

.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 18px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--surface-elevated);
  border: 1px solid var(--gold-hairline);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .panel::before, .progress-fill::after, .view { animation: none !important; }
}

/* v9 Unified 2-Row Account Box & Segmented Switch */
.code-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-secondary);
}
.code-mono { font-family: var(--font-mono); color: var(--text); font-weight: 600; }
.time-pill {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-hairline);
  font-size: 12.5px;
  line-height: 1.55;
  color: #dfd3ba;
  margin-bottom: 20px;
}
.time-pill svg { flex-shrink: 0; color: var(--gold); margin-top: 2px; }
.time-pill strong { color: var(--text); }
.step-h2 { margin: 0 0 6px; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.step-sub { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
.region-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.region-line strong { color: var(--text); }
.seg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}
.seg-btn.active {
  background: #1e1e24;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.unified-box {
  border-radius: 12px;
  border: 1px solid var(--gold-hairline);
  background: #0b0b0e;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 12px;
}
.unified-box:focus-within {
  border-color: var(--gold-focus);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1);
}
.u-row {
  display: flex;
  align-items: center;
  padding: 2px 12px 2px 14px;
}
.u-row + .u-row { border-top: 1px solid var(--line); }
.u-label { width: 58px; flex-shrink: 0; font-size: 13.5px; color: var(--text-secondary); font-weight: 500; }
.u-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  padding: 13px 6px;
  outline: none;
}
.u-input::placeholder { color: rgba(245, 245, 247, 0.11); opacity: 1; }
.lock-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}
.panel-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
