:root {
    --bg: #f5f5f7;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #8c8c8c;
    --text-hint: #b3b3b3;
    --yellow: #ffcc00;
    --yellow-dark: #e6b800;
    --yellow-light: #fff9e0;
    --yellow-soft: #fffdf5;
    --border: #ededed;
    --border-active: #ffcc00;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page-front {
    background: var(--bg);
}

.site-header, .site-main, .site-footer {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

.site-header {
    padding-top: 20px;
    padding-bottom: 8px;
    text-align: center;
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.site-main {
    padding-bottom: 32px;
}

.site-footer {
    text-align: center;
    padding: 16px 16px 28px;
    font-size: 12px;
    color: var(--text-hint);
}

.block {
    margin-bottom: 16px;
}

.block-label {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 10px;
    font-weight: 500;
}

.uid-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.uid-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 12px;
}

.uid-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text);
    outline: none;
    min-width: 0;
    height: 40px;
}

.uid-input::placeholder {
    color: #c5c5c5;
    font-size: 14px;
}

.uid-confirm {
    flex-shrink: 0;
    border: none;
    background: var(--yellow);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    padding: 0 20px;
    height: 40px;
    border-radius: 999px;
    cursor: pointer;
}

.uid-confirm:active { background: var(--yellow-dark); }
.uid-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

.uid-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 8px 12px;
}

.uid-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

.uid-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.uid-result-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uid-result-id {
    font-size: 12px;
    color: var(--text-secondary);
}

.uid-result-id em {
    font-style: normal;
    color: var(--text);
}

.uid-change {
    flex-shrink: 0;
    border: none;
    background: var(--yellow);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    padding: 0 16px;
    height: 36px;
    border-radius: 999px;
    cursor: pointer;
}

.uid-change:active { background: var(--yellow-dark); }

.uid-tip {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-hint);
    line-height: 1.6;
}

.user-bar {
    display: none;
}

.package-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    box-shadow: var(--shadow);
}

.package-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.package-item {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 14px 8px 12px;
    text-align: center;
    cursor: pointer;
    background: var(--white);
    transition: border-color .15s, background .15s;
}

.package-item:active { transform: scale(0.98); }

.package-item.active {
    border-color: var(--border-active);
    background: var(--yellow-light);
}

.package-coin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.package-coin .coin-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    object-fit: contain;
    vertical-align: middle;
}

.package-price {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.package-give {
    margin-top: 4px;
    font-size: 10px;
    color: #d48806;
}

.package-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px 12px;
    color: var(--text-hint);
    font-size: 14px;
}

.btn-recharge {
    display: block;
    width: 100%;
    margin-top: 20px;
    border: none;
    background: var(--yellow);
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    padding: 14px;
    border-radius: 999px;
    cursor: pointer;
}

.btn-recharge:active { background: var(--yellow-dark); }
.btn-recharge:disabled {
    background: #f0e6b8;
    color: #a89860;
    cursor: not-allowed;
}

.agreement-tip {
    margin-top: 12px;
    text-align: center;
    font-size: 11px;
    color: var(--text-hint);
}

.hidden { display: none !important; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 99;
    max-width: 80vw;
    text-align: center;
}

/* 支付页 */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

.pay-card .pay-header h2 {
    font-size: 17px;
    font-weight: 600;
}

.order-no {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.order-brief {
    margin: 14px 0;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--yellow-soft);
    border: 1px solid #f5ecd0;
}

.order-brief > div {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 14px;
}

.order-brief span { color: var(--text-secondary); }
.order-brief .money { color: #d48806; font-weight: 600; }

.btn {
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    color: var(--text);
    background: var(--yellow);
}

.btn-secondary {
    color: var(--text);
    background: #f5f5f5;
    border: 1px solid var(--border);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

.hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-hint);
    text-align: center;
}

.iframe-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    height: 58vh;
    min-height: 320px;
    background: #fff;
    margin-top: 12px;
}

.iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.pending-box {
    text-align: center;
    padding: 24px 12px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f0f0f0;
    border-top-color: var(--yellow);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: spin 0.8s linear infinite;
}

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

.status-bar {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-bar .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--yellow);
    animation: pulse 1.2s infinite;
}

.status-bar.paid .dot { background: #52c41a; animation: none; }
.status-bar.paid { color: #52c41a; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 结果页 */
.result-card {
    text-align: center;
    padding: 32px 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.result-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    font-size: 28px;
    color: #fff;
    background: #52c41a;
    font-weight: 700;
}

.result-icon.fail { background: #ff4d4f; }

.result-card h2 {
    font-size: 18px;
    font-weight: 600;
}

.result-sub {
    color: var(--text-secondary);
    margin: 6px 0 18px;
    font-size: 14px;
}

.result-detail {
    text-align: left;
    background: var(--yellow-soft);
    border: 1px solid #f5ecd0;
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 18px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid #f5ecd0;
    font-size: 14px;
}

.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--text-secondary); flex-shrink: 0; }
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    word-break: break-all;
    text-align: right;
}

.input, select.input {
    width: 100%;
    border: 1px solid var(--border);
    background: #fafafa;
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* 后台 */
.page-admin {
    display: flex;
    min-height: 100vh;
    background: #f5f5f7;
    color: var(--text);
}

.page-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--bg);
}

.login-card {
    width: min(400px, 92vw);
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card p { color: var(--text-secondary); font-size: 13px; margin-bottom: 18px; }

.admin-sidebar {
    width: 200px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-brand {
    padding: 0 16px 16px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.admin-sidebar nav a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 16px;
    font-size: 14px;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    background: var(--yellow-light);
    color: var(--text);
}

.admin-main {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

.admin-header h1 { font-size: 20px; margin-bottom: 14px; }

.admin-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 14px;
}

.admin-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.admin-panel h2 { font-size: 15px; margin-bottom: 12px; }

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.alert-error { background: #fff2f0; color: #cf1322; border: 1px solid #ffccc7; }

.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.filter-bar .input { width: auto; min-width: 140px; margin: 0; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    background: #fafafa;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.badge-ok { background: #f6ffed; color: #389e0d; }
.badge-wait { background: var(--yellow-light); color: #d48806; }

.btn-link {
    border: none;
    background: none;
    color: #d48806;
    cursor: pointer;
    font-size: 13px;
}

.muted { color: var(--text-hint); }
.empty { text-align: center; color: var(--text-hint); padding: 20px !important; }

.pagination { display: flex; gap: 6px; margin-top: 12px; }

.pagination a,
.pagination .page-current {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    padding: 5px 9px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
}

.pagination a { background: #f5f5f5; color: var(--text-secondary); }
.pagination .page-current { background: var(--yellow); color: var(--text); }

.status-list { list-style: none; }
.status-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.status-list code { font-size: 11px; word-break: break-all; color: var(--text-secondary); }
.status-list .ok { color: #389e0d; }
.status-list .bad { color: #cf1322; }

@media (max-width: 900px) {
    .page-admin { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
    .package-grid { gap: 8px; }
    .package-coin { font-size: 16px; }
}
