:root {
    --primary: #1677ff;
    --primary-dark: #0958d9;
    --bg1: #6a8dff;
    --bg2: #8a5cff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
}

a { color: var(--primary); }

.buy-wrap { width: 100%; display: flex; justify-content: center; }

.buy-card {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(30, 41, 59, .25);
}
.buy-card.wide { max-width: 560px; }
.buy-card.center { text-align: center; }

.brand {
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    margin-bottom: 22px;
    letter-spacing: 1px;
}

.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warn { background: #fef3c7; color: #92400e; }

.state { text-align: center; padding: 18px 0; }
.state-emoji { font-size: 52px; margin-bottom: 12px; }
.state h2 { font-size: 19px; margin-bottom: 8px; }
.state h3 { font-size: 16px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; }

.product { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 22px; }
.product-name { font-size: 20px; font-weight: 700; line-height: 1.4; margin-bottom: 8px; }
.product-desc { font-size: 13px; color: var(--muted); line-height: 1.7; }
.merchant { font-size: 12px; color: var(--muted); margin-top: 8px; }
.price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.price { font-size: 34px; font-weight: 800; color: #f43f5e; }
.price small { font-size: 18px; }
.stock { font-size: 12px; padding: 4px 12px; border-radius: 20px; font-weight: 600; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-no { background: #fee2e2; color: #991b1b; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #334155; }
.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all .15s;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 119, 255, .12); }

.btn-pay {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    margin-top: 4px;
}
.btn-pay:hover { background: var(--primary-dark); }
.btn-pay:disabled { background: #94a3b8; cursor: not-allowed; }
.agree { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }

.buy-foot { text-align: center; margin-top: 22px; font-size: 13px; }

.page-h { font-size: 18px; font-weight: 600; margin-bottom: 18px; text-align: center; }

.code-box {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px dashed #10b981;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin: 18px 0;
}
.code-label { font-size: 12px; color: #047857; margin-bottom: 8px; font-weight: 600; }
.code-value { font-size: 22px; font-weight: 800; color: #065f46; font-family: "SF Mono", Menlo, monospace; word-break: break-all; }
.btn-copy {
    margin-top: 12px;
    padding: 7px 18px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.btn-copy:hover { background: #059669; }

.order-meta { background: #f8fafc; border-radius: 10px; padding: 14px 16px; font-size: 13px; }
.order-meta div { display: flex; justify-content: space-between; padding: 4px 0; }
.order-meta span { color: var(--muted); }

.result-title { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.order-list { display: flex; flex-direction: column; gap: 12px; }
.order-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-no { font-size: 11px; color: var(--muted); }
.badge { font-size: 11px; padding: 2px 10px; border-radius: 20px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f1f5f9; color: #64748b; }
.order-body { display: flex; justify-content: space-between; align-items: center; }
.order-name { font-weight: 600; font-size: 14px; }
.order-amount { color: #f43f5e; font-weight: 700; }
.order-code { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 13px; }
.order-code code { color: #065f46; font-weight: 700; }
.order-time { margin-top: 8px; font-size: 11px; }

.mono { font-family: "SF Mono", Menlo, Consolas, monospace; }

.state-emoji.spin { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
