:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #667085;
  --line: #e6e8ec;
  --line-strong: #d5d9e0;
  --primary: #1f2937;
  --primary-soft: #eef2f6;
  --success: #14845c;
  --success-soft: #e8f6f0;
  --warn: #9a6700;
  --warn-soft: #fff6df;
  --danger: #c0342b;
  --danger-soft: #fff0ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 8px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 20px) 16px max(env(safe-area-inset-bottom), 20px);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header {
  text-align: center;
  padding-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}

.header h1 {
  margin: 10px 0 4px;
  font-size: 20px;
  line-height: 1.25;
}

.header p {
  max-width: 38ch;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card.compact {
  padding: 12px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 10px 6px;
}

.stat strong {
  font-size: 16px;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 11px;
}

.stat-icon {
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.online {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.online-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
}

.online-dot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--success);
  opacity: .35;
  animation: ping 1.4s ease-out infinite;
}

.ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f1f3f6;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.ticker b {
  color: var(--text);
}

.ticker-line {
  animation: tickerIn .35s ease both;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label {
  font-size: 14px;
  font-weight: 650;
}

.platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-btn,
.tab-btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
}

.pill-btn.active,
.tab-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.pill-btn small {
  display: inline-block;
  margin-left: 4px;
  color: inherit;
  opacity: 0.7;
  font-size: 10px;
}

.input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--card);
  color: var(--text);
  outline: none;
  padding: 11px 12px;
  font-size: 14px;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.12);
}

.primary-btn,
.outline-btn,
.ghost-btn {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
}

.primary-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
}

.outline-btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
}

.ghost-btn {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hint,
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.center {
  text-align: center;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-soft);
  flex: 0 0 auto;
}

.avatar.small {
  width: 40px;
  height: 40px;
}

.title {
  font-size: 15px;
  font-weight: 750;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
  font-weight: 750;
}

.step-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.step-back {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}

.step-back span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--primary);
}

.step-secure {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.step-progress {
  display: flex;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-progress li {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.step-progress li:last-child {
  flex: 0 0 auto;
}

.step-dot {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.step-progress li.done .step-dot,
.step-progress li.active .step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.step-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.step-progress li.done .step-label,
.step-progress li.active .step-label {
  color: var(--text);
}

.step-line {
  position: absolute;
  left: calc(50% + 20px);
  right: calc(-50% + 20px);
  top: 14px;
  height: 1px;
  background: var(--line);
}

.step-progress li.done .step-line {
  background: var(--primary);
}

.value-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.value-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.icon-box {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.notice {
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.7;
}

.notice.success {
  border: 1px solid rgba(20, 132, 92, 0.25);
  background: var(--success-soft);
}

.notice.warn {
  background: var(--warn-soft);
  color: #4d3600;
}

.notice.danger {
  border: 1px solid rgba(192, 52, 43, 0.25);
  background: var(--danger-soft);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f3f6;
  padding: 4px;
}

.tab-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.tab-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow);
}

.qr {
  width: 176px;
  height: 176px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background:
    linear-gradient(45deg, #f7f8fa 25%, transparent 25%) 0 0/18px 18px,
    linear-gradient(-45deg, #f7f8fa 25%, transparent 25%) 0 0/18px 18px,
    white;
}

.pay-stage {
  align-items: center;
}

.pay-frame {
  width: min(100%, 280px);
  height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.pay-frame iframe,
.pay-qr-img {
  width: 100%;
  height: 100%;
  border: 0;
}

.pay-qr-img {
  object-fit: contain;
  padding: 12px;
}

.pay-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.compact-action {
  width: min(100%, 360px);
}

.mobile-jump-note {
  display: none;
  color: var(--muted);
  font-size: 12px;
}

.pay-code {
  width: 100%;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 7px;
  background: #f5f6f8;
  padding: 12px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.break-all {
  word-break: break-all;
}

.copy-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-step {
  display: flex;
  gap: 10px;
  min-height: 42px;
}

.dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.dot.done {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.dot.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.line {
  width: 1px;
  flex: 1;
  background: var(--line);
}

.result-group {
  display: flex;
  flex-direction: column;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.field-row:last-child {
  border-bottom: 0;
}

.field-row dt {
  color: var(--muted);
  font-size: 13px;
  flex: 0 0 auto;
}

.field-row dd {
  margin: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: right;
  font-size: 13px;
  font-weight: 650;
}

.ad {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f1f3f6;
  padding: 12px;
}

.ad-tag {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 5px;
  color: var(--muted);
  font-size: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: calc(100vw - 32px);
  border-radius: 8px;
  background: #111827;
  color: white;
  padding: 10px 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  font-size: 13px;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes ping {
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}

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

@media (max-width: 720px) {
  .mobile-jump-note {
    display: block;
  }
}

@media (max-width: 360px) {
  .step-label {
    font-size: 10px;
  }

  .step-back {
    font-size: 13px;
  }

  .pay-frame {
    width: min(100%, 244px);
    height: 244px;
  }

  .mobile-jump-note {
    display: block;
  }

  .grid3 {
    gap: 6px;
  }

  .stat strong {
    font-size: 13px;
  }

  .field-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .field-row dd {
    width: 100%;
    justify-content: space-between;
    text-align: left;
  }
}
