/* 石头代充 · 客户端样式 */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f6;
  --brand: #0d9668;
  --brand-strong: #047857;
  --brand-soft: #ecfdf5;
  --brand-ring: rgba(13, 150, 104, .18);
  --dark: #0b1220;
  --amber: #b45309;
  --amber-soft: #fff7ed;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -8px rgba(15, 23, 42, .10);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .28);
  font-family: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 14px; line-height: 1.6; overflow-x: clip; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: var(--brand-strong); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 30px; line-height: 1.25; letter-spacing: -.01em; margin-bottom: 8px; }
h2 { font-size: 17px; line-height: 1.4; margin-bottom: 4px; }
code { font-family: "JetBrains Mono", Consolas, monospace; }
:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: 68px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1200px) / 2));
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font-size: 17px; font-weight: 800; }
.brand small { display: block; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .14em; margin-top: 1px; }
.mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #1e293b, #0b1220); color: #6ee7b7; font-size: 17px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 4px 12px -4px rgba(15, 23, 42, .5);
}
.header-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.account-chip:not(:empty) {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.brand > span:last-child, .header-right > * { white-space: nowrap; }
.text-button {
  border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-radius: 8px; text-decoration: none; transition: background .15s, color .15s;
}
.text-button:hover { background: var(--line-2); color: var(--ink); }
.logout-button { color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); }

main { max-width: 1200px; margin: 0 auto; padding: 40px 24px 96px; }

/* ---------- Shared bits ---------- */
.kicker { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .04em; margin: 0 0 8px; }
.status { min-height: 20px; margin: 10px 0 0; font-size: 13px; color: var(--brand-strong); line-height: 1.6; }
.status.error { color: var(--danger); }
.primary {
  height: 48px; width: 100%; border: 0; border-radius: 12px;
  background: linear-gradient(180deg, #10a874, var(--brand)); color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 8px 18px -8px rgba(13, 150, 104, .7);
  transition: transform .12s, box-shadow .15s, background .15s;
}
.primary:hover:not(:disabled) { background: linear-gradient(180deg, #0d9668, var(--brand-strong)); transform: translateY(-1px); }
.primary:active:not(:disabled) { transform: translateY(0); }
.primary:disabled { background: #cbd5e1; box-shadow: none; color: #f8fafc; opacity: 1; }
.outline {
  height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s;
}
.outline:hover:not(:disabled) { border-color: #cbd5e1; background: var(--surface-2); }

input, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: 12px 14px; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.auth-box label, #order-form label, #redeem-form label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 16px 0 8px;
}

/* ---------- Home / auth ---------- */
#auth-view { position: relative; }
#auth-view::before {
  content: ''; position: fixed; z-index: -1; inset: 0 0 auto; height: 720px;
  background:
    radial-gradient(600px 300px at 20% 20%, rgba(16, 185, 129, .14), transparent 70%),
    radial-gradient(500px 280px at 85% 10%, rgba(59, 130, 246, .10), transparent 70%);
  pointer-events: none;
}
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 64px; align-items: center; min-height: calc(100vh - 220px); }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px; padding: 6px 12px 6px 10px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.hero-badge span { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); }
.auth-copy h1 { font-size: 52px; line-height: 1.12; letter-spacing: -.02em; margin-bottom: 18px; font-weight: 800; }
.auth-copy h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #059669, #0ea5e9); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-description { max-width: 520px; color: var(--muted); font-size: 16px; line-height: 1.8; margin-bottom: 20px; }
.trust-list { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0 0 32px; padding: 0; }
.trust-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.trust-list li::before {
  content: '✓'; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 800;
}
.home-steps { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 24px 0 0; padding: 0; }
.home-steps li {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .7); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2);
}
.home-steps span {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 700;
}

.auth-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px;
  box-shadow: var(--shadow-lg);
}
.form-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.form-top h2 { margin: 0; font-size: 22px; }
.form-top .text-button { color: var(--brand-strong); background: var(--brand-soft); }
.form-top .text-button:hover { background: #d1fae5; }
.auth-form-note { font-size: 14px; line-height: 1.7; color: var(--muted); margin: 0 0 8px; }
.auth-box .primary { margin-top: 24px; }

/* ---------- Plan cards ---------- */
.subscription-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.subscription-card {
  --accent: #10b981; --accent-soft: #ecfdf5;
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-height: 136px; padding: 20px 20px 18px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: border-color .15s, box-shadow .2s, transform .15s;
}
.subscription-card:nth-child(2) { --accent: #3b82f6; --accent-soft: #eff6ff; }
.subscription-card:nth-child(3) { --accent: #8b5cf6; --accent-soft: #f5f3ff; }
.subscription-card:nth-child(4) { --accent: #f59e0b; --accent-soft: #fffbeb; }
.subscription-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); opacity: .9;
}
.subscription-card > strong { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.subscription-card > span {
  display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft);
  color: var(--ink-2); font-size: 12px; font-weight: 500;
}
.subscription-card > b { margin-top: auto; padding-top: 14px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.subscription-card > b.pending-price { color: var(--faint); font-weight: 500; }
button.subscription-card:hover { border-color: #cbd5e1; box-shadow: var(--shadow); transform: translateY(-2px); }
.subscription-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow); }
.subscription-card.selected::after {
  content: '✓'; position: absolute; right: 14px; top: 16px; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
}
.auth-copy .subscription-card { cursor: default; min-height: 120px; background: rgba(255, 255, 255, .85); }
.auth-copy .subscription-card > b.home-plan-caption { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- Dashboard ---------- */
.dashboard-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 20px; }
.dashboard-head h1 { margin-bottom: 6px; }
.dashboard-head > div > p:last-child { color: var(--muted); font-size: 14px; margin: 0; }
.wallet {
  position: relative; min-width: 220px; padding: 18px 22px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, #1e293b 0%, #0b1220 100%); color: #fff;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.wallet::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, .45), transparent 70%);
}
.wallet span, .wallet small { font-size: 12px; color: #94a3b8; position: relative; }
.wallet strong { font-size: 32px; line-height: 1.2; margin: 4px 0 2px; font-variant-numeric: tabular-nums; position: relative; }

.concurrency-strip {
  display: flex; align-items: center; gap: 10px; margin: 0 0 32px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm);
  font-size: 13px; color: var(--ink-2);
}
.concurrency-strip b { font-weight: 700; color: var(--ink); }
.concurrency-strip p { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #10b981; flex: none; }
.live-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #10b981;
  animation: live-pulse 1.8s ease-out infinite;
}
@keyframes live-pulse { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }

.subscription-section { margin-bottom: 28px; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.catalog-heading h2 { font-size: 18px; margin: 0; }
.catalog-heading p { font-size: 13px; color: var(--muted); margin: 0; }
.subscription-section .subscription-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.subscription-section .subscription-card > b { color: var(--ink); }

.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.checkout, .account-box, .flow-box, .orders {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.checkout { padding: 28px; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.section-heading > span {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 700;
}
.section-heading h2 { margin: 0 0 2px; font-size: 18px; }
.section-heading p { color: var(--muted); font-size: 13px; margin: 0; }

.card-source-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; width: 100%; min-width: 0;
  margin: 0; padding: 16px; text-align: left; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice:hover { border-color: #cbd5e1; }
.choice.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.choice > span { min-width: 0; }
.choice b, .choice small { display: block; }
.choice b { font-size: 15px; }
.choice small { font-size: 12px; color: var(--muted); margin-top: 3px; }
.choice strong { font-size: 13px; font-weight: 600; color: var(--brand-strong); white-space: nowrap; }
.choice:not(.active) strong { color: var(--muted); }

#order-form { margin-top: 22px; }
.session-guide {
  padding: 18px 20px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.75;
}
.session-guide h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 15px; }
.session-guide h3::before {
  content: '?'; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: #dbeafe; color: #1d4ed8; font-size: 12px; font-weight: 800;
}
.session-guide ol { margin: 0; padding: 0; list-style: none; counter-reset: guide; font-size: 14px; color: var(--ink-2); }
.session-guide li { position: relative; padding-left: 32px; counter-increment: guide; }
.session-guide li + li { margin-top: 8px; }
.session-guide li::before {
  content: counter(guide); position: absolute; left: 0; top: 2px; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.session-guide a {
  color: #1d4ed8; font-weight: 600; text-decoration: none; padding: 1px 6px; border-radius: 6px; background: #eff6ff;
}
.session-guide a:hover { background: #dbeafe; }
.session-guide p {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); color: #9a3412;
  font-size: 13px; line-height: 1.7;
}
.session-guide code { padding: 1px 5px; background: rgba(255, 255, 255, .8); border: 1px solid #fed7aa; border-radius: 5px; font-size: 12px; }
#order-form textarea {
  height: 170px; resize: vertical; background: var(--surface-2);
  font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; line-height: 1.6;
}
#order-form textarea:focus { background: var(--surface); }

.manual-card-fields { margin-top: 20px; padding-top: 4px; }
.card-expiry { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.manual-card-fields p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 12px 0 0; }

.summary {
  display: flex; justify-content: space-between; align-items: center; margin: 20px 0 14px; padding: 14px 16px;
  border-radius: 12px; background: var(--surface-2); border: 1px dashed #cbd5e1; font-size: 14px; color: var(--muted);
}
.summary strong { color: var(--ink); font-size: 20px; font-weight: 800; }

.side-column { display: flex; flex-direction: column; gap: 16px; }
.account-box, .flow-box { padding: 22px; }
.account-box { position: relative; }
.box-icon {
  display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; border-radius: 12px;
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; font-weight: 800;
}
.account-box h2, .flow-box h2 { font-size: 17px; }
.account-box > p { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 4px 0 0; }
#redeem-form label { margin-top: 14px; }
#redeem-code { font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; letter-spacing: .02em; }
#redeem-submit { width: 100%; margin-top: 10px; height: 44px; background: var(--ink); color: #fff; border-color: var(--ink); }
#redeem-submit:hover:not(:disabled) { background: #1e293b; }

.flow-box h2 { margin-bottom: 14px; }
.flow-box div { position: relative; display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--ink-2); padding: 8px 0; }
.flow-box div:not(:last-child)::after {
  content: ''; position: absolute; left: 5px; top: calc(50% + 8px); height: calc(100% - 16px); width: 2px; background: var(--line);
}
.flow-box i { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }

/* ---------- Orders ---------- */
.orders-section { margin-top: 48px; }
.orders-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.orders-head h2 { font-size: 22px; margin: 0; }
.orders { overflow: hidden; }
.empty { color: var(--faint); text-align: center; font-size: 14px; padding: 40px 20px; margin: 0; }
.order-row { display: grid; gap: 4px; padding: 16px 22px; border-bottom: 1px solid var(--line-2); transition: background .15s; }
.order-row:hover { background: var(--surface-2); }
.order-row:last-child { border-bottom: 0; }
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.order-top strong { font-size: 15px; overflow-wrap: anywhere; }
.order-row p { font-size: 13px; color: var(--muted); margin: 0; }
.order-row small { font-size: 13px; color: var(--ink-2); }
.state {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: #f1f5f9; color: var(--ink-2);
}
.state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-settled { background: #dcfce7; color: #15803d; }
.state-processing { background: #dbeafe; color: #1d4ed8; }
.state-queued { background: #e0e7ff; color: #4338ca; }
.state-review { background: #fef3c7; color: #b45309; }
.state-failed, .state-refunded { background: var(--danger-soft); color: #b91c1c; }
.state-cancelled, .state-expired { background: #f1f5f9; color: #64748b; }

/* ---------- Payment lock ---------- */
.payment-lock {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(6px);
}
.payment-progress {
  width: min(460px, 100%); padding: 40px 32px 28px; border-radius: 24px; background: var(--surface);
  text-align: center; box-shadow: 0 40px 100px -20px rgba(15, 23, 42, .5);
}
.payment-progress h2 { font-size: 24px; margin: 6px 0 10px; }
.payment-progress > p:not(.kicker) { font-size: 14px; line-height: 1.8; color: var(--muted); }
.payment-progress small {
  display: inline-block; font-family: "JetBrains Mono", Consolas, monospace; overflow-wrap: anywhere;
  font-size: 12px; color: var(--muted); margin: 6px 0 16px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2);
}
.payment-progress small:empty { display: none; }
.payment-progress .payment-hint { font-size: 13px !important; border-top: 1px solid var(--line-2); padding-top: 18px; margin: 18px 0 0; }
.payment-progress #cancel-waiting { min-width: 128px; }
.payment-spinner {
  display: block; width: 52px; height: 52px; margin: 0 auto 20px; border-radius: 50%;
  border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: payment-spin 1s linear infinite;
}
@keyframes payment-spin { to { transform: rotate(360deg); } }
body.payment-busy { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .payment-spinner, .live-dot::after { animation: none; }
  .payment-spinner { border-color: var(--brand); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; }
  .auth-copy h1 { font-size: 42px; }
  .subscription-section .subscription-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-grid { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 820px) {
  .site-header { height: 60px; padding: 0 16px; }
  .header-right:has(#logout:not([hidden])) .admin-link { display: none; }
  .account-chip:not(:empty) { max-width: 160px; }
  main { padding: 24px 16px 64px; }
  .auth-layout { grid-template-columns: 1fr; gap: 32px; min-height: 0; }
  .auth-copy h1 { font-size: 36px; }
  .auth-box { padding: 24px; }
  .dashboard-head { flex-direction: column; align-items: stretch; gap: 16px; }
  .dashboard-head h1 { font-size: 26px; }
  .wallet { min-width: 0; }
  .main-grid { grid-template-columns: 1fr; }
  .checkout { padding: 20px; }
  .side-column { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .header-right { gap: 6px; }
  .account-chip:not(:empty) { max-width: 120px; padding: 5px 10px; font-size: 12px; }
  .logout-button { padding: 6px 10px; }
  .auth-copy h1 { font-size: 32px; }
  .auth-description { font-size: 15px; }
  .subscription-grid, .subscription-section .subscription-grid { gap: 10px; }
  .subscription-card { padding: 16px; min-height: 120px; }
  .subscription-card > strong { font-size: 18px; }
  .card-source-choices { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr; }
  .card-expiry { gap: 8px; }
  .concurrency-strip { flex-wrap: wrap; }
  .order-row { padding: 14px 16px; }
}
