:root {
    --bg-primary: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --brand-color: #4f46e5;
    --brand-hover: #4338ca;
    --border-ui: #e2e8f0;
    --error-ui: #ef4444;
    --success-ui: #10b981;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.05);
    --radius-lg: 16px;
    --radius-md: 10px;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: 'Noto Sans SC', -apple-system, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 440px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-ui);
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.card.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.header {
    margin-bottom: 24px;
    text-align: center;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

input[type="text"], textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-ui);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
    color: var(--text-main);
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

textarea {
    min-height: 140px;
    resize: none;
}

.counter {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.name-highlight {
    color: var(--brand-color);
    font-weight: 700;
}

/* 滑块验证组件 */
.verify-section {
    margin: 24px 0;
}

.section-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.slider-container {
    width: 100%;
    height: 48px;
    background: #f1f5f9;
    border: 1px solid var(--border-ui);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.slider-track {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    z-index: 1;
}

.slider-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(79, 70, 229, 0.1);
    width: 0;
    z-index: 0;
}

.slider-block {
    position: absolute;
    left: 0;
    top: 2px;
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border-ui);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 2;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
    color: var(--text-muted);
}

.slider-block:active {
    cursor: grabbing;
}

.slider-container.success {
    background: #ecfdf5;
    border-color: var(--success-ui);
}

.slider-container.success .slider-text {
    color: var(--success-ui);
}

.slider-container.success .slider-block {
    display: none;
}

/* 协议链接 */
.agreement-links {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.5;
}

.agreement-links a {
    color: var(--brand-color);
    text-decoration: none;
    font-weight: 500;
}

/* 按钮 */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--brand-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-ui);
}

.btn-ghost:hover {
    background: #f1f5f9;
}

/* 上传框 */
.upload-box {
    width: 100%;
    height: 160px;
    border: 2px dashed var(--border-ui);
    border-radius: var(--radius-md);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.placeholder-content {
    text-align: center;
    color: var(--text-muted);
}

.icon-circle {
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    border: 1px solid var(--border-ui);
}

#photo-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    z-index: 2;
}

/* 弹窗样式 */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    width: 100%;
    max-width: 380px;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-wide {
    max-width: 500px;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.modal-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.id-mask-box {
    background: #f1f5f9;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.id-mask-box .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.id-text {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 4px;
    word-break: break-all;
}

.digit-input-group {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 20px 0;
}

.digit-input-group input {
    width: 44px;
    height: 54px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    border: 2px solid var(--border-ui);
    border-radius: 8px;
    background: #fff;
    transition: all 0.2s;
    text-transform: uppercase;
}

.digit-input-group input:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* 移动端适配优化 */
@media (max-width: 480px) {
    body {
        padding: 15px;
        align-items: flex-start;
    }
    
    .card {
        padding: 24px 20px;
    }
    
    .digit-input-group input {
        width: 14%;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .btn {
        padding: 12px;
    }
    
    .upload-box {
        height: 140px;
    }

    .modal {
        padding: 20px;
    }
}

.agreement-body {
    max-height: 60vh;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #475569;
    padding: 10px 0;
}

.agreement-body h3 {
    margin: 16px 0 8px;
    color: var(--text-main);
}

.error-text {
    color: var(--error-ui);
    font-size: 0.85rem;
    margin-top: 8px;
    min-height: 1.2em;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1e293b;
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Loader */
.loader-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 110;
}

.loader-mask.show {
    display: flex;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--brand-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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