:root {
    --primary-color: #4e73df;
    --primary-hover: #2e59d9;
    --success-color: #1cc88a;
    --success-hover: #17a673;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --bg-color: #f8f9fc;
    --card-bg: #ffffff;
    --text-color: #5a5c69;
    --heading-color: #4e73df;
    --border-radius: 12px;
    --box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s ease;
}

/* 容器与卡片 */
.container {
    width: 100%;
    max-width: 450px;
    perspective: 1000px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 标题 */
h1 {
    color: var(--heading-color);
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: 1px;
}

/* 表单元素 */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #858796;
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 15px 20px; /* 增加内边距 */
    padding-left: 45px; /* 为图标留空 */
    border: 2px solid #eaecf4;
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: #6e707e;
    transition: all 0.3s ease;
    background-color: #fdfdfe;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    background-color: #fff;
}

/* 输入框图标 */
.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #d1d3e2;
    transition: color 0.3s ease;
}

input[type="text"]:focus + .input-icon {
    color: var(--primary-color);
}

/* 按钮 */
.btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(78, 115, 223, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 15px rgba(78, 115, 223, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    box-shadow: 0 4px 10px rgba(28, 200, 138, 0.3);
}

.btn-success:hover {
    background-color: var(--success-hover);
    transform: translateY(-2px);
}

.btn-wechat {
    background-color: #07c160;
    color: white;
    margin-top: 10px;
}

.btn-back {
    background-color: #858796;
    color: white;
    margin-top: 20px;
}

/* 结果页样式 */
.result-box {
    text-align: center;
}

.balance-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 15px;
    color: white;
    margin-bottom: 2rem;
    box-shadow: 0 10px 20px rgba(118, 75, 162, 0.3);
    position: relative;
}

.balance-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMiIgY3k9IjIiIHI9IjIiIGZpbGw9InJnYmEoMjU1LDI1NSwyNTUsMC4xKSIvPjwvc3ZnPg==');
    opacity: 0.3;
}

.user-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 10px;
}

.balance-amount {
    font-size: 3rem;
    font-weight: 800;
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.timestamp {
    font-size: 0.8rem;
    opacity: 0.8;
}

.warning-tip {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.step-label {
    text-align: left;
    font-size: 0.85rem;
    color: #b7b9cc;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 15px 0 5px;
    font-weight: 700;
}

/* Toast 提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--success-color);
}

/* 动画定义 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Loading 遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式 */
@media (max-width: 576px) {
    .container {
        padding: 0;
    }
    .card {
        padding: 1.5rem;
        box-shadow: none;
        background: transparent;
    }
    .balance-amount {
        font-size: 2.5rem;
    }
}
