/* ===== TokenChi GPT · Swiss Modernism + Bento · light ===== */
:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #E5E7EB;
  --line-strong: #CBD5E1;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #EFF6FF;
  --accent-ring: rgba(37, 99, 235, 0.22);
  --success: #15803D; --success-bg: #F0FDF4; --success-line: #BBF7D0;
  --danger: #B91C1C;  --danger-bg: #FEF2F2;  --danger-line: #FECACA;
  --warn: #B45309;    --warn-bg: #FFFBEB;    --warn-line: #FDE68A;
  --info: #1D4ED8;    --info-bg: #EFF6FF;    --info-line: #BFDBFE;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --unit: 8px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --z-bar: 20; --z-dialog: 40; --z-toast: 50;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
h2 { font-size: 1.125rem; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.1em 0.4em; }
.ico { width: 1.15em; height: 1.15em; flex: none; }
.tiny { font-size: 0.8125rem; color: var(--muted); }
.kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.sub { color: var(--text-2); }
.label-sm { font-size: 0.8125rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { top: 8px; }
.wrap { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }

/* ===== Top bar ===== */
.topbar { position: sticky; top: 0; z-index: var(--z-bar); background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 17px; height: 17px; }
.topnav { display: flex; gap: 4px; }
.navlink { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 8px; border: 0; background: none; font: inherit; font-weight: 500; color: var(--text-2); cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.navlink:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

/* ===== Buttons ===== */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: #94A3B8; }
.btn-lg { min-height: 50px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn .spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.textlink { background: none; border: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; min-height: 40px; padding: 0 6px; }
.textlink:hover { text-decoration: underline; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.icon-btn:hover { color: var(--accent); border-color: var(--line-strong); }

/* ===== Checkout layout (12-col) ===== */
.checkout { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; padding: 40px 0 56px; align-items: start; }
.summary { grid-column: span 5; position: sticky; top: 84px; }
.flow { grid-column: span 7; display: grid; gap: 16px; }
@media (max-width: 960px) {
  /* 手机端顺序：标题 → 表单 → 兑换内容 → 保障 */
  .checkout { grid-template-columns: 1fr; padding: 24px 0 40px; gap: 16px; }
  .summary { display: contents; }
  .summary-head { order: 1; margin-bottom: 4px; }
  .flow { grid-column: auto; order: 2; }
  .redeem-box { order: 3; }
  .trust-row { order: 4; margin-top: 0; }
}

/* ===== Summary (left) ===== */
.summary-head { margin-bottom: 20px; }
.summary-head h1 { margin: 8px 0 10px; }
.plan-list { display: grid; gap: 8px; }
.plan { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; font: inherit; color: var(--text); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.plan:hover { border-color: var(--line-strong); }
.plan[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.plan .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; transition: border-color 0.15s; }
.plan .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform 0.15s; }
.plan[aria-checked="true"] .radio { border-color: var(--accent); }
.plan[aria-checked="true"] .radio::after { transform: scale(1); }
.plan-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-hint { font-size: 0.8125rem; color: var(--muted); }
.plan-price { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.plan-price small { font-weight: 500; color: var(--muted); font-size: 0.75rem; }
.badge { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.redeem-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.redeem-empty { display: flex; gap: 10px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 0.9375rem; }
.redeem-empty .ico { color: var(--line-strong); width: 1.5em; height: 1.5em; }
.redeem-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.redeem-name { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.redeem-plan .plan-hint { margin-top: 2px; }
.redeem-plan .plan-list { margin-top: 12px; }
.redeem-plan .feature-list { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.confirm-list { display: grid; gap: 10px; margin: 0 0 16px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.confirm-list div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; font-size: 0.9375rem; }
.confirm-list dt { color: var(--muted); }
.confirm-list dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.summary-detail { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.feature-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.9375rem; color: var(--text-2); }
.feature-list li { display: flex; gap: 8px; align-items: flex-start; }
.feature-list .ico { color: var(--accent); margin-top: 4px; }
.summary-total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-weight: 600; }
.summary-total .total { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.trust-row { list-style: none; margin: 20px 0 0; padding: 16px; display: grid; gap: 8px; font-size: 0.875rem; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.trust-row li { display: flex; gap: 8px; align-items: center; }
.trust-row .ico { color: var(--accent); }

/* ===== Progress ===== */
.progress { display: grid; gap: 8px; }
.progress-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.progress-bar span { height: 6px; border-radius: 999px; background: var(--line); transition: background-color 0.2s; }
.progress-bar span.is-done { background: var(--success); }
.progress-bar span.is-current { background: var(--accent); }
.progress-label { font-size: 0.875rem; color: var(--muted); }
.progress-label strong { color: var(--text); }

/* ===== Step cards ===== */
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.step-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.step-index { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.875rem; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--muted); flex: none; }
.step-card.is-active .step-index { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-card.is-done .step-index { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.step-card.is-locked { opacity: 0.7; }
.step-titles { flex: 1; min-width: 0; }
.step-summary { font-size: 0.875rem; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-body { padding: 4px 20px 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.step-card.is-active { border-color: var(--accent); }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.875rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.help-link { font-weight: 500; font-size: 0.8125rem; }
.req { font-size: 0.6875rem; font-weight: 700; color: var(--muted); margin-left: auto; letter-spacing: 0.04em; }
.hint { color: var(--muted); font-size: 0.8125rem; display: flex; gap: 6px; align-items: flex-start; }
.hint .ico { margin-top: 3px; }
input[type="text"], input[type="password"], textarea, select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); font: inherit; font-size: 1rem; transition: border-color 0.15s, box-shadow 0.15s; }
textarea { resize: vertical; font-family: var(--mono); font-size: 0.8125rem; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #94A3B8; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input.is-invalid, textarea.is-invalid { border-color: var(--danger); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 36px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.input-icon { position: relative; }
.input-icon input { padding-right: 90px; }
.card-brand { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.howto { font-size: 0.8125rem; color: var(--muted); }
.howto summary { cursor: pointer; color: var(--accent); font-weight: 500; min-height: 32px; display: flex; align-items: center; }
.howto ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; font-size: 0.875rem; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.row-actions .btn { flex: 1 1 auto; }

.notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 0.9rem; line-height: 1.55; }
.notice strong { color: var(--text); }
.notice-success { background: var(--success-bg); border-color: var(--success-line); color: #14532D; }
.notice-success strong { color: var(--success); }
.notice-danger { background: var(--danger-bg); border-color: var(--danger-line); color: #7F1D1D; }
.notice-danger strong { color: var(--danger); }
.notice-info { background: var(--info-bg); border-color: var(--info-line); color: #1E3A8A; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #78350F; }
.notice-warn strong { color: var(--warn); }
.notice dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; }
.notice dt { color: var(--muted); }
.notice dd { margin: 0; }

/* ===== Status view ===== */
.status-card { padding: 20px; display: grid; gap: 18px; }
.status-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.order-id-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.order-id-row code { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.06em; background: none; border: 0; padding: 0; }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.chip-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.chip-success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.chip-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.chip-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip-gold { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 640px) { .timeline { grid-template-columns: 1fr 1fr; } }
.timeline li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.timeline strong { display: block; font-size: 0.875rem; color: inherit; }
.timeline small { display: block; font-size: 0.75rem; color: var(--muted); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin-top: 6px; flex: none; }
.timeline li.is-done { color: var(--text-2); background: var(--surface); }
.timeline li.is-done .tl-dot { background: var(--success); }
.timeline li.is-active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.timeline li.is-active .tl-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); animation: pulse 1.6s ease-in-out infinite; }
.timeline li.is-failed { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }
.timeline li.is-failed .tl-dot { background: var(--danger); }
.timeline li.is-skipped { opacity: 0.6; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px var(--accent-ring); } 50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.06); } }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 16px; margin: 0; }
.meta div { display: grid; gap: 2px; }
.meta dt { font-size: 0.75rem; color: var(--muted); }
.meta dd { margin: 0; font-weight: 600; font-size: 0.9375rem; overflow-wrap: anywhere; }
.steps-list { list-style: none; margin: 0; padding: 12px 14px; display: grid; gap: 6px; font-size: 0.875rem; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line); }
.steps-list li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.steps-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.steps-list li.done { color: var(--text-2); } .steps-list li.done::before { background: var(--success); }
.steps-list li.running { color: var(--text); } .steps-list li.running::before { background: var(--accent); }
.steps-list li.failed { color: var(--danger); } .steps-list li.failed::before { background: var(--danger); }
.status-card .notice { margin: 0; }
.threeds { padding: 16px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: #78350F; display: grid; gap: 12px; }
.threeds .field { margin: 0; }

/* ===== Help bento ===== */
.help { padding: 24px 0 48px; border-top: 1px solid var(--line); }
.help-head { margin-bottom: 20px; }
.help-head h2 { font-size: 1.5rem; }
.bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .bento { grid-template-columns: 1fr; } }
.faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.faq-item h3 { font-size: 1rem; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.faq-item h3 .ico { color: var(--accent); margin-top: 3px; }
.faq-item p { color: var(--text-2); font-size: 0.9375rem; overflow-wrap: anywhere; }

/* ===== Footer ===== */
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 20px 0 40px; font-size: 0.875rem; color: var(--text-2); border-top: 1px solid var(--line); }

/* ===== Dialog ===== */
.dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(440px, calc(100% - 2rem)); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.dialog-body { padding: 20px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dialog input { font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }

/* ===== Toast ===== */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); z-index: var(--z-toast); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; font-size: 0.9rem; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
