/* ===== 一屏展示：禁止页面纵向滚动，内容随视口缩放 ===== */
html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

#app {
    height: 100%;
    overflow: hidden;
}

.apply-page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

.apply-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    padding: clamp(6px, 1.2vh, 10px) clamp(10px, 3vw, 14px) clamp(8px, 1.5vh, 12px);
    overflow: hidden;
}

.apply-wrapper.with-progress {
    padding-top: clamp(24px, 4vh, 30px);
}

.progress-track--placeholder {
    opacity: 0.35;
}

.progress-track--placeholder .progress-fill {
    width: 8% !important;
    transition: none;
}

.apply-wrapper > .phone-step-card {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== 一屏 step-card 布局 ===== */
.apply-wrapper > .step-card,
.apply-wrapper > * > .step-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0 !important;
    padding: clamp(10px, 2vh, 14px) !important;
}

.step-card > .step-header,
.step-card > .liveness-header,
.step-card > .face-verify-top {
    flex-shrink: 0;
}

.step-card > .step-body,
.step-card > .camera-wrap,
.step-card > .face-camera-wrap,
.step-card > .material-list,
.step-card > .info-card,
.step-card > .privacy-grid,
.step-card > .summary-box,
.step-card > .progress-status-card {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.step-card > .btn-row,
.step-card > .btn-primary,
.step-card > .liveness-actions,
.step-card > .face-verify-footer,
.step-card > .checkbox-row,
.step-card > .status-msg,
.step-card > .error-msg,
.step-card > .id-card-side-tabs {
    flex-shrink: 0;
}

/* 进度条占用高度 */
.progress-track { height: 3px; }
.progress-info { top: 4px; }

/* ===== 全局紧凑缩放 ===== */
.step-header { margin-bottom: clamp(4px, 1vh, 8px) !important; }
.step-title { font-size: clamp(15px, 4vw, 17px) !important; }
.step-desc { font-size: clamp(11px, 2.8vw, 12px) !important; line-height: 1.35 !important; }
.step-icon-wrap { width: clamp(28px, 7vw, 34px) !important; height: clamp(28px, 7vw, 34px) !important; margin-bottom: 2px !important; }

.form-group { margin-bottom: clamp(8px, 1.5vh, 10px) !important; }
.form-input { padding: clamp(10px, 2vh, 12px) clamp(12px, 3vw, 14px) !important; font-size: clamp(14px, 3.8vw, 16px) !important; }
.form-label { font-size: clamp(11px, 2.8vw, 12px) !important; margin-bottom: 4px !important; }

.btn-primary,
.btn-secondary,
.btn-outline {
    height: clamp(42px, 6.5vh, 46px) !important;
    font-size: clamp(14px, 3.6vw, 15px) !important;
}

.btn-row { margin-top: clamp(6px, 1vh, 10px) !important; gap: 8px !important; }

/* 隐私页：网格摘要，无滚动 */
.privacy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(6px, 1.2vh, 8px);
    margin: clamp(6px, 1vh, 10px) 0;
}
.privacy-grid-item {
    padding: clamp(8px, 1.5vh, 10px);
    background: #F8F9FE;
    border: 1px solid #E8EAF4;
    border-radius: var(--radius-sm);
    font-size: clamp(10px, 2.6vw, 11px);
    line-height: 1.45;
    color: var(--text-secondary);
}
.privacy-grid-item strong {
    display: block;
    font-size: clamp(11px, 2.8vw, 12px);
    color: var(--text);
    margin-bottom: 2px;
}
.privacy-note {
    font-size: clamp(10px, 2.5vw, 11px);
    color: var(--text-muted);
    line-height: 1.4;
    margin: clamp(4px, 0.8vh, 6px) 0 clamp(6px, 1vh, 8px);
    padding: clamp(6px, 1vh, 8px) clamp(8px, 2vw, 10px);
    background: rgba(89, 74, 226, 0.06);
    border-radius: var(--radius-sm);
}
.privacy-content { display: none; }

.checkbox-row { margin: clamp(6px, 1vh, 8px) 0 !important; font-size: clamp(12px, 3vw, 13px) !important; }

/* 相机区域：在卡片内弹性占满剩余空间 */
.camera-wrap,
.face-camera-wrap {
    flex: 1;
    min-height: 0;
    max-height: none !important;
    margin-bottom: clamp(4px, 0.8vh, 6px) !important;
    aspect-ratio: auto !important;
}

.id-card-step {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.id-card-step .camera-wrap {
    flex: 1;
    min-height: 0;
}

/* OCR 确认紧凑 */
.ocr-confirm-card .info-card.compact {
    margin: clamp(4px, 0.8vh, 6px) 0 !important;
    padding: clamp(6px, 1vh, 8px) !important;
}
.ocr-confirm-card .info-row.compact {
    padding: clamp(4px, 0.8vh, 5px) 0 !important;
}
.ocr-confirm-card .btn-row.compact { margin-top: clamp(6px, 1vh, 8px) !important; }

/* 补充材料：紧凑列表 */
.material-list {
    gap: clamp(6px, 1vh, 8px) !important;
    margin: clamp(6px, 1vh, 8px) 0 !important;
}
.material-item {
    padding: clamp(8px, 1.5vh, 10px) clamp(10px, 2.5vw, 12px) !important;
}
.mat-icon-wrap { width: clamp(32px, 8vw, 36px) !important; height: clamp(32px, 8vw, 36px) !important; }
.mat-name { font-size: clamp(12px, 3.2vw, 13px) !important; }
.mat-desc { font-size: clamp(10px, 2.5vw, 11px) !important; }

/* 提交 / 进度页紧凑 */
.summary-box { padding: clamp(8px, 1.5vh, 10px) !important; margin: clamp(6px, 1vh, 8px) 0 !important; }
.summary-item { padding: clamp(5px, 1vh, 6px) 0 !important; font-size: clamp(12px, 3vw, 13px) !important; }
.progress-status-card { padding: clamp(14px, 2.5vh, 18px) clamp(12px, 3vw, 14px) !important; margin: clamp(6px, 1vh, 8px) 0 !important; }
.progress-status-text { font-size: clamp(16px, 4.2vw, 18px) !important; }
.verifying-box { padding: clamp(14px, 2.5vh, 18px) !important; margin: clamp(6px, 1vh, 8px) 0 !important; }

/* 取消 enhanced 里允许人脸页滚动 */
.face-verify-card {
    max-height: none !important;
    overflow: hidden !important;
}

/* 覆盖 enhanced 中 step-card 大 padding */
.apply-wrapper .step-card {
    transform: none !important;
}
.apply-wrapper .step-card:hover {
    transform: none !important;
    box-shadow: var(--card-shadow) !important;
}

/* ===== 人脸核验：品牌风格（非亚马逊式） ===== */
.face-verify-card.face-v2 {
    padding: clamp(8px, 1.5vh, 12px) !important;
    gap: clamp(6px, 1vh, 8px);
}

.face-verify-top {
    text-align: center;
}

.face-verify-top .step-title {
    margin-bottom: clamp(4px, 0.8vh, 6px);
}

.face-phase-pills {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 1vw, 6px);
    margin-bottom: clamp(4px, 0.8vh, 6px);
}

.face-phase-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: clamp(3px, 0.6vh, 4px) clamp(8px, 2vw, 10px);
    border-radius: 20px;
    font-size: clamp(10px, 2.6vw, 11px);
    font-weight: 600;
    color: var(--text-muted);
    background: #F0F1F8;
    border: 1px solid transparent;
    transition: all 0.25s ease;
}

.face-phase-pill .pill-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    background: #D8DAE8;
    color: #fff;
}

.face-phase-pill.active {
    color: var(--primary);
    background: rgba(89, 74, 226, 0.1);
    border-color: rgba(89, 74, 226, 0.25);
}
.face-phase-pill.active .pill-dot {
    background: var(--gradient-primary);
}

.face-phase-pill.done {
    color: #0D7A4E;
    background: var(--success-bg);
}
.face-phase-pill.done .pill-dot {
    background: var(--success);
}

/* ===== 人脸轮廓：柔和脸型 + 渐变描边 ===== */
.face-contour-wrap {
    position: absolute;
    inset: 10% 16% 16%;
    z-index: 3;
    pointer-events: none;
}

.face-contour-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 4px 20px rgba(89, 74, 226, 0.12));
}

.face-contour-vignette {
    fill: rgba(0, 0, 0, 0.38);
    opacity: 0;
}

.face-contour-stroke {
    fill: none;
    stroke: url(#faceContourGrad);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 640;
    stroke-dashoffset: 640;
    vector-effect: non-scaling-stroke;
}

/* 点击后：轮廓线绘制 + 遮罩渐显 */
.face-contour-wrap.contour-revealing {
    animation: contourVignetteIn 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.face-contour-wrap.contour-revealing .face-contour-stroke {
    animation: contourStrokeDraw 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.face-contour-wrap.contour-revealing .face-contour-vignette {
    animation: contourMaskIn 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes contourStrokeDraw {
    0% {
        stroke-dashoffset: 640;
        stroke: rgba(167, 139, 250, 0.25);
        opacity: 0.4;
    }
    100% {
        stroke-dashoffset: 0;
        stroke: url(#faceContourGrad);
        opacity: 1;
    }
}

@keyframes contourMaskIn {
    0% { opacity: 0; }
    35% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes contourVignetteIn {
    from { transform: scale(0.92); opacity: 0.35; }
    to { transform: scale(1); opacity: 1; }
}

/* 轮廓已锁定 */
.face-contour-wrap.contour-locked .face-contour-stroke {
    stroke-dashoffset: 0;
    stroke: url(#faceContourGrad);
    stroke-dasharray: none;
    opacity: 0.92;
}

.face-contour-wrap.contour-locked .face-contour-vignette {
    opacity: 1;
    fill: rgba(0, 0, 0, 0.34);
}

.face-contour-wrap.contour-locked.detected .face-contour-stroke {
    stroke: url(#faceContourGradOk);
    filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.5));
    stroke-width: 2.4;
}

.face-contour-wrap.contour-locked.detected .face-contour-vignette {
    fill: rgba(0, 0, 0, 0.32);
}

.face-hint-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(4px, 1vw, 6px);
    margin-bottom: clamp(4px, 0.8vh, 6px);
}

.face-glasses-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: clamp(6px, 1vh, 10px);
    padding: clamp(8px, 1.5vw, 10px) clamp(10px, 2vw, 12px);
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius-md);
    text-align: left;
}

.face-glasses-notice svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #D97706;
}

.face-glasses-notice strong {
    display: block;
    font-size: clamp(11px, 2.8vw, 12px);
    color: #92400E;
    margin-bottom: 2px;
}

.face-glasses-notice span {
    font-size: clamp(10px, 2.5vw, 11px);
    color: #B45309;
    line-height: 1.4;
}

.face-hint-chip {
    font-size: clamp(9px, 2.4vw, 10px);
    color: var(--text-secondary);
    background: #F5F6FC;
    border: 1px solid #E8EAF4;
    border-radius: 12px;
    padding: 3px 8px;
    white-space: nowrap;
}

.face-hint-chip.highlight {
    color: #92400E;
    background: #FEF3C7;
    border-color: #FDE68A;
    font-weight: 600;
}

.face-camera-wrap.face-v2-camera {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(160deg, #1a1535 0%, #2d2860 50%, #1e3a5f 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(89, 74, 226, 0.15);
}

.face-camera-wrap.face-v2-camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.face-camera-wrap.face-v2-camera video.face-video-mirror {
    transform: scaleX(-1);
}

.face-contour-overlay {
    display: none;
}

.face-scan-line {
    position: absolute;
    left: 18%;
    right: 18%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(89, 74, 226, 0.9), transparent);
    z-index: 4;
    pointer-events: none;
    animation: faceScan 2.4s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes faceScan {
    0%, 100% { top: 18%; opacity: 0.3; }
    50% { top: 72%; opacity: 0.85; }
}

.face-action-bar.warn .face-action-sub { color: #FFE082; }

/* ===== 身份确认：醒目语音提示条 ===== */
.face-prompt-banner {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    margin-bottom: clamp(6px, 1vh, 8px);
    padding: clamp(12px, 2.2vh, 16px) clamp(14px, 3.5vw, 18px);
    border-radius: 14px;
    background: linear-gradient(135deg, #594AE2 0%, #1E88E5 100%);
    box-shadow: 0 8px 28px rgba(89, 74, 226, 0.38);
    animation: facePromptIn 0.4s ease-out both;
}

.face-prompt-banner.warn {
    background: linear-gradient(135deg, #D97706 0%, #F59E0B 100%);
    box-shadow: 0 8px 28px rgba(217, 119, 6, 0.35);
}

.face-prompt-banner.ok {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.35);
}

.face-prompt-banner.pulse {
    animation: facePromptIn 0.4s ease-out both, facePromptPulse 1.4s ease-in-out infinite;
}

.face-prompt-banner.counting {
    transform: scale(1.01);
}

.face-prompt-speaker {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(36px, 9vw, 42px);
    height: clamp(36px, 9vw, 42px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    animation: faceSpeakerPulse 1.2s ease-in-out infinite;
}

.face-prompt-text {
    margin: 0;
    flex: 1;
    color: #fff;
    font-size: clamp(16px, 4.5vw, 20px);
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.face-action-sub {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(11px, 2.8vw, 12px);
    font-weight: 500;
    line-height: 1.35;
}

@keyframes facePromptIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes facePromptPulse {
    0%, 100% { box-shadow: 0 8px 28px rgba(217, 119, 6, 0.35); }
    50% { box-shadow: 0 8px 36px rgba(245, 158, 11, 0.55); }
}

@keyframes faceSpeakerPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.92; }
}

.face-action-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: clamp(10px, 2vh, 14px) clamp(10px, 3vw, 12px);
    background: linear-gradient(transparent, rgba(15, 12, 35, 0.88));
    text-align: center;
    animation: actionBarIn 0.45s ease-out both;
}

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

.face-action-bar p {
    margin: 0;
    color: #fff;
    font-size: clamp(13px, 3.5vw, 15px);
    font-weight: 600;
    line-height: 1.35;
}

.face-action-bar.warn p { color: #FFE082; }

.face-countdown-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(36px, 9vw, 44px);
    height: clamp(36px, 9vw, 44px);
    margin-bottom: 4px;
    border-radius: 50%;
    background: rgba(89, 74, 226, 0.85);
    color: #fff;
    font-size: clamp(18px, 5vw, 22px);
    font-weight: 800;
    box-shadow: 0 4px 16px rgba(89, 74, 226, 0.45);
}

.face-rec-badge {
    position: absolute;
    top: clamp(8px, 1.5vh, 10px);
    right: clamp(8px, 2vw, 10px);
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(89, 74, 226, 0.75);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    color: #fff;
    font-size: clamp(9px, 2.4vw, 10px);
    font-weight: 600;
}

.face-rec-badge .rec-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FF5252;
    animation: recBlink 1.2s ease-in-out infinite;
}

.face-verify-footer {
    flex-shrink: 0;
    margin-top: clamp(4px, 0.8vh, 6px);
}

.face-verify-footer .btn-primary.btn-starting {
    opacity: 0.85;
}

.face-verify-footer .btn-primary {
    background: var(--gradient-primary) !important;
    box-shadow: 0 4px 16px rgba(89, 74, 226, 0.3);
}

.face-success-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: clamp(10px, 1.8vh, 12px);
    background: var(--success-bg);
    color: #0D7A4E;
    border-radius: var(--radius-md);
    font-size: clamp(13px, 3.4vw, 14px);
    font-weight: 600;
}

/* 极矮屏幕进一步压缩 */
.compact-loading { padding: clamp(12px, 3vh, 20px) 0 !important; }
.compact-loading p { font-size: clamp(12px, 3vw, 13px); color: var(--text-muted); margin-top: 8px; }
.small-spinner { width: clamp(28px, 7vw, 32px) !important; height: clamp(28px, 7vw, 32px) !important; border-width: 3px !important; margin-bottom: 0 !important; }

.reason-content {
    font-size: clamp(12px, 3vw, 13px);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.progress-hint { font-size: clamp(10px, 2.6vw, 11px) !important; }
.progress-desc { font-size: clamp(12px, 3vw, 13px) !important; }

@media (max-height: 640px) {
    .step-icon-wrap { display: none; }
    .face-hint-chips { display: none; }
    .privacy-note { display: none; }
    .mat-desc { display: none; }
}

@media (max-height: 520px) {
    .progress-step-label { display: none; }
    .step-desc { display: none; }
}
