/* ============================================================
   赞助系统 · 前台样式
   主题色等由此前注入的 CSS 变量控制（见 :root{--c-primary...}）
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --c-primary: #6366f1;
    --c-primary-dark: #4f46e5;
    --c-accent: #f59e0b;
    --c-success: #10b981;
    --c-text: #1f2937;
    --c-muted: #6b7280;
    --c-card: #ffffff;
    --c-border: #e5e7eb;
    --c-bg-soft: rgba(255, 255, 255, .62);
    --radius: 16px;
    --max-width: 1100px;
    --shadow: 0 4px 24px rgba(31, 41, 55, .07);
    --shadow-lg: 0 12px 40px rgba(31, 41, 55, .12);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--c-text);
    background: #f5f6fa;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { opacity: .85; }
img { max-width: 100%; }
code { background: rgba(0,0,0,.05); padding: 2px 6px; border-radius: 5px; font-size: 13px; }

.wrap { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ---------------- 头部 ---------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--c-bg-soft);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(0,0,0,.05);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--c-text); font-weight: 700; }
.brand:hover { opacity: 1; }
.brand-mark {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 700;
}
.brand-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; }
.brand-text small { font-size: 11.5px; color: var(--c-muted); font-weight: 400; }

.site-nav { display: flex; gap: 4px; }
.nav-link {
    padding: 8px 15px; border-radius: 10px; font-size: 14px; font-weight: 500;
    color: var(--c-muted); transition: .18s;
}
.nav-link:hover { background: rgba(0,0,0,.045); color: var(--c-text); opacity: 1; }
.nav-link.active { background: var(--c-primary); color: #fff; }

/* ---------------- 主体 ---------------- */
.site-main { flex: 1; padding: 30px 0 56px; }

.card {
    background: var(--c-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
}
.card + .card { margin-top: 22px; }
.card-border { box-shadow: none; border: 1px solid var(--c-border); }
.card-flat { box-shadow: none; background: transparent; padding: 0; }

.section-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.section-sub { color: var(--c-muted); font-size: 13px; margin: 0 0 18px; }

.page-hero { text-align: center; margin-bottom: 26px; }
.page-hero h1 { font-size: 27px; margin: 0 0 8px; letter-spacing: -.4px; }
.page-hero p { color: var(--c-muted); margin: 0; font-size: 14.5px; }

.announce {
    border-radius: 12px; padding: 13px 17px; margin-bottom: 20px; font-size: 14px;
    background: linear-gradient(90deg, rgba(99,102,241,.10), rgba(245,158,11,.10));
    border-left: 3px solid var(--c-primary); white-space: pre-wrap;
}

.tip-box {
    background: rgba(245,158,11,.09); border: 1px solid rgba(245,158,11,.25);
    color: #92400e; border-radius: 12px; padding: 12px 16px; font-size: 13.5px;
    margin-bottom: 20px; white-space: pre-wrap;
}

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
.field-label .req { color: #ef4444; margin-left: 3px; }
.field-hint { font-size: 12px; color: var(--c-muted); margin-top: 5px; }

.input, .textarea, .select {
    width: 100%; padding: 11px 14px; font-size: 14.5px; font-family: inherit;
    color: var(--c-text); background: var(--c-card);
    border: 1.5px solid var(--c-border); border-radius: 11px; outline: none; transition: .16s;
}
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--c-primary); box-shadow: 0 0 0 3.5px rgba(99,102,241,.13);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.select { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* 单选 / 多选类自定义字段的横向排列 */
.option-row { display: flex; flex-wrap: wrap; gap: 9px; }
.option-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--c-border);
    background: var(--c-card); font-size: 14px; cursor: pointer; transition: .16s;
}
.option-pill:hover { border-color: var(--c-primary); }
.option-pill:has(input:checked) { border-color: var(--c-primary); background: rgba(99,102,241,.06); }
.option-pill input { accent-color: var(--c-primary); }

.amount-input-wrap { position: relative; }
.amount-input-wrap .currency {
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    font-size: 18px; font-weight: 700; color: var(--c-muted); pointer-events: none;
}
.amount-input { padding-left: 38px; font-size: 21px; font-weight: 700; height: 54px; }

.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.pay-method {
    display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer;
    border: 1.5px solid var(--c-border); border-radius: 11px; background: var(--c-card);
    font-size: 14px; font-weight: 500; transition: .16s;
}
.pay-method:hover { border-color: var(--c-primary); }
.pay-method.selected { border-color: var(--c-primary); background: rgba(99,102,241,.06); }
.pay-method input { display: none; }
.pay-method .mark {
    width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--c-border);
    flex: 0 0 20px; transition: .16s; position: relative;
}
.pay-method.selected .mark { border-color: var(--c-primary); }
.pay-method.selected .mark::after {
    content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--c-primary);
}
.pay-icon {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 700; color: #fff; line-height: 1;
}
.pay-icon-alipay { background: #1677ff; }
.pay-icon-wxpay  { background: #07c160; }
.pay-icon-qqpay  { background: #12b7f5; }

.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; margin-bottom: 10px; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--c-primary); cursor: pointer; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 26px; border: 0; border-radius: 11px; font-size: 15px; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: .18s; text-decoration: none;
    background: var(--c-card); color: var(--c-text); border: 1.5px solid var(--c-border);
}
.btn:hover { opacity: 1; border-color: var(--c-muted); }
.btn-primary {
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
    color: #fff; border: 0; box-shadow: 0 6px 18px rgba(99,102,241,.3);
}
.btn-primary:hover { box-shadow: 0 9px 26px rgba(99,102,241,.42); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; padding: 15px; font-size: 16px; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-primary); }

/* ---------------- 赞助墙 ---------------- */
.wall-list { display: flex; flex-direction: column; gap: 10px; }
.wall-item {
    display: flex; align-items: center; gap: 13px; padding: 13px 16px;
    border-radius: 12px; background: var(--c-card); border: 1px solid var(--c-border);
}
.svg-ic { flex: 0 0 auto; vertical-align: -0.16em; }
.avatar-neutral { background: linear-gradient(135deg, #94a3b8, #64748b); }

.wall-item.is-new { animation: pop .5s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } }
.avatar {
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px; color: #fff;
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
}
img.avatar { object-fit: cover; display: block; background: var(--c-card); }

.input.input-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3.5px rgba(239, 68, 68, .12);
}

/* 联系方式输入 + QQ 头像预览 */
.contact-row { display: flex; align-items: center; gap: 10px; }
.contact-row .input { flex: 1; min-width: 0; }
.qq-avatar {
    width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; overflow: hidden;
    border: 1.5px solid var(--c-border); background: var(--c-card);
    display: flex; align-items: center; justify-content: center;
}
.qq-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall-main { flex: 1; min-width: 0; }
.wall-name { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.wall-msg { color: var(--c-muted); font-size: 13px; margin-top: 2px; word-break: break-word; }
.wall-time { font-size: 11.5px; color: var(--c-muted); }
.wall-amount { font-weight: 800; color: var(--c-primary); font-size: 16.5px; white-space: nowrap; }
.tag {
    font-size: 10.5px; padding: 1.5px 7px; border-radius: 5px; font-weight: 600;
    background: rgba(99,102,241,.12); color: var(--c-primary);
}
.tag-anon { background: rgba(107,114,128,.13); color: var(--c-muted); }

/* 跑马灯 */
.marquee-wrap { overflow: hidden; position: relative; padding: 4px 0; }
.marquee-track { display: flex; gap: 12px; width: max-content; animation: marquee 38s linear infinite; }
.marquee-wrap:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee-item {
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
    padding: 8px 15px; border-radius: 999px; font-size: 13px;
    background: var(--c-card); border: 1px solid var(--c-border);
}
.marquee-item b { color: var(--c-primary); font-weight: 700; }

/* ---------------- 榜单 ---------------- */
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 11px; background: var(--c-card); border: 1px solid var(--c-border); }
.rank-no {
    width: 25px; height: 25px; flex: 0 0 25px; border-radius: 8px; display: flex;
    align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700;
    background: rgba(0,0,0,.05); color: var(--c-muted);
}
.rank-item:nth-child(1) .rank-no { background: linear-gradient(135deg,#fbbf24,#f59e0b); color:#fff; }
.rank-item:nth-child(2) .rank-no { background: linear-gradient(135deg,#cbd5e1,#94a3b8); color:#fff; }
.rank-item:nth-child(3) .rank-no { background: linear-gradient(135deg,#d9a06a,#b45309); color:#fff; }
.rank-name { flex: 1; font-weight: 600; font-size: 14px; }
.rank-meta { font-size: 12px; color: var(--c-muted); font-weight: 400; }
.rank-amount { font-weight: 700; color: var(--c-primary); }

/* ---------------- 订单 / 状态 ---------------- */
.status-hero { text-align: center; padding: 14px 0 8px; }
.status-icon {
    font-size: 56px; line-height: 1; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-muted);
}
.status-icon.tone-ok    { color: var(--c-success); }
.status-icon.tone-warn  { color: var(--c-accent); }
.status-icon.tone-muted { color: var(--c-muted); }
.status-icon.spin {
    display: inline-block; width: 46px; height: 46px; border: 4px solid var(--c-border);
    border-top-color: var(--c-primary); border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-title { font-size: 21px; font-weight: 700; margin: 0 0 6px; }
.status-desc { color: var(--c-muted); font-size: 14px; margin: 0; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px dashed var(--c-border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--c-muted); flex: 0 0 auto; }
.kv dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }
.kv dd.big { font-size: 19px; color: var(--c-primary); font-weight: 800; }

.qr-box { text-align: center; padding: 20px 0 8px; }
.qr-box .qr-canvas { display: inline-block; padding: 13px; background: #fff; border-radius: 14px; border: 1px solid var(--c-border); }
.qr-box .qr-canvas img, .qr-box .qr-canvas canvas { display: block; }
.qr-tip { color: var(--c-muted); font-size: 13.5px; margin-top: 14px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.success { background: rgba(16,185,129,.13); color: #047857; }
.badge.warning { background: rgba(245,158,11,.15); color: #b45309; }
.badge.danger  { background: rgba(239,68,68,.13); color: #b91c1c; }
.badge.muted   { background: rgba(107,114,128,.13); color: #4b5563; }

.empty { text-align: center; padding: 44px 20px; color: var(--c-muted); }
.empty .big {
    line-height: 1; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-muted); opacity: .55;
}
.empty-icon {
    display: flex; align-items: center; justify-content: center;
    color: var(--c-muted); opacity: .5; margin-bottom: 14px;
}

/* ---------------- 页脚 ---------------- */
.site-footer { border-top: 1px solid rgba(0,0,0,.05); padding: 22px 0; font-size: 13px; color: var(--c-muted); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.footer-stats b { color: var(--c-primary); }
.footer-links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.dot { opacity: .4; }

/* ---------------- 弹层 ---------------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    opacity: 0; pointer-events: none; transition: opacity .22s;
    backdrop-filter: blur(3px);
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--c-card); border-radius: 18px; width: 100%; max-width: 420px;
    padding: 26px; box-shadow: var(--shadow-lg); transform: translateY(14px) scale(.98);
    transition: transform .22s; max-height: 90vh; overflow-y: auto;
}
.modal-mask.show .modal { transform: none; }
.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 16px; text-align: center; }

/* ---------------- 提示条 ---------------- */
.toast-wrap { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 9px; align-items: center; }
.toast {
    padding: 11px 20px; border-radius: 11px; font-size: 14px; font-weight: 500;
    background: #1f2937; color: #fff; box-shadow: var(--shadow-lg);
    animation: toastIn .25s ease; max-width: 88vw;
}
.toast.err { background: #dc2626; }
.toast.ok { background: #059669; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------------- 暗色 ---------------- */
html.dark, html.auto-dark { color-scheme: light; }
html.dark body, html.dark {
    --c-text: #e5e7eb;
    --c-muted: #9ca3af;
    --c-card: #1e2230;
    --c-border: #2f3546;
    --c-bg-soft: rgba(20, 23, 33, .78);
    --shadow: 0 4px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}
html.dark body { background: #12141c; }
html.dark .brand-mark { color: #fff; }

@media (prefers-color-scheme: dark) {
    html.auto-dark body, html.auto-dark {
        --c-text: #e5e7eb;
        --c-muted: #9ca3af;
        --c-card: #1e2230;
        --c-border: #2f3546;
        --c-bg-soft: rgba(20, 23, 33, .78);
        --shadow: 0 4px 24px rgba(0, 0, 0, .35);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    }
    html.auto-dark body { background: #12141c; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 720px) {
    .header-inner { height: 58px; }
    .brand-text small { display: none; }
    .nav-link { padding: 7px 11px; font-size: 13px; }
    .site-main { padding: 20px 0 40px; }
    .card { padding: 20px 17px; }
    .page-hero h1 { font-size: 22px; }
    .footer-inner { flex-direction: column; text-align: center; gap: 8px; }
    .status-icon { font-size: 46px; }
    .wall-item { padding: 11px 13px; gap: 10px; }
    .wall-amount { font-size: 15px; }
}

/* 打印 */
@media print {
    .site-header, .site-footer, .btn { display: none; }
}
